Package com.gargoylesoftware.base.gui
Class TableLayoutConstraints
- java.lang.Object
-
- com.gargoylesoftware.base.gui.TableLayoutConstraints
-
- All Implemented Interfaces:
java.io.Serializable
public class TableLayoutConstraints extends java.lang.Object implements java.io.SerializableThis object contains all the constraints that apply to a specific component inside a TableLayout.We use the convention of specifying row before column to conform with the swing standards. This seems counterintuitive when specifying x,y (actually y,x) co-ordinates however we felt it was more important to conform to existing java layout standards.
- Version:
- $Revision: 1.5 $
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private intcolumn_private intcolumnSpan_private inthorizontalAlignment_private booleanhorizontalStretch_private booleanisImmutable_private booleanobeyMaximumSize_private booleanobeyMinimumSize_private introw_private introwSpan_private static longserialVersionUIDprivate intverticalAlignment_private booleanverticalStretch_
-
Constructor Summary
Constructors Constructor Description TableLayoutConstraints(int row, int column)Create a new instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static voidassertNotNull(java.lang.String fieldName, java.lang.Object fieldValue)Verify that the specified value is not null.private voidensureMutable()Check to make sure that we are allowed to modify this object.intgetColumn()Return the column.intgetColumnSpan()Return the number of columns this component will span.intgetHorizontalAlignment()Return the horizontalAlignment.booleangetHorizontalStretch()Return true if this component can be stretched horizontally.booleangetObeyMaximumSize()Return true if we are obeying the maximum size.booleangetObeyMinimumSize()Return true if we are obeying the minimum size.intgetRow()Return the row.intgetRowSpan()Return the number of rows this component will span.intgetVerticalAlignment()Return the vertical alignment.booleangetVerticalStretch()Return true if this component can be stretched vertically.booleanisImmutable()Return true if this object is immutable.static TableLayoutConstraintsmakeConstraints(java.lang.String constraintString)Create an instance of TableLayoutConstraints from the specified string.private static voidparseConstraintString(TableLayoutConstraints constraints, java.lang.String constraintString, boolean isRow)Parse the constraint string.voidsetColumn(int column)Set the column.voidsetColumnSpan(int span)Set the number of columns that this component will span.voidsetHorizontalAlignment(int alignment)Set the horizontal alignment of the component within the specified area.voidsetHorizontalStretch(boolean stretch)Set whether or not this component can be stretched horizontally.voidsetImmutable()Make this object immutable.voidsetObeyMaximumSize(boolean obey)Set whether or not the component should obey it's maximum size.voidsetObeyMinimumSize(boolean obey)Set whether or not we should obey the minimum size of the component.voidsetRow(int row)Set the row.voidsetRowSpan(int span)Set the number of rows that this component will span.voidsetVerticalAlignment(int alignment)Set the vertical alignment of the component within the specified area.voidsetVerticalStretch(boolean stretch)Set whether or not this component can be stretched vertically.java.lang.StringtoString()Return a string representation of this object.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
isImmutable_
private boolean isImmutable_
-
obeyMaximumSize_
private boolean obeyMaximumSize_
-
obeyMinimumSize_
private boolean obeyMinimumSize_
-
row_
private int row_
-
column_
private int column_
-
rowSpan_
private int rowSpan_
-
columnSpan_
private int columnSpan_
-
verticalAlignment_
private int verticalAlignment_
-
verticalStretch_
private boolean verticalStretch_
-
horizontalAlignment_
private int horizontalAlignment_
-
horizontalStretch_
private boolean horizontalStretch_
-
-
Method Detail
-
toString
public final java.lang.String toString()
Return a string representation of this object.- Overrides:
toStringin classjava.lang.Object- Returns:
- Return a string representation of this object.
-
setImmutable
public final void setImmutable()
Make this object immutable.
-
isImmutable
public final boolean isImmutable()
Return true if this object is immutable.- Returns:
- Return true if this object is immutable.
-
ensureMutable
private void ensureMutable() throws java.lang.IllegalArgumentExceptionCheck to make sure that we are allowed to modify this object. If not, throw an exception.- Throws:
java.lang.IllegalArgumentException- If the object is immutable
-
setRow
public final void setRow(int row)
Set the row.- Parameters:
row- The row.
-
getRow
public final int getRow()
Return the row.- Returns:
- The row.
-
setColumn
public final void setColumn(int column)
Set the column.- Parameters:
column- The new column.
-
getColumn
public final int getColumn()
Return the column.- Returns:
- The column.
-
setRowSpan
public final void setRowSpan(int span)
Set the number of rows that this component will span. The new span must be greater than or equal to one.- Parameters:
span- The new row span.
-
getRowSpan
public final int getRowSpan()
Return the number of rows this component will span.- Returns:
- The row span.
-
setColumnSpan
public final void setColumnSpan(int span)
Set the number of columns that this component will span. The new span must be greater than or equal to one.- Parameters:
span- The new span.
-
getColumnSpan
public final int getColumnSpan()
Return the number of columns this component will span.- Returns:
- the column span.
-
setVerticalAlignment
public final void setVerticalAlignment(int alignment)
Set the vertical alignment of the component within the specified area. Possible values are- TableLayout.TOP
- TableLayout.BOTTOM
- TableLayout.CENTER
- Parameters:
alignment- The new alignment.
-
getVerticalAlignment
public final int getVerticalAlignment()
Return the vertical alignment.- Returns:
- Return the vertical alignment.
-
setHorizontalAlignment
public final void setHorizontalAlignment(int alignment)
Set the horizontal alignment of the component within the specified area. Possible values are- TableLayout.LEFT
- TableLayout.RIGHT
- TableLayout.CENTER
- Parameters:
alignment- The new alignment.
-
getHorizontalAlignment
public final int getHorizontalAlignment()
Return the horizontalAlignment.- Returns:
- Return the horizontalAlignment.
-
setVerticalStretch
public final void setVerticalStretch(boolean stretch)
Set whether or not this component can be stretched vertically.- Parameters:
stretch- true if the component will stretch vertically.
-
getVerticalStretch
public final boolean getVerticalStretch()
Return true if this component can be stretched vertically.- Returns:
- Return true if this component can be stretched vertically.
-
setHorizontalStretch
public final void setHorizontalStretch(boolean stretch)
Set whether or not this component can be stretched horizontally.- Parameters:
stretch- true if the component will stretch horizontally.
-
getHorizontalStretch
public final boolean getHorizontalStretch()
Return true if this component can be stretched horizontally.- Returns:
- Return true if this component can be stretched horizontally.
-
setObeyMaximumSize
public final void setObeyMaximumSize(boolean obey)
Set whether or not the component should obey it's maximum size. Most components do not provide sensible maximum values so always obeying these values, ends up with very strange layouts. The default value is false.- Parameters:
obey- true if we are to obey the maximum size.
-
getObeyMaximumSize
public final boolean getObeyMaximumSize()
Return true if we are obeying the maximum size.- Returns:
- Return true if we are obeying the maximum size.
-
setObeyMinimumSize
public final void setObeyMinimumSize(boolean obey)
Set whether or not we should obey the minimum size of the component. Default is true.- Parameters:
obey- true if we are to obey the minimum size.
-
getObeyMinimumSize
public final boolean getObeyMinimumSize()
Return true if we are obeying the minimum size.- Returns:
- Return true if we are obeying the minimum size.
-
makeConstraints
public static TableLayoutConstraints makeConstraints(java.lang.String constraintString)
Create an instance of TableLayoutConstraints from the specified string. Format: "1,1"- Parameters:
constraintString- The constraints string.- Returns:
- A new TableLayoutConstraints object.
-
parseConstraintString
private static void parseConstraintString(TableLayoutConstraints constraints, java.lang.String constraintString, boolean isRow)
Parse the constraint string.- Parameters:
constraints- The new constraints objectconstraintString- The constraints as an input stringisRow- true if these constraints are for a row
-
assertNotNull
protected static final void assertNotNull(java.lang.String fieldName, java.lang.Object fieldValue) throws DetailedNullPointerExceptionVerify that the specified value is not null. If it is then throw an exception- Parameters:
fieldName- The name of the field to checkfieldValue- The value of the field to check- Throws:
DetailedNullPointerException- If fieldValue is null
-
-