站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc (Current Development Version)

TabDataModel (Tab Control) - NetBeans API Javadoc (Current Development Version)

org.netbeans.swing.tabcontrol 1.8

org.netbeans.swing.tabcontrol
Interface TabDataModel

All Known Subinterfaces:
SlideBarDataModel
All Known Implementing Classes:
DefaultTabDataModel, SlideBarDataModel.Impl

public interface TabDataModel

A data model representing a set of tabs and their associated data. Allows for atomic add/remove/modification operations any of which are guaranteed to fire only one event on completion. Note that for modification operations (setText(), setIcon, setIconsAndText, no event will be fired unless data is actually changed - calling these methods with the same values that the tabs already have will not generate events. The isWidthChanged method for generated events will return true for events which can affect the area needed to display a tab (such as text or icon width changes).

Note: The standard UI implementations which use this model make no provisions for thread-safety. All changes fired from a TabDataModel should happen on the AWT event thread.


Method Summary
 void addChangeListener(ChangeListener listener)
          The model will fire a change event whenever a modification occurs that could require a repaint.
 void addComplexListDataListener(ComplexListDataListener listener)
          Add a data listener
 void addTab(int index, TabData data)
          Add a single tab at the specified location
 void addTabs(int[] indices, TabData[] data)
          Add the specified tabs at the specified indices
 void addTabs(int start, TabData[] data)
          Atomically add a set of tabs at the specified index
 TabData getTab(int index)
          Retrieve data for a given tab
 List<TabData> getTabs()
          Retrieve all the tab data contained in the model as a List
 int indexOf(TabData td)
          Fetch the index of a tab matching the passed TabData object.
 void removeChangeListener(ChangeListener listener)
          The model will fire a change event whenever a modification occurs that could require a repaint.
 void removeComplexListDataListener(ComplexListDataListener listener)
          Remove a data listener
 void removeTab(int index)
          Remove the tab at the specified index
 void removeTabs(int[] indices)
          Remove the tabs at the specified indices
 void removeTabs(int start, int end)
          Remove a range of tabs
 void setIcon(int[] indices, Icon[] icons)
          Atomically set the icons for a set of indices.
 void setIcon(int index, Icon i)
          Set the icon for a given tab.
 void setIconsAndText(int[] indices, String[] txt, Icon[] icons)
          Atomically set the icons and text simultaneously for more than one tab.
 void setTab(int index, TabData data)
          Set the tab data for a given tab to the passed value
 void setTabs(TabData[] data)
          Replace the entire set of tabs represented by the model
 void setText(int[] indices, String[] txt)
          Atomically set the text for a number of tabs.
 void setText(int index, String txt)
          Set the text for a given tab.
 int size()
          The number of tabs contained in the model.
 

Method Detail

size

int size()
The number of tabs contained in the model.

Returns:
The number of tabs

getTab

TabData getTab(int index)
Retrieve data for a given tab

Parameters:
index - The index for which to retrieve tab data
Returns:
Data describing the tab

setTab

void setTab(int index,
            TabData data)
Set the tab data for a given tab to the passed value

Parameters:
index - The index of the tab to be changed
data - The new tab data for this index

setIcon

void setIcon(int index,
             Icon i)
Set the icon for a given tab. Will trigger a list data event, and the resulting event's widthChanged property will be set appropriately if the displayed width has changed.

Parameters:
index - The index to set the icon for
i - The icon to use for the tab

setText

void setText(int index,
             String txt)
Set the text for a given tab. Triggers a list data event.

Parameters:
index - The index of the tab
txt - The replacement text

setIcon

void setIcon(int[] indices,
             Icon[] icons)
Atomically set the icons for a set of indices. Fires a single list data event with the indexes of any tabs in which the data was actually changed. If the passed data perfectly match the existing data, no event will be fired.

Parameters:
indices - The indices for which the corresponding icons should be changed
icons - The replacement icons. This array must be the same length as the indices parameter

setText

void setText(int[] indices,
             String[] txt)
Atomically set the text for a number of tabs. Fires a single list data event with the indexes of any tabs in which the data was actually changed. If the passed data perfectly match the existing data, no event will be fired.1

Parameters:
indices - The indices of the tabs to change
txt - The text values for the tabs

setIconsAndText

void setIconsAndText(int[] indices,
                     String[] txt,
                     Icon[] icons)
Atomically set the icons and text simultaneously for more than one tab. Fires a single list data event with the indexes of any tabs in which the data was actually changed. If the passed data perfectly match the existing data, no event will be fired.1

Parameters:
indices - The indices which should have their data changed
txt - The replacement text values corresponding to the passed indices
icons - The replacement icons corresponding to the passed indices

addTabs

void addTabs(int start,
             TabData[] data)
Atomically add a set of tabs at the specified index

Parameters:
start - The insert point for new tabs
data - The tab data to insert

removeTab

void removeTab(int index)
Remove the tab at the specified index

Parameters:
index - The tab index

addTabs

void addTabs(int[] indices,
             TabData[] data)
Add the specified tabs at the specified indices

Parameters:
indices - The indices at which tabs will be added
data - The tabs to add, in order corresponding to the indices parameter

setTabs

void setTabs(TabData[] data)
Replace the entire set of tabs represented by the model


removeTabs

void removeTabs(int[] indices)
Remove the tabs at the specified indices

Parameters:
indices - The indices at which tabs should be removed

removeTabs

void removeTabs(int start,
                int end)
Remove a range of tabs

Parameters:
start - the start index
end - the end index

addTab

void addTab(int index,
            TabData data)
Add a single tab at the specified location


getTabs

List<TabData> getTabs()
Retrieve all the tab data contained in the model as a List

Returns:
a List of TabData objects

indexOf

int indexOf(TabData td)
Fetch the index of a tab matching the passed TabData object. Note that the tooltip property of the passed TabData object is not used to test equality. See also org.netbeans.core.windows.ui.TabData.equals()


addComplexListDataListener

void addComplexListDataListener(ComplexListDataListener listener)
Add a data listener

Parameters:
listener - The listener

removeComplexListDataListener

void removeComplexListDataListener(ComplexListDataListener listener)
Remove a data listener

Parameters:
listener - The listener

addChangeListener

void addChangeListener(ChangeListener listener)
The model will fire a change event whenever a modification occurs that could require a repaint. This method is only here for the prototype - eventually the UI delegate should listen for ComplexDataNN events and optimize repaints based on the actual areas affected.


removeChangeListener

void removeChangeListener(ChangeListener listener)
The model will fire a change event whenever a modification occurs that could require a repaint. This method is only here for the prototype - eventually the UI delegate should listen for ComplexDataNN events and optimize repaints based on the actual areas affected.


org.netbeans.swing.tabcontrol 1.8

Built on May 28 2007.  |  Portions Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.