Package bibliothek.gui.dock.facile.menu
Class CloseableDockableMenuPiece
java.lang.Object
bibliothek.gui.dock.support.menu.MenuPiece
bibliothek.gui.dock.support.menu.BaseMenuPiece
bibliothek.gui.dock.facile.menu.CloseableDockableMenuPiece
- Direct Known Subclasses:
SingleCDockableListMenuPiece
A piece of a menu allowing to close or reopen some
Dockables that
are registered in a DockFrontend.- Author:
- Benjamin Sigg
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classAn item showing the visibility state of oneDockable. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new pieceCloseableDockableMenuPiece(DockFrontend frontend) Creates a new piece -
Method Summary
Modifier and TypeMethodDescriptionvoidbind()This method is called if there is a possibility for the user to see this menu.voidEnsures thatdockablehas an item if it isincluded, and does not have otherwise.protected CloseableDockableMenuPiece.ItemCreates a new item for the menu.Gets the frontend which is observed by this piece.getOrder()Gets the order of the menu items.protected voidEnsures thatdockableis not visible.protected booleanTells whether an item should be inserted into the menu for the givendockableor not.protected voidAdds an earlier created item into the menu, subclasses might override this method to add the item at a different location.protected voidreorder()Asynchronously order the menu itemsvoidsetFrontend(DockFrontend frontend) Sets the frontend which will be observed by this piece.voidsetOrder(Comparator<String> order) Sets the order of the menu items.protected voidEnsures thatdockableis visible.voidunbind()This method is called if the user has no longer any possibility to see this menu.Methods inherited from class bibliothek.gui.dock.support.menu.BaseMenuPiece
add, addSeparator, fill, getItem, getItemCount, insert, insertSeparator, remove, remove, removeAllMethods inherited from class bibliothek.gui.dock.support.menu.MenuPiece
addListener, fireInsert, fireRemove, getMenu, getParent, isBound, items, removeListener, setParent
-
Constructor Details
-
CloseableDockableMenuPiece
public CloseableDockableMenuPiece()Creates a new piece -
CloseableDockableMenuPiece
Creates a new piece- Parameters:
frontend- the list ofDockables, can benull
-
-
Method Details
-
setOrder
Sets the order of the menu items. The default behavior is to order the items alphabetically.- Parameters:
order- the order, ornull
-
getOrder
Gets the order of the menu items.- Returns:
- the order, can be
null
-
reorder
protected void reorder()Asynchronously order the menu items -
getFrontend
Gets the frontend which is observed by this piece.- Returns:
- the frontend, might be
null - See Also:
-
setFrontend
Sets the frontend which will be observed by this piece. EveryDockablethat is registered at thefrontendwill get an item in the menu of this piece.- Parameters:
frontend- the list ofDockables, can benull
-
bind
public void bind()Description copied from class:MenuPieceThis method is called if there is a possibility for the user to see this menu. The menu should register listeners, update its text etc. to be ready for that event. This method must never be called twice in a row. -
unbind
public void unbind()Description copied from class:MenuPieceThis method is called if the user has no longer any possibility to see this menu. The menu should unregister its listeners. This method must never be called twice in a row. -
create
Creates a new item for the menu.- Parameters:
dockable- the element which will be shown/hidden when the user clicks onto the item.- Returns:
- the new item
-
show
Ensures thatdockableis visible.- Parameters:
dockable- the element to show
-
hide
Ensures thatdockableis not visible.- Parameters:
dockable- the element to hide
-
include
Tells whether an item should be inserted into the menu for the givendockableor not.- Parameters:
dockable- the element to check- Returns:
trueif there should be an item added to the menu
-
check
Ensures thatdockablehas an item if it isincluded, and does not have otherwise.- Parameters:
dockable- the element whose item is to be checked
-