|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.event.WindowAdapter
com.ccg.swing.DirtyChecker
public class DirtyChecker
An attempt to provide a API for the purpose of letting the user know that not everything has been saved before allowing the user to exit.
| Constructor Summary | |
|---|---|
DirtyChecker(RStockDialogs rd,
boolean allowExit)
Construct the object and indicate whether it should allow exit. |
|
| Method Summary | |
|---|---|
void |
addDirtyObject(DirtySaver val)
Set a object that can be saved to the dirty list. |
boolean |
attemptSave()
Attempt to save the state of the system. |
void |
clearFailedSave()
Clear any internally error conditions set by last save attempt. |
Exception |
getFailedReason(Object o)
Get reason that the last save attempt failed. |
Enumeration |
getFailedSave()
Get set of dirty objects that failed when we tried to save them. |
boolean |
isDirty()
Does something need to be saved, or has something failed to save? |
boolean |
isExitAllowed()
Are we allowed to exit the JVM on the window closing event? |
boolean |
isOkToClear()
Checks to see if its OK to clear the current state of the object. |
void |
removeDirtyObject(DirtySaver ds)
Get a object that can be saved to the dirty list. |
void |
setExitAllowed(boolean val)
Set whether we are allowed to exit the JVM on the window closing event. |
void |
windowClosing(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 |
| Constructor Detail |
|---|
public DirtyChecker(RStockDialogs rd,
boolean allowExit)
| Method Detail |
|---|
public void windowClosing(WindowEvent e)
windowClosing in interface WindowListenerwindowClosing in class WindowAdapterpublic void setExitAllowed(boolean val)
val - New boolean value to assign.
see #getExitAllowedpublic boolean isExitAllowed()
public void addDirtyObject(DirtySaver val)
object that can be saved to the dirty list.
val - New DirtySaver value to assign.removeDirtyObject(com.ccg.swing.DirtySaver)public void removeDirtyObject(DirtySaver ds)
object that can be saved to the dirty list.
addDirtyObject(com.ccg.swing.DirtySaver)public boolean isOkToClear()
This method can be used to determine if its OK to clear the
current state of the object. If the object is "dirty", the user will be presented a dialog box asking whether
they want to:
This method then returns true if it's OK to clear the current state of the system.
For example, when a "File|New" action is chosen by the user, this method is invoked to make sure that its OK to clear the current state prior to creating a new one.
public boolean attemptSave()
This method attempts to save the state of all of the dirty objects (hopeully taking us out of the "dirty" state).
public Enumeration getFailedSave()
Enumeration of DirtySaver objects that failed to save the last time we
tried to save them.public Exception getFailedReason(Object o)
attemptSave()public void clearFailedSave()
save attempt.
attemptSave()public boolean isDirty()
You can use this method to determine if your application is
"dirty" that means that something needs to be saved, OR something
which we tried to save failed. You can use the attemptSave() method to try and "save" all of the
dirty objects.
You can use the getFailedSave() method if you want to
see what objects failed to "save" themselves (and why), or you
can use the clearFailedSave() if you don't care about the
objects that failed to save themselves.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||