|
Orbital library | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.event.WindowAdapter orbital.moon.awt.Closer
public final class Closer
If Closer is registered to a component, it will automatically close it on user requests.
On close, it will send an ActionEvent "close"
to all listeners registered to Closer.
If an additional parental Frame is specified, the Component
is only closed on Confirmation.
A Closer registered to window events will react on closing events.
When it registers to key events, it will react on the keycombos Alt-.
or Alt-,
or Ctrl-Break
as well.
Remember that, in some situations, you might have to register it to TextFields etc. by hand.
For example:
Frame f = new Frame(); // register to closing WindowEvents boolean register = true; // and to special KeyEvents // without parental Frame Closer closer = new Closer(f,register); Button b = new Button("Please Close"); f.add(b); // register to Button's ActionEvents b.addActionListener(closer);
Never register a closer as an actionListener to itself.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface orbital.logic.functor.Predicate |
---|
Predicate.Composite |
Nested classes/interfaces inherited from interface orbital.logic.functor.Functor |
---|
Functor.Specification |
Field Summary | |
---|---|
protected java.awt.Component |
component
the Component or Window to be closed |
protected java.awt.Frame |
parent
parental frame. |
Fields inherited from interface orbital.logic.functor.Predicate |
---|
callTypeDeclaration |
Constructor Summary | |
---|---|
Closer(java.awt.Component comp)
Close instantly. |
|
Closer(java.awt.Frame parent,
java.awt.Component comp)
Close only after confirmation dialog |
|
Closer(java.awt.Frame parent,
java.lang.String questionOnClosing,
java.awt.Window comp,
boolean register,
boolean definitively)
Close only after confirmation dialog; if register, self-register to WindowEvents, if definitifely force termination via System.exit(). |
|
Closer(java.awt.Frame parent,
java.awt.Window comp,
boolean register)
Close only after confirmation dialog; if register, self-register to WindowEvents. |
|
Closer(java.awt.Frame parent,
java.awt.Window comp,
boolean register,
boolean definitively)
Close only after confirmation dialog; if register, self-register to WindowEvents, if definitifely force termination via System.exit(). |
|
Closer(java.awt.Window comp,
boolean register)
Close instantly; if register, self-register to WindowEvents. |
|
Closer(java.awt.Window comp,
boolean register,
boolean definitively)
Close instantly; if register, self-register to WindowEvents, |
Method Summary | |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
when notified, request a close. |
void |
addActionListener(java.awt.event.ActionListener l)
Adds the specified action listener to receive action events from this object. |
boolean |
apply(java.lang.Object a)
Called to apply the Predicate. |
void |
close()
The close action. |
protected void |
processActionEvent(java.awt.event.ActionEvent e)
Processes action events occurring on this object by dispatching them to any registered ActionListener objects. |
void |
removeActionListener(java.awt.event.ActionListener l)
Removes the specified action listener so that it no longer receives action events from this object. |
void |
requestClose()
Request to close, but (if parent is specified) only after confirmation. |
void |
windowClosing(java.awt.event.WindowEvent e)
|
Methods inherited from class java.awt.event.WindowAdapter |
---|
windowActivated, windowClosed, windowDeactivated, windowDeiconified, windowGainedFocus, windowIconified, windowLostFocus, windowOpened, windowStateChanged |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface orbital.logic.functor.Functor |
---|
equals, hashCode, toString |
Field Detail |
---|
protected java.awt.Frame parent
protected java.awt.Component component
Constructor Detail |
---|
public Closer(java.awt.Component comp)
comp
- the component to be closed on demand.public Closer(java.awt.Window comp, boolean register)
comp
- the component to be closed on demand.register
- whether this Closer should automatically register to comp's WindowEvents for closing events via comp.addWindowListener(this)
.public Closer(java.awt.Window comp, boolean register, boolean definitively)
comp
- the component to be closed on demand.register
- whether this Closer should automatically register to comp's WindowEvents for closing events via comp.addWindowListener(this)
.definitively
- whether after a successful close action, Closer should exit the JVM via System.exit(0)
.public Closer(java.awt.Frame parent, java.awt.Component comp)
parent
- the frame to be used as parent for confirmation dialogs. null
if no confirmation is desired.comp
- the component to be closed on demand.public Closer(java.awt.Frame parent, java.awt.Window comp, boolean register)
parent
- the frame to be used as parent for confirmation dialogs. null
if no confirmation is desired.comp
- the component to be closed on demand.register
- whether this Closer should automatically register to comp's WindowEvents for closing events via comp.addWindowListener(this)
.public Closer(java.awt.Frame parent, java.awt.Window comp, boolean register, boolean definitively)
parent
- the frame to be used as parent for confirmation dialogs. null
if no confirmation is desired.comp
- the component to be closed on demand.register
- whether this Closer should automatically register to comp's WindowEvents for closing events via comp.addWindowListener(this)
.definitively
- whether after a successful close action, Closer should exit the JVM via System.exit(0)
.public Closer(java.awt.Frame parent, java.lang.String questionOnClosing, java.awt.Window comp, boolean register, boolean definitively)
parent
- the frame to be used as parent for confirmation dialogs. null
if no confirmation is desired.questionOnClosing
- which question to ask before closing component.
Will only close on affirmation.comp
- the component to be closed on demand.register
- whether this Closer should automatically register to comp's WindowEvents for closing events via comp.addWindowListener(this)
.definitively
- whether after a successful close action, Closer should exit the JVM via System.exit(0)
.Method Detail |
---|
public void close()
public void requestClose()
public boolean apply(java.lang.Object a)
Predicate
P(a)
.
apply
in interface Predicate
a
- single Object argument
public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
public void windowClosing(java.awt.event.WindowEvent e)
windowClosing
in interface java.awt.event.WindowListener
windowClosing
in class java.awt.event.WindowAdapter
protected void processActionEvent(java.awt.event.ActionEvent e)
ActionListener
objects.
e
- the action event.ActionListener
,
addActionListener(ActionListener)
public void addActionListener(java.awt.event.ActionListener l)
l
- the action listenerActionListener
,
removeActionListener(ActionListener)
public void removeActionListener(java.awt.event.ActionListener l)
l
- the action listenerActionListener
,
addActionListener(ActionListener)
|
Orbital library 1.3.0: 11 Apr 2009 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |