Package javax.print.attribute

Examples of javax.print.attribute.Attribute


        Vector attrx = new Vector();
        Class claz;
        String aname;
        byte atag;
        Vector avalue;
        Attribute a = null;

        aname = new String(attr.getName());
        claz = getClassByIppAttributeName(aname);
        atag = attr.getTag();
        avalue = attr.getValue();
View Full Code Here


    void fillCollateBox() {
        boolean isSupported =
            myService.isAttributeCategorySupported(SheetCollate.class);
        SheetCollate [] supported = (SheetCollate []) (myService
                .getSupportedAttributeValues(SheetCollate.class, flavor, attrs));
        Attribute attr = attrs.get(SheetCollate.class);
        int spinnerValue = ((Integer) cpSpinner.getValue()).intValue();
       
        if ((supported == null) || !isSupported) {
            if (attrs.containsKey(SheetCollate.class)) {
                collateBox.setSelected(attr.equals(SheetCollate.COLLATED));
            }
        } else {
            boolean isValueSupported = myService.isAttributeValueSupported(
                    SheetCollate.COLLATED, flavor, attrs);
            if (attrs.containsKey(SheetCollate.class) && isValueSupported) {
                collateBox.setSelected(attr.equals(SheetCollate.COLLATED));
            } else {
                Object defaul =
                        myService.getDefaultAttributeValue(SheetCollate.class);
                collateBox.setSelected(defaul != null
                        ? defaul.equals(SheetCollate.COLLATED)
View Full Code Here

     * get last selected Chromaticity button
     */
    private boolean getLastColor() {
        if (firstUse) {
            if (attrs.containsKey(Chromaticity.class)) {
                Attribute value = attrs.get(Chromaticity.class);
                return value.equals(Chromaticity.MONOCHROME);
            }
           
            Object defaul = myService.getDefaultAttributeValue(Chromaticity.class);
            return (myService.isAttributeCategorySupported(Chromaticity.class)
                        && (defaul != null))
View Full Code Here

        JobSheets [] supported =
                (myService.isAttributeCategorySupported(JobSheets.class)
                ? (JobSheets[]) (myService.getSupportedAttributeValues(
                        JobSheets.class, flavor, attrs))
                : null);
        Attribute value = attrs.get(JobSheets.class);
   
        if ((supported != null) && (supported.length == 0)) {
            supported = null;
        }
   
        if (supported == null) {
            /* if PrintService does not supported any JobSheets, set current
               meaning from attribute set (if present) and disable checkbox */
            if (firstUse && attrs.containsKey(JobSheets.class)) {
                bannerBox.setSelected(value.equals(JobSheets.STANDARD));
            }
        } else {
            if (supported.length == 1) {
                bannerBox.setSelected(supported[0] == JobSheets.STANDARD);
            } else if (attrs.containsKey(JobSheets.class)) {
                bannerBox.setSelected(value.equals(JobSheets.STANDARD));
            else {
                Object def = myService.getDefaultAttributeValue(JobSheets.class);
                bannerBox.setSelected(def == null
                        ? false
                        : def.equals(JobSheets.STANDARD));
View Full Code Here

        PrinterProducer producer = new PrinterProducer(endpoint, configuration);
        producer.start();
        PrinterOperations printerOperations = producer.getPrinterOperations();
        PrintRequestAttributeSet attributeSet = printerOperations.getPrintRequestAttributeSet();

        Attribute attribute = attributeSet.get(javax.print.attribute.standard.Media.class);
        assertNotNull(attribute);
        assertTrue(attribute instanceof MediaTray);
        MediaTray mediaTray = (MediaTray) attribute;
        assertEquals("middle", mediaTray.toString());
    }
View Full Code Here

            if (((Integer)copiesModel.getValue()).intValue() > 1
                && categorySupported(SheetCollate.class))
              {
                sort.setEnabled(true);
                Attribute collate = attribute(SheetCollate.class);
                if (collate != null && collate.equals(SheetCollate.COLLATED))
                  sort.setSelected(true);
              }
            else
              sort.setEnabled(false);
          }
View Full Code Here

            if (attributes == null) {
                return;
            }

            Attribute attr;
            Attribute[] attrs = attributes.toArray();
            for (int i=0; i<attrs.length; i++) {
                try {
                    attr = attrs[i];
                    if (attr.getCategory()==Sides.class) {
                        if (attr.equals(Sides.TWO_SIDED_LONG_EDGE)) {
                            mAttSides = 2; // DMDUP_VERTICAL
                        } else if (attr.equals(Sides.TWO_SIDED_SHORT_EDGE)) {
                            mAttSides = 3; // DMDUP_HORIZONTAL
                        } else { // Sides.ONE_SIDED
                            mAttSides = 1;
                        }
                    }
                    else if (attr.getCategory()==Chromaticity.class) {
                        if (attr.equals(Chromaticity.COLOR)) {
                            mAttChromaticity = 2; // DMCOLOR_COLOR
                        } else {
                            mAttChromaticity = 1; // DMCOLOR_MONOCHROME
                        }
                    }
                    else if (attr.getCategory()==PrinterResolution.class) {
                        PrinterResolution pr = (PrinterResolution)attr;
                        mAttXRes = pr.getCrossFeedResolution(PrinterResolution.DPI);
                        mAttYRes = pr.getFeedResolution(PrinterResolution.DPI);
                    }
                    else if (attr.getCategory()==PrintQuality.class) {
                        if (attr.equals(PrintQuality.HIGH)) {
                            mAttQuality = -4; // DMRES_HIGH
                        } else if (attr.equals(PrintQuality.NORMAL)) {
                            mAttQuality = -3; // DMRES_MEDIUM
                        } else {
                            mAttQuality = -2; // DMRES_LOW
                        }
                    }
                    else if (attr.getCategory()==SheetCollate.class) {
                        if (attr.equals(SheetCollate.COLLATED)) {
                            mAttCollate = 1; // DMCOLLATE_TRUE
                        } else {
                            mAttCollate = 0; // DMCOLLATE_FALSE
                        }
                    }  else if (attr.getCategory() == Media.class ||
                                attr.getCategory() ==SunAlternateMedia.class) {
                        /* SunAlternateMedia is used if its a tray, and
                         * any Media that is specified is not a tray.
                         */
                        if (attr.getCategory() == SunAlternateMedia.class) {
                            Media media = (Media)attributes.get(Media.class);
                            if (media == null ||
                                !(media instanceof MediaTray)) {
                                attr = ((SunAlternateMedia)attr).getMedia();
                            }
                        }
                        if (attr instanceof MediaSizeName) {
                            // Note: Nothing to do here.
                        }
                        if (attr instanceof MediaTray) {
                            if (attr.equals(MediaTray.BOTTOM)) {
                                mAttMediaTray = 2;        // DMBIN_LOWER
                            } else if (attr.equals(MediaTray.ENVELOPE)) {
                                mAttMediaTray = 5;        // DMBIN_ENVELOPE
                            } else if (attr.equals(MediaTray.LARGE_CAPACITY)) {
                                mAttMediaTray = 11;      // DMBIN_LARGECAPACITY
                            } else if (attr.equals(MediaTray.MAIN)) {
                                mAttMediaTray =1;           // DMBIN_UPPER
                            } else if (attr.equals(MediaTray.MANUAL)) {
                                mAttMediaTray = 4;          // DMBIN_MANUAL
                            } else if (attr.equals(MediaTray.MIDDLE)) {
                                mAttMediaTray = 3;          // DMBIN_MIDDLE
                            } else if (attr.equals(MediaTray.SIDE)) {
                                // no equivalent predefined value
                                mAttMediaTray = 7;          // DMBIN_AUTO
                            } else if (attr.equals(MediaTray.TOP)) {
                                mAttMediaTray =1;           // DMBIN_UPPER
                            } else {
                              if (attr instanceof Win32MediaTray) {
                                mAttMediaTray = ((Win32MediaTray)attr).winID;
                              } else {
View Full Code Here

          {
            bw.setEnabled(true);
            color.setEnabled(true);

            Object defaultValue = defaultValue(Chromaticity.class);
            Attribute chromaticity = attribute(Chromaticity.class);
            if (chromaticity != null)
              {
                if (chromaticity.equals(Chromaticity.MONOCHROME))
                  bw.setSelected(true);
                else
                  color.setSelected(true);
              }
            else
View Full Code Here

    boolean matchingService(PrintService service,
                            PrintServiceAttributeSet serviceSet) {
        if (serviceSet != null) {
            Attribute [] attrs =  serviceSet.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

            portrait.setEnabled(true);
            landscape.setEnabled(true);
            rev_landscape.setEnabled(true);
            rev_portrait.setEnabled(true);

            Attribute orientation = attribute(OrientationRequested.class);
            if (orientation != null)
              {
                if (orientation.equals(OrientationRequested.LANDSCAPE))
                  landscape.setSelected(true);
                else if (orientation.equals(OrientationRequested.PORTRAIT))
                  portrait.setSelected(true);
                else if (orientation.equals(OrientationRequested.REVERSE_PORTRAIT))
                  rev_portrait.setSelected(true);
                else
                  rev_landscape.setSelected(true);
              }
            else
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.