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

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

org.netbeans.swing.tabcontrol 1.8

org.netbeans.swing.tabcontrol
Class TabDisplayerUI

java.lang.Object
  extended by javax.swing.plaf.ComponentUI
      extended by org.netbeans.swing.tabcontrol.TabDisplayerUI
Direct Known Subclasses:
AbstractTabDisplayerUI, AbstractViewTabDisplayerUI

public abstract class TabDisplayerUI
extends ComponentUI

The basic UI of a tab displayer component. Defines the API of the UI for TabDisplayers, which may be called by TabDisplayer.

See Also:
AbstractTabDisplayerUI, BasicTabDisplayerUI

Field Summary
protected  TabDisplayer displayer
           
protected  SingleSelectionModel selectionModel
           
 
Constructor Summary
protected TabDisplayerUI(TabDisplayer displayer)
          Creates a new instance of TabDisplayerUI
 
Method Summary
protected abstract  void cancelRequestAttention(int tab)
           
 Image createImageOfTab(int index)
          Returns an image suitable for use in drag and drop operations, representing the tab at this index.
protected abstract  SingleSelectionModel createSelectionModel()
          Create the selection model which will handle selection for the TabDisplayer.
abstract  int dropIndexOfPoint(Point p)
          The index a tab would acquire if dropped at a given point
abstract  Icon getButtonIcon(int buttonId, int buttonState)
           
abstract  Polygon getExactTabIndication(int index)
          Get a shape representing the exact outline of the numbered tab.
abstract  Polygon getInsertTabIndication(int index)
          Get a shape representing the area of visual feedback during a drag and drop operation, which represents where a tab will be inserted if a drop operation is performed over the indicated tab.
abstract  Rectangle getTabRect(int index, Rectangle destination)
          Configure the passed rectangle with the shape of the tab at the given index.
 void installUI(JComponent c)
           
 void makeTabVisible(int index)
          Instruct the UI to ensure that the tab at the given index is visible.
 void postTabAction(TabActionEvent e)
           
abstract  void registerShortcuts(JComponent comp)
           
protected abstract  void requestAttention(int tab)
           
protected  boolean shouldPerformAction(String command, int tab, MouseEvent event)
          Allows ActionListeners attached to the container to determine if the event should be acted on.
abstract  int tabForCoordinate(Point p)
          Returns the index of the tab at the passed point, or -1 if no tab is at that location.
 void uninstallUI(JComponent c)
           
abstract  void unregisterShortcuts(JComponent comp)
           
 
Methods inherited from class javax.swing.plaf.ComponentUI
contains, createUI, getAccessibleChild, getAccessibleChildrenCount, getMaximumSize, getMinimumSize, getPreferredSize, paint, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

selectionModel

protected SingleSelectionModel selectionModel

displayer

protected final TabDisplayer displayer
Constructor Detail

TabDisplayerUI

protected TabDisplayerUI(TabDisplayer displayer)
Creates a new instance of TabDisplayerUI

Method Detail

installUI

public void installUI(JComponent c)
Overrides:
installUI in class ComponentUI

uninstallUI

public void uninstallUI(JComponent c)
Overrides:
uninstallUI in class ComponentUI

getExactTabIndication

public abstract Polygon getExactTabIndication(int index)
Get a shape representing the exact outline of the numbered tab. The implementations in the package will return instances of EqualPolygon from this method; other implementations may return what they want, but for performance reasons, it is highly desirable that the shape object returned honor equals() and hashCode(), as there are significant optimizations in NetBeans' drag and drop support that depend on this.


getInsertTabIndication

public abstract Polygon getInsertTabIndication(int index)
Get a shape representing the area of visual feedback during a drag and drop operation, which represents where a tab will be inserted if a drop operation is performed over the indicated tab.

The implementations in the package will return instances of EqualPolygon from this method; other implementations may return what they want, but for performance reasons, it is highly desirable that the shape object returned honor equals() and hashCode(), as there are significant optimizations in NetBeans' drag and drop support that depened on this.

Returns:
Shape representing feedback shape

tabForCoordinate

public abstract int tabForCoordinate(Point p)
Returns the index of the tab at the passed point, or -1 if no tab is at that location. Note that this method may return -1 for coordinates which are within a tab as returned by getTabRect(), but are not within the visible shape of the tab as the UI paints it.


getTabRect

public abstract Rectangle getTabRect(int index,
                                     Rectangle destination)
Configure the passed rectangle with the shape of the tab at the given index.


createImageOfTab

public Image createImageOfTab(int index)
Returns an image suitable for use in drag and drop operations, representing the tab at this index. The default implementation returns null.

Parameters:
index - A tab index
Throws:
IllegalArgumentException - if no tab is at the passed index

createSelectionModel

protected abstract SingleSelectionModel createSelectionModel()
Create the selection model which will handle selection for the TabDisplayer. SPI method located here because TabDisplayer.setSelectionModel is package private.


shouldPerformAction

protected final boolean shouldPerformAction(String command,
                                            int tab,
                                            MouseEvent event)
Allows ActionListeners attached to the container to determine if the event should be acted on. Delegates to displayer.postActionEvent(). This method will create a TabActionEvent with the passed string as an action command, and cause the displayer to fire this event. It will return true if no listener on the displayer consumed the TabActionEvent; consuming the event is the way a listener can veto a change, or provide special handling for it.

Parameters:
command - The action command - this should be TabDisplayer.COMMAND_SELECT or TabDisplayer.COMMAND_CLOSE, but private contracts between custom UIs and components are also an option.
tab - The index of the tab upon which the action should act, or -1 if non-applicable
event - A mouse event which initiated the action, or null
Returns:
true if the event posted was not consumed by any listener

makeTabVisible

public void makeTabVisible(int index)
Instruct the UI to ensure that the tab at the given index is visible. Some UIs allow scrolling or otherwise hiding tabs. The default implementation is a no-op.

Parameters:
index - The index of the tab that should be made visible, which should be within the range of 0 to the count of tabs in the model

dropIndexOfPoint

public abstract int dropIndexOfPoint(Point p)
The index a tab would acquire if dropped at a given point

Parameters:
p - A point
Returns:
An index which may be equal to the size of the data model

registerShortcuts

public abstract void registerShortcuts(JComponent comp)

unregisterShortcuts

public abstract void unregisterShortcuts(JComponent comp)

requestAttention

protected abstract void requestAttention(int tab)

cancelRequestAttention

protected abstract void cancelRequestAttention(int tab)

getButtonIcon

public abstract Icon getButtonIcon(int buttonId,
                                   int buttonState)

postTabAction

public void postTabAction(TabActionEvent e)

org.netbeans.swing.tabcontrol 1.8

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