Package com.jidesoft.dialog
Class MultiplePageDialog
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- java.awt.Window
-
- java.awt.Dialog
-
- javax.swing.JDialog
-
- com.jidesoft.dialog.StandardDialog
-
- com.jidesoft.dialog.MultiplePageDialog
-
- All Implemented Interfaces:
ButtonNames
,java.awt.image.ImageObserver
,java.awt.MenuContainer
,java.io.Serializable
,javax.accessibility.Accessible
,javax.swing.RootPaneContainer
,javax.swing.WindowConstants
public class MultiplePageDialog extends StandardDialog
MultiplePageDialog is a StandardDialog which can have multiple AbstractDialogPages. You can choose one from four predefined styles of how to change the page visibility. Those four styles are TAB_STYLE, ICON_STYLE, LIST_STYLE and TREE_STYLE. To use this class, just create a PageList of AbstractDialogPage and call setPageList() to set to this dialog. Based on the style, the class will automatically layout those pages correctly and hook up actions to switch based on user selection. As AbstractDialogPage extends AbstractPage, so you can always use PageListener to decide what to do when page is opened, closing, closed, activated or deactivated. We automatically create a button panel which have three button - OK, Cancel and Apply. The ButtonPanel listens to ButtonEvent from all the pages. You can simply fireButtonEvent in the page to change the state of those buttons. Or if you want to create your own button panel, just override createButtonPanel() method. If you choose LIST_STYLE and TREE_STYLE, you can set your own ListCellRenderer and TreeCellRenderer. Just call setListCellRenderer() and setTreeCellRenderer(). The value passed in the renderer is an instance of AbstractDialogPage associated with that list row or tree node.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.jidesoft.dialog.StandardDialog
StandardDialog.DefaultStandardDialogPane
-
Nested classes/interfaces inherited from class javax.swing.JDialog
javax.swing.JDialog.AccessibleJDialog
-
Nested classes/interfaces inherited from class java.awt.Dialog
java.awt.Dialog.AccessibleAWTDialog, java.awt.Dialog.ModalExclusionType, java.awt.Dialog.ModalityType
-
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
-
-
Field Summary
Fields Modifier and Type Field Description javax.swing.JTree
_tree
static int
ICON_STYLE
Predefined style of multiple page dialog.static int
LIST_STYLE
Predefined style of multiple page dialog.static int
TAB_STYLE
Predefined style of multiple page dialog.static int
TREE_STYLE
Predefined style of multiple page dialog.-
Fields inherited from class com.jidesoft.dialog.StandardDialog
_propertyChangeListener, _standardDialogPane, RESULT_AFFIRMED, RESULT_CANCELLED
-
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 com.jidesoft.dialog.ButtonNames
APPLY, BACK, BROWSE, CANCEL, CLEAR, CLOSE, DETAILS, EDIT, EXIT, FIND, FIND_NEXT, FINISH, FORWARD, HELP, NEW, NEXT, NO, OK, OPEN, PRINT, REPLACE, RESET, RETRY, RUN, SAVE, SAVE_AS, STOP, YES
-
-
Constructor Summary
Constructors Constructor Description MultiplePageDialog()
Creates a non-modal MultiplePageDialog without a title and without a specifiedFrame
owner.MultiplePageDialog(int style)
MultiplePageDialog(java.awt.Dialog owner)
Creates a non-modal MultiplePageDialog without a title with the specifiedDialog
as its owner.MultiplePageDialog(java.awt.Dialog owner, boolean modal)
Creates a modal or non-modal MultiplePageDialog without a title and with the specified ownerDialog
.MultiplePageDialog(java.awt.Dialog owner, boolean modal, int style)
MultiplePageDialog(java.awt.Dialog owner, int style)
MultiplePageDialog(java.awt.Dialog owner, java.lang.String title)
Creates a non-modal MultiplePageDialog with the specified title and with the specified owner frame.MultiplePageDialog(java.awt.Dialog owner, java.lang.String title, boolean modal)
Creates a modal or non-modal dialog with the specified title and the specified ownerDialog
.MultiplePageDialog(java.awt.Dialog owner, java.lang.String title, boolean modal, int style)
Creates a modal or non-modal MultiplePageDialog with the specified style, the specified title and the specified ownerDialog
.MultiplePageDialog(java.awt.Dialog owner, java.lang.String title, boolean modal, java.awt.GraphicsConfiguration gc)
MultiplePageDialog(java.awt.Dialog owner, java.lang.String title, boolean modal, java.awt.GraphicsConfiguration gc, int style)
MultiplePageDialog(java.awt.Dialog owner, java.lang.String title, int style)
MultiplePageDialog(java.awt.Frame owner)
Creates a non-modal MultiplePageDialog without a title with the specifiedFrame
as its owner.MultiplePageDialog(java.awt.Frame owner, boolean modal)
Creates a modal or non-modal MultiplePageDialog without a title and with the specified ownerFrame
.MultiplePageDialog(java.awt.Frame owner, boolean modal, int style)
MultiplePageDialog(java.awt.Frame owner, int style)
MultiplePageDialog(java.awt.Frame owner, java.lang.String title)
Creates a non-modal MultiplePageDialog with the specified title and with the specified owner frame.MultiplePageDialog(java.awt.Frame owner, java.lang.String title, boolean modal)
Creates a modal or non-modal dialog with the specified title and the specified ownerFrame
.MultiplePageDialog(java.awt.Frame owner, java.lang.String title, boolean modal, int style)
Creates a modal or non-modal MultiplePageDialog with the specified style, the specified title and the specified ownerFrame
.MultiplePageDialog(java.awt.Frame owner, java.lang.String title, boolean modal, java.awt.GraphicsConfiguration gc)
MultiplePageDialog(java.awt.Frame owner, java.lang.String title, boolean modal, java.awt.GraphicsConfiguration gc, int style)
MultiplePageDialog(java.awt.Frame owner, java.lang.String title, int style)
MultiplePageDialog(java.awt.Window owner)
MultiplePageDialog(java.awt.Window owner, int style)
MultiplePageDialog(java.awt.Window owner, java.awt.Dialog.ModalityType modalityType)
MultiplePageDialog(java.awt.Window owner, java.awt.Dialog.ModalityType modalityType, int style)
MultiplePageDialog(java.awt.Window owner, java.lang.String title)
MultiplePageDialog(java.awt.Window owner, java.lang.String title, int style)
MultiplePageDialog(java.awt.Window owner, java.lang.String title, java.awt.Dialog.ModalityType modalityType)
MultiplePageDialog(java.awt.Window owner, java.lang.String title, java.awt.Dialog.ModalityType modalityType, int style)
MultiplePageDialog(java.awt.Window owner, java.lang.String title, java.awt.Dialog.ModalityType modalityType, java.awt.GraphicsConfiguration gc)
MultiplePageDialog(java.awt.Window owner, java.lang.String title, java.awt.Dialog.ModalityType modalityType, java.awt.GraphicsConfiguration gc, int style)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
configureTree(javax.swing.JTree tree)
Configure the JTree used in TREE_STYLE dialog.javax.swing.JComponent
createBannerPanel()
Implements the method in StandardDialog.ButtonPanel
createButtonPanel()
Creates the button panel.javax.swing.JComponent
createContentPanel()
Implements the method in StandardDialog.protected JideButton
createIconButton(java.lang.String title, javax.swing.Icon icon)
Creates the button for each icon.protected ButtonPanel
createIconButtonPanel()
Creates the ButtonPanel used by IconPanel.protected javax.swing.JComponent
createIconPanel()
Creates the panel that contains several icons.javax.swing.JComponent
createIndexPanel()
Creates the index panel based on the style.protected javax.swing.JList
createList(javax.swing.DefaultListModel listModel)
Creates list that is used in LIST_STYLE dialog's index panel.protected javax.swing.ListCellRenderer
createListCellRenderer()
Creates a list cell renderer used by list in LIST_STYLE dialog's index panel.protected javax.swing.JComponent
createPagesPanel()
Creates the pages panel.protected javax.swing.JTabbedPane
createTabbedPane()
Creates the JTabbedPane used by TAB_STYLE dialog.protected javax.swing.JTree
createTree(javax.swing.tree.DefaultMutableTreeNode root)
Creates tree that is used in TREE_STYLE dialog's index panel.protected javax.swing.tree.TreeCellRenderer
createTreeCellRenderer()
Creates the tree cell renderer used by tree in TREE_STYLE dialog's index panel.protected javax.swing.tree.MutableTreeNode
createTreeNode(AbstractDialogPage dialogPage)
Create tree node for TREE_STYLE pages.javax.swing.JButton
getApplyButton()
Gets the apply button.javax.swing.JButton
getCancelButton()
Gets the cancel button.AbstractDialogPage
getCurrentPage()
Gets the current selected page.javax.swing.JComponent
getIndexPanel()
Gets the index panel.java.lang.String
getInitialPageTitle()
Gets the initial page title.protected javax.swing.ListCellRenderer
getListCellRenderer()
Gets the cell renderer used by the list.javax.swing.JButton
getOkButton()
Gets the OK Button only if you didn't override the createButtonPanel() and remove the OK button.PageList
getPageList()
Gets the page list of this dialog.javax.swing.JComponent
getPagesPanel()
Gets the pages panel.int
getStyle()
Gets the style of this dialog.protected javax.swing.tree.TreeCellRenderer
getTreeCellRenderer()
Gets the cell renderer used by the tree.protected void
setCurrentPage(AbstractDialogPage currentPage)
protected void
setCurrentPage(AbstractDialogPage currentPage, java.lang.Object source)
protected void
setCurrentPage(java.lang.String pageTitle)
void
setInitialPageTitle(java.lang.String initialPageTitle)
Sets the initial page title.void
setListCellRenderer(javax.swing.ListCellRenderer listCellRenderer)
Sets the list cell renderer that will be used by JList when the style is LIST_STYLE.void
setPageList(PageList pageList)
Sets the page list of this dialog.void
setStyle(int style)
Sets the style of this dialog.void
setTreeCellRenderer(javax.swing.tree.TreeCellRenderer treeCellRenderer)
Sets the tree cell renderer that will be used by JTree when the style is TREE_STYLE.protected javax.swing.JComponent
setupContentPanel(javax.swing.JComponent indexPanel, javax.swing.JComponent pagesPanel)
Setups the content panel.protected void
showCurrentPage(AbstractDialogPage currentPage)
Displays the current page.-
Methods inherited from class com.jidesoft.dialog.StandardDialog
createOKCancelButtonPanel, createStandardDialogPane, getBannerPanel, getButtonPanel, getContentPanel, getDefaultAction, getDefaultCancelAction, getDialogResult, getInitFocusedComponent, getStandardDialogPane, initComponents, initialize, pack, setDefaultAction, setDefaultCancelAction, setDialogResult, setInitFocusedComponent, show
-
Methods inherited from class javax.swing.JDialog
addImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
-
Methods inherited from class java.awt.Dialog
addNotify, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, setBackground, setModal, setModalityType, setOpacity, setResizable, setShape, setTitle, setUndecorated, setVisible, toBack
-
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, 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, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, 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, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, 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, requestFocus, requestFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setMixingCutoutShape, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
TAB_STYLE
public static final int TAB_STYLE
Predefined style of multiple page dialog.- See Also:
- Constant Field Values
-
TREE_STYLE
public static final int TREE_STYLE
Predefined style of multiple page dialog.- See Also:
- Constant Field Values
-
LIST_STYLE
public static final int LIST_STYLE
Predefined style of multiple page dialog.- See Also:
- Constant Field Values
-
ICON_STYLE
public static final int ICON_STYLE
Predefined style of multiple page dialog.- See Also:
- Constant Field Values
-
_tree
public javax.swing.JTree _tree
-
-
Constructor Detail
-
MultiplePageDialog
public MultiplePageDialog() throws java.awt.HeadlessException
Creates a non-modal MultiplePageDialog without a title and without a specifiedFrame
owner. A shared, hidden frame will be set as the owner of the dialog. By default TAB_STYLE is used.- Throws:
java.awt.HeadlessException
- if the page does not support mouse or key events.
-
MultiplePageDialog
public MultiplePageDialog(java.awt.Frame owner) throws java.awt.HeadlessException
Creates a non-modal MultiplePageDialog without a title with the specifiedFrame
as its owner. Ifowner
isnull
, a shared, hidden frame will be set as the owner of the dialog. By default TAB_STYLE is used.- Parameters:
owner
- the owner of the dialog- Throws:
java.awt.HeadlessException
- if the page does not support mouse or key events.
-
MultiplePageDialog
public MultiplePageDialog(java.awt.Frame owner, boolean modal) throws java.awt.HeadlessException
Creates a modal or non-modal MultiplePageDialog without a title and with the specified ownerFrame
. Ifowner
isnull
, a shared, hidden frame will be set as the owner of the dialog. By default TAB_STYLE is used.- Parameters:
owner
- theFrame
from which the dialog is displayedmodal
- true for a modal dialog, false for one that allows others windows to be active at the same time- Throws:
java.awt.HeadlessException
- if the page does not support mouse or key events.
-
MultiplePageDialog
public MultiplePageDialog(java.awt.Frame owner, java.lang.String title) throws java.awt.HeadlessException
Creates a non-modal MultiplePageDialog with the specified title and with the specified owner frame. Ifowner
isnull
, a shared, hidden frame will be set as the owner of the dialog.- Parameters:
owner
- theFrame
from which the dialog is displayedtitle
- theString
to display in the dialog's title bar- Throws:
java.awt.HeadlessException
- if GraphicsEnvironment.isHeadless() returns true.- See Also:
GraphicsEnvironment.isHeadless()
,JComponent.getDefaultLocale()
-
MultiplePageDialog
public MultiplePageDialog(java.awt.Frame owner, java.lang.String title, boolean modal) throws java.awt.HeadlessException
Creates a modal or non-modal dialog with the specified title and the specified ownerFrame
. Ifowner
isnull
, a shared, hidden frame will be set as the owner of this dialog.- Parameters:
owner
- theFrame
from which the dialog is displayedtitle
- theString
to display in the dialog's title barmodal
- true for a modal dialog, false for one that allows other windows to be active at the same time- Throws:
java.awt.HeadlessException
- if GraphicsEnvironment.isHeadless() returns true.- See Also:
GraphicsEnvironment.isHeadless()
,JComponent.getDefaultLocale()
-
MultiplePageDialog
public MultiplePageDialog(java.awt.Frame owner, java.lang.String title, boolean modal, java.awt.GraphicsConfiguration gc)
-
MultiplePageDialog
public MultiplePageDialog(java.awt.Frame owner, java.lang.String title, boolean modal, int style) throws java.awt.HeadlessException
Creates a modal or non-modal MultiplePageDialog with the specified style, the specified title and the specified ownerFrame
. Ifowner
isnull
, a shared, hidden frame will be set as the owner of this dialog. All constructors defer to this one.- Parameters:
owner
- theFrame
from which the dialog is displayedtitle
- theString
to display in the dialog's title barmodal
- true for a modal dialog, false for one that allows other windows to be active at the same timestyle
- the style. It must be one of the following: TAB_STYLE, ICON_STYLE, LIST_STYLE or TREE_STYLE.- Throws:
java.awt.HeadlessException
- if GraphicsEnvironment.isHeadless() returns true.- See Also:
GraphicsEnvironment.isHeadless()
,JComponent.getDefaultLocale()
-
MultiplePageDialog
public MultiplePageDialog(java.awt.Frame owner, java.lang.String title, boolean modal, java.awt.GraphicsConfiguration gc, int style)
-
MultiplePageDialog
public MultiplePageDialog(java.awt.Dialog owner, int style)
-
MultiplePageDialog
public MultiplePageDialog(java.awt.Dialog owner, boolean modal, int style)
-
MultiplePageDialog
public MultiplePageDialog(java.awt.Dialog owner, java.lang.String title, int style)
-
MultiplePageDialog
public MultiplePageDialog(java.awt.Dialog owner) throws java.awt.HeadlessException
Creates a non-modal MultiplePageDialog without a title with the specifiedDialog
as its owner. Ifowner
isnull
, a shared, hidden frame will be set as the owner of the dialog. By default TAB_STYLE is used.- Parameters:
owner
- the owner of the dialog- Throws:
java.awt.HeadlessException
- if the page does not support mouse or key events.
-
MultiplePageDialog
public MultiplePageDialog(java.awt.Dialog owner, boolean modal) throws java.awt.HeadlessException
Creates a modal or non-modal MultiplePageDialog without a title and with the specified ownerDialog
. Ifowner
isnull
, a shared, hidden frame will be set as the owner of the dialog. By default TAB_STYLE is used.- Parameters:
owner
- theFrame
from which the dialog is displayedmodal
- true for a modal dialog, false for one that allows others windows to be active at the same time- Throws:
java.awt.HeadlessException
- if the page does not support mouse or key events.
-
MultiplePageDialog
public MultiplePageDialog(java.awt.Dialog owner, java.lang.String title) throws java.awt.HeadlessException
Creates a non-modal MultiplePageDialog with the specified title and with the specified owner frame. Ifowner
isnull
, a shared, hidden frame will be set as the owner of the dialog.- Parameters:
owner
- theFrame
from which the dialog is displayedtitle
- theString
to display in the dialog's title bar- Throws:
java.awt.HeadlessException
- if GraphicsEnvironment.isHeadless() returns true.- See Also:
GraphicsEnvironment.isHeadless()
,JComponent.getDefaultLocale()
-
MultiplePageDialog
public MultiplePageDialog(java.awt.Dialog owner, java.lang.String title, boolean modal) throws java.awt.HeadlessException
Creates a modal or non-modal dialog with the specified title and the specified ownerDialog
. Ifowner
isnull
, a shared, hidden frame will be set as the owner of this dialog.- Parameters:
owner
- theDialog
from which the dialog is displayedtitle
- theString
to display in the dialog's title barmodal
- true for a modal dialog, false for one that allows other windows to be active at the same time- Throws:
java.awt.HeadlessException
- if GraphicsEnvironment.isHeadless() returns true.- See Also:
GraphicsEnvironment.isHeadless()
,JComponent.getDefaultLocale()
-
MultiplePageDialog
public MultiplePageDialog(java.awt.Dialog owner, java.lang.String title, boolean modal, java.awt.GraphicsConfiguration gc)
-
MultiplePageDialog
public MultiplePageDialog(java.awt.Window owner)
-
MultiplePageDialog
public MultiplePageDialog(java.awt.Window owner, java.awt.Dialog.ModalityType modalityType)
-
MultiplePageDialog
public MultiplePageDialog(java.awt.Window owner, java.lang.String title)
-
MultiplePageDialog
public MultiplePageDialog(java.awt.Window owner, java.lang.String title, java.awt.Dialog.ModalityType modalityType)
-
MultiplePageDialog
public MultiplePageDialog(java.awt.Window owner, java.lang.String title, java.awt.Dialog.ModalityType modalityType, java.awt.GraphicsConfiguration gc)
-
MultiplePageDialog
public MultiplePageDialog(java.awt.Dialog owner, java.lang.String title, boolean modal, int style) throws java.awt.HeadlessException
Creates a modal or non-modal MultiplePageDialog with the specified style, the specified title and the specified ownerDialog
. Ifowner
isnull
, a shared, hidden frame will be set as the owner of this dialog. All constructors defer to this one.- Parameters:
owner
- theDialog
from which the dialog is displayedtitle
- theString
to display in the dialog's title barmodal
- true for a modal dialog, false for one that allows other windows to be active at the same timestyle
- the style. It must be one of the following: TAB_STYLE, ICON_STYLE, LIST_STYLE or TREE_STYLE.- Throws:
java.awt.HeadlessException
- if GraphicsEnvironment.isHeadless() returns true.- See Also:
GraphicsEnvironment.isHeadless()
,JComponent.getDefaultLocale()
-
MultiplePageDialog
public MultiplePageDialog(java.awt.Dialog owner, java.lang.String title, boolean modal, java.awt.GraphicsConfiguration gc, int style)
-
MultiplePageDialog
public MultiplePageDialog(java.awt.Window owner, int style)
-
MultiplePageDialog
public MultiplePageDialog(java.awt.Window owner, java.awt.Dialog.ModalityType modalityType, int style)
-
MultiplePageDialog
public MultiplePageDialog(java.awt.Window owner, java.lang.String title, int style)
-
MultiplePageDialog
public MultiplePageDialog(java.awt.Window owner, java.lang.String title, java.awt.Dialog.ModalityType modalityType, int style)
-
MultiplePageDialog
public MultiplePageDialog(java.awt.Window owner, java.lang.String title, java.awt.Dialog.ModalityType modalityType, java.awt.GraphicsConfiguration gc, int style)
-
MultiplePageDialog
public MultiplePageDialog(int style)
-
MultiplePageDialog
public MultiplePageDialog(java.awt.Frame owner, int style)
-
MultiplePageDialog
public MultiplePageDialog(java.awt.Frame owner, boolean modal, int style)
-
MultiplePageDialog
public MultiplePageDialog(java.awt.Frame owner, java.lang.String title, int style)
-
-
Method Detail
-
createBannerPanel
public javax.swing.JComponent createBannerPanel()
Implements the method in StandardDialog. You can override this method to create a BannerPanel.- Specified by:
createBannerPanel
in classStandardDialog
- Returns:
- the BannerPanel
-
createContentPanel
public javax.swing.JComponent createContentPanel()
Implements the method in StandardDialog. You can override this method to create a ContentPanel. By default, a JPanel with BorderLayout is created. IndexPanel is added to WEST and PagesPanel is added to CENTER.- Specified by:
createContentPanel
in classStandardDialog
- Returns:
- the ContentPanel
-
setupContentPanel
protected javax.swing.JComponent setupContentPanel(javax.swing.JComponent indexPanel, javax.swing.JComponent pagesPanel)
Setups the content panel. It will use the index panel and the pages panel created earlier and put it into another panel.- Parameters:
indexPanel
- the index panel. It has the nagivation control to control which page to show.pagesPanel
- the pages panel. It contains all the pages of this dialog.- Returns:
- the panel that contains both index panel and pages panel.
-
createButtonPanel
public ButtonPanel createButtonPanel()
Creates the button panel. It has three buttons - OK, Cancel and Apply. If you want to create your own button panel, just override this method.- Specified by:
createButtonPanel
in classStandardDialog
- Returns:
- button panel
- See Also:
ButtonPanel
-
getOkButton
public javax.swing.JButton getOkButton()
Gets the OK Button only if you didn't override the createButtonPanel() and remove the OK button.- Returns:
- the OK Button
-
getCancelButton
public javax.swing.JButton getCancelButton()
Gets the cancel button. only if you didn't override the createButtonPanel() and remove the cancel button.- Returns:
- the cancel button.
-
getApplyButton
public javax.swing.JButton getApplyButton()
Gets the apply button. only if you didn't override the createButtonPanel() and remove the apply button.- Returns:
- the apply button.
-
createPagesPanel
protected javax.swing.JComponent createPagesPanel()
Creates the pages panel. If it's TAB_STYLE, a tabbed pane will be created. If it's any other styles, a JPanel with CardLayout will be created.- Returns:
- a panel containing all the pages.
-
createTabbedPane
protected javax.swing.JTabbedPane createTabbedPane()
Creates the JTabbedPane used by TAB_STYLE dialog.- Returns:
- a JTabbedPane
-
createIndexPanel
public javax.swing.JComponent createIndexPanel()
Creates the index panel based on the style.- Returns:
- the index panel.
-
setPageList
public void setPageList(PageList pageList)
Sets the page list of this dialog. User must call this method before the dialog is set visible.- Parameters:
pageList
- the page list
-
getPageList
public PageList getPageList()
Gets the page list of this dialog.- Returns:
- the page list.
-
getCurrentPage
public AbstractDialogPage getCurrentPage()
Gets the current selected page.- Returns:
- the current selected page.
-
setCurrentPage
protected void setCurrentPage(java.lang.String pageTitle)
-
setCurrentPage
protected void setCurrentPage(AbstractDialogPage currentPage)
-
setCurrentPage
protected void setCurrentPage(AbstractDialogPage currentPage, java.lang.Object source)
-
showCurrentPage
protected void showCurrentPage(AbstractDialogPage currentPage)
Displays the current page. If it is TAB_STYLE, this method will simply select the tab that has the current page. If it is any of the other styles, this method will show the page that is already added in a CardLayout in createPagePanel method.- Parameters:
currentPage
- the current page
-
createTree
protected javax.swing.JTree createTree(javax.swing.tree.DefaultMutableTreeNode root)
Creates tree that is used in TREE_STYLE dialog's index panel. Below is the code we used. If you just want to have a different cell renderer, you can just callsetTreeCellRenderer(javax.swing.tree.TreeCellRenderer)
to set a new one.UIManager.put("Tree.hash", Color.white); return new JTree(root);
- Parameters:
root
- the root of the tree- Returns:
- tree the created JTree instance
-
configureTree
protected void configureTree(javax.swing.JTree tree)
Configure the JTree used in TREE_STYLE dialog. Subclass can override this method to configure the JTree to the way you want. Below is the default implementation of this method.tree.setToggleClickCount(1); tree.setCellRenderer(createTreeCellRenderer()); tree.setRootVisible(false); tree.setShowsRootHandles(false); tree.addTreeSelectionListener(new TreeSelectionListener() { public void valueChanged(TreeSelectionEvent e) { if (tree.getSelectionPath() == null) { return; } DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) tree.getSelectionPath().getLastPathComponent(); // comment this while block if you want the parent page shows its own page instead of showing its first child page. while (!treeNode.isLeaf()) { final DefaultMutableTreeNode tn = treeNode; Runnable runnable = new Runnable() { public void run() { tree.expandPath(new TreePath(tn.getPath())); } }; SwingUtilities.invokeLater(runnable); treeNode = (DefaultMutableTreeNode) treeNode.getChildAt(0); } if (treeNode != null) { Object userObject = treeNode.getUserObject(); if (userObject instanceof AbstractDialogPage) { setCurrentPage((AbstractDialogPage) userObject, tree); } } } });
- Parameters:
tree
- the tree to configure
-
createTreeNode
protected javax.swing.tree.MutableTreeNode createTreeNode(AbstractDialogPage dialogPage)
Create tree node for TREE_STYLE pages.- Parameters:
dialogPage
- the corresponding dialog page.- Returns:
- the tree node.
-
createList
protected javax.swing.JList createList(javax.swing.DefaultListModel listModel)
Creates list that is used in LIST_STYLE dialog's index panel. Below is the code we used. If you just want to have a different cell renderer, you can just callsetListCellRenderer(javax.swing.ListCellRenderer)
to set a new one.JList list = new JList(listModel); list.setCellRenderer(createListCellRenderer()); return list;
- Parameters:
listModel
- the list model- Returns:
- list.
-
createIconPanel
protected javax.swing.JComponent createIconPanel()
Creates the panel that contains several icons. Each icon represents for a page. This is only used for ICON_STYLE.- Returns:
- a panel that contains several icons.
-
createIconButtonPanel
protected ButtonPanel createIconButtonPanel()
Creates the ButtonPanel used by IconPanel. By default, we create it usingnew ScrollableButtonPanel(SwingConstants.TOP, ButtonPanel.SAME_SIZE)
.- Returns:
- the ButtonPanel.
-
createIconButton
protected JideButton createIconButton(java.lang.String title, javax.swing.Icon icon)
Creates the button for each icon.- Parameters:
title
- the button titleicon
- the button icon- Returns:
- the button
-
getStyle
public int getStyle()
Gets the style of this dialog.- Returns:
- the style. It can be TAB_STYLE, ICON_STYLE, LIST_STYLE or TREE_STYLE.
-
setStyle
public void setStyle(int style)
Sets the style of this dialog. This class doesn't support change style on fly. You can only change style before the dialog is set to visible.- Parameters:
style
- It must be one of the following: TAB_STYLE, ICON_STYLE, LIST_STYLE or TREE_STYLE.
-
getIndexPanel
public javax.swing.JComponent getIndexPanel()
Gets the index panel.- Returns:
- the index panel.
-
getPagesPanel
public javax.swing.JComponent getPagesPanel()
Gets the pages panel.- Returns:
- the pages panel.
-
getTreeCellRenderer
protected javax.swing.tree.TreeCellRenderer getTreeCellRenderer()
Gets the cell renderer used by the tree. It's used only when the style is TREE_STYLE.- Returns:
- the tree cell renderer.
-
setTreeCellRenderer
public void setTreeCellRenderer(javax.swing.tree.TreeCellRenderer treeCellRenderer)
Sets the tree cell renderer that will be used by JTree when the style is TREE_STYLE.- Parameters:
treeCellRenderer
- the tree cell renderer
-
getListCellRenderer
protected javax.swing.ListCellRenderer getListCellRenderer()
Gets the cell renderer used by the list. It's used only when the style is LIST_STYLE.- Returns:
- the list cell renderer.
-
setListCellRenderer
public void setListCellRenderer(javax.swing.ListCellRenderer listCellRenderer)
Sets the list cell renderer that will be used by JList when the style is LIST_STYLE.- Parameters:
listCellRenderer
- the list cell renderer
-
createListCellRenderer
protected javax.swing.ListCellRenderer createListCellRenderer()
Creates a list cell renderer used by list in LIST_STYLE dialog's index panel.- Returns:
- the list cell renderer.
-
createTreeCellRenderer
protected javax.swing.tree.TreeCellRenderer createTreeCellRenderer()
Creates the tree cell renderer used by tree in TREE_STYLE dialog's index panel.- Returns:
- the tree cell renderer.
-
getInitialPageTitle
public java.lang.String getInitialPageTitle()
Gets the initial page title. Initial page is the page that will be selected when the dialog is just opened. Please note the title is the full title. In most case it's just the title of the page. Only in TREE_STYLE, it should be a list of titles that concats with '.'.- Returns:
- the initial page title.
-
setInitialPageTitle
public void setInitialPageTitle(java.lang.String initialPageTitle)
Sets the initial page title. Initial page is the page that will be selected when the dialog.- Parameters:
initialPageTitle
- the initial page title
-
-