Class MultiPagePane

    • 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_PanelListButtons

        protected BasePanel m_PanelListButtons
        the panel for the list buttons.
      • 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_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_SkipPageUndo

        protected boolean m_SkipPageUndo
        whether to skip tab undo.
    • Constructor Detail

      • MultiPagePane

        public MultiPagePane()
    • Method Detail

      • initialize

        protected void initialize()
        For initializing members.
        Overrides:
        initialize in class BasePanel
      • initGUI

        protected void initGUI()
        For initializing the GUI.
        Overrides:
        initGUI in class BasePanel
      • finishInit

        protected void finishInit()
        finishes the initialization.
        Overrides:
        finishInit in class BasePanel
      • 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 interface UISettingsSupporter
        Parameters:
        cls - the class
        property - the property
      • 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 index
        cont - 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 index
        page - 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 index
        title - 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 index
        icon - 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 title
        page - the page component
      • 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 at
        title - the title
        page - 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 at
        cont - 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 title
        detach - 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
      • 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 interface CleanUpHandler