com.alee.extended.tab
Class DocumentData<C extends java.awt.Component>

java.lang.Object
  extended by com.alee.extended.tab.DocumentData<C>

public class DocumentData<C extends java.awt.Component>
extends java.lang.Object

This class represents basic data for single document opened in WebDocumentPane.

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

Field Summary
protected  java.awt.Color background
          Document tab background color.
protected  boolean closeable
          Whether this document is closeable or not.
protected  C component
          Document content.
protected  boolean draggable
          Whether this document is draggable or not.
protected  java.awt.Color foreground
          Document title foreground color.
protected  javax.swing.Icon icon
          Document icon.
protected  java.lang.String id
          Document ID.
protected  java.util.List<DocumentDataListener> listeners
          Document data listeners.
protected  java.lang.String title
          Document title.
 
Constructor Summary
DocumentData(java.lang.String id, javax.swing.Icon icon, C component)
          Constructs new document.
DocumentData(java.lang.String id, javax.swing.Icon icon, java.lang.String title, C component)
          Constructs new document.
DocumentData(java.lang.String id, javax.swing.Icon icon, java.lang.String title, java.awt.Color background, boolean closeable, boolean draggable, C component)
          Constructs new document.
DocumentData(java.lang.String id, javax.swing.Icon icon, java.lang.String title, java.awt.Color background, boolean closeable, C component)
          Constructs new document.
DocumentData(java.lang.String id, javax.swing.Icon icon, java.lang.String title, java.awt.Color background, C component)
          Constructs new document.
DocumentData(java.lang.String id, javax.swing.Icon icon, java.lang.String title, java.awt.Color foreground, java.awt.Color background, boolean closeable, boolean draggable, C component)
          Constructs new document.
DocumentData(java.lang.String id, java.lang.String title, C component)
          Constructs new document.
 
Method Summary
 void addListener(DocumentDataListener listener)
          Adds document data listener.
 void fireBackgroundChanged(java.awt.Color oldBackground, java.awt.Color newBackground)
          Inform about tab background changes.
 void fireContentChanged(java.awt.Component oldComponent, java.awt.Component newComponent)
          Informs about tab component changes.
 void fireTitleChanged()
          Informs about data changes which affects document tab view.
 java.lang.String getActualTitle()
          Returns translated document title.
 java.awt.Color getBackground()
          Returns document tab background color.
 C getComponent()
          Returns document content.
 java.awt.Color getForeground()
          Returns document title text foreground color.
 javax.swing.Icon getIcon()
          Returns document icon.
 java.lang.String getId()
          Returns document ID.
 java.util.List<DocumentDataListener> getListeners()
          Returns available document data listeners.
 java.lang.String getTitle()
          Returns document title.
 boolean isCloseable()
          Returns whether document is closeable or not.
 boolean isDraggable()
          Returns whether document is draggable or not.
 void removeListener(DocumentDataListener listener)
          Removes document data listener.
 void setBackground(java.awt.Color background)
          Sets document tab background color.
 void setCloseable(boolean closeable)
          Sets whether document is closeable or not.
 void setComponent(C component)
          Sets document content.
 void setDraggable(boolean draggable)
          Sets whether document is draggable or not.
 void setForeground(java.awt.Color foreground)
          Sets document title text foreground color
 void setIcon(javax.swing.Icon icon)
          Sets document icon.
 void setId(java.lang.String id)
          Sets document ID.
 void setTitle(java.lang.String title)
          Sets document title.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

listeners

protected transient java.util.List<DocumentDataListener> listeners
Document data listeners. Used to properly update WebDocumentPane view on document changes.


id

protected java.lang.String id
Document ID. This ID have to be unique only within single WebDocumentPane instance.


icon

protected javax.swing.Icon icon
Document icon. Used to display icon on the document tab.


title

protected java.lang.String title
Document title. This can be a plain text or a language key. Whether this is a plain text or a language key will be determined automatically, you only have to provide it.


foreground

protected java.awt.Color foreground
Document title foreground color. Used to color tab title text.


background

protected java.awt.Color background
Document tab background color. Used to color tab and tab content background.


closeable

protected boolean closeable
Whether this document is closeable or not. All documents are closeable by default, but you may change that.


draggable

protected boolean draggable
Whether this document is draggable or not. All documents are draggable by default, but you may change that.


component

protected C extends java.awt.Component component
Document content. A component that represents document tab content.

Constructor Detail

DocumentData

public DocumentData(java.lang.String id,
                    java.lang.String title,
                    C component)
Constructs new document.

Parameters:
id - document ID
title - document title
component - document content

DocumentData

public DocumentData(java.lang.String id,
                    javax.swing.Icon icon,
                    C component)
Constructs new document.

Parameters:
id - document ID
icon - document icon
component - document content

DocumentData

public DocumentData(java.lang.String id,
                    javax.swing.Icon icon,
                    java.lang.String title,
                    C component)
Constructs new document.

Parameters:
id - document ID
icon - document icon
title - document title
component - document content

DocumentData

public DocumentData(java.lang.String id,
                    javax.swing.Icon icon,
                    java.lang.String title,
                    java.awt.Color background,
                    C component)
Constructs new document.

Parameters:
id - document ID
icon - document icon
title - document title
background - document tab background color
component - document content

DocumentData

public DocumentData(java.lang.String id,
                    javax.swing.Icon icon,
                    java.lang.String title,
                    java.awt.Color background,
                    boolean closeable,
                    C component)
Constructs new document.

Parameters:
id - document ID
icon - document icon
title - document title
background - document tab background color
closeable - whether document is closeable or not
component - document content

DocumentData

public DocumentData(java.lang.String id,
                    javax.swing.Icon icon,
                    java.lang.String title,
                    java.awt.Color background,
                    boolean closeable,
                    boolean draggable,
                    C component)
Constructs new document.

Parameters:
id - document ID
icon - document icon
title - document title
background - document tab background color
closeable - whether document is closeable or not
draggable - whether document is draggable or not
component - document content

DocumentData

public DocumentData(java.lang.String id,
                    javax.swing.Icon icon,
                    java.lang.String title,
                    java.awt.Color foreground,
                    java.awt.Color background,
                    boolean closeable,
                    boolean draggable,
                    C component)
Constructs new document.

Parameters:
id - document ID
icon - document icon
title - document title
foreground - document title foreground color
background - document tab background color
closeable - whether document is closeable or not
draggable - whether document is draggable or not
component - document content
Method Detail

getId

public java.lang.String getId()
Returns document ID.

Returns:
document ID

setId

public void setId(java.lang.String id)
Sets document ID.

Parameters:
id - new document ID

getIcon

public javax.swing.Icon getIcon()
Returns document icon.

Returns:
document icon

setIcon

public void setIcon(javax.swing.Icon icon)
Sets document icon.

Parameters:
icon - new document icon

getTitle

public java.lang.String getTitle()
Returns document title.

Returns:
document title

getActualTitle

public java.lang.String getActualTitle()
Returns translated document title.

Returns:
translated document title

setTitle

public void setTitle(java.lang.String title)
Sets document title.

Parameters:
title - new document title

getForeground

public java.awt.Color getForeground()
Returns document title text foreground color.

Returns:
document title text foreground color

setForeground

public void setForeground(java.awt.Color foreground)
Sets document title text foreground color

Parameters:
foreground - document title text foreground color

getBackground

public java.awt.Color getBackground()
Returns document tab background color.

Returns:
document tab background color

setBackground

public void setBackground(java.awt.Color background)
Sets document tab background color.

Parameters:
background - document tab background color

isCloseable

public boolean isCloseable()
Returns whether document is closeable or not.

Returns:
true if document is closeable, false otherwise

setCloseable

public void setCloseable(boolean closeable)
Sets whether document is closeable or not.

Parameters:
closeable - whether document is closeable or not

isDraggable

public boolean isDraggable()
Returns whether document is draggable or not.

Returns:
true if document is draggable, false otherwise

setDraggable

public void setDraggable(boolean draggable)
Sets whether document is draggable or not.

Parameters:
draggable - whether document is draggable or not

getComponent

public C getComponent()
Returns document content.

Returns:
document content

setComponent

public void setComponent(C component)
Sets document content.

Parameters:
component - new document content

getListeners

public java.util.List<DocumentDataListener> getListeners()
Returns available document data listeners.

Returns:
available document data listeners

addListener

public void addListener(DocumentDataListener listener)
Adds document data listener.

Parameters:
listener - document data listener to add

removeListener

public void removeListener(DocumentDataListener listener)
Removes document data listener.

Parameters:
listener - document data listener to remove

fireTitleChanged

public void fireTitleChanged()
Informs about data changes which affects document tab view.


fireBackgroundChanged

public void fireBackgroundChanged(java.awt.Color oldBackground,
                                  java.awt.Color newBackground)
Inform about tab background changes.

Parameters:
oldBackground - previous background color
newBackground - new background color

fireContentChanged

public void fireContentChanged(java.awt.Component oldComponent,
                               java.awt.Component newComponent)
Informs about tab component changes.

Parameters:
oldComponent - previous tab content
newComponent - new tab content