net.miginfocom.swt
Class MigLayout

java.lang.Object
  extended by org.eclipse.swt.widgets.Layout
      extended by net.miginfocom.swt.MigLayout
All Implemented Interfaces:
Externalizable, Serializable

public final class MigLayout
extends org.eclipse.swt.widgets.Layout
implements Externalizable

A very flexible layout manager.

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

See Also:
Serialized Form

Constructor Summary
MigLayout()
          Constructor with no constraints.
MigLayout(LC layoutConstraints)
          Constructor.
MigLayout(LC layoutConstraints, AC colConstraints)
          Constructor.
MigLayout(LC layoutConstraints, AC colConstraints, AC rowConstraints)
          Constructor.
MigLayout(String layoutConstraints)
          Constructor.
MigLayout(String layoutConstraints, String colConstraints)
          Constructor.
MigLayout(String layoutConstraints, String colConstraints, String rowConstraints)
          Constructor.
 
Method Summary
 void addLayoutCallback(LayoutCallback callback)
          Adds the callback function that will be called at different stages of the layout cycle.
protected  org.eclipse.swt.graphics.Point computeSize(org.eclipse.swt.widgets.Composite parent, int wHint, int hHint, boolean flushCache)
           
protected  boolean flushCache(org.eclipse.swt.widgets.Control control)
           
 Object getColumnConstraints()
          Returns the column layout constraints either as a String or AC.
 Map<org.eclipse.swt.widgets.Control,Object> getConstraintMap()
          Returns a shallow copy of the constraints map.
 float getLayoutAlignmentX(org.eclipse.swt.widgets.Composite parent)
           
 float getLayoutAlignmentY(org.eclipse.swt.widgets.Composite parent)
           
 Object getLayoutConstraints()
          Returns layout constraints either as a String or LC depending what was sent in to the constructor or set with setLayoutConstraints(Object).
 Object getRowConstraints()
          Returns the row layout constraints as a String representation.
 boolean isManagingComponent(org.eclipse.swt.widgets.Control c)
          Returns if this layout manager is currently managing this component.
protected  void layout(org.eclipse.swt.widgets.Composite parent, boolean flushCache)
           
 void readExternal(ObjectInput in)
           
 void removeLayoutCallback(LayoutCallback callback)
          Removes the callback if it exists.
 void setColumnConstraints(Object constr)
          Sets the column layout constraints for the layout manager instance as a String.
 void setConstraintMap(Map<org.eclipse.swt.widgets.Control,Object> map)
          Sets the constraints map.
 void setLayoutConstraints(Object s)
          Sets the layout constraints for the layout manager instance as a String.
 void setRowConstraints(Object constr)
          Sets the row layout constraints for the layout manager instance as a String.
 void writeExternal(ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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

getLayoutConstraints

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

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

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 constraint was not valid.

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(Object). Never 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 constraint was not valid.

getRowConstraints

public Object getRowConstraints()
Returns the row layout constraints as a String representation. This string is the exact string as set with setRowConstraints(Object) 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.

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.

getConstraintMap

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

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

setConstraintMap

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

Parameters:
map - The map. Will be copied.

isManagingComponent

public boolean isManagingComponent(org.eclipse.swt.widgets.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.

addLayoutCallback

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

Parameters:
callback - The callback. Not null.

removeLayoutCallback

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

Parameters:
callback - The callback. May be null.

getLayoutAlignmentX

public float getLayoutAlignmentX(org.eclipse.swt.widgets.Composite parent)

getLayoutAlignmentY

public float getLayoutAlignmentY(org.eclipse.swt.widgets.Composite parent)

computeSize

protected org.eclipse.swt.graphics.Point computeSize(org.eclipse.swt.widgets.Composite parent,
                                                     int wHint,
                                                     int hHint,
                                                     boolean flushCache)
Specified by:
computeSize in class org.eclipse.swt.widgets.Layout

layout

protected void layout(org.eclipse.swt.widgets.Composite parent,
                      boolean flushCache)
Specified by:
layout in class org.eclipse.swt.widgets.Layout

flushCache

protected boolean flushCache(org.eclipse.swt.widgets.Control control)
Overrides:
flushCache in class org.eclipse.swt.widgets.Layout

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Specified by:
readExternal in interface Externalizable
Throws:
IOException
ClassNotFoundException

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Specified by:
writeExternal in interface Externalizable
Throws:
IOException


Copyright © 2007-2011. All Rights Reserved.