|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.izforge.izpack.gui.IzPanelLayout
public class IzPanelLayout
This is a special layout manager for IzPanels.
Nested Class Summary | |
---|---|
static class |
IzPanelLayout.FillerComponent
Component which will be used as placeholder if not extern component will be set or as filler for struts. |
Field Summary | |
---|---|
private static int |
ANCHOR
Anchor to be used for the controls in all panels. |
private int |
columnFillOutRule
|
private java.util.ArrayList<java.util.ArrayList<IzPanelConstraints>> |
components
holds all the components and layout constraints. |
private int |
currentXPos
Current column to handle symbolic values like NEXT_COLUMN in constraints. |
private int |
currentYPos
Maximum rows to handle symbolic values like NEXT_ROW in constraints. |
private static IzPanelConstraints[] |
DEFAULT_CONSTRAINTS
Array with some default constraints. |
private static int |
DEFAULT_TEXTFIELD_LENGTH
|
protected static int[] |
DEFAULT_X_ALIGNMENT
|
protected static int[] |
DEFAULT_X_GAPS
|
protected static int[] |
DEFAULT_Y_ALIGNMENT
|
protected static int[] |
DEFAULT_Y_GAPS
|
private static double |
FULL_COLUMN_STRETCH_DEFAULT
|
private static double |
FULL_LINE_STRETCH_DEFAULT
|
private static int[][] |
GAP_INTERMEDIAER_LOOKUP
|
private java.awt.Insets |
oldParentInsets
|
private java.awt.Dimension |
oldParentSize
|
private double[] |
overallYStretch
|
private java.awt.Dimension |
prefLayoutDim
Dimension object with prefered size. |
private static int |
X_STRETCH_TYPE
|
private 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 | |
---|---|
IzPanelLayout()
Default constructor |
|
IzPanelLayout(int colFillOutRule)
Creates an layout manager which consider the given column fill out rule. |
Method Summary | |
---|---|
void |
addLayoutComponent(java.awt.Component comp,
java.lang.Object constraints)
|
void |
addLayoutComponent(java.lang.String name,
java.awt.Component comp)
|
private int |
columns()
Returns the number of columns that need to be laid out. |
static java.awt.Component |
createGap(int gapType,
int direction)
Returns a filler component which has self the size 0|0. |
static java.awt.Component |
createHorizontalFiller(int fillerNumber)
Returns a filler component which has self the size 0|0. |
static java.awt.Component |
createHorizontalStrut(int width)
Creates an invisible, component with a defined width. |
static java.awt.Component |
createParagraphGap()
Returns a filler component which has self the size 0|0. |
static java.awt.Component |
createVerticalFiller(int fillerNumber)
Returns a filler component which has self the size 0|0. |
static java.awt.Component |
createVerticalStrut(int height)
Creates an invisible, component with a defined height. |
private java.awt.Dimension |
determineSize()
Method which determine minimum with and height of this layout. |
private void |
fastLayoutContainer(java.awt.Container parent)
|
private int |
getAdaptedXPos(int xpos,
int curWidth,
java.awt.Dimension curDim,
IzPanelConstraints currentConst)
|
private int |
getAdaptedYPos(int ypos,
int curHeight,
java.awt.Dimension curDim,
IzPanelConstraints currentConst)
|
static int |
getAnchor()
Returns the anchor constant. |
private java.awt.Dimension |
getCellSize(int column,
int row,
IzPanelConstraints constraints)
Measures and returns the minimum size required to render the component in the indicated row and column. |
private IzPanelConstraints |
getConstraints(int col,
int row)
Returns the constraint object of the component at the given place. |
static IzPanelConstraints |
getDefaultConstraint(int type)
Returns the constraint for the given type. |
static int |
getDefaultTextfieldLength()
Returns the default length used by textfields. |
static int |
getDefaultXGap(int gapId)
Returns the default x gap for the given gap id. |
static int |
getDefaultYGap(int gapId)
Returns the default y gap for the given gap id. |
static double |
getFullColumnStretch()
Returns the value which should be used stretching to a full column. |
static double |
getFullLineStretch()
Returns the value which should be used stretching to a full line. |
private static int |
getIntermediarId(java.lang.Class clazz,
java.awt.Component comp)
Returns an index depending on the class type. |
float |
getLayoutAlignmentX(java.awt.Container target)
|
float |
getLayoutAlignmentY(java.awt.Container target)
|
private double[] |
getOverallYStretch()
Returns the sum of the maximum y stretch of each row. |
private static int |
getXGap(IzPanelConstraints curConst,
IzPanelConstraints nextXConst)
Returns the x gap for the given constraint dependant on the next x constraint. |
static int |
getXStretchType()
Returns the current used type of stretching for the X-direction. |
private static int |
getYGap(IzPanelConstraints curConst,
IzPanelConstraints nextYConst)
Returns the y gap for the given constraint dependant on the next y constraint. |
static int |
getYStretchType()
Returns the current used type of stretching for the Y-direction. |
void |
invalidateLayout(java.awt.Container target)
|
void |
layoutContainer(java.awt.Container parent)
|
java.awt.Dimension |
maximumLayoutSize(java.awt.Container target)
|
private int |
minimumAllColumnsWidth()
Returns the minimum width needed by all columns. |
private int |
minimumColumnWidth(int column)
Returns the minimum width of the column requested. |
java.awt.Dimension |
minimumLayoutSize(java.awt.Container parent)
|
private int |
minimumOverallHeight()
Minimum height of all rows. |
private boolean |
needNewLayout(java.awt.Container parent)
|
private boolean |
needsReEvaluation(java.awt.Component comp)
Returns whether the type of component needs potential a reevaluation or not. |
java.awt.Dimension |
preferredLayoutSize(java.awt.Container parent)
|
void |
removeLayoutComponent(java.awt.Component comp)
|
private void |
resolveDefaultSettings(int col,
int row)
|
private int |
resolveGenerellOffsets(int[] generellOffset,
java.awt.Dimension realSizeDim,
java.awt.Insets insets,
int maxWidth,
int overallHeight)
|
private int |
rowHeight(int row)
Measures and returns the minimum height required to render the components in the indicated row. |
private int |
rowHeight(int row,
int minOverallHeight,
int maxOverallHeight)
Measures and returns the minimum height required to render the components in the indicated row. |
private int |
rows()
Returns the number of rows that need to be laid out. |
static void |
setAnchor(int anchor)
Sets the anchor constant. |
static void |
setDefaultTextfieldLength(int val)
Sets the value for the default length of textfields. |
static void |
setDefaultXGap(int gap,
int gapId)
Set the gap for the given gap id for the x default gaps. |
static void |
setDefaultYGap(int gap,
int gapId)
Set the gap for the given gap id for the y default gaps. |
static void |
setFullColumnStretch(double fullStretch)
Sets the value which should be used as default for stretching to a full column. |
static void |
setFullLineStretch(double fullLineStretch)
Sets the value which should be used as default for stretching to a full line. |
static void |
setXStretchType(int x_stretch)
Sets the type of stretching to be used for the X-Direction. |
static void |
setYStretchType(int y_stretch)
Sets the type of stretching to be used for the Y-Direction. |
static int |
verifyGapId(int gapId)
Verifies whether a gap id is valid or not. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.util.ArrayList<java.util.ArrayList<IzPanelConstraints>> components
private int currentYPos
private int currentXPos
private java.awt.Dimension prefLayoutDim
private java.awt.Dimension oldParentSize
private java.awt.Insets oldParentInsets
private int columnFillOutRule
private double[] overallYStretch
protected static int[] DEFAULT_Y_GAPS
protected static int[] DEFAULT_X_GAPS
protected static int[] DEFAULT_X_ALIGNMENT
protected static int[] DEFAULT_Y_ALIGNMENT
private static IzPanelConstraints[] DEFAULT_CONSTRAINTS
private static int ANCHOR
private static int X_STRETCH_TYPE
private static int Y_STRETCH_TYPE
private static double FULL_LINE_STRETCH_DEFAULT
private static double FULL_COLUMN_STRETCH_DEFAULT
private static int DEFAULT_TEXTFIELD_LENGTH
private static final int[][] GAP_INTERMEDIAER_LOOKUP
Constructor Detail |
---|
public IzPanelLayout()
public IzPanelLayout(int colFillOutRule)
colFillOutRule
- Method Detail |
---|
private static int getYGap(IzPanelConstraints curConst, IzPanelConstraints nextYConst)
curConst
- constraint of the component for which the gap should be returndnextYConst
- constraint of the component which is the next in y direction
private static int getXGap(IzPanelConstraints curConst, IzPanelConstraints nextXConst)
curConst
- constraint of the component for which the gap should be returndnextXConst
- constraint of the component which is the next in x direction
private static int getIntermediarId(java.lang.Class clazz, java.awt.Component comp)
clazz
- class for which the index should be returnedcomp
- component for which the index should be returned
public void addLayoutComponent(java.lang.String name, java.awt.Component comp)
addLayoutComponent
in interface java.awt.LayoutManager
public void removeLayoutComponent(java.awt.Component comp)
removeLayoutComponent
in interface java.awt.LayoutManager
public java.awt.Dimension minimumLayoutSize(java.awt.Container parent)
minimumLayoutSize
in interface java.awt.LayoutManager
public java.awt.Dimension preferredLayoutSize(java.awt.Container parent)
preferredLayoutSize
in interface java.awt.LayoutManager
private java.awt.Dimension determineSize()
private int rows()
private int columns()
private int minimumOverallHeight()
private int rowHeight(int row)
row
- the index of the row to measure
private int rowHeight(int row, int minOverallHeight, int maxOverallHeight)
row
- the index of the row to measuremaxOverallHeight
- minOverallHeight
-
private double[] getOverallYStretch()
private java.awt.Dimension getCellSize(int column, int row, IzPanelConstraints constraints)
row
- the index of the row to measurecolumn
- the column of the componentconstraints
- constraints of current component
private int minimumColumnWidth(int column)
column
- the columns to measure
private int minimumAllColumnsWidth()
private IzPanelConstraints getConstraints(int col, int row)
col
- column of the componentrow
- row of the component
private int getAdaptedXPos(int xpos, int curWidth, java.awt.Dimension curDim, IzPanelConstraints currentConst)
private int getAdaptedYPos(int ypos, int curHeight, java.awt.Dimension curDim, IzPanelConstraints currentConst)
private void resolveDefaultSettings(int col, int row)
public void layoutContainer(java.awt.Container parent)
layoutContainer
in interface java.awt.LayoutManager
private void fastLayoutContainer(java.awt.Container parent)
private boolean needNewLayout(java.awt.Container parent)
private int resolveGenerellOffsets(int[] generellOffset, java.awt.Dimension realSizeDim, java.awt.Insets insets, int maxWidth, int overallHeight)
private boolean needsReEvaluation(java.awt.Component comp)
comp
- component to check
public float getLayoutAlignmentX(java.awt.Container target)
getLayoutAlignmentX
in interface java.awt.LayoutManager2
public float getLayoutAlignmentY(java.awt.Container target)
getLayoutAlignmentY
in interface java.awt.LayoutManager2
public void invalidateLayout(java.awt.Container target)
invalidateLayout
in interface java.awt.LayoutManager2
public java.awt.Dimension maximumLayoutSize(java.awt.Container target)
maximumLayoutSize
in interface java.awt.LayoutManager2
public void addLayoutComponent(java.awt.Component comp, java.lang.Object constraints)
addLayoutComponent
in interface java.awt.LayoutManager2
public static java.awt.Component createHorizontalStrut(int width)
width
- the width of the invisible component
public static java.awt.Component createVerticalStrut(int height)
height
- the height of the invisible component, in pixels >= 0
public static java.awt.Component createParagraphGap()
public static java.awt.Component createVerticalFiller(int fillerNumber)
fillerNumber
- number of the filler which should be used
public static java.awt.Component createHorizontalFiller(int fillerNumber)
fillerNumber
- number of the filler which should be used
public static java.awt.Component createGap(int gapType, int direction)
gapType
- type of gap to be useddirection
- direction to be used
public static IzPanelConstraints getDefaultConstraint(int type)
LayoutConstraints
. Possible are LABEL_CONSTRAINT, TEXT_CONSTRAINT and
CONTROL_CONSTRAINT.
type
- for which the constraint should be returned
public static int getAnchor()
public static void setAnchor(int anchor)
anchor
- symbolic constant to be usedpublic static int getXStretchType()
public static void setXStretchType(int x_stretch)
x_stretch
- constant to be used for stretch typepublic static int getYStretchType()
public static void setYStretchType(int y_stretch)
y_stretch
- constant to be used for stretch typepublic static double getFullLineStretch()
public static void setFullLineStretch(double fullLineStretch)
fullLineStretch
- value to be used as full line stretching defaultpublic static double getFullColumnStretch()
public static void setFullColumnStretch(double fullStretch)
fullStretch
- value to be used as full column stretching defaultpublic static int verifyGapId(int gapId)
gapId
- to be verified
public static int getDefaultXGap(int gapId)
gapId
- for which the default x gap should be returned
public static void setDefaultXGap(int gap, int gapId)
gap
- to be used as defaultgapId
- for which the default should be setpublic static int getDefaultYGap(int gapId)
gapId
- for which the default y gap should be returned
public static void setDefaultYGap(int gap, int gapId)
gap
- to be used as defaultgapId
- for which the default should be setpublic static int getDefaultTextfieldLength()
public static void setDefaultTextfieldLength(int val)
val
- to be set as default length for textfields
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |