public class GConstraint extends Object
Modifier and Type | Class and Description |
---|---|
static class |
GConstraint.Direction
Available flow directions for the flow constraint.
|
static class |
GConstraint.Position
Available docking positions for the dock constraint.
|
static class |
GConstraint.XAlign
Available values for the X alignment.
|
static class |
GConstraint.YAlign
Available values for the Y alignment.
|
Constructor and Description |
---|
GConstraint(GBasicConstraintInterface... basicConstraintsList)
Constructor to buid a constraint with the values defined in the argument list.
|
Modifier and Type | Method and Description |
---|---|
static GBasicConstraintInterface |
align(GConstraint.XAlign xValue,
GConstraint.YAlign yValue)
Create align basic constraint to be passed to the constructor.
|
static GBasicConstraintInterface |
alignx(GConstraint.XAlign xValue)
Create align basic constraint to be passed to the constructor.
|
static GBasicConstraintInterface |
aligny(GConstraint.YAlign yValue)
Create align basic constraint to be passed to the constructor.
|
static void |
avoidHorizontalDisplacement(GLabel longestGLabel,
GLabelWithIndicator alwaysVisibleGLabel)
Given the label that arrives the most to the right hand side of the panel, normally the loguest, or the
one with the greater gap at left, and given one label that is always visible, it computes the minimum
width for the indicator of the allways visible label in order to avoid lateral displacement of the
layout second column widgets when displaying/occulting ihm subparts, and it appyies it by the method
setWMin(int) . |
static GBasicConstraintInterface |
cell(int column,
int row)
Create cell basic constraint to be passed to the constructor, the cell associated to the constraint
will be set to null.
|
static GBasicConstraintInterface |
cell(int column,
int row,
Integer spanx)
Create cell basic constraint to be passed to the constructor, the cell associated to the constraint
will be set to null.
|
static GBasicConstraintInterface |
cell(int column,
int row,
Integer spanx,
Integer spany)
Create cell basic constraint to be passed to the constructor, the gap associated to the constraint will
be set to null.
|
static GBasicConstraintInterface |
dock(GConstraint.Position position)
Create a dock basic constraint to be passed to the constructor.
|
static GBasicConstraintInterface |
flow(GConstraint.Direction direction)
Create a flow basic constraint to be passed to the constructor.
|
static GBasicConstraintInterface |
gap(Integer gapLeft,
Integer gapRight,
Integer gapTop,
Integer gapBottom)
Create gap basic constraint to be passed to the constructor.
|
static GBasicConstraintInterface |
gapbottom(Integer gapBottom)
Create gap basic constraint to be passed to the constructor, only the gap left value is set the other
values are not modified.
|
static GBasicConstraintInterface |
gapleft(Integer gapLeft)
Create gap basic constraint to be passed to the constructor, only the gap left value is set the other
values are not modified.
|
static GBasicConstraintInterface |
gapright(Integer gapRight)
Create gap basic constraint to be passed to the constructor, only the gap right value is set the other
values are not modified.
|
static GBasicConstraintInterface |
gaptop(Integer gapTop)
Create gap basic constraint to be passed to the constructor, only the gap top value is set the other
values are not modified.
|
GConstraint.XAlign |
getalignX()
Get the alignx value or null if no alignx is defined.
|
GConstraint.YAlign |
getalignY()
Get the aligny value or null if no aligny is defined.
|
Integer |
getCellColumn()
Get the column associated to the cell.
|
Integer |
getCellRow()
Get the row associated to the cell.
|
Integer |
getCellSpanx()
Get the spanx associated to the cell.
|
Integer |
getCellSpany()
Get the spany associated to the cell.
|
GConstraint.Position |
getDock()
Get the position associated to the dock.
|
boolean |
getDoNewline()
Get the doWrap attribute value.
|
boolean |
getDoWrap()
Get the doWrap attribute value.
|
GConstraint.Direction |
getFlow()
Get the direction associated to the flow.
|
Integer[] |
getGap()
Get the gap value.
|
Integer |
getGrowX()
Get the growx value or null if no growx is defined.
|
Integer |
getGrowY()
Get the growy value or null if no growy is defined.
|
Integer |
getHeight()
Get the height value.
|
Integer |
getHMax()
Get the hmax value.
|
Integer |
getHMin()
Get the hmin value.
|
Integer |
getNewlineGap()
Get the gap associated to the gap.
|
Integer |
getPushX()
Get the pushx value or null if no pushx is defined.
|
Integer |
getPushY()
Get the pushy value or null if no pushy is defined.
|
Integer |
getSkip()
Get the skip value, or null if no skip is defined.
|
Integer |
getSpanX()
Get the spanx value or null if no spanx is defined.
|
Integer |
getSpanY()
Get the spany value or null if no spany is defined.
|
Integer |
getSplit()
Get the split value, or null if no split is defined.
|
Integer |
getWidth()
Get the width value.
|
Integer |
getWMax()
Get the wmax value.
|
Integer |
getWMin()
Get the wmin value.
|
Integer |
getWrapGap()
Get the gap associated to the gap.
|
static GBasicConstraintInterface |
grow()
Create grow basic constraint to be passed to the constructor.
|
static GBasicConstraintInterface |
grow(Integer xValue,
Integer yValue)
Create grow basic constraint to be passed to the constructor.
|
static GBasicConstraintInterface |
growx()
Create grow basic constraint to be passed to the constructor.
|
static GBasicConstraintInterface |
growx(Integer xValue)
Create grow basic constraint to be passed to the constructor.
|
static GBasicConstraintInterface |
growy()
Create grow basic constraint to be passed to the constructor.
|
static GBasicConstraintInterface |
growy(Integer yValue)
Create grow basic constraint to be passed to the constructor.
|
static GBasicConstraintInterface |
height(int value)
Create height basic constraint to be passed to the constructor.
|
static GBasicConstraintInterface |
hmax(int value)
Create hmax basic constraint to be passed to the constructor.
|
static GBasicConstraintInterface |
hmin(int value)
Create hmin basic constraint to be passed to the constructor.
|
static GBasicConstraintInterface |
newline()
Create wrap basic constraint to be passed to the constructor, the gap associated to the constraint will
be set to null.
|
static GBasicConstraintInterface |
newline(boolean doNewline)
Create wrap basic constraint to be passed to the constructor, the gap associated to the constraint will
be set to null.
|
static GBasicConstraintInterface |
newline(boolean doNewline,
Integer newlineWrap)
Create wrap basic constraint to be passed to the constructor.
|
static GBasicConstraintInterface |
push()
Create push basic constraint to be passed to the constructor.
|
static GBasicConstraintInterface |
push(Integer xValue,
Integer yValue)
Create push basic constraint to be passed to the constructor.
|
static GBasicConstraintInterface |
pushx()
Create push basic constraint to be passed to the constructor.
|
static GBasicConstraintInterface |
pushx(Integer xValue)
Create push basic constraint to be passed to the constructor.
|
static GBasicConstraintInterface |
pushy()
Create push basic constraint to be passed to the constructor.
|
static GBasicConstraintInterface |
pushy(Integer yValue)
Create push basic constraint to be passed to the constructor.
|
void |
setAlign(GConstraint.XAlign alignX,
GConstraint.YAlign alignY)
Set the align constraint value.
|
void |
setCell(int column,
int row,
Integer spanx,
Integer spany)
Set the cell value.
|
void |
setDock(GConstraint.Position position)
Set the dock position.
|
void |
setFlow(GConstraint.Direction direction)
Set the flow direction.
|
void |
setGap(Integer gapLeft,
Integer gapRight,
Integer gapTop,
Integer gapBottom)
Set the gap value.
|
void |
setGrow(boolean doGrowX,
boolean doGrowY,
Integer growX,
Integer growY)
Set the grow constraint value.
|
void |
setHeight(int value)
Set the height value.
|
void |
setHMax(int value)
Set the hmax value.
|
void |
setHMin(int value)
Set the hmin value.
|
void |
setNewline(boolean doNewLine,
Integer newLineGap)
Set the wrap constraint value.
|
void |
setPush(boolean doPushX,
boolean doPushY,
Integer pushX,
Integer pushY)
Set the push constraint value.
|
void |
setSkip(Boolean doSkip,
Integer skip)
Set the skip value.
|
void |
setSpan(Integer spanX,
Integer spanY)
Set the span constraint value.
|
void |
setSplit(boolean doSplit,
Integer split)
Set the split value.
|
void |
setWidth(int value)
Set the width value.
|
void |
setWMax(int value)
Set the wmax value.
|
void |
setWMin(int value)
Set the wmin value.
|
void |
setWrap(boolean doWrap,
Integer wrapGap)
Set the wrap constraint value.
|
void |
setWrap(int column,
int row,
Integer spanx,
Integer spany)
Set the cell constraint value.
|
static GBasicConstraintInterface |
skip()
Create skip basic constraint to be passed to the constructor, the gap associated to the constraint will
be set to null.
|
static GBasicConstraintInterface |
skip(boolean doSkip)
Create skip basic constraint to be passed to the constructor, the gap associated to the constraint will
be set to null.
|
static GBasicConstraintInterface |
skip(boolean doSkip,
Integer skip)
Create skip basic constraint to be passed to the constructor.
|
static GBasicConstraintInterface |
skip(Integer skip)
Create skip basic constraint to be passed to the constructor.
|
static GBasicConstraintInterface |
span(int xValue,
int yValue)
Create span basic constraint to be passed to the constructor.
|
static GBasicConstraintInterface |
spanx(int xValue)
Create span basic constraint to be passed to the constructor.
|
static GBasicConstraintInterface |
spany(int yValue)
Create span basic constraint to be passed to the constructor.
|
static GBasicConstraintInterface |
split()
Create split basic constraint to be passed to the constructor, the split associated to the constraint
will be set to null.
|
static GBasicConstraintInterface |
split(boolean doSplit)
Create split basic constraint to be passed to the constructor, the split associated to the constraint
will be set to null.
|
static GBasicConstraintInterface |
split(boolean doSplit,
Integer value)
Create split basic constraint to be passed to the constructor.
|
static GBasicConstraintInterface |
split(Integer value)
Create split basic constraint to be passed to the constructor.
|
String |
toString()
Builds and returns the constraint based on the stored values.
|
static GBasicConstraintInterface |
width(int value)
Create width basic constraint to be passed to the constructor.
|
static GBasicConstraintInterface |
wmax(int value)
Create wmax basic constraint to be passed to the constructor.
|
static GBasicConstraintInterface |
wmin(int value)
Create wmin basic constraint to be passed to the constructor.
|
static GBasicConstraintInterface |
wrap()
Create wrap basic constraint to be passed to the constructor, the gap associated to the constraint will
be set to null.
|
static GBasicConstraintInterface |
wrap(boolean doWrap)
Create wrap basic constraint to be passed to the constructor, the gap associated to the constraint will
be set to null.
|
static GBasicConstraintInterface |
wrap(boolean doWrap,
Integer wrapGap)
Create wrap basic constraint to be passed to the constructor.
|
public GConstraint(GBasicConstraintInterface... basicConstraintsList)
basicConstraintsList
- list of basic constraints to apply to the constraint in the creation of the object.public static void avoidHorizontalDisplacement(GLabel longestGLabel, GLabelWithIndicator alwaysVisibleGLabel)
setWMin(int)
. The minimum width is the width of the longuest label plus its gap
plus the indicator width (5 pxl) minus the width of the always visible label minus its gap. It takes
into account the font metrics, so this is a portable method.longestGLabel
- the longest GLabel in the panel including its gap (it might not be always visible).alwaysVisibleGLabel
- a label that is always visible in the panel (the most upper label normally).public String toString()
public void setNewline(boolean doNewLine, Integer newLineGap)
doNewLine
- true if there is a newline to be applied, false otherwise.newLineGap
- gap associated with the wrap.public void setPush(boolean doPushX, boolean doPushY, Integer pushX, Integer pushY)
doPushX
- boolean to activate the pushX constraintdoPushY
- boolean to activate the pushY constraintpushX
- pushx value or null if no pushx.pushY
- pushy value or null if no pushy.public void setAlign(GConstraint.XAlign alignX, GConstraint.YAlign alignY)
alignX
- alignx value or null if no alignx.alignY
- aligny value or null if no aligny.public void setGrow(boolean doGrowX, boolean doGrowY, Integer growX, Integer growY)
doGrowX
- boolean to activate the growX constraintdoGrowY
- boolean to activate the growY constraintgrowX
- growx value.growY
- growy value.public void setSpan(Integer spanX, Integer spanY)
spanX
- spanx value or null if no spanx.spanY
- spany value or null if no spany.public void setSkip(Boolean doSkip, Integer skip)
doSkip
- boolean to activate the skip constraintskip
- skip value or null if no skip.public void setSplit(boolean doSplit, Integer split)
doSplit
- boolean to activate the split constraintsplit
- split value or null if no split.public boolean getDoNewline()
public Integer getNewlineGap()
public void setWrap(boolean doWrap, Integer wrapGap)
doWrap
- true if there is a newline to be applied, false otherwise.wrapGap
- gap associated with the wrap.public void setWrap(int column, int row, Integer spanx, Integer spany)
column
- column value for the constraint.row
- column value for the constraint.spanx
- spanx value for the constraint.spany
- spany value for the constraint.public void setDock(GConstraint.Position position)
position
- dock position.public void setFlow(GConstraint.Direction direction)
direction
- flow direction.public boolean getDoWrap()
public Integer getWrapGap()
public GConstraint.Position getDock()
public GConstraint.Direction getFlow()
public Integer getCellColumn()
public Integer getCellRow()
public Integer getCellSpanx()
public Integer getCellSpany()
public void setGap(Integer gapLeft, Integer gapRight, Integer gapTop, Integer gapBottom)
gapLeft
- of the left gap, if null the left gap is not modified.gapRight
- of the right gap, if null the right gap is not modified.gapTop
- of the top gap, if null the top gap is not modified.gapBottom
- of the bottom gap, if null the bottom gap is not modified.public void setCell(int column, int row, Integer spanx, Integer spany)
column
- column value for the constraint.row
- column value for the constraint.spanx
- spanx value for the constraint.spany
- spany value for the constraint.public void setWidth(int value)
value
- of the width.public void setWMin(int value)
value
- of the wmin.public void setWMax(int value)
value
- of the wmax.public void setHeight(int value)
value
- of the height.public void setHMin(int value)
value
- of the hmin.public void setHMax(int value)
value
- of the hmax.public Integer[] getGap()
public Integer getWidth()
public Integer getWMin()
public Integer getWMax()
public Integer getHeight()
public Integer getHMin()
public Integer getHMax()
public Integer getPushX()
public Integer getPushY()
public GConstraint.XAlign getalignX()
public GConstraint.YAlign getalignY()
public Integer getGrowX()
public Integer getGrowY()
public Integer getSpanX()
public Integer getSpanY()
public Integer getSkip()
public Integer getSplit()
public static GBasicConstraintInterface wrap()
public static GBasicConstraintInterface wrap(boolean doWrap)
doWrap
- true if there is a newline to be applied, false otherwise.public static GBasicConstraintInterface cell(int column, int row)
column
- column value for the constraint.row
- column value for the constraint.public static GBasicConstraintInterface cell(int column, int row, Integer spanx)
column
- column value for the constraint.row
- column value for the constraint.spanx
- spanx value for the constraint.public static GBasicConstraintInterface cell(int column, int row, Integer spanx, Integer spany)
column
- column value for the constraint.row
- column value for the constraint.spanx
- spanx value for the constraint.spany
- spany value for the constraint.public static GBasicConstraintInterface newline(boolean doNewline, Integer newlineWrap)
doNewline
- true if there is a newline to be applied, false otherwise.newlineWrap
- gap associated with the wrap.public static GBasicConstraintInterface newline()
public static GBasicConstraintInterface newline(boolean doNewline)
doNewline
- true if there is a newline to be applied, false otherwise.public static GBasicConstraintInterface wrap(boolean doWrap, Integer wrapGap)
doWrap
- true if there is a newline to be applied, false otherwise.wrapGap
- gap associated with the wrap.public static GBasicConstraintInterface skip()
public static GBasicConstraintInterface skip(boolean doSkip)
doSkip
- true if there is a skip to be applied, false otherwise.public static GBasicConstraintInterface skip(Integer skip)
skip
- number of columns to be skipped.public static GBasicConstraintInterface skip(boolean doSkip, Integer skip)
doSkip
- true if there is a skip to be applied, false otherwise.skip
- number of columns to be skipped.public static GBasicConstraintInterface dock(GConstraint.Position position)
position
- dock position to be applied.public static GBasicConstraintInterface flow(GConstraint.Direction direction)
direction
- flow direction to be applied.public static GBasicConstraintInterface gap(Integer gapLeft, Integer gapRight, Integer gapTop, Integer gapBottom)
gapLeft
- of the left gap, if null the left gap is not modified.gapRight
- of the right gap, if null the right gap is not modified.gapTop
- of the top gap, if null the top gap is not modified.gapBottom
- of the bottom gap, if null the bottom gap is not modified.public static GBasicConstraintInterface gapleft(Integer gapLeft)
gapLeft
- of the left gap, if null the left gap is not modified.public static GBasicConstraintInterface gapright(Integer gapRight)
gapRight
- of the right gap, if null the right gap is not modified.public static GBasicConstraintInterface gaptop(Integer gapTop)
gapTop
- of the top gap, if null the top gap is not modified.public static GBasicConstraintInterface gapbottom(Integer gapBottom)
gapBottom
- of the bottom gap, if null the bottom gap is not modified.public static GBasicConstraintInterface pushx()
public static GBasicConstraintInterface pushx(Integer xValue)
xValue
- of the pushx.public static GBasicConstraintInterface pushy()
public static GBasicConstraintInterface pushy(Integer yValue)
yValue
- of the pushy.public static GBasicConstraintInterface push()
public static GBasicConstraintInterface push(Integer xValue, Integer yValue)
xValue
- of the pushx.yValue
- of the pushy.public static GBasicConstraintInterface alignx(GConstraint.XAlign xValue)
xValue
- of the alignx.public static GBasicConstraintInterface aligny(GConstraint.YAlign yValue)
yValue
- of the aligny.public static GBasicConstraintInterface align(GConstraint.XAlign xValue, GConstraint.YAlign yValue)
xValue
- of the alignx.yValue
- of the aligny.public static GBasicConstraintInterface growx()
public static GBasicConstraintInterface growx(Integer xValue)
xValue
- of the pushx.public static GBasicConstraintInterface growy()
public static GBasicConstraintInterface growy(Integer yValue)
yValue
- of the growy.public static GBasicConstraintInterface grow()
public static GBasicConstraintInterface grow(Integer xValue, Integer yValue)
xValue
- of the growx.yValue
- of the growy.public static GBasicConstraintInterface spanx(int xValue)
xValue
- of the spanx.public static GBasicConstraintInterface spany(int yValue)
yValue
- of the spany.public static GBasicConstraintInterface span(int xValue, int yValue)
xValue
- of the spanx.yValue
- of the spany.public static GBasicConstraintInterface split()
public static GBasicConstraintInterface split(boolean doSplit)
doSplit
- true if there is a split to be applied, false otherwise.public static GBasicConstraintInterface split(Integer value)
value
- the number of cell in which to split the current cellpublic static GBasicConstraintInterface split(boolean doSplit, Integer value)
doSplit
- true if there is a split to be applied, false otherwise.value
- the number of cell in which to split the current cellpublic static GBasicConstraintInterface width(int value)
value
- of the width.public static GBasicConstraintInterface wmin(int value)
value
- of the wmin.public static GBasicConstraintInterface wmax(int value)
value
- of the wmax.public static GBasicConstraintInterface height(int value)
value
- of the height.public static GBasicConstraintInterface hmin(int value)
value
- of the hmin.public static GBasicConstraintInterface hmax(int value)
value
- of the hmax.Copyright © 2024. All rights reserved.