bibliothek.gui.dock.station.stack.tab
Class MenuLineLayoutOrder

java.lang.Object
  extended by bibliothek.gui.dock.station.stack.tab.MenuLineLayoutOrder
All Implemented Interfaces:
Iterable<MenuLineLayoutOrder.Item>

public class MenuLineLayoutOrder
extends Object
implements Iterable<MenuLineLayoutOrder.Item>

Describes in which order, location and extend the LayoutBlocks should be given by a MenuLineLayout.

Author:
Benjamin Sigg

Nested Class Summary
static class MenuLineLayoutOrder.Item
          The various items that are used by the MenuLineLayout.
 
Constructor Summary
MenuLineLayoutOrder(MenuLineLayoutOrder.Item first, MenuLineLayoutOrder.Item second, MenuLineLayoutOrder.Item third)
          Creates a new order.
 
Method Summary
 float getAlignment(MenuLineLayoutOrder.Item item)
          Gets the alignment of item.
 float getFill(MenuLineLayoutOrder.Item item)
          Gets the fill ratio of item.
 MenuLineLayoutOrder.Item getFirst()
          Gets the first item to show.
 MenuLineLayoutOrder.Item getSecond()
          Gets the second item to show.
 MenuLineLayoutOrder.Item getThird()
          Gets the third item to show.
 float getWeight(MenuLineLayoutOrder.Item item)
          Gets the weight of item.
 Iterator<MenuLineLayoutOrder.Item> iterator()
           
 void setAlignment(MenuLineLayoutOrder.Item item, float alignment)
          Sets the alignment of item.
 void setConstraints(MenuLineLayoutOrder.Item item, float weight, float alignment, float fill)
          A shortcut to call setAlignment(Item, float), setWeight(Item, float) and setFill(Item, float) in one invocation.
 void setFill(MenuLineLayoutOrder.Item item, float fill)
          Sets the fill ratio of item.
 void setWeight(MenuLineLayoutOrder.Item item, float weight)
          Sets the weight of item.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MenuLineLayoutOrder

public MenuLineLayoutOrder(MenuLineLayoutOrder.Item first,
                           MenuLineLayoutOrder.Item second,
                           MenuLineLayoutOrder.Item third)
Creates a new order. No argument must be null and no two arguments must be the same.

Parameters:
first - the first item to show
second - the second item to show
third - the last item to show
Method Detail

iterator

public Iterator<MenuLineLayoutOrder.Item> iterator()
Specified by:
iterator in interface Iterable<MenuLineLayoutOrder.Item>

getFirst

public MenuLineLayoutOrder.Item getFirst()
Gets the first item to show.

Returns:
the item, not null and not the same as the other two items

getSecond

public MenuLineLayoutOrder.Item getSecond()
Gets the second item to show.

Returns:
the item, not null and not the same as the other two items

getThird

public MenuLineLayoutOrder.Item getThird()
Gets the third item to show.

Returns:
the item, not null and not the same as the other two items

setConstraints

public void setConstraints(MenuLineLayoutOrder.Item item,
                           float weight,
                           float alignment,
                           float fill)
A shortcut to call setAlignment(Item, float), setWeight(Item, float) and setFill(Item, float) in one invocation.

Parameters:
item - the item whose constraints are set
weight - the new weight, see setWeight(Item, float)
alignment - the new alignment, see setAlignment(Item, float)
fill - the new fill ratio, see setFill(Item, float)

setAlignment

public void setAlignment(MenuLineLayoutOrder.Item item,
                         float alignment)
Sets the alignment of item. The alignment tells how item reacts if there is free space. A value of 0 means that the item clings to the left wall, a value of 1 means that the item clings to the right wall.

Parameters:
item - the item whose alignment is set, not null
alignment - the new alignment, between 0 and 1

getAlignment

public float getAlignment(MenuLineLayoutOrder.Item item)
Gets the alignment of item.

Parameters:
item - the item to search
Returns:
the alignment
See Also:
setAlignment(Item, float)

setWeight

public void setWeight(MenuLineLayoutOrder.Item item,
                      float weight)
Sets the weight of item. The weight tells how free space should be distributed, as larger the number as more space is assigned to item.

Parameters:
item - the item whose wheight is set, not null
weight - the new weight, at least 0

getWeight

public float getWeight(MenuLineLayoutOrder.Item item)
Gets the weight of item.

Parameters:
item - the item to search, not null
Returns:
the weight
See Also:
setWeight(Item, float)

setFill

public void setFill(MenuLineLayoutOrder.Item item,
                    float fill)
Sets the fill ratio of item. The fill parameter tells how much free space is used up by item. A value of 0 indicates that item does not use any free space, a value of 1 indicates that item fills up all free space.

Parameters:
item - the item whose fill ratio is set, not null
fill - the new fill ratio, between 0 and 1

getFill

public float getFill(MenuLineLayoutOrder.Item item)
Gets the fill ratio of item.

Parameters:
item - the item to search
Returns:
the fill ratio
See Also:
setFill(Item, float)