|
| Components |
|
| |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||||
com.sas.swing.visuals.OptionsDialog
public class OptionsDialog
A generic dialog class that handles adding and responding to general buttons such as "OK", "Cancel", "Apply", etc.
| Field Summary | |
|---|---|
protected int |
buttons
|
static java.lang.String |
RB_KEY
|
| Fields inherited from interface com.sas.swing.visuals.util.LayoutConstants |
|---|
DOTS_BUTTON_INSETS, EMPTY_INSETS, HGAP, HMARGIN, INDENTED_BORDER, TAB_BORDER, TEXTFIELD_INSETS, VGAP, VMARGIN |
| Constructor Summary | |
|---|---|
OptionsDialog(java.awt.Frame parent,
PanelInterface panel,
boolean modal)
Creates a new Dialog for the specified panel. |
|
OptionsDialog(java.awt.Frame f,
PanelInterface panel,
boolean modal,
int buttons,
int buttonLocation)
Creates a new Dialog for the specified panel. |
|
OptionsDialog(java.awt.Frame parent,
java.lang.String title,
boolean modal)
Creates a new dialog initialized with the specified title. |
|
OptionsDialog(java.awt.Frame f,
java.lang.String title,
boolean modal,
int buttons,
int buttonLocation)
Creates a new dialog initialized with the specified title and buttons. |
|
| Method Summary | |
|---|---|
void |
actionPerformed(java.awt.event.ActionEvent actionEvent)
|
void |
addButton(javax.swing.AbstractButton b)
Adds the specified button to the dialog. |
protected javax.swing.AbstractButton[] |
createButtons(int newButtons)
Factory method to create the buttons for the specified identifiers. |
protected javax.swing.AbstractButton |
getButton(int id)
|
int |
getButtonLocation()
Returns the location of the buttons in the dialog. |
java.lang.String |
getHelpID()
Returns the help id for this dialog. |
javax.swing.JPanel |
getMainPanel()
Returns the main panel of this dialog. |
PanelInterface |
getPanel()
Returns that panel hosted by this dialog. |
void |
onApply()
Handles the "apply" action which usually occurs whenever the button for the CommonButtons.APPLY_BUTTON identifier is pressed. |
void |
onCancel()
Handles the "cancel" action which usually occurs whenever the button for the CommonButtons.CANCEL_BUTTON identifier is pressed. |
void |
onClose()
Handles the "close" action which usually occurs whenever the button for the CommonButtons.CLOSE_BUTTON identifier is pressed. |
void |
onHelp()
Handles the "help" action which usually occurs whenever the button for the CommonButtons.HELP_BUTTON identifier is pressed. |
void |
onOK()
Handles the "ok" action. |
protected void |
processWindowEvent(java.awt.event.WindowEvent event)
Process the window events that occur on this dialog. |
void |
setButtonLocation(int newButtonLocation)
Sets the location of the buttons in the dialog. |
void |
setButtons(int newButtons)
Adds the specified buttons to the dialog. |
void |
setHelpID(java.lang.String newValue)
Sets the help id for this dialog. |
void |
setPanel(PanelInterface newValue)
Sets the panel to be hosted by this dialog. |
void |
setVisible(boolean visible)
|
protected void |
updateButtonsForPanel()
|
boolean |
wasCancelled()
Indicates if this dialog was cancelled after it was displayed. |
| Field Detail |
|---|
public static final java.lang.String RB_KEY
protected int buttons
| Constructor Detail |
|---|
public OptionsDialog(java.awt.Frame parent,
java.lang.String title,
boolean modal)
default buttons positioned in the
CommonButtons.SOUTH_EAST location.
This is an alias for:
Dialog(parent, title, modal, CommonButtons.OK_CANCEL_BUTTONS, CommonButtons.SOUTH_EAST)
parent - the parent frame of the new dialogtitle - the title of the dialog to display on the title barmodal - true for modal, false for non-modal
public OptionsDialog(java.awt.Frame f,
java.lang.String title,
boolean modal,
int buttons,
int buttonLocation)
Valid button identifiers and locations are any of those or a combination of those from CommonButtons.
parent - the parent frame of the new dialogtitle - the title of the dialog to display on the title barmodal - true for modal, false for non-modalbuttons - the buttons to add to the dialogbuttonLocation - the location to position the buttons on the dialog
public OptionsDialog(java.awt.Frame parent,
PanelInterface panel,
boolean modal)
Dialog for the specified panel. The new dialog will
have ok and cancel positioned in the
CommonButtons.SOUTH_EAST location.
This is an alias for:
Dialog(parent, panel, modal, CommonButtons.OK_CANCEL_BUTTONS, CommonButtons.SOUTH_EAST)
parent - the parent frame of the new dialogpanel - the panel to display in the dialogmodal - true for modal, false for non-modalapp - the application that owns this dialog
public OptionsDialog(java.awt.Frame f,
PanelInterface panel,
boolean modal,
int buttons,
int buttonLocation)
Dialog for the specified panel. This is a convenience
for creating a new dialog and calling
setPanel().
f - the parent frame of the new dialogpanel - the panel to display in the dialogmodal - true for modal, false for non-modalapp - the application which owns this dialog| Method Detail |
|---|
public javax.swing.JPanel getMainPanel()
public java.lang.String getHelpID()
null.
nullpublic void setHelpID(java.lang.String newValue)
newValue - the new help idpublic boolean wasCancelled()
true if cancelled, otherwise falsepublic void onApply()
CommonButtons.APPLY_BUTTON identifier is pressed. This is also called from
the onOK method. If this dialog hosts
an instance of PanelInterface
its onApply() method will first be called.
public void onCancel()
CommonButtons.CANCEL_BUTTON identifier is pressed. This method hides the dialog
by calling the onClose() method. If this dialog hosts
an instance of PanelInterface
its onCancel() method will first be called.
public void onClose()
CommonButtons.CLOSE_BUTTON identifier is pressed. This is also called from
the onCancel and onOK() methods. The dialog is hidden
by calling setVisible(false).
If this dialog hosts an instance of PanelInterface then its isContentsValid()
method will first be called. If the isContentsValid() method returns false, then the onClose method returns
without doing anything else. If it returns true, then the PanelInterface
onClose() method is called, followed by the dialog being hidden by calling setVisible(false).
public void onOK()
CommonButtons.OK_BUTTON identifier is pressed. This method first applies
any changes by calling the onApply() method and then it hides the dialog
by calling the onClose() method.
public PanelInterface getPanel()
nullpublic void setPanel(PanelInterface newValue)
newValue - the panel to be hosted by this dialogprotected void updateButtonsForPanel()
protected javax.swing.AbstractButton getButton(int id)
public void onHelp()
CommonButtons.HELP_BUTTON identifier is pressed. By default, does nothing.
public void setButtons(int newButtons)
Valid button identifiers are any of those or a combination of those from CommonButtons.
buttons - the buttons to add to the dialogprotected javax.swing.AbstractButton[] createButtons(int newButtons)
CommonButtons.createButtons()
to create the button instances.
Valid button identifiers are any of those or a combination of those from CommonButtons.
buttons - Identifies the buttons to createCommonButtonspublic int getButtonLocation()
setButtonLocation(int)public void setButtonLocation(int newButtonLocation)
buttonLocation - a location to position the buttonspublic void addButton(javax.swing.AbstractButton b)
b - the button to add to the dialogpublic void actionPerformed(java.awt.event.ActionEvent actionEvent)
actionPerformed in interface java.awt.event.ActionListenerprotected void processWindowEvent(java.awt.event.WindowEvent event)
onCancel method.
processWindowEvent in class javax.swing.JDialogevent - the event to handlepublic void setVisible(boolean visible)
setVisible in class java.awt.Dialog
|
| Components |
|
| |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||||