|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
com.metamatrix.toolbox.ui.widget.DialogPanel
public class DialogPanel
This class is intended to be used everywhere within the application that a dialog panel needs to be displayed. It provides for
a navigation button bar at the bottom of the panel, a set of methods to work with it, and a default pair of "accept" and
"cancel" buttons within the bar. Support exists for multiple accept buttons, however it is up to the developer to ensure that
if accept buttons are removed or reordered, the list of accept buttons
is updated appropriately.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
javax.swing.JPanel.AccessibleJPanel |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
javax.swing.JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
java.awt.Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary |
---|
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface com.metamatrix.toolbox.ui.widget.ButtonConstants |
---|
ACCEPT_BUTTON, APPLY_BUTTON, BACK_BUTTON, CANCEL_BUTTON, CONTEXT_SENSITIVE_HELP, DEFAULTS_BUTTON, DETAILS_BUTTON, EXIT_BUTTON, FINISH_BUTTON, HELP_BUTTON, LOGIN_BUTTON, NEXT_BUTTON, NO_BUTTON, OVERWRITE_BUTTON, REPLACE_BUTTON, RETRY_BUTTON, SKIP_BUTTON, YES_BUTTON |
Fields inherited from interface com.metamatrix.toolbox.ui.UIConstants |
---|
DATE_FORMAT_PROPERTY, SPACER_HORIZONTAL_LENGTH_PROPERTY, WINDOW_BORDER_PROPERTY |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
DialogPanel()
Creates a panel with a BorderLayout and a navigation bar in the SOUTH region. |
|
DialogPanel(java.awt.Component content)
Creates a panel with a BorderLayout, a navigation bar in the SOUTH region, and the specified content in the CENTER region. |
Method Summary | |
---|---|
protected void |
accept(WidgetActionEvent event)
Called when the panel's parent is a DialogWindow and the user activates the accept button. |
int |
addAcceptButton(ButtonWidget button)
Adds the specified button as the accept button to the end of the navigation bar. |
void |
addAcceptButton(ButtonWidget button,
int index)
Adds the specified button as the accept button to the navigation bar at the specified index. |
int |
addCancelButton(ButtonWidget button)
Adds the specified button as the cancel button to the end of the navigation bar. |
void |
addCancelButton(ButtonWidget button,
int index)
Adds the specified button as the cancel button to the navigation bar at the specified index. |
int |
addHelpButton(ButtonWidget button)
Adds the specified button as the help button to the front of the navigation bar. |
void |
addHelpButton(ButtonWidget button,
int index)
Adds the specified button as the help button to the navigation bar at the specified index. |
int |
addNavigationButton(ButtonWidget button)
Adds the specified button immediately before the space in front of the cancel button. |
void |
addNavigationButton(ButtonWidget button,
int index)
Adds the specified button to the navigation bar at the specified index. |
protected void |
addNavigationComponent(java.awt.Component component,
int index)
Adds the specified component to the navigation bar at the specified index. |
int |
addNavigationSpacer(SpacerWidget spacer)
Adds the specified spacer immediately before the space in front of the cancel button. |
void |
addNavigationSpacer(SpacerWidget spacer,
int index)
Adds the specified spacer to the navigation bar at the specified index. |
protected void |
buildNavigationBar()
Creates a navigation bar with default accept and cancel buttons, and if a context-sensitive-help property exists, a help button. |
boolean |
canAccept()
|
boolean |
canCancel()
|
protected void |
cancel(WidgetActionEvent event)
Called when the panel's parent is a DialogWindow and the user activates the cancel button or cancels the dialog via the title bar close button (with the 'X' icon) or the title bar system menu 'Close' option. |
protected ButtonWidget |
createAcceptButton()
Creates an accept button with a default label (as determined by the ToolboxStandards class). |
protected ButtonWidget |
createCancelButton()
Creates an cancel button with a default label (as determined by the ToolboxStandards class). |
protected ButtonWidget |
createHelpButton()
Creates a help button with a default label (as determined by the ToolboxStandards class). |
protected javax.swing.JComponent |
createNavigationBar()
Creates a navigation bar that will contain all buttons that apply to the entire panel. |
protected void |
equalizeNavigationButtonWidths()
Sets the size of all navigation buttons to the size of the largest navigation button. |
ButtonWidget |
getAcceptButton()
|
java.util.List |
getAcceptButtons()
|
ButtonWidget |
getCancelButton()
|
java.awt.Component |
getContent()
|
java.awt.Container |
getContentContainer()
|
ButtonWidget |
getHelpButton()
|
javax.swing.JComponent |
getNavigationBar()
Retrieves the navigation bar. |
ButtonWidget |
getNavigationButton(java.lang.String text)
Retrieves the button in the navigation bar with the specified text. |
java.awt.Component |
getNavigationComponent(int index)
Retrieves the component in the navigation bar (either a button or spacer ) at the
specified index. |
int |
getNavigationComponentIndex(java.awt.Component component)
Retrieves the index of the specified component in the navigation bar. |
ButtonWidget |
getSelectedButton()
|
java.awt.Window |
getWindowAncestor()
Gets the Window ancestor of this panel |
protected void |
initializeDialogPanel()
Initializes the panel: Adds a content panel to the center Adds the navigation bar to the bottom, initialized with default next and cancel buttons. |
int |
removeNavigationButton(ButtonWidget button)
Removes the specified button from the navigation bar. |
java.awt.Component |
removeNavigationComponent(int index)
Removes the component (either a button or spacer ) at the specified index from the
navigation bar. |
void |
removeNavigationSpacer(SpacerWidget spacer)
Removes the specified spacer from the navigation bar. |
protected void |
setCanAccept(boolean canAccept)
|
protected void |
setCanCancel(boolean canCancel)
|
void |
setContent(java.awt.Component content)
Sets the specified component as the main content to be displayed in the CENTER region of the panel. |
void |
setLayout(java.awt.LayoutManager layout)
Overridden to ensure this class uses a BorderLayout |
void |
setVisible(boolean visible)
Overridden to clear the selected button each time the panel is made visible. |
protected void |
validateState()
Ensures that the navigation bar exists in the panel. |
protected void |
windowActivated()
To be overridden by subclasses, allowing you to refresh your dialog panel when the focus on the parent window is lost and then reactivated. |
protected void |
windowAdded()
To be overridden by subclasses, allowing you to refresh your dialog panel when the focus on the parent window is added. |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class javax.swing.JComponent |
---|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public DialogPanel()
public DialogPanel(java.awt.Component content)
content
- The component to be displayed.Method Detail |
---|
protected void accept(WidgetActionEvent event)
event
- The WidgetActionEvent generated from activating the buttonpublic int addAcceptButton(ButtonWidget button)
button
- The button to add as an accept button
public void addAcceptButton(ButtonWidget button, int index)
button
- The button to add as an accept buttonindex
- The index within the navigation bar to add the buttonpublic int addCancelButton(ButtonWidget button)
button
- The button to add as an cancel button
public void addCancelButton(ButtonWidget button, int index)
button
- The button to add as an cancel buttonindex
- The index within the navigation bar to add the buttonpublic int addHelpButton(ButtonWidget button)
button
- The button to add as a help button
public void addHelpButton(ButtonWidget button, int index)
button
- The button to add as a help buttonindex
- The index within the navigation bar to add the buttonpublic int addNavigationButton(ButtonWidget button)
button
- The button to add
public void addNavigationButton(ButtonWidget button, int index)
button
- The button to addindex
- The index within the navigation bar to add the buttonprotected void addNavigationComponent(java.awt.Component component, int index)
component
- The component to addindex
- The index within the navigation bar at which to add the componentpublic int addNavigationSpacer(SpacerWidget spacer)
spacer
- The spacer to add
public void addNavigationSpacer(SpacerWidget spacer, int index)
spacer
- The spacer to addindex
- The index within the navigation bar to add the spacerprotected void buildNavigationBar()
public boolean canAccept()
public boolean canCancel()
protected void cancel(WidgetActionEvent event)
event
- The WidgetActionEvent generated from activating the button or closing the windowprotected ButtonWidget createAcceptButton()
protected ButtonWidget createCancelButton()
protected ButtonWidget createHelpButton()
protected javax.swing.JComponent createNavigationBar()
protected void equalizeNavigationButtonWidths()
public ButtonWidget getAcceptButton()
public java.util.List getAcceptButtons()
public ButtonWidget getCancelButton()
public java.awt.Component getContent()
public java.awt.Container getContentContainer()
public ButtonWidget getHelpButton()
public javax.swing.JComponent getNavigationBar()
public ButtonWidget getNavigationButton(java.lang.String text)
text
- The button text
public java.awt.Component getNavigationComponent(int index)
button
or spacer
) at the
specified index.
index
- The index within the navigation bar of the component
public int getNavigationComponentIndex(java.awt.Component component)
component
- The component
public ButtonWidget getSelectedButton()
public java.awt.Window getWindowAncestor()
protected void initializeDialogPanel()
public int removeNavigationButton(ButtonWidget button)
button
- The button to remove
public java.awt.Component removeNavigationComponent(int index)
button
or spacer
) at the specified index from the
navigation bar.
index
- The index within the navigation bar of the component
public void removeNavigationSpacer(SpacerWidget spacer)
spacer
- The spacer to removeprotected void setCanAccept(boolean canAccept)
protected void setCanCancel(boolean canCancel)
public void setContent(java.awt.Component content)
content
- The componentpublic void setLayout(java.awt.LayoutManager layout)
setLayout
in class java.awt.Container
Container.setLayout(LayoutManager)
public void setVisible(boolean visible)
setVisible
in class javax.swing.JComponent
protected void validateState()
protected void windowActivated()
protected void windowAdded()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |