Package org.jfree.layout
Class FormatLayout
java.lang.Object
org.jfree.layout.FormatLayout
- All Implemented Interfaces:
LayoutManager
,Serializable
A layout manager that spaces components over six columns in seven different
formats.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
A useful constant representing layout format 1.private int[]
The gaps between the columns (gap[0] is the gap following column zero).private int
Combined width of columns 0 to 5.private int
Combined width of columns 1 and 2.private int
Combined width of columns 1 to 4.private int
Combined width of columns 1 to 5.private int
Combined width of columns 4 and 5.private int[]
Working array for recording the width of each column.static final int
A useful constant representing layout format 2.static final int
A useful constant representing layout format 3.static final int
A useful constant representing layout format 6.static final int
A useful constant representing layout format 7.static final int
A useful constant representing layout format 4.static final int
A useful constant representing layout format 5.private int[]
The layout format for each row.private int
The gap between the rows.private int[]
Working array for recording the height of each row.private static final long
For serialization.private int
The total height of the layout.private int
The total width of the layout. -
Constructor Summary
ConstructorsConstructorDescriptionFormatLayout
(int rowCount, int[] rowFormats) Constructs a new layout manager that can be used to create input forms. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addLayoutComponent
(Component comp) Not used.void
addLayoutComponent
(String name, Component comp) Not used.void
complete()
Finishes of the processing.void
layoutContainer
(Container parent) Performs the layout of the container.minimumLayoutSize
(Container parent) Returns the minimum size of the component using this layout manager.preferredLayoutSize
(Container parent) Returns the preferred size of the component using this layout manager.void
Not used.void
removeLayoutComponent
(String name, Component comp) Not used.private boolean
Returns true if this layout involves a split into two sections.protected void
Processes a row in 'C' format.protected void
Processes a row in 'LC' format.protected void
Processes a row in 'LCB' format.protected void
Processes a row in 'LCBLC' format.protected void
updateLCBLCB
(int rowIndex, Dimension d0, Dimension d1, Dimension d2, Dimension d3, Dimension d4, Dimension d5) Processes a row in 'LCBLCB' format.protected void
updateLCLC
(int rowIndex, Dimension d0, Dimension d1, Dimension d2, Dimension d3) Processes a row in 'LCLC' format.protected void
Processes a row in 'LCLCB' format.
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDFor serialization.- See Also:
-
C
public static final int CA useful constant representing layout format 1.- See Also:
-
LC
public static final int LCA useful constant representing layout format 2.- See Also:
-
LCB
public static final int LCBA useful constant representing layout format 3.- See Also:
-
LCLC
public static final int LCLCA useful constant representing layout format 4.- See Also:
-
LCLCB
public static final int LCLCBA useful constant representing layout format 5.- See Also:
-
LCBLC
public static final int LCBLCA useful constant representing layout format 6.- See Also:
-
LCBLCB
public static final int LCBLCBA useful constant representing layout format 7.- See Also:
-
rowFormats
private int[] rowFormatsThe layout format for each row. -
rowGap
private int rowGapThe gap between the rows. -
columnGaps
private int[] columnGapsThe gaps between the columns (gap[0] is the gap following column zero). -
rowHeights
private int[] rowHeightsWorking array for recording the height of each row. -
totalHeight
private int totalHeightThe total height of the layout. -
columnWidths
private int[] columnWidthsWorking array for recording the width of each column. -
totalWidth
private int totalWidthThe total width of the layout. -
columns1and2Width
private int columns1and2WidthCombined width of columns 1 and 2. -
columns4and5Width
private int columns4and5WidthCombined width of columns 4 and 5. -
columns1to4Width
private int columns1to4WidthCombined width of columns 1 to 4. -
columns1to5Width
private int columns1to5WidthCombined width of columns 1 to 5. -
columns0to5Width
private int columns0to5WidthCombined width of columns 0 to 5.
-
-
Constructor Details
-
FormatLayout
public FormatLayout(int rowCount, int[] rowFormats) Constructs a new layout manager that can be used to create input forms. The layout manager works by arranging components in rows using six columns (some components will use more than one column).Any component can be added, but I think of them in terms of Labels, Components, and Buttons. The formats available are: C, LC, LCB, LCLC, LCLCB, LCBLC or LCBLCB.
C 1 component in this row (spread across all six columns). LC 2 components, a label in the 1st column, and a component using the remaining 5 columns). LCB 3 components, a label in the 1st column, a component spread across the next 4, and a button in the last column. LCLC 4 components, a label in column 1, a component in 2-3, a label in 4 and a component in 5-6. LCLCB 5 components, a label in column 1, a component in 2-3, a label in 4, a component in 5 and a button in 6. LCBLC 5 components, a label in column 1, a component in 2, a button in 3, a label in 4, a component in 5-6. LCBLCB 6 components, one in each column. Columns 1 and 4 expand to accommodate the widest label, and 3 and 6 to accommodate the widest button.
Each row will contain the number of components indicated by the format. Be sure to specify enough row formats to cover all the components you add to the layout.
- Parameters:
rowCount
- the number of rows.rowFormats
- the row formats.
-
-
Method Details
-
preferredLayoutSize
Returns the preferred size of the component using this layout manager.- Specified by:
preferredLayoutSize
in interfaceLayoutManager
- Parameters:
parent
- the parent.- Returns:
- the preferred size of the component.
-
minimumLayoutSize
Returns the minimum size of the component using this layout manager.- Specified by:
minimumLayoutSize
in interfaceLayoutManager
- Parameters:
parent
- the parent.- Returns:
- the minimum size of the component
-
layoutContainer
Performs the layout of the container.- Specified by:
layoutContainer
in interfaceLayoutManager
- Parameters:
parent
- the parent.
-
updateC
Processes a row in 'C' format.- Parameters:
rowIndex
- the row index.d0
- dimension 0.
-
updateLC
Processes a row in 'LC' format.- Parameters:
rowIndex
- the row index.d0
- dimension 0.d1
- dimension 1.
-
updateLCB
Processes a row in 'LCB' format.- Parameters:
rowIndex
- the row index.d0
- dimension 0.d1
- dimension 1.d2
- dimension 2.
-
updateLCLC
Processes a row in 'LCLC' format.- Parameters:
rowIndex
- the row index.d0
- dimension 0.d1
- dimension 1.d2
- dimension 2.d3
- dimension 3.
-
updateLCBLC
protected void updateLCBLC(int rowIndex, Dimension d0, Dimension d1, Dimension d2, Dimension d3, Dimension d4) Processes a row in 'LCBLC' format.- Parameters:
rowIndex
- the row index.d0
- dimension 0.d1
- dimension 1.d2
- dimension 2.d3
- dimension 3.d4
- dimension 4.
-
updateLCLCB
protected void updateLCLCB(int rowIndex, Dimension d0, Dimension d1, Dimension d2, Dimension d3, Dimension d4) Processes a row in 'LCLCB' format.- Parameters:
rowIndex
- the row index.d0
- dimension 0.d1
- dimension 1.d2
- dimension 2.d3
- dimension 3.d4
- dimension 4.
-
updateLCBLCB
protected void updateLCBLCB(int rowIndex, Dimension d0, Dimension d1, Dimension d2, Dimension d3, Dimension d4, Dimension d5) Processes a row in 'LCBLCB' format.- Parameters:
rowIndex
- the row index.d0
- dimension 0.d1
- dimension 1.d2
- dimension 2.d3
- dimension 3.d4
- dimension 4.d5
- dimension 5.
-
complete
public void complete()Finishes of the processing. -
splitLayout
private boolean splitLayout()Returns true if this layout involves a split into two sections.- Returns:
true
if this layout involves a split into two sections.
-
addLayoutComponent
Not used.- Parameters:
comp
- the component.
-
removeLayoutComponent
Not used.- Specified by:
removeLayoutComponent
in interfaceLayoutManager
- Parameters:
comp
- the component.
-
addLayoutComponent
Not used.- Specified by:
addLayoutComponent
in interfaceLayoutManager
- Parameters:
name
- the component name.comp
- the component.
-
removeLayoutComponent
Not used.- Parameters:
name
- the component name.comp
- the component.
-