net.miginfocom.swt

Class MigLayout

public final class MigLayout extends Layout implements Externalizable

A very flexbile layout manager.

Read the documentation that came with this layout manager for information on usage.

Constructor Summary
MigLayout()
Constructor with no constraints.
MigLayout(String layoutConstraints)
Constructor.
MigLayout(String layoutConstraints, String colConstraints)
Constructor.
MigLayout(String layoutConstraints, String colConstraints, String rowConstraints)
Constructor.
MigLayout(LC layoutConstraints)
Constructor.
MigLayout(LC layoutConstraints, AC colConstraints)
Constructor.
MigLayout(LC layoutConstraints, AC colConstraints, AC rowConstraints)
Constructor.
Method Summary
voidaddLayoutCallback(LayoutCallback callback)
Adds the callback function that will be called at different stages of the layout cylce.
protected PointcomputeSize(Composite parent, int wHint, int hHint, boolean flushCache)
protected booleanflushCache(Control control)
ObjectgetColumnConstraints()
Returns the column layout constraints either as a String or AC.
Map<Control,Object>getConstraintMap()
Returns a shallow copy of the constraints map.
floatgetLayoutAlignmentX(Composite parent)
floatgetLayoutAlignmentY(Composite parent)
ObjectgetLayoutConstraints()
Returns layout constraints eighter as a String or LC depending what was sent in to the constructor or set with setLayoutConstraints.
ObjectgetRowConstraints()
Returns the row layout constraints as a String representation.
booleanisManagingComponent(Control c)
Returns if this layout manager is currently managing this component.
protected voidlayout(Composite parent, boolean flushCache)
voidreadExternal(ObjectInput in)
voidremoveLayoutCallback(LayoutCallback callback)
Removes the callback if it exists.
voidsetColumnConstraints(Object constr)
Sets the column layout constraints for the layout manager instance as a String.
voidsetConstraintMap(Map<Control,Object> map)
Sets the constraints map.
voidsetLayoutConstraints(Object s)
Sets the layout constraints for the layout manager instance as a String.
voidsetRowConstraints(Object constr)
Sets the row layout constraints for the layout manager instance as a String.
voidwriteExternal(ObjectOutput out)

Constructor Detail

MigLayout

public MigLayout()
Constructor with no constraints.

MigLayout

public MigLayout(String layoutConstraints)
Constructor.

Parameters: layoutConstraints The constraints that concern the whole layout. null will be treated as "".

MigLayout

public MigLayout(String layoutConstraints, String colConstraints)
Constructor.

Parameters: layoutConstraints The constraints that concern the whole layout. null will be treated as "". colConstraints The constraints for the columns in the grid. null will be treated as "".

MigLayout

public MigLayout(String layoutConstraints, String colConstraints, String rowConstraints)
Constructor.

Parameters: layoutConstraints The constraints that concern the whole layout. null will be treated as "". colConstraints The constraints for the columns in the grid. null will be treated as "". rowConstraints The constraints for the rows in the grid. null will be treated as "".

MigLayout

public MigLayout(LC layoutConstraints)
Constructor.

Parameters: layoutConstraints The constraints that concern the whole layout. null will be treated as an empty cosntraint.

MigLayout

public MigLayout(LC layoutConstraints, AC colConstraints)
Constructor.

Parameters: layoutConstraints The constraints that concern the whole layout. null will be treated as an empty cosntraint. colConstraints The constraints for the columns in the grid. null will be treated as an empty constraint.

MigLayout

public MigLayout(LC layoutConstraints, AC colConstraints, AC rowConstraints)
Constructor.

Parameters: layoutConstraints The constraints that concern the whole layout. null will be treated as an empty cosntraint. colConstraints The constraints for the columns in the grid. null will be treated as an empty constraint. rowConstraints The constraints for the rows in the grid. null will be treated as an empty constraint.

Method Detail

addLayoutCallback

public void addLayoutCallback(LayoutCallback callback)
Adds the callback function that will be called at different stages of the layout cylce.

Parameters: callback The callback. Not null.

computeSize

protected Point computeSize(Composite parent, int wHint, int hHint, boolean flushCache)

flushCache

protected boolean flushCache(Control control)

getColumnConstraints

public Object getColumnConstraints()
Returns the column layout constraints either as a String or AC.

Returns: The column constraints eighter as a String or LC depending what was sent in to the constructor or set with setLayoutConstraints. Never null.

getConstraintMap

public Map<Control,Object> getConstraintMap()
Returns a shallow copy of the constraints map.

Returns: A shallow copy of the constraints map. Never null.

getLayoutAlignmentX

public float getLayoutAlignmentX(Composite parent)

getLayoutAlignmentY

public float getLayoutAlignmentY(Composite parent)

getLayoutConstraints

public Object getLayoutConstraints()
Returns layout constraints eighter as a String or LC depending what was sent in to the constructor or set with setLayoutConstraints.

Returns: The layout constraints eighter as a String or LC depending what was sent in to the constructor or set with setLayoutConstraints. Never null.

getRowConstraints

public Object getRowConstraints()
Returns the row layout constraints as a String representation. This string is the exact string as set with setRowConstraints or sent into the constructor.

See the class JavaDocs for information on how this string is formatted.

Returns: The row layout constraints as a String representation. Never null.

isManagingComponent

public boolean isManagingComponent(Control c)
Returns if this layout manager is currently managing this component.

Parameters: c The component to check. If null then false will be returned.

Returns: If this layout manager is currently managing this component.

layout

protected void layout(Composite parent, boolean flushCache)

readExternal

public void readExternal(ObjectInput in)

removeLayoutCallback

public void removeLayoutCallback(LayoutCallback callback)
Removes the callback if it exists.

Parameters: callback The callback. May be null.

setColumnConstraints

public void setColumnConstraints(Object constr)
Sets the column layout constraints for the layout manager instance as a String.

See the class JavaDocs for information on how this string is formatted.

Parameters: constr The column layout constraints as a String representation. null is converted to "" for storage.

Throws: RuntimeException if the constaint was not valid.

setConstraintMap

public void setConstraintMap(Map<Control,Object> map)
Sets the constraints map.

Parameters: map The map. Will be copied.

setLayoutConstraints

public void setLayoutConstraints(Object s)
Sets the layout constraints for the layout manager instance as a String.

See the class JavaDocs for information on how this string is formatted.

Parameters: s The layout constraints as a String representation. null is converted to "" for storage.

Throws: RuntimeException if the constaint was not valid.

setRowConstraints

public void setRowConstraints(Object constr)
Sets the row layout constraints for the layout manager instance as a String.

See the class JavaDocs for information on how this string is formatted.

Parameters: constr The row layout constraints as a String representation. null is converted to "" for storage.

Throws: RuntimeException if the constaint was not valid.

writeExternal

public void writeExternal(ObjectOutput out)