Package javax.print.attribute.standard

Examples of javax.print.attribute.standard.PrinterStateReasons


            // Check the list of services.  This service may have been
            // deleted already
            PrinterState prnState = (PrinterState)service.getAttribute(
                                                  PrinterState.class);
            if (prnState == PrinterState.STOPPED) {
                PrinterStateReasons prnStateReasons =
                    (PrinterStateReasons)service.getAttribute(
                                                 PrinterStateReasons.class);
                if ((prnStateReasons != null) &&
                    (prnStateReasons.containsKey(PrinterStateReason.SHUTDOWN)))
                {
                    throw new PrinterException("PrintService is no longer available.");
                }
            }
View Full Code Here


        // Check the list of services.  This service may have been
        // deleted already
        PrinterState prnState = (PrinterState)psvc.getAttribute(
                                                  PrinterState.class);
        if (prnState == PrinterState.STOPPED) {
            PrinterStateReasons prnStateReasons =
                    (PrinterStateReasons)psvc.getAttribute(
                                                 PrinterStateReasons.class);
                if ((prnStateReasons != null) &&
                    (prnStateReasons.containsKey(PrinterStateReason.SHUTDOWN)))
                {
                    throw new PrinterException("PrintService is no longer available.");
                }
        }
View Full Code Here

        }

        PrinterState prnState = (PrinterState)service.getAttribute(
                                                  PrinterState.class);
        if (prnState == PrinterState.STOPPED) {
            PrinterStateReasons prnStateReasons =
                    (PrinterStateReasons)service.getAttribute(
                                                 PrinterStateReasons.class);
                if ((prnStateReasons != null) &&
                    (prnStateReasons.containsKey(PrinterStateReason.SHUTDOWN)))
                {
                    throw new PrintException("PrintService is no longer available.");
                }
        }
View Full Code Here

        }
    }

    private PrinterStateReasons getPrinterStateReasons() {
        if (isInvalid) {
            PrinterStateReasons psr = new PrinterStateReasons();
            psr.put(PrinterStateReason.SHUTDOWN, Severity.ERROR);
            return psr;
        } else {
            return null;
        }
    }
View Full Code Here

        attrs.add(getPrinterIsAcceptingJobs());
        PrinterState prnState = getPrinterState();
        if (prnState != null) {
            attrs.add(prnState);
        }
        PrinterStateReasons prnStateReasons = getPrinterStateReasons();
        if (prnStateReasons != null) {
            attrs.add(prnStateReasons);
        }
        attrs.add(getQueuedJobCount());
        int caps = getPrinterCapabilities();
View Full Code Here

                    attrx.add(a);
                }
            }
        } else if (aname.equals("printer-state-reason")
                || aname.equals("printer-state-reasons")) {
            PrinterStateReasons rs = new PrinterStateReasons();
            String r;
            Severity s;
            for (int i = 0, ii = avalue.size(); i < ii; i++) {
                r = new String((byte[]) avalue.get(i));
                if (r.endsWith("-error")) {
                    r = r.substring(0, r.indexOf("-error"));
                    s = Severity.ERROR;
                } else if (r.endsWith("-warning")) {
                    r = r.substring(0, r.indexOf("-warning"));
                    s = Severity.WARNING;
                } else if (r.endsWith("-report")) {
                    r = r.substring(0, r.indexOf("-report"));
                    s = Severity.WARNING;
                } else {
                    s = Severity.ERROR;
                }
                a = (Attribute) IppAttributeUtils.getObject(
                        PrinterStateReason.class, r);
                if (a != null) {
                    rs.put((PrinterStateReason)a, s);
                }
            }
            if (rs.size() > 0) {
                attrx.add(rs);
            }
        } else if (aname.equals("copies") || aname.equals("copies-default")
                || aname.equals("copies-supported")) {
            for (int i = 0, ii = avalue.size(); i < ii; i++) {
View Full Code Here

                    attrx.add(a);
                }
            }
        } else if (aname.equals("printer-state-reason")
                || aname.equals("printer-state-reasons")) {
            PrinterStateReasons rs = new PrinterStateReasons();
            String r;
            Severity s;
            for (int i = 0, ii = avalue.size(); i < ii; i++) {
                r = new String((byte[]) avalue.get(i));
                if (r.endsWith("-error")) {
                    r = r.substring(0, r.indexOf("-error"));
                    s = Severity.ERROR;
                } else if (r.endsWith("-warning")) {
                    r = r.substring(0, r.indexOf("-warning"));
                    s = Severity.WARNING;
                } else if (r.endsWith("-report")) {
                    r = r.substring(0, r.indexOf("-report"));
                    s = Severity.WARNING;
                } else {
                    s = Severity.ERROR;
                }
                a = (Attribute) IppAttributeUtils.getObject(
                        PrinterStateReason.class, r);
                if (a != null) {
                    rs.put((PrinterStateReason)a, s);
                }
            }
            if (rs.size() > 0) {
                attrx.add(rs);
            }
        } else if (aname.equals("copies") || aname.equals("copies-default")
                || aname.equals("copies-supported")) {
            for (int i = 0, ii = avalue.size(); i < ii; i++) {
View Full Code Here

            }
        }

        PrinterState prnState = (PrinterState)service.getAttribute(PrinterState.class);
        if(prnState == PrinterState.STOPPED){
            PrinterStateReasons prnStateReasons = (PrinterStateReasons)service.getAttribute(PrinterStateReasons.class);
            if((prnStateReasons != null) && (prnStateReasons.containsKey(PrinterStateReason.SHUTDOWN))){
                throw new PrintException("PrintService is no longer available.");
            }
        }

        if((PrinterIsAcceptingJobs)(service.getAttribute(PrinterIsAcceptingJobs.class)) == PrinterIsAcceptingJobs.NOT_ACCEPTING_JOBS){
View Full Code Here

        }
    }

    private PrinterStateReasons getPrinterStateReasons() {
        if (isInvalid) {
            PrinterStateReasons psr = new PrinterStateReasons();
            psr.put(PrinterStateReason.SHUTDOWN, Severity.ERROR);
            return psr;
        } else {
            return null;
        }
    }
View Full Code Here

        attrs.add(getPrinterIsAcceptingJobs());
        PrinterState prnState = getPrinterState();
        if (prnState != null) {
            attrs.add(prnState);
        }
        PrinterStateReasons prnStateReasons = getPrinterStateReasons();
        if (prnStateReasons != null) {
            attrs.add(prnStateReasons);
        }
        attrs.add(getQueuedJobCount());
        return AttributeSetUtilities.unmodifiableView(attrs);
View Full Code Here

TOP

Related Classes of javax.print.attribute.standard.PrinterStateReasons

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.