public abstract class TabDisplayerUI extends ComponentUI
AbstractTabDisplayerUI
,
BasicTabDisplayerUI
Modifier and Type | Field and Description |
---|---|
protected TabDisplayer |
displayer |
protected SingleSelectionModel |
selectionModel |
Modifier | Constructor and Description |
---|---|
protected |
TabDisplayerUI(TabDisplayer displayer)
Creates a new instance of TabDisplayerUI
|
Modifier and Type | Method and Description |
---|---|
void |
autoscroll(Point location)
Scroll the tabs when something is dragged over the TabDisplayer.
|
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
|
Insets |
getAutoscrollInsets() |
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.
|
protected Font |
getTxtFont() |
void |
installUI(JComponent c) |
boolean |
isTabBusy(int tabIndex)
Check if the given tab is busy and should be painted in a special way.
|
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 void |
setAttentionHighlight(int tab,
boolean highlight)
Turn tab highlight on/off
|
protected boolean |
shouldPerformAction(String command,
int tab,
MouseEvent event)
Allows ActionListeners attached to the container to determine if the
event should be acted on.
|
protected boolean |
shouldPerformAction(TabActionEvent e)
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) |
contains, createUI, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehavior, getMaximumSize, getMinimumSize, getPreferredSize, paint, update
protected SingleSelectionModel selectionModel
protected final TabDisplayer displayer
protected TabDisplayerUI(TabDisplayer displayer)
public void installUI(JComponent c)
installUI
in class ComponentUI
public void uninstallUI(JComponent c)
uninstallUI
in class ComponentUI
protected Font getTxtFont()
public abstract Polygon getExactTabIndication(int index)
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.public abstract Polygon getInsertTabIndication(int index)
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.
public abstract int tabForCoordinate(Point p)
public abstract Rectangle getTabRect(int index, Rectangle destination)
public Image createImageOfTab(int index)
index
- A tab indexIllegalArgumentException
- if no tab is at the passed indexprotected abstract SingleSelectionModel createSelectionModel()
protected final boolean shouldPerformAction(String command, int tab, MouseEvent event)
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.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-applicableevent
- A mouse event which initiated the action, or nullprotected final boolean shouldPerformAction(TabActionEvent e)
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.e
- The original tab action event.public void makeTabVisible(int index)
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
modelpublic final boolean isTabBusy(int tabIndex)
tabIndex
- public abstract int dropIndexOfPoint(Point p)
p
- A pointpublic abstract void registerShortcuts(JComponent comp)
public abstract void unregisterShortcuts(JComponent comp)
protected abstract void requestAttention(int tab)
protected abstract void cancelRequestAttention(int tab)
protected void setAttentionHighlight(int tab, boolean highlight)
tab
- public Icon getButtonIcon(int buttonId, int buttonState)
public void postTabAction(TabActionEvent e)
public Insets getAutoscrollInsets()
public void autoscroll(Point location)
location
- Mouse location in TabDisplayer's coordinates.