|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.JPanel bibliothek.gui.dock.util.BackgroundPanel bibliothek.gui.dock.util.ConfiguredBackgroundPanel bibliothek.extension.gui.dock.theme.eclipse.stack.tab.BaseTabComponent
@ColorCodes(value={"stack.tab.border","stack.tab.border.selected","stack.tab.border.selected.focused","stack.tab.border.selected.focuslost","stack.tab.border.disabled","stack.tab.top","stack.tab.top.selected","stack.tab.top.selected.focused","stack.tab.top.selected.focuslost","stack.tab.top.disabled","stack.tab.bottom","stack.tab.bottom.selected","stack.tab.bottom.selected.focused","stack.tab.bottom.selected.focuslost","stack.tab.bottom.disabled","stack.tab.text","stack.tab.text.selected","stack.tab.text.selected.focused","stack.tab.text.selected.focuslost","stack.tab.text.disabled","stack.border"}) public abstract class BaseTabComponent
A base implementation of TabComponent
. This component contains
an OrientedLabel
which is used to paint icon and text, also a
ButtonPanel
is present to paint additional buttons.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
JPanel.AccessibleJPanel |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
BaseTabComponent(EclipseTabPane pane,
Dockable dockable)
Creates a new TabComponent |
|
BaseTabComponent(EclipseTabPane pane,
Dockable dockable,
String colorPostfix)
Creates a new TabComponent |
Method Summary | |
---|---|
protected void |
addAdditionalColors(TabColor... colors)
Adds an additional set of colors to this tab. |
void |
addMouseInputListener(MouseInputListener listener)
Adds a listener to this representative, it is not defined what to do with that listener, but most subclasses would just add the listener to their component . |
void |
addMouseListener(MouseListener l)
|
void |
addMouseMotionListener(MouseMotionListener l)
|
void |
bind()
Informs this tab that it will be shown soon |
protected void |
cleanNextTabSelected()
Cleans the state set by setNextTabSelected(boolean) |
protected void |
cleanPreviousTabSelected()
Cleans the state set by setPreviousTabSelected(boolean) |
protected boolean |
containsButton(int x,
int y)
Tells whether the buttons contain the position x/y . |
boolean |
doPaintIconWhenInactive()
|
Insets |
getButtonInsets()
Gets the space that is to be left free around the buttons. |
ButtonPanel |
getButtons()
Gets the panel which shows a set of DockAction s. |
Component |
getComponent()
Gets the Component which is to be painted. |
DockController |
getController()
|
Dockable |
getDockable()
Gets the Dockable which is represented by this tab. |
int |
getDockableIndex()
Tells which index the dockable of this tab
has on the owner. |
EclipseTabStateInfo |
getEclipseTabStateInfo()
Gets information about the state of this tab. |
DockElement |
getElement()
Gets the element which is represented by this . |
Icon |
getIcon()
Gets the icon that is painted on this component. |
protected OrientedLabel |
getLabel()
Gets the label which is used to paint icon and text. |
Insets |
getLabelInsets()
Gets the space that is left free around the label. |
Dimension |
getMinimumSize(TabComponent[] tabs)
Gets the minimum size of this tab under the assumption that this tab is displayed together with tabs . |
TabPlacement |
getOrientation()
Gets the current orientation of this tab, see setOrientation(TabPlacement) . |
EclipseTabPane |
getPane()
Gets the parent of this component. |
Point |
getPopupLocation(Point click,
boolean popupTrigger)
Tells whether a popup menu should be opened when the user clicks at click with the mouse. |
Dimension |
getPreferredSize(TabComponent[] tabs)
Gets the preferred size of this tab under the assumption that this tab is displayed together with tabs . |
DockStation |
getStation()
|
int |
getTabIndex()
|
String |
getText()
Gets the text of this component. |
boolean |
isBound()
Tells whether the bind() method has been called. |
boolean |
isFocused()
Whether the tab is currently focused. |
boolean |
isFocusTemporarilyLost()
Tells whether the focus of this component is currently lost, but will be retrieved as soon as the underlying frame gets activated. |
protected boolean |
isNextTabSelected()
Tells whether the tab after this one is selected. |
protected boolean |
isPreviousTabSelected()
Tells whether the tab before this one is selected. |
boolean |
isSelected()
Whether the tab is currently selected. |
boolean |
isUsedAsTitle()
Tells whether this DockElementRepresentative is used as title.Some modules grant more rights to titles than to non-titles, i.e. |
protected void |
refreshActions()
Recalculates which actions to show on this component. |
void |
removeMouseInputListener(MouseInputListener listener)
Removes a listener from this representative. |
void |
removeMouseListener(MouseListener l)
|
void |
removeMouseMotionListener(MouseMotionListener l)
|
void |
setButtonInsets(Insets buttonInsets)
Sets the insets to be left free around the buttons. |
void |
setConfiguration(TabConfiguration configuration)
Fine tunes the look and behavior of this tab. |
void |
setEnabled(boolean enabled)
Enables or disables this component. |
void |
setFocused(boolean focused)
Tells this component that its Dockable gained or lost focus. |
void |
setIcon(Icon icon)
Sets the icon that is painted on this component. |
void |
setLabelInsets(Insets labelInsets)
Sets the insets to be left free around the label. |
protected void |
setNextTabSelected(boolean selected)
Overrides the result of isNextTabSelected() , the method
will from now on only return selected until
cleanNextTabSelected() is called which reinstates the
original behavior. |
void |
setOrientation(TabPlacement orientation)
Sets the placement of the tabs and as a result the orientation of this component. |
void |
setPaintIconWhenInactive(boolean paintIconWhenInactive)
Tells this component whether to paint an icon if not selected. |
protected void |
setPreviousTabSelected(boolean selected)
Overrides the result of isPreviousTabSelected() , the method
will from now on only return selected until
cleanPreviousTabSelected() is called which reinstates the
original behavior. |
void |
setSelected(boolean selected)
Tells this component whether it has to be painted selected or not. |
void |
setTab(EclipseTab tab)
Informs this TabComponent by which tab is is used. |
void |
setText(String text)
Sets the text that is to be painted on this component. |
void |
setTooltip(String tooltip)
Sets the tooltip that should be displayed on this tab. |
protected void |
setupRenderingHints(Graphics g)
Called before painting on this panel happens. |
boolean |
shouldFocus()
Tells whether a click onto this component should transfer the focus either to this component or to the Dockable . |
boolean |
shouldTransfersFocus()
Tells whether a click onto this component should transfer the focus to the Dockable or not. |
void |
unbind()
Informs this tab that it is invisible and must not have any connections to other resources |
abstract void |
updateBorder()
Called when one of the border colors changed |
protected abstract void |
updateColors()
Called when the colors of this tab changed. |
protected abstract void |
updateEnabled()
Called when the enabled state of this tab changed. |
abstract void |
updateFocus()
Called when the focus state of this component changed. |
protected void |
updateFont()
Called when the font of this component has to be updated |
protected abstract void |
updateOrientation()
Called when the tab placement of this tab changed. |
protected void |
updatePaintIcon()
Called when the paint icon property of
this component changed. |
protected abstract void |
updateSelected()
Called when the selection state of this tab changed. |
Methods inherited from class bibliothek.gui.dock.util.ConfiguredBackgroundPanel |
---|
configure |
Methods inherited from class bibliothek.gui.dock.util.BackgroundPanel |
---|
getBackgroundAlgorithm, getTransparency, paint, paintBackground, paintBorder, paintChildren, paintComponent, paintForeground, paintOverlay, setBackground, setTransparency |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface bibliothek.extension.gui.dock.theme.eclipse.stack.tab.TabComponent |
---|
getOverlap |
Field Detail |
---|
protected final TabColor colorStackTabBorder
protected final TabColor colorStackTabBorderSelected
protected final TabColor colorStackTabBorderSelectedFocused
protected final TabColor colorStackTabBorderSelectedFocusLost
protected final TabColor colorStackTabBorderDisabled
protected final TabColor colorStackTabTop
protected final TabColor colorStackTabTopSelected
protected final TabColor colorStackTabTopSelectedFocused
protected final TabColor colorStackTabTopSelectedFocusLost
protected final TabColor colorStackTabTopDisabled
protected final TabColor colorStackTabBottom
protected final TabColor colorStackTabBottomSelected
protected final TabColor colorStackTabBottomSelectedFocused
protected final TabColor colorStackTabBottomSelectedFocusLost
protected final TabColor colorStackTabBottomDisabled
protected final TabColor colorStackTabText
protected final TabColor colorStackTabTextSelected
protected final TabColor colorStackTabTextSelectedFocused
protected final TabColor colorStackTabTextSelectedFocusLost
protected final TabColor colorStackTabTextDisabled
protected final TabColor colorStackBorder
protected final TabFont fontSelected
protected final TabFont fontFocused
protected final TabFont fontUnselected
Constructor Detail |
---|
public BaseTabComponent(EclipseTabPane pane, Dockable dockable)
TabComponent
pane
- the owner of this tab, not null
dockable
- the element which is represented by this component, not null
public BaseTabComponent(EclipseTabPane pane, Dockable dockable, String colorPostfix)
TabComponent
pane
- the owner of this tab, not null
dockable
- the element which is represented by this component, not null
colorPostfix
- a string that will be added to any key for a color, can be null
Method Detail |
---|
public EclipseTabStateInfo getEclipseTabStateInfo()
TabComponent
getEclipseTabStateInfo
in interface TabComponent
protected void addAdditionalColors(TabColor... colors)
bound
.
colors
- the additional set of colorspublic void setConfiguration(TabConfiguration configuration)
TabComponent
setConfiguration
in interface TabComponent
configuration
- the new configuration to use, not null
public abstract void updateBorder()
protected void updateFont()
protected void refreshActions()
public abstract void updateFocus()
protected abstract void updateSelected()
protected abstract void updateColors()
protected abstract void updateEnabled()
protected void updatePaintIcon()
paint icon property
of
this component changed.
protected abstract void updateOrientation()
public void setTab(EclipseTab tab)
TabComponent
TabComponent
by which tab is is used.
setTab
in interface TabComponent
tab
- the owner of this TabComponent
public void bind()
TabComponent
bind
in interface TabComponent
public void unbind()
TabComponent
unbind
in interface TabComponent
public boolean isBound()
bind()
method has been called.
true
if this tab is bound to its ownerpublic Dockable getDockable()
EclipseTabStateInfo
Dockable
which is represented by this tab.
getDockable
in interface EclipseTabStateInfo
null
public DockElement getElement()
DockElementRepresentative
this
.
The result of this method must not change.
getElement
in interface DockElementRepresentative
null
public boolean isUsedAsTitle()
DockElementRepresentative
DockElementRepresentative
is used as title.DockRelocator
can allow drag & drop only for titles.Dockable
should have only one element that is a title,
so if in doubt return false
.
isUsedAsTitle
in interface DockElementRepresentative
true
if this representative should be seen as titlepublic boolean shouldTransfersFocus()
DockElementRepresentative
Dockable
or not. If this
object is a Dockable
, then a result of true
might change the currently focused item
of itself. This property is ignored if DockElementRepresentative.shouldFocus()
returns false
.
shouldTransfersFocus
in interface DockElementRepresentative
public boolean shouldFocus()
DockElementRepresentative
Dockable
.
shouldFocus
in interface DockElementRepresentative
true
if clicking this component should influence focuspublic void addMouseInputListener(MouseInputListener listener)
DockElementRepresentative
component
. It is valid to do nothing.
addMouseInputListener
in interface DockElementRepresentative
listener
- the new listenerpublic void removeMouseInputListener(MouseInputListener listener)
DockElementRepresentative
removeMouseInputListener
in interface DockElementRepresentative
listener
- the listener to removepublic void addMouseListener(MouseListener l)
addMouseListener
in class Component
public void removeMouseListener(MouseListener l)
removeMouseListener
in class Component
public void addMouseMotionListener(MouseMotionListener l)
addMouseMotionListener
in class Component
public void removeMouseMotionListener(MouseMotionListener l)
removeMouseMotionListener
in class Component
public Point getPopupLocation(Point click, boolean popupTrigger)
DockElementRepresentative
click
with the mouse. If yes, then the top left edge
of the popup should be returned, otherwise null
should be
returned.
getPopupLocation
in interface DockElementRepresentative
click
- the location where the user clicked with the mousepopupTrigger
- whether the invocation is the systems popup trigger
or not. Many implementations of this method will return click
in case of true
, and null
in case of false
null
if no
popup-menu should be openedpublic DockController getController()
public DockStation getStation()
protected void setupRenderingHints(Graphics g)
BackgroundPanel
g
.
setupRenderingHints
in class ConfiguredBackgroundPanel
g
- the painting contextpublic EclipseTabPane getPane()
public Component getComponent()
PaintableComponent
Component
which is to be painted.
getComponent
in interface TabComponent
getComponent
in interface DockElementRepresentative
getComponent
in interface PaintableComponent
getComponent
in class BackgroundPanel
public void setFocused(boolean focused)
TabComponent
Dockable
gained or lost focus.
setFocused
in interface TabComponent
focused
- the state of its dockable.public boolean isFocused()
EclipseTabStateInfo
isFocused
in interface EclipseTabStateInfo
public boolean isFocusTemporarilyLost()
true
if the focus is only temporarily lostpublic void setSelected(boolean selected)
TabComponent
setSelected
in interface TabComponent
selected
- the selection state of this tabpublic boolean isSelected()
EclipseTabStateInfo
isSelected
in interface EclipseTabStateInfo
protected void setPreviousTabSelected(boolean selected)
isPreviousTabSelected()
, the method
will from now on only return selected
until
cleanPreviousTabSelected()
is called which reinstates the
original behavior.
selected
- the future result of isPreviousTabSelected()
protected void cleanPreviousTabSelected()
setPreviousTabSelected(boolean)
protected boolean isPreviousTabSelected()
true
if the tab before is selectedprotected void setNextTabSelected(boolean selected)
isNextTabSelected()
, the method
will from now on only return selected
until
cleanNextTabSelected()
is called which reinstates the
original behavior.
selected
- the future result of isNextTabSelected()
protected void cleanNextTabSelected()
setNextTabSelected(boolean)
protected boolean isNextTabSelected()
true
if the tab before is selectedpublic int getDockableIndex()
dockable
of this tab
has on the owner.
public int getTabIndex()
public boolean doPaintIconWhenInactive()
public void setPaintIconWhenInactive(boolean paintIconWhenInactive)
BaseTabComponent
itself never checks this property.
setPaintIconWhenInactive
in interface TabComponent
paintIconWhenInactive
- true
if an icon is always to be painted,
false
if icons should only appear on selected tabs.public void setIcon(Icon icon)
setPaintIconWhenInactive(boolean)
is false
.
setIcon
in interface TabComponent
icon
- the icon to paint, can be null
public Icon getIcon()
null
public void setText(String text)
setText
in interface TabComponent
text
- the text, can be null
public void setTooltip(String tooltip)
TabComponent
setTooltip
in interface TabComponent
tooltip
- the new tooltip, can be null
public String getText()
null
public void setLabelInsets(Insets labelInsets)
labelInsets
- the free space, not null
public Insets getLabelInsets()
null
public void setButtonInsets(Insets buttonInsets)
buttonInsets
- the free space, not null
public Insets getButtonInsets()
protected OrientedLabel getLabel()
public ButtonPanel getButtons()
DockAction
s.
null
protected boolean containsButton(int x, int y)
buttons
contain the position x/y
.
x
- x coordinatey
- y coordinate
true
if the buttons contains this locationpublic void setEnabled(boolean enabled)
TabComponent
EclipseTab
automatically removes all MouseInputListener
s from a TabComponent
that
is not enabled.
setEnabled
in interface TabComponent
setEnabled
in class JComponent
enabled
- whether this component is enabled or notpublic void setOrientation(TabPlacement orientation)
TabComponent
setOrientation
in interface TabComponent
orientation
- the orientation, not null
public TabPlacement getOrientation()
setOrientation(TabPlacement)
.
public Dimension getMinimumSize(TabComponent[] tabs)
TabComponent
tabs
.
getMinimumSize
in interface TabComponent
tabs
- the displayed tabs, exactly one entry is this
and may contain null
entries.
public Dimension getPreferredSize(TabComponent[] tabs)
TabComponent
tabs
.
getPreferredSize
in interface TabComponent
tabs
- the displayed tabs, exactly one entry is this
and may contain null
entries.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |