public class ButtonLayout extends PercentLayoutBase
A layout manager that deals with button bars for dialogs.
With this layout manager typical horizontal button bars for dialogs can be created in an easy way. The button objects simply need to be added to the container, no constraints need to be passed. These button bars have the following properties:
This class is a special implementation of PercentLayoutBase
. It
implements the button layout on top of a percent layout. As its ancestor this
class is platform neutral, i.e. it can work together with different GUI
libraries for which a PercentLayoutPlatformAdapter
implementation is
available.
Modifier and Type | Class and Description |
---|---|
static class |
ButtonLayout.Alignment
An enumeration class for the alignment of a
ButtonLayout . |
Constructor and Description |
---|
ButtonLayout()
Creates a new instance of
ButtonLayout . |
Modifier and Type | Method and Description |
---|---|
ButtonLayout.Alignment |
getAlignment()
Returns the alignment of the button bar.
|
NumberWithUnit |
getBottomMargin()
Returns the bottom margin.
|
NumberWithUnit |
getGap()
Returns the width of the gap between the buttons.
|
NumberWithUnit |
getLeftMargin()
Returns the left margin.
|
NumberWithUnit |
getRightMargin()
Returns the right margin.
|
NumberWithUnit |
getTopMargin()
Returns the top margin.
|
protected void |
initCells(PercentLayoutPlatformAdapter adapter)
Initializes the whole layout.
|
protected void |
initColumnConstraints(int lastIndex,
int buttonCount)
Initializes the column constraints.
|
protected void |
initRowConstraints()
Initializes the row constraints.
|
protected void |
insertButtons(PercentLayoutPlatformAdapter adapter,
int buttonCount)
Inserts all buttons into the percent layout.
|
void |
setAlignment(ButtonLayout.Alignment alignment)
Sets the alignment of the button bar.
|
void |
setBottomMargin(NumberWithUnit bottomMargin)
Sets the bottom margin.
|
void |
setGap(NumberWithUnit gap)
Sets the width of the gap between the buttons.
|
void |
setLeftMargin(NumberWithUnit leftMargin)
Sets the left margin.
|
void |
setRightMargin(NumberWithUnit rightMargin)
Sets the right margin.
|
void |
setTopMargin(NumberWithUnit topMargin)
Sets the top margin.
|
addColumnGroup, addRowGroup, alignComponent, applyCellGroups, applyWeightFactors, applyWeightFactors, calcCellPositions, calcCellSize, calcCellSizes, calcCellSizesWithGroups, calcComponentSize, calcComponentSizes, calcMinimumLayoutSize, calcPreferredLayoutSize, calcSizes, calcTotalWeight, checkConstraints, clearCells, clearCells, constraintsFor, fetchPlatformAdapter, flushCache, getAllColumnConstraints, getAllRowConstraints, getColumnConstraints, getColumnCount, getColumnGroups, getComponent, getConstraintsBuilder, getInternalAllColumnConstraints, getInternalAllRowConstraints, getMinimumComponentSize, getOrientationValue, getPercentData, getPlatformAdapter, getPreferredComponentSize, getRowConstraints, getRowCount, getRowGroups, getSizeHandler, getTotalWeightX, getTotalWeightY, handleMultiSpans, initCell, initDimensions, initFromCollections, isCanShrink, performLayout, performLayout, removeComponent, setCanShrink, setColumnConstraints, setComponentBounds, setPlatformAdapter, setRowConstraints
public ButtonLayout()
ButtonLayout
. All properties are
set to default values.public NumberWithUnit getTopMargin()
public void setTopMargin(NumberWithUnit topMargin)
topMargin
- the top margin (a null reference is converted to
a value of 0)public NumberWithUnit getBottomMargin()
public void setBottomMargin(NumberWithUnit bottomMargin)
bottomMargin
- the bottom marginpublic NumberWithUnit getLeftMargin()
public void setLeftMargin(NumberWithUnit leftMargin)
leftMargin
- the left margin (a null reference is converted
to a value of 0)public NumberWithUnit getRightMargin()
public void setRightMargin(NumberWithUnit rightMargin)
rightMargin
- the right margin (a null reference is converted
to a value of 0)public NumberWithUnit getGap()
public void setGap(NumberWithUnit gap)
gap
- the gap's width (a null reference is converted to a
value of 0)public ButtonLayout.Alignment getAlignment()
public void setAlignment(ButtonLayout.Alignment alignment)
alignment
- the new alignment (must not be null)IllegalArgumentException
- if the alignment is nullprotected void initCells(PercentLayoutPlatformAdapter adapter)
initCells
in class PercentLayoutBase
adapter
- the currently used platform adapterprotected void initRowConstraints()
protected void initColumnConstraints(int lastIndex, int buttonCount)
lastIndex
- the index of the last columnbuttonCount
- the number of buttonsprotected void insertButtons(PercentLayoutPlatformAdapter adapter, int buttonCount)
adapter
- the platform adapterbuttonCount
- the number of available buttonsCopyright © 2016 The JGUIraffe Team. All rights reserved.