de.matthiasmann.twl
Class DialogLayout.Group

java.lang.Object
  extended by de.matthiasmann.twl.DialogLayout.Group
Enclosing class:
DialogLayout

public abstract class DialogLayout.Group
extends java.lang.Object


Constructor Summary
DialogLayout.Group()
           
 
Method Summary
 void addDefaultGap()
          Add a default gap between all children except if the neighbour is already a Gap.
 DialogLayout.Group addGap()
          Adds a flexible gap with no minimum size.
 DialogLayout.Group addGap(int size)
          Adds a fixed sized gap.
 DialogLayout.Group addGap(int min, int pref, int max)
          Adds a generic gap.
 DialogLayout.Group addGap(java.lang.String name)
          Adds a named gap.
 DialogLayout.Group addGroup(DialogLayout.Group g)
          Adds another group.
 DialogLayout.Group addGroups(DialogLayout.Group... groups)
          Adds several groups.
 DialogLayout.Group addMinGap(int minSize)
          Adds a gap with minimum size.
 DialogLayout.Group addWidget(Widget w)
          Adds a widget to this group.
 DialogLayout.Group addWidget(Widget w, Alignment alignment)
          Adds a widget to this group.
 DialogLayout.Group addWidgets(Widget... widgets)
          Adds several widgets to this group.
 DialogLayout.Group addWidgetsWithGap(java.lang.String gapName, Widget... widgets)
          Adds several widgets to this group, inserting the specified gap in between.
 void clear(boolean removeWidgets)
          Removes all elements from this group
 void removeDefaultGaps()
          Remove all default gaps from this and child groups
 boolean removeGroup(DialogLayout.Group g, boolean removeWidgets)
          Removes the specified group from this group.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DialogLayout.Group

public DialogLayout.Group()
Method Detail

addGroup

public DialogLayout.Group addGroup(DialogLayout.Group g)
Adds another group. A group can only be added once. WARNING: No check is made to prevent cycles.

Parameters:
g - the child Group
Returns:
this Group

addGroups

public DialogLayout.Group addGroups(DialogLayout.Group... groups)
Adds several groups. A group can only be added once. WARNING: No check is made to prevent cycles.

Parameters:
groups - the groups to add
Returns:
this Group

addWidget

public DialogLayout.Group addWidget(Widget w)
Adds a widget to this group.

If the widget is already a child widget of the DialogLayout then it keeps it current settings, otherwise it is added the alignment is set to Alignment.FILL.

Parameters:
w - the child widget.
Returns:
this Group
See Also:
Widget.add(de.matthiasmann.twl.Widget)

addWidget

public DialogLayout.Group addWidget(Widget w,
                                    Alignment alignment)
Adds a widget to this group.

If the widget is already a child widget of the DialogLayout then it it's alignment is set to the specified value overwriting any current alignment setting, otherwise it is added to the DialogLayout.

Parameters:
w - the child widget.
alignment - the alignment of the child widget.
Returns:
this Group
See Also:
Widget.add(de.matthiasmann.twl.Widget), DialogLayout.setWidgetAlignment(de.matthiasmann.twl.Widget, de.matthiasmann.twl.Alignment)

addWidgets

public DialogLayout.Group addWidgets(Widget... widgets)
Adds several widgets to this group. The widget is automatically added as child widget.

Parameters:
widgets - The widgets which should be added.
Returns:
this Group

addWidgetsWithGap

public DialogLayout.Group addWidgetsWithGap(java.lang.String gapName,
                                            Widget... widgets)
Adds several widgets to this group, inserting the specified gap in between. Each widget also gets an animation state set depending on it's position. The state gapName+"NotFirst" is set to false for widgets[0] and true for all others The state gapName+"NotLast" is set to false for widgets[n-1] and true for all others

Parameters:
gapName - the name of the gap to insert between widgets
widgets - The widgets which should be added.
Returns:
this Group

addGap

public DialogLayout.Group addGap(int min,
                                 int pref,
                                 int max)
Adds a generic gap. Can use symbolic gap names.

Parameters:
min - the minimum size in pixels or a symbolic constant
pref - the preferred size in pixels or a symbolic constant
max - the maximum size in pixels or a symbolic constant
Returns:
this Group
See Also:
DialogLayout.SMALL_GAP, DialogLayout.MEDIUM_GAP, DialogLayout.LARGE_GAP, DialogLayout.DEFAULT_GAP

addGap

public DialogLayout.Group addGap(int size)
Adds a fixed sized gap. Can use symbolic gap names.

Parameters:
size - the size in pixels or a symbolic constant
Returns:
this Group
See Also:
DialogLayout.SMALL_GAP, DialogLayout.MEDIUM_GAP, DialogLayout.LARGE_GAP, DialogLayout.DEFAULT_GAP

addMinGap

public DialogLayout.Group addMinGap(int minSize)
Adds a gap with minimum size. Can use symbolic gap names.

Parameters:
minSize - the minimum size in pixels or a symbolic constant
Returns:
this Group
See Also:
DialogLayout.SMALL_GAP, DialogLayout.MEDIUM_GAP, DialogLayout.LARGE_GAP, DialogLayout.DEFAULT_GAP

addGap

public DialogLayout.Group addGap()
Adds a flexible gap with no minimum size.

This is equivalent to addGap(0, 0, Short.MAX_VALUE)

Returns:
this Group

addGap

public DialogLayout.Group addGap(java.lang.String name)
Adds a named gap.

Named gaps are configured via the theme parameter "namedGaps" which maps from names to <gap> objects.

They behave equal to addGap(int, int, int).

Parameters:
name - the name of the gap (vcase sensitive)
Returns:
this Group

removeDefaultGaps

public void removeDefaultGaps()
Remove all default gaps from this and child groups


addDefaultGap

public void addDefaultGap()
Add a default gap between all children except if the neighbour is already a Gap.


removeGroup

public boolean removeGroup(DialogLayout.Group g,
                           boolean removeWidgets)
Removes the specified group from this group.

Parameters:
g - the group to remove
removeWidgets - if true all widgets in the specified group should be removed from the DialogLayout
Returns:
true if it was found and removed, false otherwise

clear

public void clear(boolean removeWidgets)
Removes all elements from this group

Parameters:
removeWidgets - if true all widgets in this group are removed from the DialogLayout