skrueger.swing
Class DialogManager<KEY,DIALOG extends AtlasDialog>
java.lang.Object
skrueger.swing.DialogManager<KEY,DIALOG>
- Direct Known Subclasses:
- CancellableDialogManager
public abstract class DialogManager<KEY,DIALOG extends AtlasDialog>
- extends Object
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
dialogCache
protected HashMap<KEY,DIALOG extends AtlasDialog> dialogCache
DialogManager
public DialogManager()
- A
DialogManager
instance can be created for any extension of
JDialog
that will implement the
getInstanceFor(Object, Component, Object...)
method.
bringup
protected DIALOG bringup(DIALOG dialog)
- This will be done with every dialog that an instance is required for.
- Parameters:
dialog
-
- Returns:
getInstanceFor
public abstract DIALOG getInstanceFor(KEY key,
Component owner,
Object... constArgs)
- Parameters:
key
- owner
- constArgs
-
- Returns:
- a cached instance or creates a new instance. Instances are always retuned visible and toFront.
isVisibleFor
public boolean isVisibleFor(KEY key)
- Returns:
- Is there an open/visible dialog for the given layer id?
disposeInstanceForParent
public void disposeInstanceForParent(Component parent)
- Will dispose any dialog that is registered to the given parent
Component
- Parameters:
parent
-
disposeInstanceFor
public boolean disposeInstanceFor(KEY key)
getInstanceFor
public DIALOG getInstanceFor(KEY key,
DialogManager.FactoryInterface factory)
- Checks whether there already is an instance for that key and otherwise
will create the instance by invoking the
DialogManager.FactoryInterface
#create
method.
- Parameters:
factory
- DialogManager.FactoryInterface
that creates the DIALOG
- Returns:
- Always a visible and inFront instance of DIALOG for the given
key.
disposeAll
public boolean disposeAll()
- Disposes all open instances and removes them from the cache.
- Returns:
true
if at least one window has been disposed.
getAllInstances
public Collection<DIALOG> getAllInstances()
- Returns:
- All instances of DIALOG as they are cached.