dip.gui.dialog
Class HeaderDialog

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Window
              extended byjava.awt.Dialog
                  extended byjavax.swing.JDialog
                      extended bydip.gui.dialog.XDialog
                          extended bydip.gui.dialog.HeaderDialog
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, javax.swing.RootPaneContainer, java.io.Serializable, javax.swing.WindowConstants
Direct Known Subclasses:
AboutDialog, FlocImportDialog, MapPicker, MetadataDialog, NewGameDialog, PreferenceDialog, SelectPhaseDialog, TextViewer, ValidationOptionsDialog

public class HeaderDialog
extends XDialog

A Dialog with an HTML message header at the top, which may be of fixed height (or adjust to fit).

A configurable lower bar (usually for buttons) is also available. Components other than buttons may be added to this lower bar. Any component that implements JButton can be used as a default button, and/or close button. Components are added from the left to right.

All buttons must have an action command set if they call the close() method. Buttons created with the convenience methods will have an action command set.

See Also:
Serialized Form

Nested Class Summary
static class HeaderDialog.GradientXJEditorPane
          A gradient-shaded background XJEditorPane with a stylish bottom separator.
 
Nested classes inherited from class javax.swing.JDialog
javax.swing.JDialog.AccessibleJDialog
 
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 java.lang.String ACTION_ACCEPT
          Accept button Action Command; constant across languages
static java.lang.String ACTION_CANCEL
          Cancel Button Action Command; constant across languages
static java.lang.String ACTION_CLOSE
          Close Button Action Command; constant across languages
static java.lang.String ACTION_OK
          OK Button Action Command; constant across languages
static int BTN_BAR_BETWEEN
          Default spacint between buttun bar buttons
static int BTN_BAR_EDGE
          Default margin between button bar edge and components
protected  javax.swing.JEditorPane header
           
 
Fields inherited from class dip.gui.dialog.XDialog
TEXT_ACCEPT, TEXT_CANCEL, TEXT_CLOSE, TEXT_OK
 
Fields inherited from class javax.swing.JDialog
accessibleContext, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
HeaderDialog(javax.swing.JFrame parent, java.lang.String title, boolean isModal)
          Create a Dialog with a HTML-aware Header
 
Method Summary
 void addSingleButton(javax.swing.JButton button)
          Convenience method: for dialogs with ONE button, and no other components to be added to the button bar, adds the given button to the button bar, with the appropriate spacing.
 void addToButtonPanel(java.awt.Component component)
          Add a component to the button bar (left to right)
 void addTwoButtons(javax.swing.JButton rightMost, javax.swing.JButton leftMost, boolean rightDefault, boolean rightClose)
          Convenience method: for dialogs with TWO buttons, and no other components to be added to the button bar, adds the given buttons to the button bar, with the appropriate spacing.
protected  void close()
          Do not override this method!
protected  void close(java.lang.String actionCommand)
          Called when the dialog is closing.
 void createDefaultContentBorder(javax.swing.JComponent comp)
          Creates a default border around the given component, of BTN_BAR_EDGE size, except at bottom.
 javax.swing.JButton getButton(int i)
          Get the JButton of the given index; throws an exception if index is out of bounds.
 java.awt.Container getContentPane()
          Get the content panel
 javax.swing.JButton getDefaultButton()
          Get the default button
 java.lang.String getReturnedActionCommand()
          Get the returned JButton ActionCommand used to close the dialog.
 boolean isCloseOrCancel(java.lang.String actionCommand)
          Convenience method: check if action command is Close or Cancel
 boolean isOKorAccept(java.lang.String actionCommand)
          Convenience method: check if action command is OK or Accept
 javax.swing.JButton makeAcceptButton()
          Make an "Accept" button (i18n); calls close with self.
 javax.swing.JButton makeButton(java.lang.String text, java.lang.String actionCommand, boolean doClose)
          Make a button with the given text; calls close() with self if boolean flag is set to 'true'.
 javax.swing.JButton makeCancelButton()
          Make an "Cancel" button (i18n); calls close with self.
 javax.swing.JButton makeCloseButton()
          Make an "Close" button (i18n); calls close with self.
static java.awt.Component makeGlue()
          Make a glue component (takes up as much space as possible)
 javax.swing.JButton makeOKButton()
          Make an "OK" button (i18n); calls close with self.
static java.awt.Component makeSpacer(int width)
          Make a spacer of the desired width in pixels
 void setContentPane(java.awt.Container container)
          Set the dialog content; this may be called at any time.
 void setDefaultButton(javax.swing.JButton btn)
          Set the button that is focus-selected by default
 void setDefaultCloseButton(javax.swing.JButton btn)
          Sets the JButton that the close(actionCommand) method will have as its argument.
 void setHeaderText(java.lang.String text)
          Set the header text
 void setHeaderVisible(boolean value)
          Show or hide the header.
 void setSeparatorVisible(boolean value, int horizontalMargin, int verticalMargin)
          Show or Hide the separator between the button and content panels.
 
Methods inherited from class dip.gui.dialog.XDialog
createRootPane, dialogInit, setDefaultCloseOperation, setHelpID
 
Methods inherited from class javax.swing.JDialog
addImpl, getAccessibleContext, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Dialog
addNotify, dispose, getTitle, hide, isModal, isResizable, isUndecorated, setModal, setResizable, setTitle, setUndecorated, show
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, finalize, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, isActive, isFocusableWindow, isFocusCycleRoot, isFocused, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationRelativeTo, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, removeNotify, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, 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, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BTN_BAR_EDGE

public static final int BTN_BAR_EDGE
Default margin between button bar edge and components

See Also:
Constant Field Values

BTN_BAR_BETWEEN

public static final int BTN_BAR_BETWEEN
Default spacint between buttun bar buttons

See Also:
Constant Field Values

ACTION_OK

public static final java.lang.String ACTION_OK
OK Button Action Command; constant across languages

See Also:
Constant Field Values

ACTION_CLOSE

public static final java.lang.String ACTION_CLOSE
Close Button Action Command; constant across languages

See Also:
Constant Field Values

ACTION_CANCEL

public static final java.lang.String ACTION_CANCEL
Cancel Button Action Command; constant across languages

See Also:
Constant Field Values

ACTION_ACCEPT

public static final java.lang.String ACTION_ACCEPT
Accept button Action Command; constant across languages

See Also:
Constant Field Values

header

protected javax.swing.JEditorPane header
Constructor Detail

HeaderDialog

public HeaderDialog(javax.swing.JFrame parent,
                    java.lang.String title,
                    boolean isModal)
Create a Dialog with a HTML-aware Header

Method Detail

setContentPane

public void setContentPane(java.awt.Container container)
Set the dialog content; this may be called at any time.


getContentPane

public java.awt.Container getContentPane()
Get the content panel


addToButtonPanel

public void addToButtonPanel(java.awt.Component component)
Add a component to the button bar (left to right)


setDefaultButton

public void setDefaultButton(javax.swing.JButton btn)
Set the button that is focus-selected by default


getDefaultButton

public javax.swing.JButton getDefaultButton()
Get the default button


getButton

public javax.swing.JButton getButton(int i)
Get the JButton of the given index; throws an exception if index is out of bounds.

Index 0 is the leftmost button.


setDefaultCloseButton

public void setDefaultCloseButton(javax.swing.JButton btn)
Sets the JButton that the close(actionCommand) method will have as its argument.


close

protected void close(java.lang.String actionCommand)
Called when the dialog is closing. Subclasses should subclass this method instead of close(); to close the dialog, subclasses


close

protected final void close()
Do not override this method!

Overrides:
close in class XDialog

makeOKButton

public javax.swing.JButton makeOKButton()
Make an "OK" button (i18n); calls close with self.


makeCancelButton

public javax.swing.JButton makeCancelButton()
Make an "Cancel" button (i18n); calls close with self.


makeCloseButton

public javax.swing.JButton makeCloseButton()
Make an "Close" button (i18n); calls close with self.


makeAcceptButton

public javax.swing.JButton makeAcceptButton()
Make an "Accept" button (i18n); calls close with self.


isOKorAccept

public boolean isOKorAccept(java.lang.String actionCommand)
Convenience method: check if action command is OK or Accept


isCloseOrCancel

public boolean isCloseOrCancel(java.lang.String actionCommand)
Convenience method: check if action command is Close or Cancel


makeButton

public javax.swing.JButton makeButton(java.lang.String text,
                                      java.lang.String actionCommand,
                                      boolean doClose)
Make a button with the given text; calls close() with self if boolean flag is set to 'true'.


makeSpacer

public static java.awt.Component makeSpacer(int width)
Make a spacer of the desired width in pixels


makeGlue

public static java.awt.Component makeGlue()
Make a glue component (takes up as much space as possible)


addSingleButton

public void addSingleButton(javax.swing.JButton button)
Convenience method: for dialogs with ONE button, and no other components to be added to the button bar, adds the given button to the button bar, with the appropriate spacing. It also sets it as the default and default close button.


addTwoButtons

public void addTwoButtons(javax.swing.JButton rightMost,
                          javax.swing.JButton leftMost,
                          boolean rightDefault,
                          boolean rightClose)
Convenience method: for dialogs with TWO buttons, and no other components to be added to the button bar, adds the given buttons to the button bar, with the appropriate spacing. It also sets it as the default and default close button, depending upon the boolean value.

Typically, the "cancel" button is the rightmost, and is the same as the default dialog close button.


createDefaultContentBorder

public void createDefaultContentBorder(javax.swing.JComponent comp)
Creates a default border around the given component, of BTN_BAR_EDGE size, except at bottom.


setSeparatorVisible

public void setSeparatorVisible(boolean value,
                                int horizontalMargin,
                                int verticalMargin)
Show or Hide the separator between the button and content panels. No separator is shown by default. Margin values must be 0 or greater.


setHeaderVisible

public void setHeaderVisible(boolean value)
Show or hide the header. By default, the header is visible.


getReturnedActionCommand

public java.lang.String getReturnedActionCommand()
Get the returned JButton ActionCommand used to close the dialog.


setHeaderText

public void setHeaderText(java.lang.String text)
Set the header text



Copyright 2002-2004 Zachary DelProposto / jDip Development Team. All Rights Reserved.