RADi Runtime Library v1.2.1

de.muntjak.newlayout
Class NewLayout

java.lang.Object
  extended by de.muntjak.newlayout.NewLayout
All Implemented Interfaces:
LayoutManager, LayoutManager2, Serializable

public class NewLayout
extends Object
implements LayoutManager2, Serializable

NewLayout is RADi's layout manager for panels, folder panels and internal frames/palettes.

See Also:
Serialized Form

Field Summary
static int ENLARGE_AND_FIT
          Weight usage constant: Enlarge if there is free space or the size of components spanning multiple columns/rows exeeds the size of those columns/rows.
static int ENLARGE_ONLY
          Weight usage constant: Enlarge only if there is free space.
static int FIT_MULTICOLUMNS_ONLY
          Weight usage constant: Enlarge only if the size of components spanning multiple columns exeeds the size of those columns.
static int FIT_MULTIROWS_ONLY
          Weight usage constant: Enlarge only if the size of components spanning multiple rows exeeds the size of those rows.
 
Constructor Summary
NewLayout(int[] columnWidths, int[] rowHeights)
          Create a new NewLayout layout manager with the given minimum sizes for columns and rows.
 
Method Summary
 void addLayoutComponent(Component comp, Object constraints)
          Adds the specified component to the layout, using the specified constraint object.
 void addLayoutComponent(String name, Component comp)
          Not supported.
 void addSameHeightClass(int[] rows)
          Links the heights of several rows.
 void addSameWidthClass(int[] columns)
          Links the widths of several columns.
 Dimension getCurrentGridSize()
          Returns the current grid size in pixels.
 float getLayoutAlignmentX(Container target)
          Always returns 0f.
 float getLayoutAlignmentY(Container target)
          Always returns 0f.
 void invalidateLayout(Container target)
          Clears cached values.
 void layoutContainer(Container target)
          Calculates the container's layout.
 Dimension maximumLayoutSize(Container target)
          Returns a dimension where both width and height are Integer.MAX_VALUE.
 Dimension minimumLayoutSize(Container target)
          Calculates and returns the container's minimum layout size.
 Dimension preferredLayoutSize(Container target)
          Calculates and returns the container's preferred layout size.
 void removeLayoutComponent(Component comp)
          Removes argument from the layout.
 void setColumnWeight(int column, int weight)
          Sets the weight of the specified column to weight.
 void setColumnWeight(int column, int weight, int weightUsage)
          Sets the weight of the specified column to weight and the weight usage to weightUsage.
 void setColumnWeightUsage(int column, int weightUsage)
          Sets the weight usage of the specified column to weightUsage.
 void setRowWeight(int row, int weight)
          Sets the weight of the specified row to weight.
 void setRowWeight(int row, int weight, int weightUsage)
          Sets the weight of the specified row to weight and the weight usage to weightUsage.
 void setRowWeightUsage(int row, int weightUsage)
          Sets the weight usage of the specified row to weightUsage.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ENLARGE_AND_FIT

public static final int ENLARGE_AND_FIT
Weight usage constant: Enlarge if there is free space or the size of components spanning multiple columns/rows exeeds the size of those columns/rows.

See Also:
Constant Field Values

ENLARGE_ONLY

public static final int ENLARGE_ONLY
Weight usage constant: Enlarge only if there is free space.

See Also:
Constant Field Values

FIT_MULTICOLUMNS_ONLY

public static final int FIT_MULTICOLUMNS_ONLY
Weight usage constant: Enlarge only if the size of components spanning multiple columns exeeds the size of those columns.

See Also:
Constant Field Values

FIT_MULTIROWS_ONLY

public static final int FIT_MULTIROWS_ONLY
Weight usage constant: Enlarge only if the size of components spanning multiple rows exeeds the size of those rows.

See Also:
Constant Field Values
Constructor Detail

NewLayout

public NewLayout(int[] columnWidths,
                 int[] rowHeights)
Create a new NewLayout layout manager with the given minimum sizes for columns and rows. Each column/row has a weight of 0 and a weight usage of ENLARGE_AND_FIT.

Parameters:
columnWidths - minimum column widths
rowHeights - minimum row heights
Throws:
IllegalArgumentException - if an element of the argument arrays isd less than zero
Method Detail

addLayoutComponent

public void addLayoutComponent(Component comp,
                               Object constraints)
Adds the specified component to the layout, using the specified constraint object.

Specified by:
addLayoutComponent in interface LayoutManager2
Parameters:
constraints - must be an instance of NLConstraint
Throws:
IllegalArgumentException - if constraints is not an instance of NLConstraint or the NLConstraint object's parameters are invalid

addLayoutComponent

public void addLayoutComponent(String name,
                               Component comp)
Not supported.

Specified by:
addLayoutComponent in interface LayoutManager
Throws:
UnsupportedOperationException - because this method is not supported

addSameHeightClass

public void addSameHeightClass(int[] rows)
Links the heights of several rows. Does nothing if argument is null.

Parameters:
rows - the rows which shall be of the same height

addSameWidthClass

public void addSameWidthClass(int[] columns)
Links the widths of several columns. Does nothing if argument is null.

Parameters:
columns - the columns which shall be of the same width

getCurrentGridSize

public Dimension getCurrentGridSize()
Returns the current grid size in pixels.

Returns:
the current grid size in pixels

getLayoutAlignmentX

public float getLayoutAlignmentX(Container target)
Always returns 0f.

Specified by:
getLayoutAlignmentX in interface LayoutManager2

getLayoutAlignmentY

public float getLayoutAlignmentY(Container target)
Always returns 0f.

Specified by:
getLayoutAlignmentY in interface LayoutManager2

invalidateLayout

public void invalidateLayout(Container target)
Clears cached values.

Specified by:
invalidateLayout in interface LayoutManager2

layoutContainer

public void layoutContainer(Container target)
Calculates the container's layout.

Specified by:
layoutContainer in interface LayoutManager

maximumLayoutSize

public Dimension maximumLayoutSize(Container target)
Returns a dimension where both width and height are Integer.MAX_VALUE.

Specified by:
maximumLayoutSize in interface LayoutManager2

minimumLayoutSize

public Dimension minimumLayoutSize(Container target)
Calculates and returns the container's minimum layout size.

Specified by:
minimumLayoutSize in interface LayoutManager

preferredLayoutSize

public Dimension preferredLayoutSize(Container target)
Calculates and returns the container's preferred layout size.

Specified by:
preferredLayoutSize in interface LayoutManager

removeLayoutComponent

public void removeLayoutComponent(Component comp)
Removes argument from the layout.

Specified by:
removeLayoutComponent in interface LayoutManager

setColumnWeight

public void setColumnWeight(int column,
                            int weight)
Sets the weight of the specified column to weight.

Parameters:
column - a valid column index
weight - the new column weight >= 0
Throws:
IllegalArgumentException - if weight < 0 or column is not a valid column index

setColumnWeight

public void setColumnWeight(int column,
                            int weight,
                            int weightUsage)
Sets the weight of the specified column to weight and the weight usage to weightUsage.

Parameters:
column - a valid column index
weight - the new column weight >= 0
weightUsage - one of ENLARGE_AND_FIT, ENLARGE_ONLY or FIT_MULTICOLUMNS_ONLY
Throws:
IllegalArgumentException - if weight < 0 or column is not a valid column index or weightUsage is not one of ENLARGE_AND_FIT, ENLARGE_ONLY or FIT_MULTICOLUMNS_ONLY

setColumnWeightUsage

public void setColumnWeightUsage(int column,
                                 int weightUsage)
Sets the weight usage of the specified column to weightUsage.

Parameters:
column - a valid column index
weightUsage - one of ENLARGE_AND_FIT, ENLARGE_ONLY or FIT_MULTICOLUMNS_ONLY
Throws:
IllegalArgumentException - if column is not a valid column index or weightUsage is not one of ENLARGE_AND_FIT, ENLARGE_ONLY or FIT_MULTICOLUMNS_ONLY

setRowWeight

public void setRowWeight(int row,
                         int weight)
Sets the weight of the specified row to weight.

Parameters:
row - a valid row index
weight - the new row weight >= 0
Throws:
IllegalArgumentException - if weight < 0 or row is not a valid row index

setRowWeight

public void setRowWeight(int row,
                         int weight,
                         int weightUsage)
Sets the weight of the specified row to weight and the weight usage to weightUsage.

Parameters:
row - a valid row index
weight - the new row weight >= 0
weightUsage - one of ENLARGE_AND_FIT, ENLARGE_ONLY or FIT_MULTIROWS_ONLY
Throws:
IllegalArgumentException - if weight < 0 or row is not a valid row index or weightUsage is not one of ENLARGE_AND_FIT, ENLARGE_ONLY or FIT_MULTIROWS_ONLY

setRowWeightUsage

public void setRowWeightUsage(int row,
                              int weightUsage)
Sets the weight usage of the specified row to weightUsage.

Parameters:
row - a valid row index
weightUsage - one of ENLARGE_AND_FIT, ENLARGE_ONLY or FIT_MULTIROWNS_ONLY
Throws:
IllegalArgumentException - if row is not a valid row index or weightUsage is not one of ENLARGE_AND_FIT, ENLARGE_ONLY or FIT_MULTIROWNS_ONLY

RADi Runtime Library v1.2.1