Package javax.print.attribute

Examples of javax.print.attribute.Attribute


    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

    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

        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

    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

        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

            return null;
        }

        private String getDocName(final Object doc,
                        final AttributeSet... attrSets) {
            Attribute name = getAttribute(DocumentName.class, attrSets);

            if (name == null) {
                name = getAttribute(JobName.class, attrSets);
            }
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.