|
![]() |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.openpermis.editor.policy.gui.forms.FormBuilder
public class FormBuilder
Simple builder for GUI forms that mostly look the same.
Nested Class Summary | |
---|---|
protected static class |
FormBuilder.AbstractRow
Abstract base class for rows. |
protected static class |
FormBuilder.ComponentRow
Abstract row that contains multiple components. |
protected static class |
FormBuilder.GapRow
Row without components that denotes a section gap. |
protected static class |
FormBuilder.LabelComponentRow
Row that contains a label and a component (no tool bar). |
protected static class |
FormBuilder.LabelComponentsRow
Row that contains a label and two components. |
protected static class |
FormBuilder.LabelToolBarRow
Row that contains a label and a toolbar. |
protected static interface |
FormBuilder.Row
Describes a single row during construction time of a form builder layout. |
protected static class |
FormBuilder.SingleComponentRow
Row that fills and grows vertically. |
Field Summary | |
---|---|
protected static String |
LINE_GAP
Gap between two related rows. |
protected static String |
SECTION_GAP
Gap between two unrelated rows. |
Constructor Summary | |
---|---|
FormBuilder(ActionMap actionMap,
org.jdesktop.application.ResourceMap resourceMap)
Creates a new form builder. |
Method Summary | ||
---|---|---|
FormBuilder |
addComponentRow(JComponent component,
boolean grow)
Adds a row that contains a single component. |
|
FormBuilder |
addGap()
Adds a section gap which is slightly bigger than the usual row gap. |
|
FormBuilder |
addHeaderRow(String header)
Adds a labeled header row with a separator. |
|
FormBuilder |
addLabelComponentButtonRow(String label,
JComponent component,
String button)
Adds a row consisting of a label, component and a button. |
|
FormBuilder |
addLabelComponentRow(String label,
JComponent component)
Adds a row consisting of a label and a component (no tool bar). |
|
FormBuilder |
addLabelComponentRow(String label,
JComponent component,
String rowSpec)
Adds a row consisting of a label and a component (no tool bar). |
|
FormBuilder |
addLabelComponentToolBarRow(String label,
JComponent component,
String toolBar)
Adds a row consisting of a label, component and its tool bar. |
|
FormBuilder |
addLabelRow(String label)
Adds a row that containing a single label. |
|
FormBuilder |
addLabelToolBarComponentRows(String label,
String toolBar,
JComponent scrollComponent)
Convenience method to add two rows to the form layout. |
|
FormBuilder |
addLabelToolBarRow(String label,
String toolBar)
Adds a row consisting of a label and a tool bar. |
|
protected FormBuilder |
addRow(FormBuilder.Row row)
Adds a row to the layout. |
|
FormBuilder |
addScrollComponentRow(JComponent component)
Adds a row that contains a single component that is optionally wrapped in a scroll pane. |
|
protected FormBuilder |
addSingleComponentRow(JComponent component,
boolean scroll,
boolean grow,
boolean gap)
Adds a single component that stretches the whole row. |
|
JComponent |
createDialogPane()
Builds a component that can be used as the content of a dialog, includes dialog borders. |
|
static JComponent |
createDialogPane(JComponent content)
Wraps the specified content in a form pane which features dialog borders. |
|
JComponent |
createFormPane()
Builds a component that can be used as the content of a form, includes scroll pane and correct form borders. |
|
static JComponent |
createFormPane(JComponent content)
Wraps the specified content in a form pane which features scroll bars and form borders. |
|
static com.jgoodies.forms.layout.FormLayout |
createLayout(String encodedColumnSpecs,
String encodedRowSpecs)
Creates a new form layout that uses the form builder layout map. |
|
JPanel |
createPanel()
Builds a panel with the components added to this form builder. |
|
static JComponent |
createToolPane(JComponent content,
JToolBar toolBar)
Wraps the specified content in a form pane which features optional scroll bars and appropriate borders for a tool (including an optional tool bar). |
|
|
fill(T container)
Fills the container specified with the components added to the form builder. |
|
protected String |
getColumnSpecs()
Returns the column specifications used by the form builder. |
|
protected ControlFactory |
getControlFactory()
Returns the control factory. |
|
static com.jgoodies.forms.layout.LayoutMap |
getLayoutMap()
Returns the layout map of the form layout used by the form builder. |
|
protected String |
getRowSpecs()
Returns the row specifications used by the form builder. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final String LINE_GAP
"${nlgap}"
protected static final String SECTION_GAP
"${npgap}"
Constructor Detail |
---|
public FormBuilder(ActionMap actionMap, org.jdesktop.application.ResourceMap resourceMap)
actionMap
- the action map used to create actions.resourceMap
- the resource map used to create components.Method Detail |
---|
public static com.jgoodies.forms.layout.LayoutMap getLayoutMap()
This layout map extends the default layout map with the following mappings:
Variable | Value | ||
---|---|---|---|
* | lcgap | gap between a label and its component | |
* | rgap | gap between two related components | |
* | ugap | gap between two unrelated components | |
* | lgap | gap between two lines | |
* | nlgap | narrow gap between two lines | |
* | pgap | gap between two paragraphs/sections | |
fpg | fill,preferred,grow | fill:min(50dlu;pref):grow | |
lct | label,control,toolbar | pref,${lcgap},${fpg},${rgap},pref | |
npgap | narrow section gap | 3dlu | |
fgap | form gap | 3dlu | |
dgap | dialog gap | 6dlu |
*) Marked variables are part of the default JGoodies LayoutMap
.
public static com.jgoodies.forms.layout.FormLayout createLayout(String encodedColumnSpecs, String encodedRowSpecs)
encodedColumnSpecs
- comma separated encoded column specifications.encodedRowSpecs
- comma separated encoded row specifications.
getLayoutMap()
,
FormLayout.FormLayout(String, String)
public static JComponent createFormPane(JComponent content)
content
- the content to wrap in a form pane.
public static JComponent createDialogPane(JComponent content)
content
- the content to wrap in a dialog pane.
public static JComponent createToolPane(JComponent content, JToolBar toolBar)
content
- the content to wrap in a form.toolBar
- optional tool bar to include, may be null
.
protected ControlFactory getControlFactory()
protected FormBuilder addRow(FormBuilder.Row row)
row
- the row to add.
protected String getColumnSpecs()
protected String getRowSpecs()
public FormBuilder addGap()
public FormBuilder addLabelComponentButtonRow(String label, JComponent component, String button)
label
- the key of the label to add.component
- the component to add.button
- the key of the button to add.
public FormBuilder addLabelComponentToolBarRow(String label, JComponent component, String toolBar)
label
- the key of the label to add.component
- the component to add.toolBar
- the key of the tool bar to add.
public FormBuilder addLabelComponentRow(String label, JComponent component)
label
- the key of the label to add.component
- the component to add.
public FormBuilder addLabelRow(String label)
label
- the key of the label to add.
public FormBuilder addHeaderRow(String header)
header
- the key of the header to add.
public FormBuilder addLabelComponentRow(String label, JComponent component, String rowSpec)
label
- the key of the label to add.component
- the component to add.rowSpec
- the row specification (height format) of the row,
may be null
for preferred size.
public FormBuilder addLabelToolBarRow(String label, String toolBar)
label
- the key of the label to add.toolBar
- the key of the tool bar to add.
public FormBuilder addComponentRow(JComponent component, boolean grow)
component
- the component to add.grow
- true
to make the row fill and grow vertically,
false
to use the component preferred size.
public FormBuilder addScrollComponentRow(JComponent component)
The row of the component will grow and fill available space.
component
- the component to add, if it does not denote a JScrollPane
it will
be wrapped into a JScrollPane
before adding.
protected FormBuilder addSingleComponentRow(JComponent component, boolean scroll, boolean grow, boolean gap)
The component is added with preferred size and can optionally be wrapped in a scroll pane if necessary and fill/grow vertically.
component
- the component to add.scroll
- true
to optionally wrap the component in a JScrollPane
,
false
to leave the component alone and use it as is.grow
- true
to make the row fill and grow vertically,
false
to use the component preferred size.gap
- true
to add a default row gap in front of the component,
false
to insert the component without any row gap.
public FormBuilder addLabelToolBarComponentRows(String label, String toolBar, JComponent scrollComponent)
The first row consists of a label and a toolbar, the second row of a filling and growing scroll component.
If the component passed in is already a scroll pane then it is added directly.
label
- the label of the first row.toolBar
- the toolbar of the first row.scrollComponent
- the scroll component in the second row.
public JPanel createPanel()
public JComponent createFormPane()
public JComponent createDialogPane()
public <T extends JComponent> T fill(T container)
Note: The container must not have any components added to begin with.
T
- the type of container to fill.container
- the container to fill.
|
![]() |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
OpenPermis Role Based Access Control 0.9.0 (Build 16)
2009/08/13 07:17:21
Copyright (c) 2002-2007 Ergon Informatik AG