This chapter covers each Layout in detail. For an explanation of how Layouts fit into the overall architecture of Metawidget, see Chapter 2, Architecture.
Metawidget supports multiple Layouts for each desktop framework, targeting different arrangements within each environment.
Layout to simply output components one after another, with no labels and no structure, using javax.swing.BoxLayout. This is like FlowLayout (below), except it fills width. It can be useful for JTable CellEditors (see Section 1.3.1, “Desktop Address Book”).
Layout to simply output components one after another, with no labels and no structure, using java.awt.FlowLayout. This is like BoxLayout, except it does not fill width. It can be useful for button bars (see Section 1.3.1, “Desktop Address Book”).
Layout to arrange widgets using java.awt.GridBagLayout. Widgets are arranged in a table, with one column for the label and another for the widget. This Layout recognizes the following parameters, configured using GridBagLayoutConfig:
Property | Description |
---|---|
labelAlignment | Such as SwingConstants.LEFT or SwingConstants.RIGHT |
labelFont | Label font |
labelForeground | Label foreground color |
labelSuffix | Text to display after label text. Defaults to a colon (:) |
numberOfColumns | Number of columns. Each label/component pair is considered one column |
requiredAlignment | Alignment of the asterisk relative to the component. Can be SwingConstants.LEFT, SwingConstants.CENTER or SwingConstants.RIGHT |
requiredText | Text to display for required properties. Defaults to an asterisk |
supportMnemonics | Whether to convert &'s in labels into keyboard mnemonics |
Layout to arrange widgets using javax.swing.GroupLayout. Widgets are arranged in a table, with one column for the label and another for the widget.
Layout to arrange widgets using net.miginfocom.swing.MigLayout. Widgets are arranged in a table, with one column for the label and another for the widget. This Layout recognizes the following parameters, configured using MigLayoutConfig:
Property | Description |
---|---|
numberOfColumns | Number of columns. Each label/component pair is considered one column |
supportMnemonics | Whether to convert &'s in labels into keyboard mnemonics |
LayoutDecorator to decorate widgets from different sections using a JSeparator. This LayoutDecorator recognizes the following parameters, configured using SeparatorLayoutDecoratorConfig:
Property | Description |
---|---|
alignment | One of SwingConstants.LEFT or SwingConstants.RIGHT. |
layout | Metawidget Layout to use for laying out the sections, for example org.metawidget.swing.layout.GridBagLayout. |
LayoutDecorator to decorate widgets from different sections using a JTabbedPane. This LayoutDecorator recognizes the following parameters, configured using TabbedPaneLayoutDecoratorConfig:
Property | Description |
---|---|
layout | Metawidget Layout to use for laying out the sections, for example org.metawidget.swing.layout.GridBagLayout. |
tabPlacement | One of SwingConstants.TOP, SwingConstants.BOTTOM, SwingConstants.LEFT or SwingConstants.RIGHT as defined by JTabbedPane.setTabPlacement. |
LayoutDecorator to decorate widgets from different sections using a JPanel with a TitledBorder. This LayoutDecorator recognizes the following parameters, configured using LayoutDecoratorConfig:
Property | Description |
---|---|
layout | Metawidget Layout to use for laying out the sections, for example org.metawidget.swing.layout.GridBagLayout. |
Layout to simply output components one after another, with no labels and no structure, using org.eclipse.swt.layout.FillLayout. This is like RowLayout, except it fills width. It can be useful for Table Editors (see Section 1.3.1, “Desktop Address Book”).
Layout to arrange widgets using org.eclipse.swt.layout.GridLayout. Widgets are arranged in a table, with one column for the label and another for the widget. This Layout recognizes the following parameters, configured using GridLayoutConfig:
Property | Description |
---|---|
labelAlignment | Such as SWT.LEFT or SWT.RIGHT |
labelFont | Label font |
labelForeground | Label foreground color |
labelSuffix | Text to display after label text. Defaults to a colon (:) |
numberOfColumns | Number of columns. Each label/component pair is considered one column |
requiredAlignment | Alignment of the asterisk relative to the control. Can be SWT.LEFT or SWT.RIGHT |
requiredText | Text to display for required properties. Defaults to an asterisk |
Layout to arrange widgets using net.miginfocom.swt.MigLayout. Widgets are arranged in a table, with one column for the label and another for the widget. This Layout recognizes the following parameters, configured using MigLayoutConfig:
Property | Description |
---|---|
numberOfColumns | Number of columns. Each label/component pair is considered one column |
Layout to simply output components one after another, with no labels and no structure, using org.eclipse.swt.layout.RowLayout. This is like FillLayout, except it does not fill width. It can be useful for button bars (see Section 1.3.1, “Desktop Address Book”).
LayoutDecorator to decorate widgets from different sections using a Label( SWT.SEPARATOR ). This LayoutDecorator recognizes the following parameters, configured using SeparatorLayoutDecoratorConfig:
Property | Description |
---|---|
alignment | One of SWT.LEFT or SWT.RIGHT. |
layout | Metawidget Layout to use for laying out the sections, for example org.metawidget.swt.layout.GridLayout. |
LayoutDecorator to decorate widgets from different sections using a TabFolder. This LayoutDecorator recognizes the following parameters, configured using TabFolderLayoutDecoratorConfig:
Property | Description |
---|---|
layout | Metawidget Layout to use for laying out the sections, for example org.metawidget.swt.layout.GridLayout. |
tabLocation | One of SWT.TOP or SWT.BOTTOM. |