MetaDone
metadone.client.grasyla2.visuallibrary.widgets.layouts.SpringFlowLayout Class Reference
Inheritance diagram for metadone.client.grasyla2.visuallibrary.widgets.layouts.SpringFlowLayout:
Collaboration diagram for metadone.client.grasyla2.visuallibrary.widgets.layouts.SpringFlowLayout:

List of all members.

Public Member Functions

 SpringFlowLayout (SerialAlignment align, boolean verticalOrientation, int gap)
SerialAlignment getSerialAlignment ()
int getGap ()
boolean getVerticalOrientation ()
boolean isSpringWidgetClass (Widget widget)
void layout (Widget widget)
boolean requiresJustification (Widget widget)
void justify (Widget widget)

Protected Member Functions

double getSpringWeight (Widget widget)
void layout (Widget widget, Rectangle parentBounds)

Static Protected Member Functions

static int getMinSizeConstraint (Widget w)

Private Member Functions

int layoutPlaceChild (int pos, int size, SerialAlignment align, boolean verticalOrientation, Widget child, Point location, Rectangle bounds)

Private Attributes

SerialAlignment align
int gap
boolean verticalOrientation

Detailed Description

Spring flow layout places elements in-line (horizontally or vertically) while aligning them in the opposite direction and it contains dynamically expanding elements (springs).

Places elements in line leaving some gap between them. If there is some free space left, the spring elements are extended to fill the entire space. Also, the alignment in the opposite direction may be given.

Example:

 // a widget with vertically distributed children which are horizontally centered
 Widget w = new Widget(scene);
 w.setLayout(new SpringFlowLayout(SerialAlign.CENTER, true, 0);
 w.add(child1);
 w.add(new W_Spring(scene), 50); // here 50 is the minimum size of this spring
 w.add(child2);
 w.add(new W_Spring(scene)); // normal spring
 
Author:
kma
See also:
W_Spring

Constructor & Destructor Documentation

metadone.client.grasyla2.visuallibrary.widgets.layouts.SpringFlowLayout.SpringFlowLayout ( SerialAlignment  align,
boolean  verticalOrientation,
int  gap 
)

Creates a new spring layout.

Parameters:
alignThe opposite alignment of elements (if null, JUSTIFY is used)
verticalOrientationWhether the orientation is vertical
gapThe gap between elements

References metadone.client.grasyla2.visuallibrary.widgets.layouts.SpringFlowLayout.align, metadone.client.grasyla2.visuallibrary.widgets.layouts.SpringFlowLayout.gap, and metadone.client.grasyla2.visuallibrary.widgets.layouts.SpringFlowLayout.verticalOrientation.


Member Function Documentation

static int metadone.client.grasyla2.visuallibrary.widgets.layouts.SpringFlowLayout.getMinSizeConstraint ( Widget  w) [static, protected]

Returns the minimum size constraint for a widget.

Parameters:
wThe widget
Returns:
The minimum size

Referenced by metadone.client.grasyla2.visuallibrary.widgets.layouts.SpringFlowLayout.layoutPlaceChild().

double metadone.client.grasyla2.visuallibrary.widgets.layouts.SpringFlowLayout.getSpringWeight ( Widget  widget) [protected]

Gets the widgets weight.

If the widget has an Integer constraint, it is used as the minimal size of the spring.

Parameters:
widgetThe spring widget
Returns:
A weight (default 1.0)

References metadone.client.grasyla2.visuallibrary.widgets.layouts.SpringFlowLayout.isSpringWidgetClass().

Referenced by metadone.client.grasyla2.visuallibrary.widgets.layouts.SpringFlowLayout.justify().

boolean metadone.client.grasyla2.visuallibrary.widgets.layouts.SpringFlowLayout.isSpringWidgetClass ( Widget  widget)
void metadone.client.grasyla2.visuallibrary.widgets.layouts.SpringFlowLayout.layout ( Widget  widget)
int metadone.client.grasyla2.visuallibrary.widgets.layouts.SpringFlowLayout.layoutPlaceChild ( int  pos,
int  size,
SerialAlignment  align,
boolean  verticalOrientation,
Widget  child,
Point  location,
Rectangle  bounds 
) [private]
boolean metadone.client.grasyla2.visuallibrary.widgets.layouts.SpringFlowLayout.requiresJustification ( Widget  widget)

Member Data Documentation


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations