Java Code Examples for javax.print.event.PrintJobEvent#JOB_FAILED

The following examples show how to use javax.print.event.PrintJobEvent#JOB_FAILED . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PSStreamPrintJob.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
private void notifyEvent(int reason) {
    synchronized (this) {
        if (jobListeners != null) {
            PrintJobListener listener;
            PrintJobEvent event = new PrintJobEvent(this, reason);
            for (int i = 0; i < jobListeners.size(); i++) {
                listener = jobListeners.elementAt(i);
                switch (reason) {

                    case PrintJobEvent.JOB_CANCELED :
                        listener.printJobCanceled(event);
                        break;

                    case PrintJobEvent.JOB_FAILED :
                        listener.printJobFailed(event);
                        break;

                    case PrintJobEvent.DATA_TRANSFER_COMPLETE :
                        listener.printDataTransferCompleted(event);
                        break;

                    case PrintJobEvent.NO_MORE_EVENTS :
                        listener.printJobNoMoreEvents(event);
                        break;

                    case PrintJobEvent.JOB_COMPLETE :
                        listener.printJobCompleted(event);
                        break;

                    default:
                        break;
                }
            }
        }
   }
}
 
Example 2
Source File: PSStreamPrintJob.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void notifyEvent(int reason) {
    synchronized (this) {
        if (jobListeners != null) {
            PrintJobListener listener;
            PrintJobEvent event = new PrintJobEvent(this, reason);
            for (int i = 0; i < jobListeners.size(); i++) {
                listener = jobListeners.elementAt(i);
                switch (reason) {

                    case PrintJobEvent.JOB_CANCELED :
                        listener.printJobCanceled(event);
                        break;

                    case PrintJobEvent.JOB_FAILED :
                        listener.printJobFailed(event);
                        break;

                    case PrintJobEvent.DATA_TRANSFER_COMPLETE :
                        listener.printDataTransferCompleted(event);
                        break;

                    case PrintJobEvent.NO_MORE_EVENTS :
                        listener.printJobNoMoreEvents(event);
                        break;

                    case PrintJobEvent.JOB_COMPLETE :
                        listener.printJobCompleted(event);
                        break;

                    default:
                        break;
                }
            }
        }
   }
}
 
Example 3
Source File: UnixPrintJob.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private void notifyEvent(int reason) {

        /* since this method should always get called, here's where
         * we will perform the clean up of any data stream supplied.
         */
        switch (reason) {
            case PrintJobEvent.DATA_TRANSFER_COMPLETE:
            case PrintJobEvent.JOB_CANCELED :
            case PrintJobEvent.JOB_FAILED :
            case PrintJobEvent.NO_MORE_EVENTS :
            case PrintJobEvent.JOB_COMPLETE :
                closeDataStreams();
        }

        synchronized (this) {
            if (jobListeners != null) {
                PrintJobListener listener;
                PrintJobEvent event = new PrintJobEvent(this, reason);
                for (int i = 0; i < jobListeners.size(); i++) {
                    listener = jobListeners.elementAt(i);
                    switch (reason) {

                        case PrintJobEvent.JOB_CANCELED :
                            listener.printJobCanceled(event);
                            break;

                        case PrintJobEvent.JOB_FAILED :
                            listener.printJobFailed(event);
                            break;

                        case PrintJobEvent.DATA_TRANSFER_COMPLETE :
                            listener.printDataTransferCompleted(event);
                            break;

                        case PrintJobEvent.NO_MORE_EVENTS :
                            listener.printJobNoMoreEvents(event);
                            break;

                        default:
                            break;
                    }
                }
            }
       }
    }
 
Example 4
Source File: Win32PrintJob.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private void notifyEvent(int reason) {

        /* since this method should always get called, here's where
         * we will perform the clean up of any data stream supplied.
         */
        switch (reason) {
            case PrintJobEvent.DATA_TRANSFER_COMPLETE:
            case PrintJobEvent.JOB_CANCELED :
            case PrintJobEvent.JOB_FAILED :
            case PrintJobEvent.NO_MORE_EVENTS :
            case PrintJobEvent.JOB_COMPLETE :
                closeDataStreams();
        }

        synchronized (this) {
            if (jobListeners != null) {
                PrintJobListener listener;
                PrintJobEvent event = new PrintJobEvent(this, reason);
                for (int i = 0; i < jobListeners.size(); i++) {
                    listener = jobListeners.elementAt(i);
                    switch (reason) {

                        case PrintJobEvent.JOB_COMPLETE :
                            listener.printJobCompleted(event);
                            break;

                        case PrintJobEvent.JOB_CANCELED :
                            listener.printJobCanceled(event);
                            break;

                        case PrintJobEvent.JOB_FAILED :
                            listener.printJobFailed(event);
                            break;

                        case PrintJobEvent.DATA_TRANSFER_COMPLETE :
                            listener.printDataTransferCompleted(event);
                            break;

                        case PrintJobEvent.NO_MORE_EVENTS :
                            listener.printJobNoMoreEvents(event);
                            break;

                        default:
                            break;
                    }
                }
            }
       }
    }