public abstract class AbstractCombinedMenu extends AbstractTabPaneComponent implements CombinedMenu
CombinedMenu
, this menu
delegates creation and management of its Component
to its
subclasses and uses a CombinedMenuContent
to show its content.Constructor and Description |
---|
AbstractCombinedMenu(TabPane parent,
CombinedHandler<? super AbstractCombinedMenu> handler)
Creates a new menu.
|
Modifier and Type | Method and Description |
---|---|
void |
addTabMenuListener(TabMenuListener listener)
Adds a new listener to this menu.
|
protected void |
backgroundChanged(BackgroundPaint paint)
Called if the background algorithm has been exchanged.
|
protected void |
closed()
Called once the menu is closed, the default implementation does
nothing.
|
protected abstract Component |
createComponent()
Creates the button which will always be visible.
|
protected void |
ensureComponent()
Ensures that
createComponent() is called and its result
stored. |
protected BackgroundAlgorithm |
getBackground()
Gets an algorithm that can be used to paint the background of this menu.
|
Component |
getComponent()
Gets the
Component which is wrapped into this
AbstractTabPaneComponent . |
DockController |
getController()
Gets the controller in whose realm this menu is used.
|
Dockable |
getDockable(int index)
Gets the index'th
Dockable of this menu. |
int |
getDockableCount()
Gets the number of
Dockable s shown on this menu. |
Dockable[] |
getDockables()
Gets all the
Dockable s that are shown in this menu. |
int |
getZOrder()
Gets the value of the z order.
|
void |
insert(int index,
Dockable dockable)
Inserts a new item at
index in this menu. |
boolean |
isPaneVisible()
Tells whether this component is visible or not.
|
void |
open()
Opens a menu where the user can select a
Dockable . |
void |
remove(Dockable dockable)
Removes the item
dockable from this menu |
void |
removeTabMenuListener(TabMenuListener listener)
Removes
listener from this menu. |
protected abstract void |
selected(Dockable dockable)
Called if this menu was open, an element was selected and the menu closed.
|
void |
setController(DockController controller)
Sets the controller in whose realm this menu is used.
|
void |
setEnabled(int index,
boolean enabled)
Enables or disables a menu entry.
|
void |
setIcon(int index,
Icon icon)
Sets the image of this menu at
index . |
void |
setPaneVisible(boolean visible)
Changes the visibility state of this component.
|
void |
setText(int index,
String text)
Sets the text of this menu at
index . |
void |
setTooltip(int index,
String tooltip)
Sets the tooltip of this menu at
index . |
void |
setZOrder(int order)
Sets the z order of this component.
|
protected TabMenuListener[] |
tabMenuListeners()
Gets all the
TabMenuListener that are currently registered at this menu. |
getBounds, getMaximumSize, getMinimumSize, getOrientation, getOverlap, getPreferredSize, getTabParent, setBounds, setOrientation
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getBounds, getMaximumSize, getMinimumSize, getOverlap, getPreferredSize, getTabParent, setBounds, setOrientation
public AbstractCombinedMenu(TabPane parent, CombinedHandler<? super AbstractCombinedMenu> handler)
parent
- the owner of this menu, must not be null
handler
- handler for making this menu visible or invisible and change the z orderprotected void ensureComponent()
createComponent()
is called and its result
stored.protected BackgroundAlgorithm getBackground()
null
protected void backgroundChanged(BackgroundPaint paint)
paint
- the new background algorithm, can be null
protected abstract Component createComponent()
AbstractCombinedMenu
.public void open()
Dockable
.protected void closed()
public void setController(DockController controller)
CombinedMenu
setController
in interface CombinedMenu
controller
- the realmpublic DockController getController()
null
public void addTabMenuListener(TabMenuListener listener)
TabMenu
addTabMenuListener
in interface TabMenu
listener
- the new listener, not null
public void removeTabMenuListener(TabMenuListener listener)
TabMenu
listener
from this menu.removeTabMenuListener
in interface TabMenu
listener
- the listener to removeprotected TabMenuListener[] tabMenuListeners()
TabMenuListener
that are currently registered at this menu.public void setPaneVisible(boolean visible)
TabPaneComponent
setPaneVisible
in interface TabPaneComponent
visible
- the new statepublic boolean isPaneVisible()
TabPaneComponent
isPaneVisible
in interface TabPaneComponent
true
if visible, false
otherwisepublic void setZOrder(int order)
TabPaneComponent
TabPaneComponent
s
on the parent TabPane
. The implementation may increase or
decrease z-orders to prevent collisions between components with the same
order.setZOrder
in interface TabPaneComponent
order
- the order, can be any integer.public int getZOrder()
TabPaneComponent
getZOrder
in interface TabPaneComponent
TabPaneComponent.setZOrder(int)
protected abstract void selected(Dockable dockable)
dockable
- the selected elementpublic Component getComponent()
AbstractTabPaneComponent
Component
which is wrapped into this
AbstractTabPaneComponent
. This method is not called from the
constructor.getComponent
in interface CombinedMenu
getComponent
in class AbstractTabPaneComponent
Component
, not null
public void setIcon(int index, Icon icon)
CombinedMenu
index
.setIcon
in interface CombinedMenu
index
- the entry that should be modifiedicon
- an icon that should be shown, can be null
public void setText(int index, String text)
CombinedMenu
index
.setText
in interface CombinedMenu
index
- the entry that should be modifiedtext
- the text to displaypublic void setTooltip(int index, String tooltip)
CombinedMenu
index
.setTooltip
in interface CombinedMenu
index
- the entry that should be modifiedtooltip
- the tooltip text, can be null
public void setEnabled(int index, boolean enabled)
CombinedMenu
setEnabled
in interface CombinedMenu
index
- the index of the item that should be enabled or disabledenabled
- whether the item is activepublic void insert(int index, Dockable dockable)
CombinedMenu
index
in this menu.insert
in interface CombinedMenu
index
- the location of the new itemdockable
- the new itempublic void remove(Dockable dockable)
CombinedMenu
dockable
from this menuremove
in interface CombinedMenu
dockable
- the item to removepublic Dockable[] getDockables()
TabMenu
Dockable
s that are shown in this menu.getDockables
in interface TabMenu
public int getDockableCount()
TabMenu
Dockable
s shown on this menu.getDockableCount
in interface TabMenu
public Dockable getDockable(int index)
TabMenu
Dockable
of this menu.getDockable
in interface TabMenu
index
- the index of an item