echopointng.tabbedpane
Interface TabModel

All Known Implementing Classes:
AbstractTabModel, DefaultTabModel

public interface TabModel

TabModel is used to provide information on a collection of tabs, including their title, icons and the components that represent the tab's content.

This is designed to support "lazy" loading of the tabs content and TabbedPane will not call getComponentAt(index) until absolutely needed.


Method Summary
 void addChangeListener(ChangeListener listener)
          Adds listener as a listener to changes in the model.
 Component getTabAt(int index, boolean isSelected)
          This is called to retrieve a Component that represents the title of the tab at the specified index.
 Component getTabContentAt(int index)
          This is called to retrieve the Component that represents the contents of the tab at the specified index.
 TabImageRenderer getTabImageRenderer()
          This is called to return a TabImageRenderer which can be used to render the tabs as images.
 int indexOfTab(Component tabComponent)
          This is called to return the index of the component that makes up a tab.
 void releaseTabAt(int index)
          This is called when the content of a tab is no longer selected and hence resources associated with it may be released by the underlying TabModel.
 void removeChangeListener(ChangeListener listener)
          Removes listener as a listener to changes in the model.
 int size()
          This is called to return how many tabs are returned by this TabModel.
 

Method Detail

getTabImageRenderer

TabImageRenderer getTabImageRenderer()
This is called to return a TabImageRenderer which can be used to render the tabs as images. This can be null, in which case tabs cannot be rendered as images.

Returns:
a TabImageRenderer or null

size

int size()
This is called to return how many tabs are returned by this TabModel.

Returns:
an int greater than 0

getTabAt

Component getTabAt(int index,
                   boolean isSelected)
This is called to retrieve a Component that represents the title of the tab at the specified index.

The returned Component must be unique since it will become a child of the TabbedPane so it can be fully rendered.

If the returned Component has ActionListeners, such as a ButtonEx, then the parent TabbedPane wil attach itself so it can know when the Tab is pressed and hence has become selected. If not then it is the responbility of the component to inform that TabbedPane of the events that may affect tab selection.

This method may be called at any time and does not support lazy loading of the tabs (since it makes no sense as they must all be visible in order to select one).

Parameters:
index - - the index of the tab
isSelected - - true if the index is the current selected tab index.
Returns:
- the component of the tab at index or null if there isnt a component at that index

getTabContentAt

Component getTabContentAt(int index)
This is called to retrieve the Component that represents the contents of the tab at the specified index. This is designed to be lazy loaded, and hence will not be called until absolutely needed.

However once it has been called it may be called multiples times again so take care about how content Component s are dynamically created.

Parameters:
index - - the index of the tab
Returns:
- the component which makes up the tabs content at index or null if there isnt a component at the index

releaseTabAt

void releaseTabAt(int index)
This is called when the content of a tab is no longer selected and hence resources associated with it may be released by the underlying TabModel. The content Component will have been released from the TabbedPane when this call is made.

Parameters:
index - - the index of the tab to be released

indexOfTab

int indexOfTab(Component tabComponent)
This is called to return the index of the component that makes up a tab.

Parameters:
tabComponent - - the component to return and index for
Returns:
the index of the component or -1 if it cant be found

addChangeListener

void addChangeListener(ChangeListener listener)
Adds listener as a listener to changes in the model.


removeChangeListener

void removeChangeListener(ChangeListener listener)
Removes listener as a listener to changes in the model.