|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.izforge.izpack.installer.gui.LayoutHelper
public class LayoutHelper
This class manages the layout for IzPanels. The layout related methods in IzPanel delegates the
work to this class. Use the layout helper directly because the delegating methods in IzPanel will
be removed in the future.
This layout helper works with a GridBagLayout or a IzPanelLayout as layout manager. The layout
manager has to be set at calling the method startLayout. This method has to be
called before the first add of a component to the IzPanel.
| Field Summary | |
|---|---|
static String |
ALL_X_GAP
Identifier of x gap for all default x gaps. |
static String |
ALL_Y_GAP
Identifier of x gap for all default y gaps. |
protected static int |
ANCHOR
Layout anchor declared in the xml file with the guiprefs modifier "layoutAnchor" |
protected Object |
defaultConstraints
The default grid bag constraint. |
protected static Double |
DOUBLE_ZERO
|
protected static double |
FULL_COLUMN_STRETCH_DEFAULT
|
protected static double |
FULL_LINE_STRETCH_DEFAULT
|
protected int |
gridxCounter
Current x position of grid. |
protected int |
gridyCounter
Current y position of grid. |
protected static Double |
INITIAL_STRETCH_DEFAULT
|
protected LayoutManager2 |
izPanelLayout
internal layout |
protected boolean |
layoutStarted
Indicates whether grid bag layout was started or not |
static String[] |
X_GAP_NAME_LOOK_UP
Look-up table for gap identifier to gap names for the x direction. |
protected static int |
X_STRETCH_TYPE
|
static String[] |
Y_GAP_NAME_LOOK_UP
Look-up table for gap identifier to gap names for the y direction. |
protected static int |
Y_STRETCH_TYPE
|
| Fields inherited from interface javax.swing.SwingConstants |
|---|
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
| Constructor Summary | |
|---|---|
protected |
LayoutHelper(InstallData installData)
Constructs a LayoutHelper. |
|
LayoutHelper(JComponent parent,
InstallData installData)
Creates a layout manager for special purpose. |
| Method Summary | |
|---|---|
static void |
buildConstraints(GridBagConstraints gbc,
int gx,
int gy,
int gw,
int gh,
double wx,
double wy)
Sets the parameters of a GridBagConstraints object. |
void |
completeLayout()
Complete layout determining. |
int |
getAnchor()
Returns the anchor as value declared in GridBagConstraints. |
Object |
getDefaultConstraints()
Returns the default constraints of this panel. |
double |
getFullColumnStretch()
Returns the default value for stretching to a full column. |
double |
getFullLineStretch()
Returns the default value for stretching to a full line. |
LayoutManager2 |
getLayout()
Returns the layout manager which current used by this layout helper. |
Object |
getNewConstraints(int gridx,
int gridy)
Returns a newly created constraints with the given values and the values from the default constraints for the other parameters. |
Object |
getNewConstraints(int gridx,
int gridy,
int gridwidth,
int gridheight)
Returns a newly created constraints with the given values and the values from the defaultGridBagConstraints for the other parameters. |
Object |
getNextXConstraints()
Returns a newly created constraints for the next column of the current layout row. |
Object |
getNextYConstraints()
Returns a newly created constraints with column 0 for the next row. |
Object |
getNextYConstraints(int gridwidth,
int gridheight)
Returns a newly created constraints with column 0 for the next row using the given parameters. |
int |
getXGap(int gapId)
Returns the gap which should be used between the given gui objects for the x direction. |
int |
getXStretchType()
Returns the used stretch type for the x direction. |
int |
getYGap(int gapId)
Returns the gap which should be used between the given gui objects for the y direction. |
int |
getYStretchType()
Returns the used stretch type for the y direction. |
void |
resetGridCounter()
Resets the grid counters which are used at getNextXConstraints and getNextYConstraints. |
void |
setDefaultConstraints(Object constraints)
Sets the default constraints of this panel to the given object. |
void |
setLayout(LayoutManager2 izPanelLayout)
Sets the given layout manager for this layout helper to be used. |
void |
startLayout(LayoutManager2 layout)
Start layout determining. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected boolean layoutStarted
protected Object defaultConstraints
protected int gridxCounter
protected int gridyCounter
protected LayoutManager2 izPanelLayout
protected static int ANCHOR
protected static int X_STRETCH_TYPE
protected static int Y_STRETCH_TYPE
protected static double FULL_LINE_STRETCH_DEFAULT
protected static double FULL_COLUMN_STRETCH_DEFAULT
protected static Double INITIAL_STRETCH_DEFAULT
protected static Double DOUBLE_ZERO
public static final String[] X_GAP_NAME_LOOK_UP
public static final String[] Y_GAP_NAME_LOOK_UP
public static final String ALL_X_GAP
public static final String ALL_Y_GAP
| Constructor Detail |
|---|
public LayoutHelper(JComponent parent,
InstallData installData)
parent - for which this layout manager will be usedinstallData - the installation dataprotected LayoutHelper(InstallData installData)
installData - the installation data| Method Detail |
|---|
public void startLayout(LayoutManager2 layout)
IzPanel.LayoutType are also supported.
layout - layout to be used by this layout helperpublic void completeLayout()
IzPanel.LayoutType are also supported.
public Object getDefaultConstraints()
public void setDefaultConstraints(Object constraints)
constraints - which should be set as default for this objectpublic void resetGridCounter()
public Object getNewConstraints(int gridx,
int gridy)
gridx - value to be used for the new constraintgridy - value to be used for the new constraint
public Object getNewConstraints(int gridx,
int gridy,
int gridwidth,
int gridheight)
gridx - value to be used for the new constraintgridy - value to be used for the new constraintgridwidth - value to be used for the new constraintgridheight - value to be used for the new constraint
public Object getNextXConstraints()
public Object getNextYConstraints()
public Object getNextYConstraints(int gridwidth,
int gridheight)
gridwidth - width for this constraintgridheight - height for this constraint
public int getAnchor()
public int getXGap(int gapId)
gapId - index in array GAP_NAME_LOOK_UP for the needed gap
public int getYGap(int gapId)
gapId - index in array GAP_NAME_LOOK_UP for the needed gap
public int getXStretchType()
public int getYStretchType()
public double getFullLineStretch()
public double getFullColumnStretch()
public LayoutManager2 getLayout()
public void setLayout(LayoutManager2 izPanelLayout)
izPanelLayout - layout manager to be used
public static void buildConstraints(GridBagConstraints gbc,
int gx,
int gy,
int gw,
int gh,
double wx,
double wy)
gbc - The constraints object.gx - The x coordinates.gy - The y coordinates.gw - The width.wx - The x wheight.wy - The y wheight.gh - Description of the Parameter
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||