Package bibliothek.gui.dock.support.menu
Class SeparatingMenuPiece
java.lang.Object
bibliothek.gui.dock.support.menu.MenuPiece
bibliothek.gui.dock.support.menu.SeparatingMenuPiece
A piece which envelops another piece with separators.
- Author:
- Benjamin Sigg
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new pieceSeparatingMenuPiece(boolean topSeparator, boolean emptySeparator, boolean bottomSeparator) Creates a new pieceSeparatingMenuPiece(MenuPiece piece) Creates a new pieceSeparatingMenuPiece(MenuPiece piece, boolean topSeparator, boolean emptySeparator, boolean bottomSeparator) 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.voidInserts all items of this piece intoitems.intgetPiece()Gets the piece which is embraced by separators.protected intGets the number of separators which were added by this piece.booleanTells whether there is a separator below this piece.booleanTells whether there should be a single separator shown when this piece is empty.booleanTells whether there is a separator shown above the content of this piece.voidsetBottomSeparator(boolean bottomSeparator) Sets whether there should be a separator added to the menu after the contents described in this piece.voidsetEmptySeparator(boolean emptySeparator) Sets whether there should be a separator shown when this piece is empty.voidSets the piece which will be embraced by separators.voidsetTopSeparator(boolean topSeparator) Sets whether there should be a separator shown above the content of this piece.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.MenuPiece
addListener, fireInsert, fireRemove, getMenu, getParent, isBound, items, removeListener, setParent
-
Constructor Details
-
SeparatingMenuPiece
public SeparatingMenuPiece()Creates a new piece -
SeparatingMenuPiece
public SeparatingMenuPiece(boolean topSeparator, boolean emptySeparator, boolean bottomSeparator) Creates a new piece- Parameters:
topSeparator- whether to show a separator at the topemptySeparator- whether to show a separator ifpieceis emptybottomSeparator- whether to show a separator at the bottom
-
-
Method Details
-
getPiece
Gets the piece which is embraced by separators.- Returns:
- the piece
-
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. -
getItemCount
public int getItemCount()Description copied from class:MenuPiece- Specified by:
getItemCountin classMenuPiece- Returns:
- the number of items
-
fill
Description copied from class:MenuPieceInserts all items of this piece intoitems. -
getSeparatorCount
protected int getSeparatorCount()Gets the number of separators which were added by this piece.- Returns:
- the number of separators
-
isBottomSeparator
public boolean isBottomSeparator()Tells whether there is a separator below this piece.- Returns:
trueif there is a separator- See Also:
-
setBottomSeparator
public void setBottomSeparator(boolean bottomSeparator) Sets whether there should be a separator added to the menu after the contents described in this piece. Note that there might not be any separator if this piece is empty.- Parameters:
bottomSeparator-trueif there should be a separator
-
isEmptySeparator
public boolean isEmptySeparator()Tells whether there should be a single separator shown when this piece is empty.- Returns:
trueif there is a separator
-
setEmptySeparator
public void setEmptySeparator(boolean emptySeparator) Sets whether there should be a separator shown when this piece is empty.- Parameters:
emptySeparator-trueif a separator should be made visible
-
isTopSeparator
public boolean isTopSeparator()Tells whether there is a separator shown above the content of this piece.- Returns:
trueif there is a separator
-
setTopSeparator
public void setTopSeparator(boolean topSeparator) Sets whether there should be a separator shown above the content of this piece. Note that there might not be any separator if this piece is empty.- Parameters:
topSeparator-trueif the separator should be shown
-