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

java.lang.Object
  extended by com.alee.extended.tab.PaneData<T>
All Implemented Interfaces:
StructureData<T>, javax.swing.SwingConstants

public final class PaneData<T extends DocumentData>
extends java.lang.Object
implements StructureData<T>, javax.swing.SwingConstants

Data for single tabbed pane within document pane. It basically contains tabbed pane and opened documents list.

Author:
Mikle Garin
See Also:
How to use WebDocumentPane, WebDocumentPane

Field Summary
protected  java.util.List<T> data
          Pane documents.
protected  WebDocumentPane<T> documentPane
          WebDocumentPane this PaneData belongs to.
protected  DefaultFocusTracker focusTracker
          Pane focus tracker.
protected  WebTabbedPane tabbedPane
          Actual tabbed pane component.
 
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
 
Constructor Summary
PaneData(WebDocumentPane<T> documentPane)
          Constructs new PaneData for the specified WebDocumentPane.
 
Method Summary
 void activate()
          Activates this pane within WebDocumentPane.
 void add(T document)
          Adds new document into this pane.
 void add(T document, int index)
          Adds new document into this pane at the specified index.
 void checkSelection()
          Checks document pane selection.
 boolean close(int index)
          Closes document at the specified index in the active pane.
 boolean close(java.lang.String id)
          Closes document with the specified ID.
 boolean close(T document)
          Closes the specified document.
 void closeAll()
          Closes all document in this group.
 void closeOthers(T document)
          Closes all documents except the specified one.
 void closeSelected()
          Closes selected document.
 boolean contains(java.lang.String documentId)
          Returns whether document with the specified ID is in this pane or not.
 boolean contains(T document)
          Returns whether specified document is in this pane or not.
 int count()
          Returns pane documents count.
protected  javax.swing.JComponent createTabComponent(T document)
          Returns new tab component.
 PaneData<T> findClosestPane()
          Returns closest PaneData.
protected  DocumentDataListener<T> findDocumentListener(T document)
          Returns document listener attached by this pane data class.
 T get(int index)
          Returns pane document at the specified index.
 T get(java.lang.String id)
          Returns pane document with the specified ID.
 java.awt.Component getComponent()
          Returns actual component behind this structure element.
 java.util.List<T> getData()
          Returns pane documents.
 java.util.List<java.lang.String> getDocumentIds()
          Returns pane document IDs.
 WebDocumentPane getDocumentPane()
          Returns parent WebDocumentPane.
 T getSelected()
          Returns pane's selected document.
 int getSelectedIndex()
          Returns pane's selected document index.
 WebTabbedPane getTabbedPane()
          Returns actual tabbed pane component.
 int indexOf(java.lang.String id)
          Returns index of the document with the specified ID.
 int indexOf(T document)
          Returns index of the specified document.
 boolean isActive()
          Returns whether this pane is active one within WebDocumentPane or not.
 void merge()
          Merges this pane with its neighbour.
 void mergeAll()
          Merges all panes within WebDocumentPane.
 void mergeIfEmpty()
          Merges this pane with its neighbour if it is empty.
 void open(T document)
          Opens document in this pane.
 boolean remove(int index)
          Closes document at the specified index in the active pane.
 boolean remove(java.lang.String id)
          Closes document with the specified ID.
 boolean remove(T document)
          Closes the specified document.
 void rotate()
          Changes parent split orientation if this pane is located within a split.
 void selectNext()
          Increments selected document index inside the active pane.
 void selectPrevious()
          Decrements selected document index inside the active pane.
 void setDocumentPane(WebDocumentPane<T> documentPane)
          Sets parent WebDocumentPane reference.
 void setSelected(int index)
          Sets selected document index.
 void setSelected(java.lang.String id)
          Sets pane's selected document ID.
 void setSelected(T document)
          Sets selected document.
 void split(T document, int direction)
          Splits the specified document into a separate pane.
 void swap()
          Changes parent split sides if this pane is located within a split.
 void updateTabBackground(T document)
          Updates tab background for the specified document.
protected  void updateTabbedPaneCustomizer(WebDocumentPane<T> documentPane)
          Updates tabbed pane customizer.
 void updateTabComponent(T document)
          Updates tab view for the specified document.
 void updateTabTitleComponent(T document)
          Updates tab title component for the specified document.
 void updateTabTitleComponents()
          Updates all tab title components.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

documentPane

protected WebDocumentPane<T extends DocumentData> documentPane
WebDocumentPane this PaneData belongs to. Referenced to properly act when WebDocumentPane is required to retrieve customizers or perform any operation.


tabbedPane

protected final WebTabbedPane tabbedPane
Actual tabbed pane component.


focusTracker

protected final DefaultFocusTracker focusTracker
Pane focus tracker.


data

protected java.util.List<T extends DocumentData> data
Pane documents.

Constructor Detail

PaneData

public PaneData(WebDocumentPane<T> documentPane)
Constructs new PaneData for the specified WebDocumentPane.

Parameters:
documentPane - parent WebDocumentPane
Method Detail

checkSelection

public void checkSelection()
Checks document pane selection.


updateTabbedPaneCustomizer

protected void updateTabbedPaneCustomizer(WebDocumentPane<T> documentPane)
Updates tabbed pane customizer.

Parameters:
documentPane - parent WebDocumentPane

getComponent

public java.awt.Component getComponent()
Returns actual component behind this structure element.

Specified by:
getComponent in interface StructureData<T extends DocumentData>
Returns:
actual component behind this structure element

findClosestPane

public PaneData<T> findClosestPane()
Returns closest PaneData. Used to provide default active pane.

Specified by:
findClosestPane in interface StructureData<T extends DocumentData>
Returns:
closest PaneData

getDocumentPane

public WebDocumentPane getDocumentPane()
Returns parent WebDocumentPane.

Returns:
parent WebDocumentPane

setDocumentPane

public void setDocumentPane(WebDocumentPane<T> documentPane)
Sets parent WebDocumentPane reference.

Parameters:
documentPane - parent WebDocumentPane reference

getTabbedPane

public WebTabbedPane getTabbedPane()
Returns actual tabbed pane component.

Returns:
actual tabbed pane component

getData

public java.util.List<T> getData()
Returns pane documents.

Returns:
pane documents

getDocumentIds

public java.util.List<java.lang.String> getDocumentIds()
Returns pane document IDs.

Returns:
pane document IDs

count

public int count()
Returns pane documents count.

Returns:
pane documents count

contains

public boolean contains(T document)
Returns whether specified document is in this pane or not.

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

contains

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

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

add

public void add(T document)
Adds new document into this pane.

Parameters:
document - document to add

add

public void add(T document,
                int index)
Adds new document into this pane at the specified index.

Parameters:
document - document to add
index - index to add at

createTabComponent

protected javax.swing.JComponent createTabComponent(T document)
Returns new tab component.

Parameters:
document - document to create tab component for
Returns:
new tab component

updateTabTitleComponents

public void updateTabTitleComponents()
Updates all tab title components.


updateTabTitleComponent

public void updateTabTitleComponent(T document)
Updates tab title component for the specified document.

Parameters:
document - document to update tab title component for

updateTabBackground

public void updateTabBackground(T document)
Updates tab background for the specified document.

Parameters:
document - document to update tab background for

updateTabComponent

public void updateTabComponent(T document)
Updates tab view for the specified document.

Parameters:
document - document to update tab view for

open

public void open(T document)
Opens document in this pane. Unlike add method this one informs listeners about opened document.

Parameters:
document - document to open

get

public T get(int index)
Returns pane document at the specified index.

Parameters:
index - document index
Returns:
pane document at the specified index

get

public T get(java.lang.String id)
Returns pane document with the specified ID.

Parameters:
id - document ID
Returns:
pane document with the specified ID

getSelected

public T getSelected()
Returns pane's selected document.

Returns:
pane's selected document

getSelectedIndex

public int getSelectedIndex()
Returns pane's selected document index.

Returns:
pane's selected document index

setSelected

public void setSelected(java.lang.String id)
Sets pane's selected document ID.

Parameters:
id - ID of the document to select

setSelected

public void setSelected(T document)
Sets selected document.

Parameters:
document - document to select

setSelected

public void setSelected(int index)
Sets selected document index.

Parameters:
index - index of the document to select

selectPrevious

public void selectPrevious()
Decrements selected document index inside the active pane.


selectNext

public void selectNext()
Increments selected document index inside the active pane.


indexOf

public int indexOf(java.lang.String id)
Returns index of the document with the specified ID.

Parameters:
id - document ID
Returns:
index of the document with the specified ID

indexOf

public int indexOf(T document)
Returns index of the specified document.

Parameters:
document - document
Returns:
index of the specified document

remove

public boolean remove(int index)
Closes document at the specified index in the active pane.

Parameters:
index - index of the document to close

remove

public boolean remove(java.lang.String id)
Closes document with the specified ID.

Parameters:
id - ID of the document to close

remove

public boolean remove(T document)
Closes the specified document.

Parameters:
document - document to close

findDocumentListener

protected DocumentDataListener<T> findDocumentListener(T document)
Returns document listener attached by this pane data class.

Parameters:
document - listened document
Returns:
document listener attached by this pane data class

closeAll

public void closeAll()
Closes all document in this group.


close

public boolean close(int index)
Closes document at the specified index in the active pane.

Parameters:
index - index of the document to close

close

public boolean close(java.lang.String id)
Closes document with the specified ID.

Parameters:
id - ID of the document to close

close

public boolean close(T document)
Closes the specified document.

Parameters:
document - document to close

closeOthers

public void closeOthers(T document)
Closes all documents except the specified one.

Parameters:
document - document to keep opened

closeSelected

public void closeSelected()
Closes selected document.


activate

public void activate()
Activates this pane within WebDocumentPane.


isActive

public boolean isActive()
Returns whether this pane is active one within WebDocumentPane or not.

Returns:
true if this pane is active one within WebDocumentPane, false otherwise

split

public void split(T document,
                  int direction)
Splits the specified document into a separate pane.

Parameters:
document - document to split
direction - split direction

mergeIfEmpty

public void mergeIfEmpty()
Merges this pane with its neighbour if it is empty.


rotate

public void rotate()
Changes parent split orientation if this pane is located within a split.


swap

public void swap()
Changes parent split sides if this pane is located within a split.


merge

public void merge()
Merges this pane with its neighbour.


mergeAll

public void mergeAll()
Merges all panes within WebDocumentPane.