com.alee.extended.tab
Class WebDocumentPane<T extends DocumentData>

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by com.alee.laf.panel.WebPanel
                      extended by com.alee.extended.tab.WebDocumentPane<T>
Type Parameters:
T - document type
All Implemented Interfaces:
PartialDecoration, LanguageContainerMethods, ShapeProvider, Styleable, SizeMethods<WebPanel>, SwingMethods, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.SwingConstants

public class WebDocumentPane<T extends DocumentData>
extends WebPanel
implements javax.swing.SwingConstants

This component is basically a special container for customizable documents described by DocumentData class. You can also override DocumentData class and for example include your own data into the document itself.

This component uses either single or multiply tabbed panes and allow tabs reorder, drag, split and closability. All those features are of course configurable within the WebDocumentPane instance.

Author:
Mikle Garin
See Also:
How to use WebDocumentPane, PaneData, SplitData, DocumentData, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  PaneData<T> activePane
          Last active pane.
protected  boolean closeable
          Whether documents can be closed or not.
protected static java.lang.String DATA_KEY
          Constant key used to put pane element data into the UI component.
protected  boolean dragBetweenPanesEnabled
          Whether documents drag between tabbed panes is enabled or not.
protected  boolean dragEnabled
          Whether documents drag enabled or not.
protected  java.lang.String id
          Unique document pane ID.
protected  java.util.List<DocumentListener<T>> listeners
          Document listeners.
protected  StructureData root
          Root structure element.
protected  boolean splitEnabled
          Whether split creation is enabled or not.
protected  Customizer<WebSplitPane> splitPaneCustomizer
          Document customizer.
protected  Customizer<WebTabbedPane> tabbedPaneCustomizer
          Tabbed panes customizer.
protected  boolean tabMenuEnabled
          Whether tab menu is enabled or not.
 
Fields inherited from class javax.swing.JComponent
accessibleContext, 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
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
WebDocumentPane()
          Constructs new document pane.
WebDocumentPane(Customizer<WebTabbedPane> tabbedPaneCustomizer, Customizer<WebSplitPane> splitPaneCustomizer)
          Constructs new document pane.
 
Method Summary
protected  void activate(PaneData<T> paneData)
          Sets active pane.
protected  void activate(T document)
          Sets active pane.
 void addDocumentListener(DocumentListener<T> listener)
          Adds document listener.
 void closeAll()
          Closes all documents.
 void closeDocument(int index)
          Closes document at the specified index in the active pane.
 void closeDocument(java.lang.String id)
          Closes document with the specified ID.
 void closeDocument(T document)
          Closes the specified document.
protected  void collectPanes(StructureData structureData, java.util.List<PaneData<T>> panes)
          Collects all PaneData available under the specified stucture element into list.
protected  void collectSplitPanes(StructureData structureData, java.util.List<SplitData<T>> splits)
          Collects all SplitData available under the specified stucture element into list.
 void fireDocumentClosed(T document, PaneData<T> pane, int index)
          Fires document closed event.
 boolean fireDocumentClosing(T document, PaneData<T> pane, int index)
          Fires document closing event.
 void fireDocumentOpened(T document, PaneData<T> pane, int index)
          Fires document opened event.
 PaneData<T> getActivePane()
          Returns currently active pane data.
 java.util.List<PaneData<T>> getAllPanes()
          Returns list of all available panes within this document pane.
 java.util.List<SplitData<T>> getAllSplitPanes()
          Returns list of all available split panes within this document pane.
static
<T extends DocumentData>
SplitData<T>
getData(WebSplitPane splitPane)
          Returns split data stored inside the split pane component.
static
<T extends DocumentData>
PaneData<T>
getData(WebTabbedPane tabbedPane)
          Returns pane data stored inside the tabbed pane component.
 T getDocument(int index)
          Returns document at the specified tab index of the active pane.
 T getDocument(java.lang.String id)
          Returns document with the specified ID or null if it is not inside this document pane.
 java.util.List<T> getDocuments()
          Returns all documents opened in this document pane.
 int getDocumentsCount()
          Returns amount of documents opened in this document pane.
 java.lang.String getId()
          Returns unique document pane ID.
 PaneData<T> getPane(java.lang.String documentId)
          Returns pane that contains document with the specified ID.
 PaneData<T> getPane(T document)
          Returns pane that contains specified document.
 T getSelectedDocument()
          Returns selected document data.
 Customizer<WebSplitPane> getSplitPaneCustomizer()
          Returns split pane customizer.
 StructureData getStructureRoot()
          Returns current root element data.
 Customizer<WebTabbedPane> getTabbedPaneCustomizer()
          Returns tabbed pane customizer.
protected  void init()
          Initializes root and active pane.
 boolean isCloseable()
          Returns whether tabs in this document pane are globally closable or not.
 boolean isDocumentOpened(java.lang.String documentId)
          Returns whether document with the specified ID is opened inside this document pane or not.
 boolean isDocumentOpened(T document)
          Returns whether specified document is opened inside this document pane or not.
 boolean isDragBetweenPanesEnabled()
          Returns whether tabs drag between different tabbed panes is enabled or not.
 boolean isDragEnabled()
          Returns whether tabs drag is enabled or not.
static boolean isEmptyPane(StructureData data)
          Returns whether the specified element is an empty pane or not.
 boolean isSplitEnabled()
          Returns whether split creation is enabled or not.
 boolean isTabMenuEnabled()
          Returns whether tab menu is enabled or not.
 void merge(StructureData toMerge)
          Merges specified structure element and its sub-elements if it is possible.
protected  void mergeImpl(SplitData<T> splitData)
          Merges specified split element and its sub-elements if it is possible.
 void openDocument(T document)
          Opens document in this document pane.
 void removeDocumentListener(DocumentListener<T> listener)
          Removes document listener.
 void setCloseable(boolean closeable)
          Sets whether tabs in this document pane should be globally closable or not.
 void setDragBetweenPanesEnabled(boolean dragBetweenPanesEnabled)
          Sets whether tabs drag between different tabbed panes is enabled or not.
 void setDragEnabled(boolean dragEnabled)
          Sets whether tabs drag is enabled or not.
 void setSelected(DocumentData document)
          Sets document selected inside its pane.
 void setSelected(int index)
          Sets selected document index inside the active pane.
 void setSelected(java.lang.String id)
          Sets document with the specified ID selected inside its pane.
 void setSplitEnabled(boolean splitEnabled)
          Sets whether split creation is enabled or not.
 void setSplitPaneCustomizer(Customizer<WebSplitPane> customizer)
          Sets split pane customizer and applies it to existing panes.
 void setStructureRoot(StructureData root)
          Sets new root element data.
 void setTabbedPaneCustomizer(Customizer<WebTabbedPane> customizer)
          Sets tabbed pane customizer and applies it to existing panes.
 void setTabMenuEnabled(boolean tabMenuEnabled)
          Sets whether tab menu is enabled or not.
protected  PaneData<T> split(PaneData<T> splittedPane, T movedDocument, int direction)
          Splits specified pane into two panes using the specified direction to decide split settings.
 void split(T movedDocument, int direction)
          Splits document's pane into two panes using the specified direction to decide split settings.
 
Methods inherited from class com.alee.laf.panel.WebPanel
add, add, add, add, add, add, getBorderColor, getBorderStroke, getDisabledBorderColor, getFirstComponent, getLanguageContainerKey, getLastComponent, getMargin, getMinimumHeight, getMinimumWidth, getPainter, getPreferredHeight, getPreferredSize, getPreferredWidth, getRound, getShadeTransparency, getShadeWidth, getStyleId, getWebUI, isPaintBackground, isPaintBottom, isPaintBottomLine, isPaintFocus, isPaintLeft, isPaintLeftLine, isPaintRight, isPaintRightLine, isPaintTop, isPaintTopLine, isUndecorated, isWebColoredBackground, provideShape, removeLanguageContainerKey, setBorderColor, setBorderStroke, setDisabledBorderColor, setLanguageContainerKey, setMargin, setMargin, setMargin, setMinimumHeight, setMinimumWidth, setPaintBackground, setPaintBottom, setPaintBottomLine, setPainter, setPaintFocus, setPaintLeft, setPaintLeftLine, setPaintRight, setPaintRightLine, setPaintSideLines, setPaintSides, setPaintTop, setPaintTopLine, setPreferredHeight, setPreferredWidth, setRound, setShadeTransparency, setShadeWidth, setStyleId, setUndecorated, setWebColoredBackground, updateUI
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI
 
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, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, 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
 
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, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, 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, hide, 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, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DATA_KEY

protected static final java.lang.String DATA_KEY
Constant key used to put pane element data into the UI component.

See Also:
Constant Field Values

listeners

protected java.util.List<DocumentListener<T extends DocumentData>> listeners
Document listeners.


id

protected final java.lang.String id
Unique document pane ID. Used to allow or disallow documents drag between different document panes.


root

protected StructureData root
Root structure element. Might either be PaneData or SplitData.


activePane

protected PaneData<T extends DocumentData> activePane
Last active pane.


tabbedPaneCustomizer

protected Customizer<WebTabbedPane> tabbedPaneCustomizer
Tabbed panes customizer.


splitPaneCustomizer

protected Customizer<WebSplitPane> splitPaneCustomizer
Document customizer.


closeable

protected boolean closeable
Whether documents can be closed or not.


dragEnabled

protected boolean dragEnabled
Whether documents drag enabled or not.


dragBetweenPanesEnabled

protected boolean dragBetweenPanesEnabled
Whether documents drag between tabbed panes is enabled or not.


splitEnabled

protected boolean splitEnabled
Whether split creation is enabled or not.


tabMenuEnabled

protected boolean tabMenuEnabled
Whether tab menu is enabled or not.

Constructor Detail

WebDocumentPane

public WebDocumentPane()
Constructs new document pane.


WebDocumentPane

public WebDocumentPane(Customizer<WebTabbedPane> tabbedPaneCustomizer,
                       Customizer<WebSplitPane> splitPaneCustomizer)
Constructs new document pane.

Method Detail

getId

public java.lang.String getId()
Returns unique document pane ID. Might be used within D&D functionality to determine whether drag source is the same as destination.

Returns:
unique document pane ID

getTabbedPaneCustomizer

public Customizer<WebTabbedPane> getTabbedPaneCustomizer()
Returns tabbed pane customizer. It is null by default.

Returns:
tabbed pane customizer

setTabbedPaneCustomizer

public void setTabbedPaneCustomizer(Customizer<WebTabbedPane> customizer)
Sets tabbed pane customizer and applies it to existing panes. Note that changes made by previously set customizers are not reverted even if you set this to null.

Parameters:
customizer - new tabbed pane customizer

getSplitPaneCustomizer

public Customizer<WebSplitPane> getSplitPaneCustomizer()
Returns split pane customizer. It is null by default.

Returns:
split pane customizer

setSplitPaneCustomizer

public void setSplitPaneCustomizer(Customizer<WebSplitPane> customizer)
Sets split pane customizer and applies it to existing panes. Note that changes made by previously set customizers are not reverted even if you set this to null.

Parameters:
customizer - new split pane customizer

isCloseable

public boolean isCloseable()
Returns whether tabs in this document pane are globally closable or not.

Returns:
true if tabs in this document pane are globally closable, false otherwise

setCloseable

public void setCloseable(boolean closeable)
Sets whether tabs in this document pane should be globally closable or not.

Parameters:
closeable - whether tabs in this document pane should be globally closable or not

isDragEnabled

public boolean isDragEnabled()
Returns whether tabs drag is enabled or not.

Returns:
true if tabs drag is enabled, false otherwise

setDragEnabled

public void setDragEnabled(boolean dragEnabled)
Sets whether tabs drag is enabled or not.

Parameters:
dragEnabled - whether tabs drag is enabled or not

isDragBetweenPanesEnabled

public boolean isDragBetweenPanesEnabled()
Returns whether tabs drag between different tabbed panes is enabled or not.

Returns:
true if tabs drag between different tabbed panes is enabled, false otherwise

setDragBetweenPanesEnabled

public void setDragBetweenPanesEnabled(boolean dragBetweenPanesEnabled)
Sets whether tabs drag between different tabbed panes is enabled or not.

Parameters:
dragBetweenPanesEnabled - whether tabs drag between different tabbed panes is enabled or not

isSplitEnabled

public boolean isSplitEnabled()
Returns whether split creation is enabled or not.

Returns:
true if split creation is enabled, false otherwise

setSplitEnabled

public void setSplitEnabled(boolean splitEnabled)
Sets whether split creation is enabled or not.

Parameters:
splitEnabled - true if split creation is enabled, false otherwise

isTabMenuEnabled

public boolean isTabMenuEnabled()
Returns whether tab menu is enabled or not.

Returns:
true if tab menu is enabled, false otherwise

setTabMenuEnabled

public void setTabMenuEnabled(boolean tabMenuEnabled)
Sets whether tab menu is enabled or not.

Parameters:
tabMenuEnabled - whether tab menu is enabled or not

getStructureRoot

public StructureData getStructureRoot()
Returns current root element data. This is either SplitData or PaneData object.

Returns:
current root element data

setStructureRoot

public void setStructureRoot(StructureData root)
Sets new root element data. This call replaces all data stored in this document pane with new one.

Parameters:
root - new root element data

init

protected void init()
Initializes root and active pane.


split

public void split(T movedDocument,
                  int direction)
Splits document's pane into two panes using the specified direction to decide split settings.

Parameters:
movedDocument - document that should be moved to new pane
direction - split direction

split

protected PaneData<T> split(PaneData<T> splittedPane,
                            T movedDocument,
                            int direction)
Splits specified pane into two panes using the specified direction to decide split settings.

Parameters:
splittedPane - pane that will be splitted
movedDocument - document that should be moved from splitted pane to new one
direction - split direction
Returns:
second pane created in the split process

merge

public void merge(StructureData toMerge)
Merges specified structure element and its sub-elements if it is possible. If PaneData provided its parent split will be merged. If SplitData provided it will be merged.

Parameters:
toMerge - structure element to merge

mergeImpl

protected void mergeImpl(SplitData<T> splitData)
Merges specified split element and its sub-elements if it is possible.

Parameters:
splitData - split element to merge

getActivePane

public PaneData<T> getActivePane()
Returns currently active pane data. This is the last pane that had focus within this document pane.

Returns:
currently active pane data

activate

protected void activate(PaneData<T> paneData)
Sets active pane.

Parameters:
paneData - new active pane

activate

protected void activate(T document)
Sets active pane.

Parameters:
document - document to activate

getSelectedDocument

public T getSelectedDocument()
Returns selected document data.

Returns:
selected document data

getDocument

public T getDocument(int index)
Returns document at the specified tab index of the active pane.

Parameters:
index - active pane tab index
Returns:
document at the specified tab index of the active pane

getDocument

public T getDocument(java.lang.String id)
Returns document with the specified ID or null if it is not inside this document pane.

Parameters:
id - document ID
Returns:
document with the specified ID or null if it is not inside this document pane

getDocuments

public java.util.List<T> getDocuments()
Returns all documents opened in this document pane.

Returns:
all documents opened in this document pane

getDocumentsCount

public int getDocumentsCount()
Returns amount of documents opened in this document pane.

Returns:
amount of documents opened in this document pane

getAllPanes

public java.util.List<PaneData<T>> getAllPanes()
Returns list of all available panes within this document pane.

Returns:
list of all available panes within this document pane

collectPanes

protected void collectPanes(StructureData structureData,
                            java.util.List<PaneData<T>> panes)
Collects all PaneData available under the specified stucture element into list.

Parameters:
structureData - structure element
panes - PaneData list

getAllSplitPanes

public java.util.List<SplitData<T>> getAllSplitPanes()
Returns list of all available split panes within this document pane.

Returns:
list of all available split panes within this document pane

collectSplitPanes

protected void collectSplitPanes(StructureData structureData,
                                 java.util.List<SplitData<T>> splits)
Collects all SplitData available under the specified stucture element into list.

Parameters:
structureData - structure element
splits - SplitData list

getPane

public PaneData<T> getPane(T document)
Returns pane that contains specified document.

Parameters:
document - document to look for
Returns:
pane that contains specified document

getPane

public PaneData<T> getPane(java.lang.String documentId)
Returns pane that contains document with the specified ID.

Parameters:
documentId - ID of the document to look for
Returns:
pane that contains document with the specified ID

setSelected

public void setSelected(int index)
Sets selected document index inside the active pane.

Parameters:
index - index of the document to select

setSelected

public void setSelected(DocumentData document)
Sets document selected inside its pane.

Parameters:
document - document to select

setSelected

public void setSelected(java.lang.String id)
Sets document with the specified ID selected inside its pane.

Parameters:
id - ID of the document to select

isDocumentOpened

public boolean isDocumentOpened(T document)
Returns whether specified document is opened inside this document pane or not.

Parameters:
document - document to look for
Returns:
true if specified document is opened inside this document pane, false otherwise

isDocumentOpened

public boolean isDocumentOpened(java.lang.String documentId)
Returns whether document with the specified ID is opened inside this document pane or not.

Parameters:
documentId - ID of the document to look for
Returns:
true if document with the specified ID is opened inside this document pane, false otherwise

openDocument

public void openDocument(T document)
Opens document in this document pane.

Parameters:
document - document to open

closeDocument

public void closeDocument(int index)
Closes document at the specified index in the active pane.

Parameters:
index - index of the document to close

closeDocument

public void closeDocument(java.lang.String id)
Closes document with the specified ID.

Parameters:
id - ID of the document to close

closeDocument

public void closeDocument(T document)
Closes the specified document.

Parameters:
document - document to close

closeAll

public void closeAll()
Closes all documents. Be aware that some documents might cancel their close operation and will still be opened after this call.


addDocumentListener

public void addDocumentListener(DocumentListener<T> listener)
Adds document listener.

Parameters:
listener - new document listener

removeDocumentListener

public void removeDocumentListener(DocumentListener<T> listener)
Removes document listener.

Parameters:
listener - document listener

fireDocumentOpened

public void fireDocumentOpened(T document,
                               PaneData<T> pane,
                               int index)
Fires document opened event.

Parameters:
document - opened document
pane - document's pane
index - document's index

fireDocumentClosing

public boolean fireDocumentClosing(T document,
                                   PaneData<T> pane,
                                   int index)
Fires document closing event. Returns whether document is allowed to close or not.

Parameters:
document - closing document
pane - document's pane
index - document's index
Returns:
true if document is allowed to close, false otherwise

fireDocumentClosed

public void fireDocumentClosed(T document,
                               PaneData<T> pane,
                               int index)
Fires document closed event.

Parameters:
document - closed document
pane - document's pane
index - document's index

getData

public static <T extends DocumentData> PaneData<T> getData(WebTabbedPane tabbedPane)
Returns pane data stored inside the tabbed pane component.

Type Parameters:
T - document type
Parameters:
tabbedPane - tabbed pane component
Returns:
pane data stored inside the tabbed pane component

getData

public static <T extends DocumentData> SplitData<T> getData(WebSplitPane splitPane)
Returns split data stored inside the split pane component.

Type Parameters:
T - document type
Parameters:
splitPane - split pane component
Returns:
split data stored inside the split pane component

isEmptyPane

public static boolean isEmptyPane(StructureData data)
Returns whether the specified element is an empty pane or not.

Parameters:
data - structure element to check
Returns:
true if the specified element is an empty pane, false otherwise