bibliothek.gui.dock.support.menu
Class SeparatingMenuPiece

java.lang.Object
  extended by bibliothek.gui.dock.support.menu.MenuPiece
      extended by bibliothek.gui.dock.support.menu.SeparatingMenuPiece

public class SeparatingMenuPiece
extends MenuPiece

A piece which envelops another piece with separators.

Author:
Benjamin Sigg

Constructor Summary
SeparatingMenuPiece()
          Creates a new piece
SeparatingMenuPiece(boolean topSeparator, boolean emptySeparator, boolean bottomSeparator)
          Creates a new piece
SeparatingMenuPiece(MenuPiece piece)
          Creates a new piece
SeparatingMenuPiece(MenuPiece piece, boolean topSeparator, boolean emptySeparator, boolean bottomSeparator)
          Creates a new piece
 
Method Summary
 void fill(List<Component> items)
          Inserts all items of this piece into items.
 int getItemCount()
          Gets the number of items this MenuPiece added to its menu.
 MenuPiece getPiece()
          Gets the piece which is embraced by separators.
protected  int getSeparatorCount()
          Gets the number of separators which were added by this piece.
 boolean isBottomSeparator()
          Tells whether there is a separator below this piece.
 boolean isEmptySeparator()
          Tells whether there should be a single separator shown when this piece is empty.
 boolean isTopSeparator()
          Tells whether there is a separator shown above the content of this piece.
 void setBottomSeparator(boolean bottomSeparator)
          Sets whether there should be a separator added to the menu after the contents described in this piece.
 void setEmptySeparator(boolean emptySeparator)
          Sets whether there should be a separator shown when this piece is empty.
 void setPiece(MenuPiece piece)
          Sets the piece which will be embraced by separators.
 void setTopSeparator(boolean topSeparator)
          Sets whether there should be a separator shown above the content of this piece.
 
Methods inherited from class bibliothek.gui.dock.support.menu.MenuPiece
addListener, fireInsert, fireRemove, getMenu, getParent, items, removeListener, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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 top
emptySeparator - whether to show a separator if piece is empty
bottomSeparator - whether to show a separator at the bottom

SeparatingMenuPiece

public SeparatingMenuPiece(MenuPiece piece)
Creates a new piece

Parameters:
piece - the piece which might be covered by separators

SeparatingMenuPiece

public SeparatingMenuPiece(MenuPiece piece,
                           boolean topSeparator,
                           boolean emptySeparator,
                           boolean bottomSeparator)
Creates a new piece

Parameters:
piece - the piece which might be covered by separators
topSeparator - whether to show a separator at the top
emptySeparator - whether to show a separator if piece is empty
bottomSeparator - whether to show a separator at the bottom
Method Detail

getPiece

public MenuPiece getPiece()
Gets the piece which is embraced by separators.

Returns:
the piece

setPiece

public void setPiece(MenuPiece piece)
Sets the piece which will be embraced by separators.

Parameters:
piece - the child of this piece

getItemCount

public int getItemCount()
Description copied from class: MenuPiece
Gets the number of items this MenuPiece added to its menu.

Specified by:
getItemCount in class MenuPiece
Returns:
the number of items

fill

public void fill(List<Component> items)
Description copied from class: MenuPiece
Inserts all items of this piece into items.

Specified by:
fill in class MenuPiece
Parameters:
items - the list which has to be filled in the same order as the items will appear on the menu

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:
true if there is a separator
See Also:
setBottomSeparator(boolean)

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 - true if there should be a separator

isEmptySeparator

public boolean isEmptySeparator()
Tells whether there should be a single separator shown when this piece is empty.

Returns:
true if 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 - true if a separator should be made visible

isTopSeparator

public boolean isTopSeparator()
Tells whether there is a separator shown above the content of this piece.

Returns:
true if 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 - true if the separator should be shown