javatools.swing.panel
Class SubPanelDispatcher

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--javatools.swing.panel.SubPanelDispatcher
All Implemented Interfaces:
java.lang.Runnable

public class SubPanelDispatcher
extends java.lang.Thread

It represents an "event dispatcher" for sub-panels, i.e. panels into other panels. It is multi-panel, you can create only one for your application, if you want them to be processed in queue. It can manage fixed sub-panels (i.e. when you create a panel and its subpanels once and you have it until end of execution) or dynamic sub-panels (i.e. when you create a panel as you need it). Use this sequence of commands: Integer fillerID1; Long fillerID2; SubPanelDispatcher disp = new SubPanelDispatcher(); disp.setStatusLabelSync(myStatusLabelSync); -- repeat fillerID1 = disp.registerFiller(myFiller, myMessage); -- until you have "fixed subpanels" -- repeat fillerID2 = disp.reserveKey(); disp.registerFiller(fillerID2, myFiller, myMessage); -- until you have "dynamic subpanels" disp.fill(fillerID1, selectedObjectArray1); disp.fill(fillerID2, selectedObjectArray2); disp.releaseKey(fillerID2); -- At the end of application: disp.stopAll();


Field Summary
protected  StatusLabelSync statusSync
          Is is the status label sync to be used to display messages.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
SubPanelDispatcher()
          Creates a new instance of SubPanelDispatcher
 
Method Summary
protected  void doDispatchOne(java.lang.Object fillerID, java.lang.Object[] IDs)
          Dispatches one subpanel request in the queue.
 void fill(java.lang.Object fillerID, java.lang.Object[] IDs)
          Fills a subpanel.
 void registerFiller(java.lang.Long fillerID, SubPanelFiller filler, java.lang.String message)
          Registers a filler for a dynamic subpanel.
 java.lang.Integer registerFiller(SubPanelFiller filler, java.lang.String message)
          Registers a fixed subpanel's filler.
 void releaseKey(java.lang.Long key)
          Releases a key to be used for dynamic subpanels
 java.lang.Long reserveKey()
          Reserves a key for a dynamic subpanel.
 java.lang.Long reserveKey(SubPanelFiller filler, java.lang.String message)
          Reserves a key and sets the filler and the message to display.
 void run()
          Thread's run method.
 void setStatusLabelSync(StatusLabelSync sync)
          Sets the status label sync to display messages.
 void stopAll()
          Stops the thread.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

statusSync

protected StatusLabelSync statusSync
Is is the status label sync to be used to display messages.

Constructor Detail

SubPanelDispatcher

public SubPanelDispatcher()
Creates a new instance of SubPanelDispatcher

Method Detail

setStatusLabelSync

public void setStatusLabelSync(StatusLabelSync sync)
Sets the status label sync to display messages.

Parameters:
sync - The sync to use.

reserveKey

public java.lang.Long reserveKey()
Reserves a key for a dynamic subpanel.

Returns:
The key to be used in the "fill" method.

reserveKey

public java.lang.Long reserveKey(SubPanelFiller filler,
                                 java.lang.String message)
Reserves a key and sets the filler and the message to display.

Parameters:
filler - The filler to use.
message - The message to display.
Returns:
The key to be used in the "fill" method.

registerFiller

public void registerFiller(java.lang.Long fillerID,
                           SubPanelFiller filler,
                           java.lang.String message)
Registers a filler for a dynamic subpanel.

Parameters:
fillerID - The key to use.
filler - The filler to be registered.
message - The message to display.

releaseKey

public void releaseKey(java.lang.Long key)
Releases a key to be used for dynamic subpanels

Parameters:
key - The key to use.

registerFiller

public java.lang.Integer registerFiller(SubPanelFiller filler,
                                        java.lang.String message)
Registers a fixed subpanel's filler.

Parameters:
filler - The filler to use.
message - The message to display.
Returns:
The key to use in the "fill" method.

run

public void run()
Thread's run method.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

stopAll

public void stopAll()
Stops the thread.


fill

public void fill(java.lang.Object fillerID,
                 java.lang.Object[] IDs)
Fills a subpanel.

Parameters:
fillerID - The ID of the filler to use (either dynamic or fixed).
IDs - The IDs of selected objects somewhere else in the application.

doDispatchOne

protected void doDispatchOne(java.lang.Object fillerID,
                             java.lang.Object[] IDs)
Dispatches one subpanel request in the queue.

Parameters:
fillerID - The filler ID to use.
IDs - The IDs of selected objects somewhere else in the application.