Package javax.print

Examples of javax.print.PrintService


        if (index > 0 && paperChanged) {

            mPSStream.print("<< /PageSize [" +
                            paperWidth + " " + paperHeight + "]");

            final PrintService pservice = getPrintService();
            Boolean isPS =
                (Boolean)java.security.AccessController.doPrivileged(

                new java.security.PrivilegedAction() {
                    public Object run() {
View Full Code Here


    //** BEGIN Functions called by native code for querying/updating attributes

    private final String getPrinterAttrib() {
        // getPrintService will get current print service or default if none
        PrintService service = this.getPrintService();
        String name = (service != null) ? service.getName() : null;
        return name;
    }
View Full Code Here

        mAttXRes = pr.getCrossFeedResolution(PrinterResolution.DPI);
        mAttYRes = pr.getFeedResolution(PrinterResolution.DPI);
    }

    private void setPrinterNameAttrib(String printerName) {
        PrintService service = this.getPrintService();

        if (printerName == null) {
            return;
        }

        if (service != null && printerName.equals(service.getName())) {
            return;
        } else {
            PrintService []services = PrinterJob.lookupPrintServices();
            for (int i=0; i<services.length; i++) {
                if (printerName.equals(services[i].getName())) {
View Full Code Here

     * Tests that if this attribute set does not support the add() operation
     * UnmodifiableSetException is thrown.
     */
    public final void testAdd2() {

        PrintService service = PrintServiceLookup.lookupDefaultPrintService();
        if (service != null) {
            PrintServiceAttributeSet psaset = service.getAttributes();
            try{
                psaset.add(ColorSupported.NOT_SUPPORTED);
                fail("add() doesn't throw Exception when" +
                    "trying to add attribute to unmodifiable attribute set ");
            } catch (UnmodifiableSetException e){
View Full Code Here

     * equals(Object object) method testing.
     */
    public final void testEquals() {

        aset = new HashAttributeSet();
        PrintService service = PrintServiceLookup.lookupDefaultPrintService();
        if (service != null) {
            PrintServiceAttributeSet psaset = service.getAttributes();
            if (aset.addAll(psaset)){
                assertTrue(aset.equals(psaset));
            }
        } else {
            System.out.println("Warning: default print service wasn't found!\n"
View Full Code Here

    public PrintService getDefaultPrintService() {
        synchronized (this) {
            String defaultService = findDefaultPrintService();

            if (defaultService != null) {
                PrintService service = getServiceStored(defaultService,
                        services);
                if (service != null) {
                    return service;
                }
View Full Code Here

                return new PrintService[0];
            }

            ArrayList newServices = new ArrayList();
            for (int i = 0; i < serviceNames.length; i++) {
                PrintService service = getServiceStored(serviceNames[i],
                        services);
                if (service != null) {
                    newServices.add(service);
                } else if (getServiceStored(serviceNames[i], newServices) == null) {
                    try {
View Full Code Here

            }

            // return only those are stored in field 'services'
            ArrayList newServices = new ArrayList();
            for (int i = 0; i < serviceNames.length; i++) {
                PrintService service = getServiceStored(serviceNames[i],
                        services);
                if (service != null) {
                    newServices.add(service);
                }
            }
View Full Code Here

     * find service which name is same as serviceName
     */
    private PrintService getServiceStored(String serviceName,
            ArrayList servicesList) {
        for (int i = 0; i < servicesList.size(); i++) {
            PrintService service = (PrintService) servicesList.get(i);
            if (service.getName().equals(serviceName)) {
                return service;
            }
        }
        return null;
    }
View Full Code Here

            running = true;
            while (running) {
                Thread.sleep(1000);
               
                for (int i = 0; i < services.size(); i++) {
                    PrintService service = (PrintService)services.get(i);
                    PrintServiceAttributeSet lastSet =
                        (PrintServiceAttributeSet)attributes.get(service);
                    PrintServiceAttributeSet newSet = service.getAttributes();
                    if (!lastSet.equals(newSet)) {
                        PrintServiceAttributeSet updated =
                            getUpdatedAttributeSet(lastSet, newSet);
                        if (updated.size() > 0) {
                            PrintServiceAttributeEvent event =
View Full Code Here

TOP

Related Classes of javax.print.PrintService

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.