Package javax.print.attribute

Examples of javax.print.attribute.Attribute


            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
View Full Code Here


          priority.setEnabled(false);

        // Requesting username
        if (categorySupported(RequestingUserName.class))
          {
            Attribute user = attribute(RequestingUserName.class);
            Object value = defaultValue(RequestingUserName.class);
            username.setEnabled(true);
            if (user != null)
              username_tf.setText(user.toString());
            else
              username_tf.setText(value.toString());
          }
        else
          username.setEnabled(false);

        // Job Name
        if (categorySupported(JobName.class))
          {
            Attribute job = attribute(JobName.class);
            Object value = defaultValue(JobName.class);
            jobname.setEnabled(true);
            if (job != null)
              jobname_tf.setText(job.toString());
            else
              jobname_tf.setText(value.toString());
          }
        else
          jobname.setEnabled(false);

        // Job sheets
        if (categorySupported(JobSheets.class))
          {
            Attribute sheet = attribute(JobSheets.class);
            Object value = defaultValue(JobSheets.class);
            cover.setEnabled(true);
            if (sheet != null)
              {
                if (sheet.equals(JobSheets.NONE))
                  cover.setSelected(false);
                else
                  cover.setSelected(true);
              }
            else
View Full Code Here

            oneside.setEnabled(true);
            calendar.setEnabled(true);
            duplex.setEnabled(true);

            Object defaultValue = defaultValue(Sides.class);
            Attribute sides = attribute(Sides.class);
            if (sides != null)
              {
                if (sides.equals(Sides.TWO_SIDED_SHORT_EDGE))
                  calendar.setSelected(true);
                else if (sides.equals(Sides.ONE_SIDED))
                  oneside.setSelected(true);
                else
                  duplex.setSelected(true);
              }
            else
View Full Code Here

    private boolean matchesAttributes(PrintService service,
                                      PrintServiceAttributeSet attributes) {

        Attribute [] attrs =  attributes.toArray();
        Attribute serviceAttr;
        for (int i=0; i<attrs.length; i++) {
            serviceAttr = service.getAttribute(attrs[i].getCategory());
            if (serviceAttr == null || !serviceAttr.equals(attrs[i])) {
                return false;
            }
        }
        return true;
    }
View Full Code Here

        } else {
            PrintServiceAttributeSet updates =
                new HashPrintServiceAttributeSet();
            Attribute []attrs =  currSet.toArray();
            for (int i=0; i<attrs.length; i++) {
                Attribute attr = attrs[i];
                if (!lastSet.containsValue(attr)) {
                    updates.add(attr);
                }
            }
            lastSet = currSet;
View Full Code Here

        if (attributes == null) {
            return null;
        }

        Attribute attr;
        AttributeSet unsupp = new HashAttributeSet();
        Attribute []attrs = attributes.toArray();
        for (int i=0; i<attrs.length; i++) {
            try {
                attr = attrs[i];
                if (!isAttributeCategorySupported(attr.getCategory())) {
                    unsupp.add(attr);
                }
                else if (!isAttributeValueSupported(attr, flavor, attributes)) {
                    unsupp.add(attr);
                }
View Full Code Here

    private boolean matchesAttributes(PrintService service,
                                      PrintServiceAttributeSet attributes) {

        Attribute [] attrs =  attributes.toArray();
        Attribute serviceAttr;
        for (int i=0; i<attrs.length; i++) {
            serviceAttr
                = service.getAttribute((Class<PrintServiceAttribute>)attrs[i].getCategory());
            if (serviceAttr == null || !serviceAttr.equals(attrs[i])) {
                return false;
            }
        }
        return true;
    }
View Full Code Here

            return AttributeSetUtilities.unmodifiableView(currSet);
        } else {
            PrintServiceAttributeSet updates =
                new HashPrintServiceAttributeSet();
            Attribute []attrs = currSet.toArray();
            Attribute attr;
            for (int i=0; i<attrs.length; i++) {
                attr = attrs[i];
                if (!lastSet.containsValue(attr)) {
                    updates.add(attr);
                }
View Full Code Here

        if (attributes == null) {
            return null;
        }

        Attribute attr;
        AttributeSet unsupp = new HashAttributeSet();
        Attribute []attrs = attributes.toArray();
        for (int i=0; i<attrs.length; i++) {
            try {
                attr = attrs[i];
                if (!isAttributeCategorySupported(attr.getCategory())) {
                    unsupp.add(attr);
                } else if (!isAttributeValueSupported(attr, flavor,
                                                      attributes)) {
                    unsupp.add(attr);
                }
View Full Code Here

        jobAttrSet = AttributeSetUtilities.unmodifiableView(jobAttrSet);
    }

    private void getAttributeValues(DocFlavor flavor) throws PrintException {
        Attribute attr;
        Class category;

        if (reqAttrSet.get(Fidelity.class) == Fidelity.FIDELITY_TRUE) {
            fidelity = true;
        } else {
            fidelity = false;
        }

        Attribute []attrs = reqAttrSet.toArray();
        for (int i=0; i<attrs.length; i++) {
            attr = attrs[i];
            category = attr.getCategory();
            if (fidelity == true) {
                if (!service.isAttributeCategorySupported(category)) {
                    notifyEvent(PrintJobEvent.JOB_FAILED);
                    throw new PrintJobAttributeException(
                        "unsupported category: " + category, category, null);
View Full Code Here

TOP

Related Classes of javax.print.attribute.Attribute

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.