|
|||||||||
| Home >> All >> com >> flexstor >> common >> awt >> [ dialogs overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.flexstor.common.awt.dialogs
Class OptionDlg

java.lang.Objectjava.awt.Component
java.awt.Container
java.awt.Window
java.awt.Dialog
com.flexstor.common.awt.dialogs.ModalDlg
com.flexstor.common.awt.dialogs.OptionDlg
- All Implemented Interfaces:
- javax.accessibility.Accessible, java.awt.event.ActionListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.event.KeyListener, java.awt.MenuContainer, java.io.Serializable
- Direct Known Subclasses:
- InputDialog, MessageBox
- public abstract class OptionDlg
- extends ModalDlg
- implements java.awt.event.ActionListener, java.awt.event.KeyListener
- extends ModalDlg
This class adds default buttons to a modal dialog as well
as default action and cancel behavior for enter key and escape.
It builds a button panel on the bottom depending on
the option passed into the constructor.
These are the options:
- YES_NO
- YES_NO_CANCEL
- OK_CANCEL
- OK
- APPLY_DISCARD_CANCEL
- OK_CANCEL_HELP
Predefined return values are:
- ACTION_OK
- ACTION_CANCEL
- ACTION_YES
- ACTION_NO
- ACTION_APPLY
- ACTION_DISCARD, _HELP
createButtonPanel() can be overwritten to create a custom button layout.
canPerformDefaultAction() is abstract and must be overwritten by subclasses to indicate that the default action can indeed be executed.
| Nested Class Summary |
| Nested classes inherited from class java.awt.Dialog |
java.awt.Dialog.AccessibleAWTDialog |
| Nested classes inherited from class java.awt.Window |
java.awt.Window.AccessibleAWTWindow |
| Nested classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
| Nested classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Field Summary | |
static int |
ACTION_APPLY
Result code for Apply button |
static int |
ACTION_CANCEL
Result code for Cancel button |
static int |
ACTION_CUSTOM
Starting value for custom action ids |
static int |
ACTION_DISCARD
Result code for Discard button |
static int |
ACTION_HELP
Result code for Help button |
static int |
ACTION_NO
Result code for No button |
static int |
ACTION_OK
Result code for OK button |
static int |
ACTION_SAVE
Result code for Save button |
static int |
ACTION_YES
Result code for Yes button |
static int |
APPLY_DISCARD_CANCEL
Constant for options Apply, discard, and Cancel |
private java.awt.Component |
cSource
|
protected static com.flexstor.common.awt.HelpHandlerI |
helpHandler
|
static java.lang.String |
IDENTIFIER
|
protected com.flexstor.common.awt.KeyWatcher |
keyWatcher
|
protected int |
nCancelActionId
|
protected int |
nDefaultActionId
|
protected int |
nStatus
|
static int |
OK
Constant for options Ok |
static int |
OK_CANCEL
Constant for options Ok and Cancel |
static int |
OK_CANCEL_HELP
Constant for options Ok, Cancel, and Help |
protected java.awt.Panel |
pnlButtons
|
protected java.util.Vector |
vButtons
|
static int |
YES_NO
Constant for options Yes and No |
static int |
YES_NO_CANCEL
Constant for options Yes, No, and Cancel |
| Fields inherited from class com.flexstor.common.awt.dialogs.ModalDlg |
bEnforceMinimumSize, focusComponent, fParent |
| Fields inherited from class java.awt.Dialog |
|
| Fields inherited from class java.awt.Window |
|
| Fields inherited from class java.awt.Container |
|
| Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
OptionDlg(java.awt.Frame fParent,
int nButtons)
Creates a dialog with a parent and predefined options. |
|
OptionDlg(java.awt.Frame fParent,
java.lang.String sTitle,
int nButtons)
Creates a dialog with a parent, a dialog title, and predefined options. |
|
| Method Summary | |
void |
actionPerformed(java.awt.event.ActionEvent e)
Performs the default dialog behavior: ACTION_HELP: pops up the help file, uses getWindowId() of subclasses All other : set status and dispose of dialog |
void |
addNotify()
Creates the buton panel. |
protected abstract boolean |
canPerformDefaultAction()
This abstract method returns a boolean indicating if the default action can be executed, i.e. |
protected void |
createButtonPanel()
If subclasses need a different layout for the buttons, they should overwrite this method. |
protected java.util.Vector |
createButtons(int nButtons)
Creates the predefined buttons and returns them in the vector vButtons which is a protected member. |
int |
getCancelAction()
Returns the cancel action id. |
protected com.flexstor.common.awt.field.ActionButton |
getComponentForId(int nId)
Retrieves the component for a given action id. |
int |
getDefaultAction()
Returns the default action id. |
protected int |
getFieldId()
Subclasses need to overwrite this method to define the field id for the help call, default indicate no call to the help system. |
int |
getStatus()
Returns the user's choice as an action id |
protected int |
getWindowId()
Subclasses need to overwrite this method to define their window id for the help call, default indicate no call to the help system. |
protected void |
initialize(int nButtons)
Performs initializations for all constructors. |
void |
keyPressed(java.awt.event.KeyEvent e)
Empty method, implementing KeyListener |
void |
keyReleased(java.awt.event.KeyEvent e)
All key event handling occurs on the key release. Escape fires an action event with the cancel action id. Enter fires an action event with the default action id. F1 fires an action event with the help action id. |
void |
keyTyped(java.awt.event.KeyEvent e)
Empty method, implementing KeyListener |
static void |
registerHelpHandler(com.flexstor.common.awt.HelpHandlerI handler)
Registers the global help handler for dialogs. |
void |
setCancelAction(int nActionId)
Defines the cancel action if the user hits the escape key or closes the dialog with the close box or system menu. |
void |
setContent(java.awt.Component c)
Sets the center component of the predefined border layout. |
void |
setDefaultAction(int nActionId)
Defines the default action if the user hits the enter key. |
protected void |
setStatus(int nStatus)
Sets the new status |
| Methods inherited from class com.flexstor.common.awt.dialogs.ModalDlg |
centerOn, enableInput, setFocusComponent, setMinimumSizeEnforcement, setVisible, validate |
| Methods inherited from class java.awt.Dialog |
dispose, getAccessibleContext, getTitle, hide, isModal, isResizable, isUndecorated, paramString, setModal, setResizable, setTitle, setUndecorated, show |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
IDENTIFIER
public static final java.lang.String IDENTIFIER
- See Also:
- Constant Field Values
ACTION_OK
public static final int ACTION_OK
- Result code for OK button
- See Also:
- Constant Field Values
ACTION_CANCEL
public static final int ACTION_CANCEL
- Result code for Cancel button
- See Also:
- Constant Field Values
ACTION_YES
public static final int ACTION_YES
- Result code for Yes button
- See Also:
- Constant Field Values
ACTION_NO
public static final int ACTION_NO
- Result code for No button
- See Also:
- Constant Field Values
ACTION_APPLY
public static final int ACTION_APPLY
- Result code for Apply button
- See Also:
- Constant Field Values
ACTION_DISCARD
public static final int ACTION_DISCARD
- Result code for Discard button
- See Also:
- Constant Field Values
ACTION_HELP
public static final int ACTION_HELP
- Result code for Help button
- See Also:
- Constant Field Values
ACTION_SAVE
public static final int ACTION_SAVE
- Result code for Save button
- See Also:
- Constant Field Values
ACTION_CUSTOM
public static final int ACTION_CUSTOM
- Starting value for custom action ids
- See Also:
- Constant Field Values
YES_NO
public static final int YES_NO
- Constant for options Yes and No
- See Also:
- Constant Field Values
YES_NO_CANCEL
public static final int YES_NO_CANCEL
- Constant for options Yes, No, and Cancel
- See Also:
- Constant Field Values
OK_CANCEL
public static final int OK_CANCEL
- Constant for options Ok and Cancel
- See Also:
- Constant Field Values
OK
public static final int OK
- Constant for options Ok
- See Also:
- Constant Field Values
APPLY_DISCARD_CANCEL
public static final int APPLY_DISCARD_CANCEL
- Constant for options Apply, discard, and Cancel
- See Also:
- Constant Field Values
OK_CANCEL_HELP
public static final int OK_CANCEL_HELP
- Constant for options Ok, Cancel, and Help
- See Also:
- Constant Field Values
helpHandler
protected static com.flexstor.common.awt.HelpHandlerI helpHandler
nStatus
protected int nStatus
nDefaultActionId
protected int nDefaultActionId
nCancelActionId
protected int nCancelActionId
pnlButtons
protected java.awt.Panel pnlButtons
vButtons
protected java.util.Vector vButtons
keyWatcher
protected com.flexstor.common.awt.KeyWatcher keyWatcher
cSource
private java.awt.Component cSource
| Constructor Detail |
OptionDlg
public OptionDlg(java.awt.Frame fParent, int nButtons)
- Creates a dialog with a parent and predefined options.
OptionDlg
public OptionDlg(java.awt.Frame fParent, java.lang.String sTitle, int nButtons)
- Creates a dialog with a parent, a dialog title, and predefined options.
| Method Detail |
initialize
protected void initialize(int nButtons)
- Performs initializations for all constructors.
createButtons
protected java.util.Vector createButtons(int nButtons)
- Creates the predefined buttons and returns them in the vector
vButtons which is a protected member.
Also sets the default action and cancel action.
createButtonPanel
protected void createButtonPanel()
- If subclasses need a different layout for the buttons,
they should overwrite this method.
setContent
public void setContent(java.awt.Component c)
- Sets the center component of the predefined border layout.
addNotify
public void addNotify()
- Creates the buton panel. Adds a window listener to perform the default cancel
action when the window close box is clicked.
getComponentForId
protected com.flexstor.common.awt.field.ActionButton getComponentForId(int nId)
- Retrieves the component for a given action id.
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent e)
- Performs the default dialog behavior:
ACTION_HELP: pops up the help file, uses getWindowId() of subclasses
All other : set status and dispose of dialog- Specified by:
actionPerformedin interfacejava.awt.event.ActionListener
setStatus
protected void setStatus(int nStatus)
- Sets the new status
getStatus
public int getStatus()
- Returns the user's choice as an action id
getWindowId
protected int getWindowId()
- Subclasses need to overwrite this method to define their window
id for the help call, default indicate no call to the help system.
getFieldId
protected int getFieldId()
- Subclasses need to overwrite this method to define the field
id for the help call, default indicate no call to the help system.
setDefaultAction
public void setDefaultAction(int nActionId)
- Defines the default action if the user hits the enter key.
getDefaultAction
public int getDefaultAction()
- Returns the default action id.
setCancelAction
public void setCancelAction(int nActionId)
- Defines the cancel action if the user hits the escape key
or closes the dialog with the close box or system menu.
getCancelAction
public int getCancelAction()
- Returns the cancel action id.
keyTyped
public void keyTyped(java.awt.event.KeyEvent e)
- Empty method, implementing KeyListener
- Specified by:
keyTypedin interfacejava.awt.event.KeyListener
keyReleased
public void keyReleased(java.awt.event.KeyEvent e)
- All key event handling occurs on the key release.
Escape fires an action event with the cancel action id.
Enter fires an action event with the default action id.
F1 fires an action event with the help action id.- Specified by:
keyReleasedin interfacejava.awt.event.KeyListener
keyPressed
public void keyPressed(java.awt.event.KeyEvent e)
- Empty method, implementing KeyListener
- Specified by:
keyPressedin interfacejava.awt.event.KeyListener
canPerformDefaultAction
protected abstract boolean canPerformDefaultAction()
- This abstract method returns a boolean indicating if the default
action can be executed, i.e. if this method returns false, the enter
key does NOT fire an action event.
registerHelpHandler
public static void registerHelpHandler(com.flexstor.common.awt.HelpHandlerI handler)
- Registers the global help handler for dialogs. Subsequent calls will
replace the help handler.
|
|||||||||
| Home >> All >> com >> flexstor >> common >> awt >> [ dialogs overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC