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

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

org.netbeans.swing.tabcontrol 1.8

org.netbeans.swing.tabcontrol.plaf
Class BasicSlidingTabDisplayerUI

java.lang.Object
  extended by javax.swing.plaf.ComponentUI
      extended by org.netbeans.swing.tabcontrol.TabDisplayerUI
          extended by org.netbeans.swing.tabcontrol.plaf.AbstractTabDisplayerUI
              extended by org.netbeans.swing.tabcontrol.plaf.BasicSlidingTabDisplayerUI

public final class BasicSlidingTabDisplayerUI
extends AbstractTabDisplayerUI

Common UI for sliding tabs. Simply uses JToggleButtons for displayers, since the contents of the data model are not expected to change often, and no scrolling behavior needs to be supported for the tabs area.

Note that the "sliding" is provided by an instance of FxProvider provided in the DefaultTabbedContainerUI, not here.

To change the appearance of the buttons, simply provide a subclass of SlidingTabDisplayerButtonUI via UIDefaults. This class is final.


Nested Class Summary
 class BasicSlidingTabDisplayerUI.IndexButton
          JToggleButton subclass which maps to an index in the data model, and displays whatever the content of the data model at that index is.
protected  class BasicSlidingTabDisplayerUI.SlidingPropertyChangeListener
           
 
Nested classes/interfaces inherited from class org.netbeans.swing.tabcontrol.plaf.AbstractTabDisplayerUI
AbstractTabDisplayerUI.DisplayerHierarchyListener, AbstractTabDisplayerUI.DisplayerPropertyChangeListener, AbstractTabDisplayerUI.ModelListener
 
Field Summary
 
Fields inherited from class org.netbeans.swing.tabcontrol.plaf.AbstractTabDisplayerUI
componentListener, hierarchyListener, layoutModel, modelListener, mouseListener, propertyChangeListener, selectionListener
 
Fields inherited from class org.netbeans.swing.tabcontrol.TabDisplayerUI
displayer, selectionModel
 
Constructor Summary
BasicSlidingTabDisplayerUI(TabDisplayer displayer)
          Creates a new instance of BasicSlidingTabDisplayerUI
 
Method Summary
 void cancelRequestAttention(int tab)
           
protected  Font createFont()
           
 Image createImageOfTab(int index)
          Paints the rectangle occupied by a tab into an image and returns the result
protected  TabLayoutModel createLayoutModel()
          Not used so much to determine layout as to calculate preferred sizes here
protected  MouseListener createMouseListener()
          Create the mouse listener that will be responsible for changing the selection on mouse events, triggering repaints on mouse enter/exit/motion, etc.
protected  ChangeListener createSelectionListener()
          Create a ChangeListener to be attached to the selection model.
static ComponentUI createUI(JComponent c)
           
 Icon getButtonIcon(int buttonId, int buttonState)
           
 Polygon getExactTabIndication(int index)
          Get a shape representing the exact outline of the numbered tab.
 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.
 Dimension getMinimumSize(JComponent c)
           
 Dimension getPreferredSize(JComponent c)
           
 Rectangle getTabRect(int index, Rectangle destination)
          Configure the passed rectangle with the shape of the tab at the given index.
protected  void install()
          Called after creating the layout model, selection model and mouse listener, but before installing the mouse listener and selection model.
protected  void modelChanged()
          Convenience method called by ModelListener.stateChanged() when the data model changes.
 void requestAttention(int tab)
           
 int tabForCoordinate(Point p)
          Returns the index of the tab at the passed point, or -1 if no tab is at that location.
protected  void uninstall()
          Called after uninstalling the mouse listener and selection model, but before references to that or the layout model or displayer have been nulled.
 
Methods inherited from class org.netbeans.swing.tabcontrol.plaf.AbstractTabDisplayerUI
createComponentListener, createHierarchyListener, createModelListener, createPropertyChangeListener, createSelectionModel, dropIndexOfPoint, installListeners, installUI, registerShortcuts, toDropPoint, uninstallListeners, uninstallUI, unregisterShortcuts
 
Methods inherited from class org.netbeans.swing.tabcontrol.TabDisplayerUI
makeTabVisible, postTabAction, shouldPerformAction
 
Methods inherited from class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, getMaximumSize, paint, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicSlidingTabDisplayerUI

public BasicSlidingTabDisplayerUI(TabDisplayer displayer)
Creates a new instance of BasicSlidingTabDisplayerUI

Method Detail

createUI

public static ComponentUI createUI(JComponent c)

install

protected void install()
Description copied from class: AbstractTabDisplayerUI
Called after creating the layout model, selection model and mouse listener, but before installing the mouse listener and selection model. Subclasses may use this method to do anything they need to do at ui install time.

Overrides:
install in class AbstractTabDisplayerUI

createFont

protected Font createFont()
Overrides:
createFont in class AbstractTabDisplayerUI

uninstall

protected void uninstall()
Description copied from class: AbstractTabDisplayerUI
Called after uninstalling the mouse listener and selection model, but before references to that or the layout model or displayer have been nulled. Subclasses may use this method to do any cleanup they need to do at uninstall time.

Overrides:
uninstall in class AbstractTabDisplayerUI

getPreferredSize

public Dimension getPreferredSize(JComponent c)
Overrides:
getPreferredSize in class ComponentUI

getMinimumSize

public Dimension getMinimumSize(JComponent c)
Overrides:
getMinimumSize in class ComponentUI

createLayoutModel

protected TabLayoutModel createLayoutModel()
Not used so much to determine layout as to calculate preferred sizes here

Specified by:
createLayoutModel in class AbstractTabDisplayerUI

createMouseListener

protected MouseListener createMouseListener()
Description copied from class: AbstractTabDisplayerUI
Create the mouse listener that will be responsible for changing the selection on mouse events, triggering repaints on mouse enter/exit/motion, etc. The installation code will detect if the resulting listener also implements MouseWheelListener or MouseMotionListener, and if so, will add it as such.

Specified by:
createMouseListener in class AbstractTabDisplayerUI
Returns:
A mouse listener, which may also implement MouseMotionListener and/or MouseWheelListener

requestAttention

public void requestAttention(int tab)
Specified by:
requestAttention in class TabDisplayerUI

cancelRequestAttention

public void cancelRequestAttention(int tab)
Specified by:
cancelRequestAttention in class TabDisplayerUI

createSelectionListener

protected ChangeListener createSelectionListener()
Description copied from class: AbstractTabDisplayerUI
Create a ChangeListener to be attached to the selection model. This listener will be responsible for repainting the appropriate areas on selection changes.

Specified by:
createSelectionListener in class AbstractTabDisplayerUI
Returns:
A changeListener that will be notified of selection changes

getExactTabIndication

public Polygon getExactTabIndication(int index)
Description copied from class: TabDisplayerUI
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.

Specified by:
getExactTabIndication in class TabDisplayerUI

getInsertTabIndication

public Polygon getInsertTabIndication(int index)
Description copied from class: TabDisplayerUI
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.

Specified by:
getInsertTabIndication in class TabDisplayerUI
Returns:
Shape representing feedback shape

getTabRect

public Rectangle getTabRect(int index,
                            Rectangle destination)
Description copied from class: TabDisplayerUI
Configure the passed rectangle with the shape of the tab at the given index.

Specified by:
getTabRect in class TabDisplayerUI

tabForCoordinate

public int tabForCoordinate(Point p)
Description copied from class: TabDisplayerUI
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.

Specified by:
tabForCoordinate in class TabDisplayerUI

createImageOfTab

public Image createImageOfTab(int index)
Paints the rectangle occupied by a tab into an image and returns the result

Overrides:
createImageOfTab in class TabDisplayerUI
Parameters:
index - A tab index

modelChanged

protected void modelChanged()
Description copied from class: AbstractTabDisplayerUI
Convenience method called by ModelListener.stateChanged() when the data model changes. Eliminates the need for custom subclasses where the only purpose is to discard some small amount of cached data. The default implementation simply calls displayer.repaint().

Overrides:
modelChanged in class AbstractTabDisplayerUI

getButtonIcon

public Icon getButtonIcon(int buttonId,
                          int buttonState)
Specified by:
getButtonIcon in class TabDisplayerUI

org.netbeans.swing.tabcontrol 1.8

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