public class MultiplePageDialogPane extends StandardDialogPane
MultiplePageDialogPane
has lazy loading feature. So when you are done setup the page list, you need to
call StandardDialogPane.initComponents()
to initialize everything. This method will be called automatically if the dialog pane
is added to StandardDialog.javax.swing.JPanel.AccessibleJPanel
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and 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.
|
_bannerPanel, _buttonPanel, _contentPanel, PROPERTY_CANCEL_ACTION, PROPERTY_DEFAULT_ACTION
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Constructor and Description |
---|
MultiplePageDialogPane()
Creates a non-modal MultiplePageDialog without a title and without a specified
Frame owner. |
MultiplePageDialogPane(int style)
Creates a modal or non-modal MultiplePageDialog with the specified style, the specified title and the specified
owner
Frame . |
Modifier and Type | Method and 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.
|
javax.swing.JButton |
getApplyButton()
Gets the apply button.
|
javax.swing.AbstractAction |
getCancelAction()
Gets the cancel action.
|
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.AbstractAction |
getOKAction()
Gets the OK action.
|
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.
|
void |
setCancelAction(javax.swing.AbstractAction cancelAction)
Changes the default cancel action.
|
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 |
setOKAction(javax.swing.AbstractAction okAction)
Changes the default OK action.
|
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.
|
getBannerPanel, getButtonPanel, getContentPanel, getDefaultAction, getDefaultCancelAction, getInitFocusedComponent, initComponents, layoutComponents, setDefaultAction, setDefaultCancelAction, setInitFocusedComponent
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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, setVisible, unregisterKeyboardAction, update
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, setLayout, transferFocusDownCycle, validate, validateTree
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, 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, transferFocusBackward, transferFocusUpCycle
public static final int TAB_STYLE
public static final int TREE_STYLE
public static final int LIST_STYLE
public static final int ICON_STYLE
public javax.swing.JTree _tree
public MultiplePageDialogPane() throws java.awt.HeadlessException
Frame
owner. A
shared, hidden frame will be set as the owner of the dialog. By default TAB_STYLE is used.java.awt.HeadlessException
public MultiplePageDialogPane(int style)
Frame
. If owner
is null
, a shared, hidden frame will be set as the
owner of this dialog. All constructors defer to this one.style
- the style. It must be one of the following: TAB_STYLE, ICON_STYLE, LIST_STYLE or TREE_STYLE.java.awt.HeadlessException
- if GraphicsEnvironment.isHeadless() returns true.GraphicsEnvironment.isHeadless()
,
JComponent.getDefaultLocale()
public javax.swing.JComponent createBannerPanel()
createBannerPanel
in class StandardDialogPane
public javax.swing.JComponent createContentPanel()
createContentPanel
in class StandardDialogPane
protected javax.swing.JComponent setupContentPanel(javax.swing.JComponent indexPanel, javax.swing.JComponent pagesPanel)
indexPanel
- the index panel. It has the navigation control to control which page to show.pagesPanel
- the pages panel. It contains all the pages of this dialog.public ButtonPanel createButtonPanel()
createButtonPanel
in class StandardDialogPane
ButtonPanel
public javax.swing.JButton getOkButton()
public javax.swing.JButton getCancelButton()
public javax.swing.JButton getApplyButton()
public void setCancelAction(javax.swing.AbstractAction cancelAction)
cancelAction
- public javax.swing.AbstractAction getCancelAction()
public void setOKAction(javax.swing.AbstractAction okAction)
okAction
- public javax.swing.AbstractAction getOKAction()
protected javax.swing.JComponent createPagesPanel()
protected javax.swing.JTabbedPane createTabbedPane()
public javax.swing.JComponent createIndexPanel()
public void setPageList(PageList pageList)
pageList
- public PageList getPageList()
public AbstractDialogPage getCurrentPage()
protected void setCurrentPage(java.lang.String pageTitle)
protected void setCurrentPage(AbstractDialogPage currentPage)
protected void setCurrentPage(AbstractDialogPage currentPage, java.lang.Object source)
protected void showCurrentPage(AbstractDialogPage currentPage)
currentPage
- protected javax.swing.JTree createTree(javax.swing.tree.DefaultMutableTreeNode root)
setTreeCellRenderer(javax.swing.tree.TreeCellRenderer)
to
set a new one.
UIManager.put("Tree.hash", Color.white);
return new JTree(root);
root
- protected void configureTree(javax.swing.JTree tree)
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);
}
}
}
});
tree
- protected javax.swing.JList createList(javax.swing.DefaultListModel listModel)
setListCellRenderer(javax.swing.ListCellRenderer)
to set a
new one.
JList list = new JList(listModel);
list.setCellRenderer(createListCellRenderer());
return list;
listModel
- protected javax.swing.JComponent createIconPanel()
protected ButtonPanel createIconButtonPanel()
new
ScrollableButtonPanel(SwingConstants.TOP, ButtonPanel.SAME_SIZE)
.protected JideButton createIconButton(java.lang.String title, javax.swing.Icon icon)
title
- icon
- public int getStyle()
public void setStyle(int style)
style
- It must be one of the following: TAB_STYLE, ICON_STYLE, LIST_STYLE or TREE_STYLE.public javax.swing.JComponent getIndexPanel()
public javax.swing.JComponent getPagesPanel()
protected javax.swing.tree.TreeCellRenderer getTreeCellRenderer()
public void setTreeCellRenderer(javax.swing.tree.TreeCellRenderer treeCellRenderer)
treeCellRenderer
- protected javax.swing.ListCellRenderer getListCellRenderer()
public void setListCellRenderer(javax.swing.ListCellRenderer listCellRenderer)
listCellRenderer
- protected javax.swing.ListCellRenderer createListCellRenderer()
protected javax.swing.tree.TreeCellRenderer createTreeCellRenderer()
public java.lang.String getInitialPageTitle()
public void setInitialPageTitle(java.lang.String initialPageTitle)
initialPageTitle
-