Search in sources :

Example 1 with PrintJobListener

use of javax.print.event.PrintJobListener in project jdk8u_jdk by JetBrains.

the class UnixPrintJob method notifyEvent.

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 = (PrintJobListener) (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;
                }
            }
        }
    }
}
Also used : PrintJobEvent(javax.print.event.PrintJobEvent) java.awt.print(java.awt.print) PrintJobListener(javax.print.event.PrintJobListener)

Example 2 with PrintJobListener

use of javax.print.event.PrintJobListener in project jdk8u_jdk by JetBrains.

the class PSStreamPrintJob method notifyEvent.

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 = (PrintJobListener) (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;
                }
            }
        }
    }
}
Also used : PrintJobEvent(javax.print.event.PrintJobEvent) java.awt.print(java.awt.print) PrintJobListener(javax.print.event.PrintJobListener)

Example 3 with PrintJobListener

use of javax.print.event.PrintJobListener in project jdk8u_jdk by JetBrains.

the class Win32PrintJob method notifyEvent.

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 = (PrintJobListener) (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;
                }
            }
        }
    }
}
Also used : PrintJobEvent(javax.print.event.PrintJobEvent) java.awt.print(java.awt.print) PrintJobListener(javax.print.event.PrintJobListener)

Aggregations

java.awt.print (java.awt.print)3 PrintJobEvent (javax.print.event.PrintJobEvent)3 PrintJobListener (javax.print.event.PrintJobListener)3