Package adams.gui.core
Class MultiPagePane
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- adams.gui.core.BasePanel
-
- adams.gui.core.MultiPagePane
-
- All Implemented Interfaces:
CleanUpHandler
,UISettingsSupporter
,ImageObserver
,MenuContainer
,Serializable
,Accessible
- Direct Known Subclasses:
FlowMultiPagePane
,ImageMultiPagePane
,ImageProcessorMultiPagePane
,InformativeStatisticFactory.MultiPagePane
,MultiPagePane
,NotesFactory.MultiPagePane
,PDFViewerPanel.MultiPagePane
,PerFoldMultiPagePane
public class MultiPagePane extends BasePanel implements CleanUpHandler, UISettingsSupporter
Manages multiple pages, like JTabbedPane manages multiple tabs. Uses a JList for listing the page titles.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MultiPagePane.DetachablePage
static interface
MultiPagePane.PageCloseApprover
Interface for classes that can hook into the closing of pages and stop it.static class
MultiPagePane.PageContainer
Container for page component and title.static class
MultiPagePane.PageUndo
Container for the page undo list.static interface
MultiPagePane.PopupCustomizer
Interface for classes that want to customize the popup menu for entry.static class
MultiPagePane.TitleRenderer
The cell renderer.static interface
MultiPagePane.ToolTipCustomizer
Interface for classes that want to customize the tool tip of an entry.-
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
-
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
-
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
-
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
-
Field Summary
Fields Modifier and Type Field Description protected BaseSplitButton
m_ButtonAction
the action button.protected BaseFlatButton
m_ButtonDown
the move down button.protected BaseFlatButton
m_ButtonRemove
the remove button.protected BaseFlatButton
m_ButtonRemoveAll
the remove all button.protected BaseFlatButton
m_ButtonUndo
the undo button.protected BaseFlatButton
m_ButtonUp
the move up button.protected HashSet<ChangeListener>
m_ChangeListeners
the listeners when pages get selected.protected boolean
m_IgnoreUpdates
whether to ignore updates.protected BasePanel
m_LeftPanel
the panel with the list and buttons.protected int
m_MaxPageCloseUndo
the maximum number of tabs to keep for undo.protected MultiPagePane.PageCloseApprover
m_PageCloseApprover
for approving page closing.protected BaseList
m_PageList
the page list.protected DefaultListModel<MultiPagePane.PageContainer>
m_PageListModel
the list model.protected List<MultiPagePane.PageUndo>
m_PageUndoList
the list of tabs to undo.protected BasePanel
m_PanelContent
the content pane for the pages.protected BasePanel
m_PanelListButtons
the panel for the list buttons.protected MultiPagePane.PopupCustomizer
m_PopupCustomizer
an optional customizer for the popup on the JList.protected boolean
m_ReadOnly
whether the page list is readonly.protected boolean
m_SkipPageUndo
whether to skip tab undo.protected BaseSplitPane
m_SplitPane
the split pane.protected MultiPagePane.ToolTipCustomizer
m_ToolTipCustomizer
an optional customizer for the tooltips of the JList.-
Fields inherited from class adams.gui.core.BasePanel
m_FileChooser
-
Fields inherited from class javax.swing.JComponent
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
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
-
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
-
Constructor Summary
Constructors Constructor Description MultiPagePane()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAction(Action action)
Adds the action to the action button.void
addAction(JMenuItem action)
Adds the menu item to the action button.void
addChangeListener(ChangeListener l)
Adds the change listener to its internal list.void
addPage(int index, MultiPagePane.PageContainer cont)
Adds the page at the specified index.void
addPage(int index, String title, Component page)
Adds the page at the specified index.void
addPage(MultiPagePane.PageContainer cont)
Adds the page at the end.void
addPage(String title, Component page)
Adds the page at the end.protected void
addPageUndo(int index)
Adds the page to its undo list, if enabled.void
addRemoveItemsListener(RemoveItemsListener l)
Adds the remove items listener to its internal list.boolean
canMoveDown()
checks whether the selected items can be moved down.boolean
canMoveUp()
checks whether the selected items can be moved up.boolean
canRemovePageAt(int index)
Checks whether the page can be removed.boolean
canRemoveSelectedPages()
Checks whether the selected pages can be removed.boolean
canUndoPageClose()
Returns whether a tab close can be undone.void
checkedRemoveAllPages()
Removes all pages.MultiPagePane.PageContainer
checkedRemovePageAt(int index)
Removes the page container at the specified index, if approved.MultiPagePane.PageContainer
checkedRemoveSelectedPage()
Removes the currently selected page container, if approved.void
checkedRemoveSelectedPages()
Removes the currently selected page containers, if approved.void
cleanUp()
Cleans up data structures, frees up memory.protected void
clearPageUndo()
Clears the page undo list.void
clearUISettingsParameters()
Clears the para meters for storing the divider location.protected BasePopupMenu
createPopup(MouseEvent e)
Generates the right-click menu for the JList.protected void
finishInit()
finishes the initialization.protected String
generateToolTip(int index)
Generates the tool tip for the index.MultiPagePane.DetachablePage
getDetachablePageAt(int index)
Returns the detachable page component at the specified index.int
getDividerLocation()
Returns the current location of the divider between page titles and content.ImageIcon
getIconAt(int index)
Returns the icon at the specified index.int
getMaxPageCloseUndo()
Returns the maximum pages to keep around for undoing closing.Component
getPageAt(int index)
Returns the page component at the specified index.MultiPagePane.PageCloseApprover
getPageCloseApprover()
Returns the approver for closing pages.MultiPagePane.PageContainer
getPageContainerAt(int index)
Returns the page container at the specified index.int
getPageCount()
Returns the number of pages.protected List<MultiPagePane.PageUndo>
getPageUndoList()
Returns the page undo list.MultiPagePane.PopupCustomizer
getPopupCustomizer()
Returns the currently set popup customizer.MultiPagePane.DetachablePage
getSelectedDetachablePage()
Returns the currently selected detachable page.ImageIcon
getSelectedIcon()
Returns the icon of the currently selected page.int
getSelectedIndex()
Returns the currently selected page index.int[]
getSelectedIndices()
Returns the currently selected page indices.Component
getSelectedPage()
Returns the currently selected page.MultiPagePane.PageContainer
getSelectedPageContainer()
Returns the currently selected page container.String
getSelectedTitle()
Returns the title of the currently selected page.String
getTitleAt(int index)
Returns the title at the specified index.ListCellRenderer
getTitleRenderer()
Returns the renderer for the titles.MultiPagePane.ToolTipCustomizer
getToolTipCustomizer()
Returns the currently set tool tip customizer.int
indexOfPage(MultiPagePane.PageContainer cont)
Returns the page index for the page container.int
indexOfPage(Component page)
Returns the page index for the page component.protected void
initGUI()
For initializing the GUI.protected void
initialize()
For initializing members.protected boolean
isPageClosingApproved(int index)
Approves the closing of the specified page.protected boolean
isPageClosingApproved(int[] indices)
Approves the closing of the specified pages.boolean
isReadOnly()
Returns whether the pages are readonly or can be manipulated.void
moveBottom()
moves the selected items to the end.void
moveDown()
moves the selected item down by 1.void
moveTop()
moves the selected items to the top.void
moveUp()
moves the selected items up by 1.protected MultiPagePane.TitleRenderer
newRenderer()
Returns the renderer to use.protected void
notifyChangeListeners()
Notifies the change listeners.protected boolean
processListKey(KeyEvent e)
Handles the key event from the page list.void
removeAllPages()
Removes all pages.void
removeChangeListener(ChangeListener l)
Removes the change listener from its internal list.MultiPagePane.PageContainer
removePageAt(int index)
Removes the page container at the specified index.void
removeRemoveItemsListener(RemoveItemsListener l)
Removes the remove items listener from its internal list.MultiPagePane.PageContainer
removeSelectedPage()
Removes the currently selected page container.void
removeSelectedPages()
Removes the currently selected page containers.void
setDividerLocation(int value)
Sets the location for the divider between page titles and content.void
setIconAt(int index, ImageIcon icon)
Sets the icon at the specified index.void
setMaxPageCloseUndo(int value)
Sets the maximum pages to keep around for undoing closing.void
setPageAt(int index, MultiPagePane.PageContainer cont)
Sets the container at the specified index.void
setPageAt(int index, Component page)
Sets the page at the specified index.void
setPageCloseApprover(MultiPagePane.PageCloseApprover value)
Sets the approver for closing pages.void
setPopupCustomizer(MultiPagePane.PopupCustomizer value)
Sets the popup customizer to use.void
setReadOnly(boolean value)
Sets whether the pages are readonly or can be manipulated.void
setSelectedIndex(int index)
Selects the specified page index.void
setSelectedIndices(int[] indices)
Sets the currently selected page indices.void
setSelectedPage(Component page)
Selects the specified page component as active page.void
setTitleAt(int index, String title)
Sets the title at the specified index.void
setTitleRenderer(ListCellRenderer renderer)
Sets the renderer for the titles.void
setToolTipCustomizer(MultiPagePane.ToolTipCustomizer value)
Sets the tool tip customizer to use.void
setUISettingsParameters(Class cls, String property)
Sets the parameters for storing the divider location.protected void
showPopup(MouseEvent e)
Generates and pops up the right-click menu on the JList.boolean
undoPageClose()
Performs an undo of a page close.protected void
update()
Updates the content panel.protected void
updateButtons()
Updates the enabled state of the buttons.protected void
updateTitle(String title, MultiPagePane.DetachablePage detach)
Hook method for updating the title.-
Methods inherited from class adams.gui.core.BasePanel
afterHide, afterShow, beforeHide, beforeShow, closeParent, getParentChild, getParentDialog, getParentFrame, getParentInternalFrame, getParentTitle, initFileChooser, main, printErrorMessage, printException, saveComponent, setEnabledCascade, setEnabledCascade, setParentTitle, setVisible
-
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, 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, 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, setLayout, 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, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
m_SplitPane
protected BaseSplitPane m_SplitPane
the split pane.
-
m_LeftPanel
protected BasePanel m_LeftPanel
the panel with the list and buttons.
-
m_PageList
protected BaseList m_PageList
the page list.
-
m_PageListModel
protected DefaultListModel<MultiPagePane.PageContainer> m_PageListModel
the list model.
-
m_PanelListButtons
protected BasePanel m_PanelListButtons
the panel for the list buttons.
-
m_ButtonUp
protected BaseFlatButton m_ButtonUp
the move up button.
-
m_ButtonDown
protected BaseFlatButton m_ButtonDown
the move down button.
-
m_ButtonRemove
protected BaseFlatButton m_ButtonRemove
the remove button.
-
m_ButtonRemoveAll
protected BaseFlatButton m_ButtonRemoveAll
the remove all button.
-
m_ButtonUndo
protected BaseFlatButton m_ButtonUndo
the undo button.
-
m_ButtonAction
protected BaseSplitButton m_ButtonAction
the action button.
-
m_PanelContent
protected BasePanel m_PanelContent
the content pane for the pages.
-
m_ChangeListeners
protected HashSet<ChangeListener> m_ChangeListeners
the listeners when pages get selected.
-
m_IgnoreUpdates
protected boolean m_IgnoreUpdates
whether to ignore updates.
-
m_PageCloseApprover
protected MultiPagePane.PageCloseApprover m_PageCloseApprover
for approving page closing.
-
m_PopupCustomizer
protected MultiPagePane.PopupCustomizer m_PopupCustomizer
an optional customizer for the popup on the JList.
-
m_ToolTipCustomizer
protected MultiPagePane.ToolTipCustomizer m_ToolTipCustomizer
an optional customizer for the tooltips of the JList.
-
m_ReadOnly
protected boolean m_ReadOnly
whether the page list is readonly.
-
m_MaxPageCloseUndo
protected int m_MaxPageCloseUndo
the maximum number of tabs to keep for undo.
-
m_PageUndoList
protected transient List<MultiPagePane.PageUndo> m_PageUndoList
the list of tabs to undo.
-
m_SkipPageUndo
protected boolean m_SkipPageUndo
whether to skip tab undo.
-
-
Method Detail
-
initialize
protected void initialize()
For initializing members.- Overrides:
initialize
in classBasePanel
-
finishInit
protected void finishInit()
finishes the initialization.- Overrides:
finishInit
in classBasePanel
-
newRenderer
protected MultiPagePane.TitleRenderer newRenderer()
Returns the renderer to use.- Returns:
- the renderer
-
setReadOnly
public void setReadOnly(boolean value)
Sets whether the pages are readonly or can be manipulated.- Parameters:
value
- true if no manipulation possible
-
isReadOnly
public boolean isReadOnly()
Returns whether the pages are readonly or can be manipulated.- Returns:
- true if no manipulation possible
-
setUISettingsParameters
public void setUISettingsParameters(Class cls, String property)
Sets the parameters for storing the divider location.- Specified by:
setUISettingsParameters
in interfaceUISettingsSupporter
- Parameters:
cls
- the classproperty
- the property
-
clearUISettingsParameters
public void clearUISettingsParameters()
Clears the para meters for storing the divider location.- Specified by:
clearUISettingsParameters
in interfaceUISettingsSupporter
-
setDividerLocation
public void setDividerLocation(int value)
Sets the location for the divider between page titles and content.- Parameters:
value
- the location in pixels
-
getDividerLocation
public int getDividerLocation()
Returns the current location of the divider between page titles and content.- Returns:
- the location in pixels
-
setTitleRenderer
public void setTitleRenderer(ListCellRenderer renderer)
Sets the renderer for the titles.- Parameters:
renderer
- the renderer to use
-
getTitleRenderer
public ListCellRenderer getTitleRenderer()
Returns the renderer for the titles.- Returns:
- the renderer to use
-
getPageCount
public int getPageCount()
Returns the number of pages.- Returns:
- the number of pages
-
getSelectedIndex
public int getSelectedIndex()
Returns the currently selected page index.- Returns:
- the index, -1 if none selected
-
setSelectedIndex
public void setSelectedIndex(int index)
Selects the specified page index.- Parameters:
index
- the index of the page to select
-
getSelectedIndices
public int[] getSelectedIndices()
Returns the currently selected page indices.- Returns:
- the indices, 0-length array if none selected
-
setSelectedIndices
public void setSelectedIndices(int[] indices)
Sets the currently selected page indices.- Parameters:
indices
- the indices
-
setSelectedPage
public void setSelectedPage(Component page)
Selects the specified page component as active page.- Parameters:
page
- the component to select
-
setPageAt
public void setPageAt(int index, MultiPagePane.PageContainer cont)
Sets the container at the specified index.- Parameters:
index
- the page indexcont
- the new container
-
getPageContainerAt
public MultiPagePane.PageContainer getPageContainerAt(int index)
Returns the page container at the specified index.- Parameters:
index
- the page index- Returns:
- the associated page container
-
getSelectedPageContainer
public MultiPagePane.PageContainer getSelectedPageContainer()
Returns the currently selected page container.- Returns:
- the page container, null if none selected
-
setPageAt
public void setPageAt(int index, Component page)
Sets the page at the specified index.- Parameters:
index
- the page indexpage
- the new page
-
getPageAt
public Component getPageAt(int index)
Returns the page component at the specified index.- Parameters:
index
- the page index- Returns:
- the associated page component
-
getDetachablePageAt
public MultiPagePane.DetachablePage getDetachablePageAt(int index)
Returns the detachable page component at the specified index.- Parameters:
index
- the page index- Returns:
- the associated detachable page component
-
indexOfPage
public int indexOfPage(Component page)
Returns the page index for the page component.- Parameters:
page
- the page component to look up- Returns:
- the associated page index, -1 if not found
-
indexOfPage
public int indexOfPage(MultiPagePane.PageContainer cont)
Returns the page index for the page container.- Parameters:
cont
- the page component to look up- Returns:
- the associated page index, -1 if not found
-
getSelectedPage
public Component getSelectedPage()
Returns the currently selected page.- Returns:
- the page, null if none selected
-
getSelectedDetachablePage
public MultiPagePane.DetachablePage getSelectedDetachablePage()
Returns the currently selected detachable page.- Returns:
- the detachable page, null if none selected
-
setTitleAt
public void setTitleAt(int index, String title)
Sets the title at the specified index.- Parameters:
index
- the page indextitle
- the new title
-
getTitleAt
public String getTitleAt(int index)
Returns the title at the specified index.- Parameters:
index
- the page index- Returns:
- the associated title
-
getSelectedTitle
public String getSelectedTitle()
Returns the title of the currently selected page.- Returns:
- the title, null if none selected
-
setIconAt
public void setIconAt(int index, ImageIcon icon)
Sets the icon at the specified index.- Parameters:
index
- the page indexicon
- the new icon
-
getIconAt
public ImageIcon getIconAt(int index)
Returns the icon at the specified index.- Parameters:
index
- the page index- Returns:
- the associated icon
-
getSelectedIcon
public ImageIcon getSelectedIcon()
Returns the icon of the currently selected page.- Returns:
- the icon, null if none selected
-
isPageClosingApproved
protected boolean isPageClosingApproved(int index)
Approves the closing of the specified page.- Parameters:
index
- the page index- Returns:
- true if can be closed
- See Also:
getPageCloseApprover()
-
isPageClosingApproved
protected boolean isPageClosingApproved(int[] indices)
Approves the closing of the specified pages.- Parameters:
indices
- the page indices- Returns:
- true if can be closed
- See Also:
getPageCloseApprover()
-
checkedRemoveSelectedPage
public MultiPagePane.PageContainer checkedRemoveSelectedPage()
Removes the currently selected page container, if approved.- Returns:
- the removed container, if any
-
removeSelectedPage
public MultiPagePane.PageContainer removeSelectedPage()
Removes the currently selected page container.- Returns:
- the removed container
-
canRemoveSelectedPages
public boolean canRemoveSelectedPages()
Checks whether the selected pages can be removed.- Returns:
- true if not read-only or read-only and all selected pages allowing removal
- See Also:
canRemovePageAt(int)
-
checkedRemoveSelectedPages
public void checkedRemoveSelectedPages()
Removes the currently selected page containers, if approved.
-
removeSelectedPages
public void removeSelectedPages()
Removes the currently selected page containers.
-
checkedRemovePageAt
public MultiPagePane.PageContainer checkedRemovePageAt(int index)
Removes the page container at the specified index, if approved.- Parameters:
index
- the page index- Returns:
- the removed container, null if not removed
- See Also:
m_PageCloseApprover
-
canRemovePageAt
public boolean canRemovePageAt(int index)
Checks whether the page can be removed.- Parameters:
index
- the index of the page- Returns:
- true if not read-only or read-only and the page allows removal explicitly
-
removePageAt
public MultiPagePane.PageContainer removePageAt(int index)
Removes the page container at the specified index.- Parameters:
index
- the page index- Returns:
- the removed container
-
checkedRemoveAllPages
public void checkedRemoveAllPages()
Removes all pages. Does not stored them in undo.
-
removeAllPages
public void removeAllPages()
Removes all pages. Does not stored them in undo.
-
addPage
public void addPage(String title, Component page)
Adds the page at the end.- Parameters:
title
- the titlepage
- the page component
-
addPage
public void addPage(MultiPagePane.PageContainer cont)
Adds the page at the end.- Parameters:
cont
- the page container
-
addPage
public void addPage(int index, String title, Component page)
Adds the page at the specified index.- Parameters:
index
- the page index to insert the page attitle
- the titlepage
- the page component
-
addPage
public void addPage(int index, MultiPagePane.PageContainer cont)
Adds the page at the specified index.- Parameters:
index
- the page index to insert the page atcont
- the page container
-
moveUp
public void moveUp()
moves the selected items up by 1.
-
moveDown
public void moveDown()
moves the selected item down by 1.
-
moveTop
public void moveTop()
moves the selected items to the top.
-
moveBottom
public void moveBottom()
moves the selected items to the end.
-
canMoveUp
public boolean canMoveUp()
checks whether the selected items can be moved up.- Returns:
- true if the selected items can be moved
-
canMoveDown
public boolean canMoveDown()
checks whether the selected items can be moved down.- Returns:
- true if the selected items can be moved
-
addRemoveItemsListener
public void addRemoveItemsListener(RemoveItemsListener l)
Adds the remove items listener to its internal list.- Parameters:
l
- the listener to add
-
removeRemoveItemsListener
public void removeRemoveItemsListener(RemoveItemsListener l)
Removes the remove items listener from its internal list.- Parameters:
l
- the listener to remove
-
addChangeListener
public void addChangeListener(ChangeListener l)
Adds the change listener to its internal list.- Parameters:
l
- the listener to add
-
removeChangeListener
public void removeChangeListener(ChangeListener l)
Removes the change listener from its internal list.- Parameters:
l
- the listener to remove
-
notifyChangeListeners
protected void notifyChangeListeners()
Notifies the change listeners.
-
update
protected void update()
Updates the content panel.
-
updateButtons
protected void updateButtons()
Updates the enabled state of the buttons.
-
addAction
public void addAction(Action action)
Adds the action to the action button.- Parameters:
action
- the action to add
-
addAction
public void addAction(JMenuItem action)
Adds the menu item to the action button.- Parameters:
action
- the item to add
-
processListKey
protected boolean processListKey(KeyEvent e)
Handles the key event from the page list.- Parameters:
e
- the event- Returns:
- true if processed
-
setPageCloseApprover
public void setPageCloseApprover(MultiPagePane.PageCloseApprover value)
Sets the approver for closing pages.- Parameters:
value
- the approver, null to remove
-
getPageCloseApprover
public MultiPagePane.PageCloseApprover getPageCloseApprover()
Returns the approver for closing pages.- Returns:
- the approver, null if none set
-
createPopup
protected BasePopupMenu createPopup(MouseEvent e)
Generates the right-click menu for the JList.
Derived classes should override this method instead of making use of the PopupCustomizer.- Parameters:
e
- the event that triggered the popup- Returns:
- the generated menu
- See Also:
showPopup(MouseEvent)
-
updateTitle
protected void updateTitle(String title, MultiPagePane.DetachablePage detach)
Hook method for updating the title.- Parameters:
title
- the entry titledetach
- the detachable page
-
showPopup
protected void showPopup(MouseEvent e)
Generates and pops up the right-click menu on the JList.- Parameters:
e
- the event that triggered the popup- See Also:
createPopup(MouseEvent)
-
setPopupCustomizer
public void setPopupCustomizer(MultiPagePane.PopupCustomizer value)
Sets the popup customizer to use.- Parameters:
value
- the customizer, use null to turn off
-
getPopupCustomizer
public MultiPagePane.PopupCustomizer getPopupCustomizer()
Returns the currently set popup customizer.- Returns:
- the customizer, can be null if none set
-
setToolTipCustomizer
public void setToolTipCustomizer(MultiPagePane.ToolTipCustomizer value)
Sets the tool tip customizer to use.- Parameters:
value
- the customizer, use null to turn off
-
getToolTipCustomizer
public MultiPagePane.ToolTipCustomizer getToolTipCustomizer()
Returns the currently set tool tip customizer.- Returns:
- the customizer, can be null if none set
-
generateToolTip
protected String generateToolTip(int index)
Generates the tool tip for the index.- Parameters:
index
- the index, can be outside range- Returns:
- the tool tip, null if none available
-
setMaxPageCloseUndo
public void setMaxPageCloseUndo(int value)
Sets the maximum pages to keep around for undoing closing.- Parameters:
value
- the maximum, <1 turned off
-
getMaxPageCloseUndo
public int getMaxPageCloseUndo()
Returns the maximum pages to keep around for undoing closing.- Returns:
- the maximum, <1 turned off
-
getPageUndoList
protected List<MultiPagePane.PageUndo> getPageUndoList()
Returns the page undo list.- Returns:
- the list
-
addPageUndo
protected void addPageUndo(int index)
Adds the page to its undo list, if enabled.- Parameters:
index
- the position of the tab
-
canUndoPageClose
public boolean canUndoPageClose()
Returns whether a tab close can be undone.- Returns:
- true if possible
-
undoPageClose
public boolean undoPageClose()
Performs an undo of a page close.- Returns:
- true if successfully restored
-
clearPageUndo
protected void clearPageUndo()
Clears the page undo list.
-
cleanUp
public void cleanUp()
Cleans up data structures, frees up memory.- Specified by:
cleanUp
in interfaceCleanUpHandler
-
-