net.sf.doolin.gui.layout
Class FormLayoutService

java.lang.Object
  extended by net.sf.doolin.gui.layout.FormLayoutService
All Implemented Interfaces:
LayoutService

public class FormLayoutService
extends Object
implements LayoutService

Layout based on FormLayout.

Author:
Damien Coraboeuf

Constructor Summary
FormLayoutService()
          Constructor with default values
FormLayoutService(String columnSpecs, String rowSpecs)
          Constructor
 
Method Summary
 void add(JPanel panel, JComponent component, Object constraint)
          Adds a component to a panel using the given constraint.
 String getColumnGroups()
          Gets the column groups.
 String getColumnSpecs()
          Gets the column specifications.
 int getRowCount()
          Gets the row count.
 String getRowGap()
          Gets the row gap.
 String getRowGroups()
          Gets the row groups.
 String getRowSpec()
          Gets the specification for one row.
 String getRowSpecs()
          Gets the row specifications.
 void init(JPanel panel)
          Initializes a panel for layout
 boolean isDefaultBorder()
          Checks if is default border.
 int[][] parseGroups(String group)
          Parses a row or column group definition.
 void postConstruct()
          Initialisation of properties.
 void setColumnGroups(String columnGroups)
          Sets the column groups.
 void setColumnSpecs(String columnSpecs)
          Sets the column specifications.
 void setDefaultBorder(boolean defaultBorder)
          Sets the default border.
 void setRowCount(int rowCount)
          Sets the row count.
 void setRowGap(String rowGap)
          Sets the row gap.
 void setRowGroups(String rowGroups)
          Sets the row groups.
 void setRowSpec(String rowSpec)
          Sets the specification for one row.
 void setRowSpecs(String rowSpecs)
          Sets the row specifications.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FormLayoutService

public FormLayoutService()
Constructor with default values


FormLayoutService

public FormLayoutService(String columnSpecs,
                         String rowSpecs)
Constructor

Parameters:
columnSpecs - Column specifications
rowSpecs - Row specifications
See Also:
setColumnSpecs(String), setRowSpecs(String)
Method Detail

postConstruct

@PostConstruct
public void postConstruct()
Initialisation of properties.

If rowSpecs property has not been set, it is computed using rowSpec, rowGap and rowCount using:

 rowSpecs := rowSpec "," rowGap "," rowSpec "," rowGap ... (rowCount times)
 


add

public void add(JPanel panel,
                JComponent component,
                Object constraint)
Description copied from interface: LayoutService
Adds a component to a panel using the given constraint.

Specified by:
add in interface LayoutService
Parameters:
panel - Container
component - Component to add
constraint - Constraint for the position

init

public void init(JPanel panel)
Description copied from interface: LayoutService
Initializes a panel for layout

Specified by:
init in interface LayoutService
Parameters:
panel - Panel to initialize.

parseGroups

public int[][] parseGroups(String group)
Parses a row or column group definition.

Groups are comma-separated lists of integers. And the group definition is a "|"-separated list of groups.

For example,
3,4|5,7
stands for
{{3,4},{5,7}}

Parameters:
group - Group definition
Returns:
Group

getColumnSpecs

public String getColumnSpecs()
Gets the column specifications.

Returns:
the column specifications
See Also:
FormLayout

setColumnSpecs

public void setColumnSpecs(String columnSpecs)
Sets the column specifications.

Parameters:
columnSpecs - the new column specifications
See Also:
FormLayout

getColumnGroups

public String getColumnGroups()
Gets the column groups.

Returns:
the column groups
See Also:
parseGroups(String)

setColumnGroups

public void setColumnGroups(String columnGroups)
Sets the column groups.

Parameters:
columnGroups - the new column groups
See Also:
parseGroups(String)

getRowSpecs

public String getRowSpecs()
Gets the row specifications.

Returns:
the row specifications
See Also:
FormLayout

setRowSpecs

public void setRowSpecs(String rowSpecs)
Sets the row specifications.

Parameters:
rowSpecs - the new row specifications
See Also:
FormLayout

getRowGroups

public String getRowGroups()
Gets the row groups.

Returns:
the row groups
See Also:
parseGroups(String)

setRowGroups

public void setRowGroups(String rowGroups)
Sets the row groups.

Parameters:
rowGroups - the new row groups
See Also:
parseGroups(String)

getRowSpec

public String getRowSpec()
Gets the specification for one row.

Returns:
Specification
See Also:
postConstruct()

setRowSpec

public void setRowSpec(String rowSpec)
Sets the specification for one row.

Parameters:
rowSpec - Specification
See Also:
postConstruct()

getRowGap

public String getRowGap()
Gets the row gap.

Returns:
the row gap
See Also:
postConstruct()

setRowGap

public void setRowGap(String rowGap)
Sets the row gap.

Parameters:
rowGap - the new row gap
See Also:
postConstruct()

getRowCount

public int getRowCount()
Gets the row count.

Returns:
the row count
See Also:
postConstruct()

setRowCount

public void setRowCount(int rowCount)
Sets the row count.

Parameters:
rowCount - the new row count
See Also:
postConstruct()

isDefaultBorder

public boolean isDefaultBorder()
Checks if is default border.

Returns:
true, if is default border

setDefaultBorder

public void setDefaultBorder(boolean defaultBorder)
Sets the default border.

Parameters:
defaultBorder - the new default border


Copyright © 2011. All Rights Reserved.