本文整理汇总了Java中javax.print.attribute.standard.PrintQuality类的典型用法代码示例。如果您正苦于以下问题:Java PrintQuality类的具体用法?Java PrintQuality怎么用?Java PrintQuality使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PrintQuality类属于javax.print.attribute.standard包,在下文中一共展示了PrintQuality类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setAttribute
import javax.print.attribute.standard.PrintQuality; //导入依赖的package包/类
public void setAttribute(final Attribute attr) {
final Class<? extends Attribute> category = attr.getCategory();
if (OrientationRequested.class.equals(category)) {
setOrientation((OrientationRequested) attr);
} else if (MediaSize.class.equals(category)) {
setPaper((MediaSize) attr);
} else if (Media.class.equals(category)) {
setPaper((MediaSizeName) attr);
} else if (Paper.class.equals(category)) {
setPaper((Paper) attr);
} else if (Copies.class.equals(category)) {
setCopies((Copies) attr);
} else if (PrintQuality.class.equals(category)) {
setPrintQuality((PrintQuality) attr);
} else if (Sides.class.equals(category)) {
setSides((Sides) attr);
} else if (SheetCollate.class.equals(category)) {
setCollate((SheetCollate) attr);
} else if (PrinterResolution.class.equals(category)) {
setPrinterResolution((PrinterResolution) attr);
} else if (Chromaticity.class.equals(category)) {
setChromaticity((Chromaticity) attr);
}
}
示例2: fillQualityFields
import javax.print.attribute.standard.PrintQuality; //导入依赖的package包/类
void fillQualityFields() {
PrintQuality quality = (PrintQuality) attrs.get(PrintQuality.class);
if (firstUse) {
selectQualityButton(quality);
}
PrintQuality [] aList = (
myService.isAttributeCategorySupported(PrintQuality.class)
? (PrintQuality []) myService
.getSupportedAttributeValues(PrintQuality.class, flavor, attrs)
: null);
enableQualityButtons(aList); /* enable qualities which are supported */
/* select quality */
if ((aList != null) && (!qualityIsEnabled(getSelectedQuality()))) {
selectQualityButton(qualityIsEnabled(quality)
? quality
: (PrintQuality) (myService
.getDefaultAttributeValue(PrintQuality.class)));
}
}
示例3: enableQualityButtons
import javax.print.attribute.standard.PrintQuality; //导入依赖的package包/类
private void enableQualityButtons(PrintQuality [] list) {
normalBtn.setEnabled(false);
draftBtn.setEnabled(false);
highBtn.setEnabled(false);
if (list != null) {
for (int i = 0; i < list.length; i++) {
if (list[i].equals(PrintQuality.DRAFT)) {
draftBtn.setEnabled(true);
} else if (list[i].equals(PrintQuality.NORMAL)) {
normalBtn.setEnabled(true);
} else if (list[i].equals(PrintQuality.HIGH)) {
highBtn.setEnabled(true);
}
}
}
}
示例4: createPrintQualityCombo
import javax.print.attribute.standard.PrintQuality; //导入依赖的package包/类
private void createPrintQualityCombo(PrintRequestAttributeSet set) {
PrintQuality[] qualities = (PrintQuality[]) mService.getSupportedAttributeValues(PrintQuality.class, DocFlavor.SERVICE_FORMATTED.PRINTABLE, null);
if (qualities != null && qualities.length > 0) {
HashSet<PrintQuality> possible = new HashSet<>();
for (PrintQuality one : qualities) {
possible.add(one);
}
ArrayList<Quality> choices = new ArrayList<>();
for (Quality quality : Quality.values()) {
if (possible.contains(quality.getPrintQuality())) {
choices.add(quality);
}
}
mPrintQuality = new JComboBox<>(choices.toArray(new Quality[0]));
mPrintQuality.setSelectedItem(PrintUtilities.getPrintQuality(mService, set, true));
UIUtilities.setOnlySize(mPrintQuality, mPrintQuality.getPreferredSize());
LinkedLabel label = new LinkedLabel(QUALITY, mPrintQuality);
add(label, new PrecisionLayoutData().setEndHorizontalAlignment());
add(mPrintQuality);
} else {
mPrintQuality = null;
}
}
示例5: showPrintSetupDialog
import javax.print.attribute.standard.PrintQuality; //导入依赖的package包/类
/**
* Show a print setup dialog, to alter the ViewerModel's PageFormat
*
* @see ViewModel
*/
public void showPrintSetupDialog() {
PrintHelper printHelper = viewModel.getPrintHelper();
// create a new print helper for this document instance
if (printHelper == null) {
MediaSizeName mediaSizeName = loadDefaultPrinterProperties();
// create the new print help
printHelper = new PrintHelper(documentViewController.getViewContainer(),
getPageTree(), documentViewController.getRotation(), mediaSizeName,
PrintQuality.NORMAL);
}
// reuse previous print attributes if they exist.
else {
printHelper = new PrintHelper(documentViewController.getViewContainer(),
getPageTree(), documentViewController.getRotation(),
printHelper.getDocAttributeSet(),
printHelper.getPrintRequestAttributeSet());
}
viewModel.setPrintHelper(printHelper);
viewModel.getPrintHelper().showPrintSetupDialog();
// save new printer attributes to properties
savePrinterProperties(printHelper);
}
示例6: getSupportedAttributeCategories
import javax.print.attribute.standard.PrintQuality; //导入依赖的package包/类
public Class<?>[] getSupportedAttributeCategories() {
ArrayList categList = new ArrayList(otherAttrCats.length+3);
for (int i=0; i < otherAttrCats.length; i++) {
categList.add(otherAttrCats[i]);
}
int caps = getPrinterCapabilities();
if ((caps & DEVCAP_DUPLEX) != 0) {
categList.add(Sides.class);
}
if ((caps & DEVCAP_QUALITY) != 0) {
int[] defaults = getDefaultPrinterSettings();
// Added check: if supported, we should be able to get the default.
if ((defaults[3] >= DMRES_HIGH) && (defaults[3] < 0)) {
categList.add(PrintQuality.class);
}
}
PrinterResolution[] supportedRes = getPrintResolutions();
if ((supportedRes!=null) && (supportedRes.length>0)) {
categList.add(PrinterResolution.class);
}
return (Class[])categList.toArray(new Class[categList.size()]);
}
示例7: setQualityAttrib
import javax.print.attribute.standard.PrintQuality; //导入依赖的package包/类
private void setQualityAttrib(Attribute attr) {
if (attr == PrintQuality.HIGH) {
mAttQuality = -4; // DMRES_HIGH
} else if (attr == PrintQuality.NORMAL) {
mAttQuality = -3; // DMRES_MEDIUM
} else {
mAttQuality = -2; // DMRES_LOW
}
}
示例8: actionPerformed
import javax.print.attribute.standard.PrintQuality; //导入依赖的package包/类
@Override final public void actionPerformed(ActionEvent objPactionEvent) {
final Object objPsourceObject = objPactionEvent.getSource();
if (objPsourceObject == this.objGdraftJRadioButton) {
this.objGprintJDialog.getAttributes().add(PrintQuality.DRAFT);
} else if (objPsourceObject == this.objGnormalJRadioButton) {
this.objGprintJDialog.getAttributes().add(PrintQuality.NORMAL);
} else if (objPsourceObject == this.objGhighJRadioButton) {
this.objGprintJDialog.getAttributes().add(PrintQuality.HIGH);
}
}
示例9: getSupportedAttributeCategories
import javax.print.attribute.standard.PrintQuality; //导入依赖的package包/类
public Class<?>[] getSupportedAttributeCategories() {
ArrayList<Class<?>> categList = new ArrayList<>(otherAttrCats.length+3);
for (int i=0; i < otherAttrCats.length; i++) {
categList.add(otherAttrCats[i]);
}
int caps = getPrinterCapabilities();
if ((caps & DEVCAP_DUPLEX) != 0) {
categList.add(Sides.class);
}
if ((caps & DEVCAP_QUALITY) != 0) {
int[] defaults = getDefaultPrinterSettings();
// Added check: if supported, we should be able to get the default.
if ((defaults[3] >= DMRES_HIGH) && (defaults[3] < 0)) {
categList.add(PrintQuality.class);
}
}
PrinterResolution[] supportedRes = getPrintResolutions();
if ((supportedRes!=null) && (supportedRes.length>0)) {
categList.add(PrinterResolution.class);
}
return categList.toArray(new Class<?>[categList.size()]);
}
示例10: getAssociatedAttributeArray
import javax.print.attribute.standard.PrintQuality; //导入依赖的package包/类
/**
* Constructs an array from a set of -supported attributes.
* @param set set to process
* @return The constructed array.
*
* @see #getAssociatedAttribute()
*/
public static PrintQuality[] getAssociatedAttributeArray(Set<Attribute> set)
{
PrintQuality[] result = new PrintQuality[set.size()];
int j = 0;
for (Attribute tmp : set)
{
result[j] = ((PrintQualitySupported) tmp).getAssociatedAttribute();
j++;
}
return result;
}
示例11: write
import javax.print.attribute.standard.PrintQuality; //导入依赖的package包/类
/**
* Writes an attribute in EnumSyntax into the stream.
* @param attribute the attribute
* @throws IOException if thrown by the stream
*/
private void write(EnumSyntax attribute) throws IOException
{
// in JPS API enum syntax is used for enums, keyword and boolean types
String name = ((Attribute) attribute).getName();
// the enum value types
if (attribute instanceof Finishings
|| attribute instanceof OrientationRequested
|| attribute instanceof PrintQuality)
{
out.writeByte(IppValueTag.ENUM);
out.writeShort(name.length());
out.write(name.getBytes());
out.writeShort(4); // length, enum is 4 bytes
out.writeInt(attribute.getValue());
}
// the boolean value type
else if (attribute instanceof Fidelity)
{
out.writeByte(IppValueTag.BOOLEAN);
out.writeShort(name.length());
out.write(name.getBytes());
out.writeShort(1); // length, boolean is 1 bytes
out.writeByte(attribute.getValue() == 0 ? 0x00 : 0x01);
}
// the keyword value types
else
{
String keyword = attribute.toString();
out.writeByte(IppValueTag.KEYWORD);
out.writeShort(name.length());
out.write(name.getBytes());
out.writeShort(keyword.length());
out.write(keyword.getBytes());
}
}
示例12: actionPerformed
import javax.print.attribute.standard.PrintQuality; //导入依赖的package包/类
public void actionPerformed(ActionEvent e)
{
if (e.getSource() == low)
atts.add(PrintQuality.DRAFT);
else if (e.getSource() == normal)
atts.add(PrintQuality.NORMAL);
else
atts.add(PrintQuality.HIGH);
}
示例13: updateForSelectedService
import javax.print.attribute.standard.PrintQuality; //导入依赖的package包/类
/**
* Called to update for new selected
* print service. Tests if currently
* selected attributes are supported.
*/
void updateForSelectedService()
{
if (categorySupported(PrintQuality.class))
{
low.setEnabled(true);
normal.setEnabled(true);
high.setEnabled(true);
Object defaultValue = defaultValue(PrintQuality.class);
Attribute quality = attribute(PrintQuality.class);
if (quality != null)
{
if (quality.equals(PrintQuality.DRAFT))
low.setSelected(true);
else if (quality.equals(PrintQuality.NORMAL))
normal.setSelected(true);
else
high.setSelected(true);
}
else
{
if (defaultValue.equals(PrintQuality.DRAFT))
low.setSelected(true);
else if (defaultValue.equals(PrintQuality.NORMAL))
normal.setSelected(true);
else
high.setSelected(true);
}
}
else
{
low.setEnabled(false);
normal.setEnabled(false);
high.setEnabled(false);
}
}
示例14: getAssociatedAttributeArray
import javax.print.attribute.standard.PrintQuality; //导入依赖的package包/类
/**
* Constructs an array from a set of -supported attributes.
* @param set set to process
* @return The constructed array.
*
* @see #getAssociatedAttribute()
*/
public static PrintQuality[] getAssociatedAttributeArray(Set set)
{
PrintQualitySupported tmp;
PrintQuality[] result = new PrintQuality[set.size()];
Iterator it = set.iterator();
int j = 0;
while (it.hasNext())
{
tmp = (PrintQualitySupported) it.next();
result[j] = tmp.getAssociatedAttribute();
j++;
}
return result;
}
示例15: actionPerformed
import javax.print.attribute.standard.PrintQuality; //导入依赖的package包/类
public void actionPerformed(ActionEvent e)
{
if (e.getSource() == low)
atts.add(PrintQuality.DRAFT);
else if (e.getSource() == normal)
atts.add(PrintQuality.NORMAL);
else
atts.add(PrintQuality.HIGH);
}