com.levigo.jadice.printer.event
Class PrintEventBroadcaster

java.lang.Object
  extended by com.levigo.jadice.printer.event.PrintEventBroadcaster

public final class PrintEventBroadcaster
extends Object

This class broadcasts print events of all jadice print processes to registered print listeners.

Customized realisations of PrintEventListenershould be attached to this broadcaster to monitor the status of running printer jobs processed by jadice printing api.

The print state monitoring may be invoked on the thread processing the print job, or a service created notification thread. In either case developers are strongly encouraged not perform time consuming processes in the callback method of the attached print listeners.

See also
PrintEvent,
PrintEventListener.


Method Summary
static void addPrintListener(PrintEventListener listener)
          Add the given PrintEventListenerto its list of registerd print listeners.
static void firePrintStateChanged(PrintEvent evt)
          Forwards the print event to all registered listeners.
static int getPrintListenerCount()
          Returns the total number of registered print listeners
static PrintEventListener[] getPrintListeners()
          Returns an array of all registered print listeners.
static String getStacktraceAsString(Throwable t)
          Returns a string describing given throwable and its backtrace.
static void removePrintListener(PrintEventListener listener)
          Removes given PrintEventListenerfrom its list of registerd print listeners.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

addPrintListener

public static void addPrintListener(PrintEventListener listener)
Add the given PrintEventListenerto its list of registerd print listeners.
If given listener is null or is not already registered nothing will happen.

Parameters:
listener - the print listener to add

getPrintListenerCount

public static int getPrintListenerCount()
Returns the total number of registered print listeners

Returns:
number of registered listener

getPrintListeners

public static PrintEventListener[] getPrintListeners()
Returns an array of all registered print listeners.

Returns:
all registered print listeners

removePrintListener

public static void removePrintListener(PrintEventListener listener)
Removes given PrintEventListenerfrom its list of registerd print listeners.
If given listener is null or is not registered to this class nothing will happen.

Parameters:
listener - the print listener to remove

firePrintStateChanged

public static void firePrintStateChanged(PrintEvent evt)
Forwards the print event to all registered listeners.

Parameters:
evt - PrintEvent describing which printing event took place

getStacktraceAsString

public static String getStacktraceAsString(Throwable t)
Returns a string describing given throwable and its backtrace.

Parameters:
t -
Returns:
The stack trace as String.


Copyright © 1995-2020 levigo holding gmbh. All Rights Reserved.