public static class PercentData.Builder extends Object implements Serializable
A builder implementation for creating instances of PercentData
. Using this class PercentData
objects with all
properties supported can be created in a convenient way. Refer to the
class comment for PercentData
for example use cases for this
class.
Implementation note: This class is not thread-safe.
Constructor and Description |
---|
Builder()
Creates a new instance of
Builder . |
Modifier and Type | Method and Description |
---|---|
PercentData |
create()
Creates the
PercentData instance whose properties were
specified by the preceding method calls. |
PercentData |
pos(int x,
int y)
Returns a
PercentData object with the specified column and
row index. |
void |
reset()
Resets all properties of this builder to default values.
|
PercentData.Builder |
span(int w,
int h)
Initializes the number of columns and rows occupied by the component
association with the
PercentData instance to be created. |
PercentData.Builder |
spanX(int w)
Initializes the number of columns occupied by the component
associated with the
PercentData instance to be created. |
PercentData.Builder |
spanY(int h)
Initializes the number of rows occupied by the component associated
with the
PercentData instance to be created. |
PercentData.Builder |
withColumnConstraints(CellConstraints cc)
Sets a
CellConstraints reference for the column for the
PercentData instance to be created. |
PercentData.Builder |
withRowConstraints(CellConstraints cc)
Sets a
CellConstraints reference for the row for the PercentData instance to be created. |
PercentData.Builder |
withTargetColumn(int tc)
Initializes the
targetColumn property of the PercentData instance to be created. |
PercentData.Builder |
withTargetRow(int tr)
Initializes the
targetRow property of the PercentData
instance to be created. |
PercentData.Builder |
xy(int x,
int y)
Initializes the column and the row index of the
PercentData
instance to be created. |
public PercentData.Builder xy(int x, int y)
PercentData
instance to be created.x
- the column index (must be greater or equal 0)y
- the row index (must be greater or equal 0)IllegalArgumentException
- if a parameter is invalidpublic PercentData.Builder spanX(int w)
PercentData
instance to be created. This
value is used to populate the spanX
property of the PercentData
object.w
- the number of occupied columns (must be greater 0)IllegalArgumentException
- if the number of columns is less or
equal 0public PercentData.Builder spanY(int h)
PercentData
instance to be created. This value is
used to populate the spanY
property of the PercentData
object.h
- the number of occupied rows (must be greater 0)IllegalArgumentException
- if the number of rows is less or
equal 0public PercentData.Builder span(int w, int h)
PercentData
instance to be created. This
is convenience method that combines calls to spanX(int)
and
spanY(int)
.w
- the number of occupied columns (must be greater 0)h
- the number of occupied rows (must be greater 0)IllegalArgumentException
- if the number of columns or rows is
less or equal 0public PercentData.Builder withTargetColumn(int tc)
targetColumn
property of the PercentData
instance to be created. If a component spans multiple
columns, the target column specifies, to which column the size of the
component should be applied. If no target column is set (which is the
default), the width of the component is not taken into account when
determining the width of the layout's columns.tc
- the index of the target column (must be greater or equal 0)IllegalArgumentException
- if the target column is less than 0public PercentData.Builder withTargetRow(int tr)
targetRow
property of the PercentData
instance to be created. If a component spans multiple rows, the
target row specifies, to which row the size of the component should
be applied. If no target row is set (which is the default), the
height of the component is not taken into account when determining
the height of the layout's rows.tr
- the index of the target row (must be greater or equal 0)IllegalArgumentException
- if the target row is less than 0public PercentData.Builder withColumnConstraints(CellConstraints cc)
CellConstraints
reference for the column for the
PercentData
instance to be created. With this method the
columnConstraints
property of the PercentData
object
can be specified.cc
- the CellConstraints
object for the columnpublic PercentData.Builder withRowConstraints(CellConstraints cc)
CellConstraints
reference for the row for the PercentData
instance to be created. With this method the rowConstraints
property of the PercentData
object can be
specified.cc
- the CellConstraints
object for the rowpublic PercentData pos(int x, int y)
PercentData
object with the specified column and
row index. This is a convenience method for the frequent use case
that only the position of a component in the layout needs to be
specified. It has the same effect as calling xy(int, int)
followed by create()
. Properties that have been set before
are not cleared.x
- the column index (must be greater or equal 0)y
- the row index (must be greater or equal 0)PercentData
object with the given coordinatesIllegalArgumentException
- if a parameter is invalidpublic PercentData create()
PercentData
instance whose properties were
specified by the preceding method calls. This method requires that
the position was set using the xy(int, int)
method. All
other properties are optional and are initialized with the following
default values:
PercentData
instanceIllegalStateException
- if required parameters have not been
setpublic void reset()
create()
, so that the definition
of a new instance can be started. It can be invoked manually to undo
the effects of methods called before.Copyright © 2016 The JGUIraffe Team. All rights reserved.