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

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

org.netbeans.swing.tabcontrol 1.8

org.netbeans.swing.tabcontrol
Class TabbedContainerUI

java.lang.Object
  extended by javax.swing.plaf.ComponentUI
      extended by org.netbeans.swing.tabcontrol.TabbedContainerUI
Direct Known Subclasses:
DefaultTabbedContainerUI

public abstract class TabbedContainerUI
extends ComponentUI

Basic UI for tabbed containers. Note this is distinct from the UI for the embedded tab displayer component - that where all the interesting painting logic is.

To provide an implementation of TabbedContainerUI, it is a far better idea to subclass AbstractTabbedContainerUI, BasicTabbedContainerUI, or BasicScrollingTabbedContainerUI.


Field Summary
protected  TabbedContainer container
          The TabbedContainer this instance is acting as a ui delegate for.
 
Constructor Summary
TabbedContainerUI(TabbedContainer container)
          Creates a new instance of TabbedContainerUI
 
Method Summary
protected abstract  void cancelRequestAttention(int tab)
           
abstract  Image createImageOfTab(int idx)
          Create an image suitable for use in drag and drop operations, of a tab
abstract  int dropIndexOfPoint(Point p)
          Index at which a tab would be inserted if a suitable object were dropped at this point.
abstract  Rectangle getContentArea()
          Get a rectangle matching the area in which content is displayed
abstract  Polygon getExactTabIndication(int idx)
          Get a polygon matching the shape of the tab
abstract  Polygon getInsertTabIndication(int idx)
          Get a polygon indicating the insertion of a tab before the passed index, unless the index is equal to the model size, in which case it will return an indication for inserting a tab at the end.
abstract  SingleSelectionModel getSelectionModel()
          Get the selection model that tracks and determines which tab is selected.
abstract  Rectangle getTabRect(int tab, Rectangle r)
          Get the bounds of a tab.
abstract  Rectangle getTabsArea()
          Get a rectangle matching the area in which tabs are displayed
 void installUI(JComponent c)
           
abstract  boolean isShowCloseButton()
           
abstract  void makeTabVisible(int index)
          Make a tab visible.
protected abstract  void requestAttention(int tab)
           
abstract  void setShowCloseButton(boolean val)
           
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)
          Get the tab at a given point in the coordinate space of the container.
protected  boolean uichange()
          This method is called if TabbedContainer.updateUI() gets called after a UI delegate has been installed (in other words, the user did something like switch look and feels or switch the Windows desktop theme).
 
Methods inherited from class javax.swing.plaf.ComponentUI
contains, createUI, getAccessibleChild, getAccessibleChildrenCount, getMaximumSize, getMinimumSize, getPreferredSize, paint, uninstallUI, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

container

protected TabbedContainer container
The TabbedContainer this instance is acting as a ui delegate for. do not alter the value in this field.

Constructor Detail

TabbedContainerUI

public TabbedContainerUI(TabbedContainer container)
Creates a new instance of TabbedContainerUI

Method Detail

installUI

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

uichange

protected boolean uichange()
This method is called if TabbedContainer.updateUI() gets called after a UI delegate has been installed (in other words, the user did something like switch look and feels or switch the Windows desktop theme).

Normally, the only UI delegate that exists for TabbedContainer is DefaultTabbedContainerUI, so it makes no sense to replace one with another, since they do the same thing.

However, this method can be used to update the tab displayer component's UI. Subclasses are expected to override this method to call updateUI() on the displayer, or do whatever is appropriate to ensure that the UI will look right after the change - or to return true from this method, in which the entire UI delegate for the tabbed container will be replaced.

Returns:
false

getTabRect

public abstract Rectangle getTabRect(int tab,
                                     Rectangle r)
Get the bounds of a tab. Note that for non-rectangular tabs this may not correspond exactly to the area in which it will respond to mouse clicks.

Parameters:
tab - A tab index
r - A rectangle to configure with the information, or null
Returns:
The passed rectangle, or a new one if null was passed

tabForCoordinate

public abstract int tabForCoordinate(Point p)
Get the tab at a given point in the coordinate space of the container.

Parameters:
p - A point
Returns:
The tab index at this point, or -1 if no tab

makeTabVisible

public abstract void makeTabVisible(int index)
Make a tab visible. No-op except in the case of scrolling tabs, in which case the tab may be scrolled offscreen.

Parameters:
index - A tab index

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

getSelectionModel

public abstract SingleSelectionModel getSelectionModel()
Get the selection model that tracks and determines which tab is selected.

Returns:
The selection model (in the default implementation, this is the selection model of the embedded tab displayer)

createImageOfTab

public abstract Image createImageOfTab(int idx)
Create an image suitable for use in drag and drop operations, of a tab


getExactTabIndication

public abstract Polygon getExactTabIndication(int idx)
Get a polygon matching the shape of the tab


getInsertTabIndication

public abstract Polygon getInsertTabIndication(int idx)
Get a polygon indicating the insertion of a tab before the passed index, unless the index is equal to the model size, in which case it will return an indication for inserting a tab at the end.

Parameters:
idx - A tab index
Returns:
A shape representing the shape of the tab as it is displayed onscreen, in the coordinate space of the displayer

getContentArea

public abstract Rectangle getContentArea()
Get a rectangle matching the area in which content is displayed


getTabsArea

public abstract Rectangle getTabsArea()
Get a rectangle matching the area in which tabs are displayed


dropIndexOfPoint

public abstract int dropIndexOfPoint(Point p)
Index at which a tab would be inserted if a suitable object were dropped at this point.

Parameters:
p - A point
Returns:
A tab index which may be equal to the size of the model (past the last tab index) if the tab should be inserted at the end.

setShowCloseButton

public abstract void setShowCloseButton(boolean val)

isShowCloseButton

public abstract boolean isShowCloseButton()

requestAttention

protected abstract void requestAttention(int tab)

cancelRequestAttention

protected abstract void cancelRequestAttention(int tab)

org.netbeans.swing.tabcontrol 1.8

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