public abstract class AbstractTabDisplayerUI extends TabDisplayerUI
For most use cases, it will make more sense to subclass BasicTabDisplayerUI or BasicScrollingTabDisplayerUI, which handle most of the logic any implementation will need.
BasicTabDisplayerUI
,
BasicScrollingTabDisplayerUI
Modifier and Type | Class and Description |
---|---|
protected class |
AbstractTabDisplayerUI.DisplayerHierarchyListener
A hierarchy listener which registers the component with ToolTipManager
when displayed, and de-registers it when hidden
|
protected class |
AbstractTabDisplayerUI.DisplayerPropertyChangeListener
A property change listener which will repaint the selected tab when the
"active" property changes on the tab displayer
|
protected class |
AbstractTabDisplayerUI.ModelListener
Simple implementation of a listener on a TabDataModel.
|
Modifier and Type | Field and Description |
---|---|
protected ComponentListener |
componentListener
Component listener - mainly used to detach listeners when the component is hidden,
and reattach them when it is shown.
|
protected HierarchyListener |
hierarchyListener |
protected TabLayoutModel |
layoutModel
Layout model, which will be initialized in
installUI() by calling
createLayoutModel . |
protected AbstractTabDisplayerUI.ModelListener |
modelListener
Listener on the TabDataModel.
|
protected MouseListener |
mouseListener
Mouse listener (which may optionally implement MouseWheelListener and MouseMotionListener),
which handles mouse events over the tab, triggering selection model changes, repaints, etc.
|
protected PropertyChangeListener |
propertyChangeListener
A property change listener to listen on any changes from the component which should
trigger repainting or other operations.
|
protected ChangeListener |
selectionListener
A change listener which listens on the selection model and repaints as needed when
the selection changes.
|
displayer, selectionModel
Constructor and Description |
---|
AbstractTabDisplayerUI(TabDisplayer displayer)
Creates a new instance of AbstractTabDisplayerUI
|
Modifier and Type | Method and Description |
---|---|
protected ComponentListener |
createComponentListener()
Create a ComponentListener that may be needed to handle resize, show,
hide, etc.
|
protected Font |
createFont() |
protected HierarchyListener |
createHierarchyListener() |
protected abstract TabLayoutModel |
createLayoutModel()
Create an instance of TabLayoutModel which will provide coordinates for
tabs
|
protected AbstractTabDisplayerUI.ModelListener |
createModelListener()
Create a listener on the data model that triggers repaints on appropriate
changes.
|
protected abstract 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 PropertyChangeListener |
createPropertyChangeListener()
Create a PropertyChangeListener which listens on any interesting
properties of the control
|
protected abstract ChangeListener |
createSelectionListener()
Create a
ChangeListener to be attached to the selection model. |
protected SingleSelectionModel |
createSelectionModel()
Creates an instance of
DefaultTabSelectionModel |
int |
dropIndexOfPoint(Point p)
A very basic implementation of dropIndexOfPoint, which simply iterates
all of the tab rectangles to see if they contain the point.
|
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 |
installListeners()
Installs the mouse listener returned by createMouseListener into the
control.
|
void |
installUI(JComponent c)
installUI is final to ensure listeners, etc.
|
protected void |
modelChanged()
Convenience method called by ModelListener.stateChanged() when the data model changes.
|
void |
registerShortcuts(JComponent comp)
Does nothing, no shortcuts
|
protected Point |
toDropPoint(Point location)
Converts a point into a point in the coordinate space of the tabs area, for
determining what index a drop operation should affect.
|
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.
|
protected void |
uninstallListeners()
Installs the mouse listener returned by createMouseListener into the
control.
|
void |
uninstallUI(JComponent c)
This method is final - subclasses that need to deinitialize should override
uninstall() , and remove any listeners, null any unneeded references, etc. |
void |
unregisterShortcuts(JComponent comp)
Does nothing, no shortcuts
|
autoscroll, cancelRequestAttention, createImageOfTab, getAutoscrollInsets, getButtonIcon, getExactTabIndication, getInsertTabIndication, getTabRect, getTxtFont, isTabBusy, makeTabVisible, postTabAction, requestAttention, setAttentionHighlight, shouldPerformAction, shouldPerformAction, tabForCoordinate
contains, createUI, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehavior, getMaximumSize, getMinimumSize, getPreferredSize, paint, update
protected TabLayoutModel layoutModel
installUI()
by calling
createLayoutModel
. The layout model provides tab coordinates.protected MouseListener mouseListener
protected ComponentListener componentListener
protected PropertyChangeListener propertyChangeListener
active
property to trigger a repaint.protected AbstractTabDisplayerUI.ModelListener modelListener
protected ChangeListener selectionListener
protected HierarchyListener hierarchyListener
public AbstractTabDisplayerUI(TabDisplayer displayer)
public final void installUI(JComponent c)
install()
,
and refer to the displayer
instance field, which will be initialized here.installUI
in class TabDisplayerUI
c
- An instance of TabDisplayerpublic final void uninstallUI(JComponent c)
uninstall()
, and remove any listeners, null any unneeded references, etc.uninstallUI
in class TabDisplayerUI
c
- protected void install()
protected void uninstall()
protected final void installListeners()
protected final void uninstallListeners()
protected HierarchyListener createHierarchyListener()
protected abstract TabLayoutModel createLayoutModel()
protected abstract MouseListener createMouseListener()
protected abstract ChangeListener createSelectionListener()
ChangeListener
to be attached to the selection model. This
listener will be responsible for repainting the appropriate areas on selection changes.protected Font createFont()
protected AbstractTabDisplayerUI.ModelListener createModelListener()
protected ComponentListener createComponentListener()
protected PropertyChangeListener createPropertyChangeListener()
protected SingleSelectionModel createSelectionModel()
DefaultTabSelectionModel
createSelectionModel
in class TabDisplayerUI
public int dropIndexOfPoint(Point p)
dropIndexOfPoint
in class TabDisplayerUI
p
- A pointprotected void modelChanged()
displayer.repaint()
.protected Point toDropPoint(Point location)
location
- A point in the coordinate space of the containerpublic void unregisterShortcuts(JComponent comp)
unregisterShortcuts
in class TabDisplayerUI
public void registerShortcuts(JComponent comp)
registerShortcuts
in class TabDisplayerUI