public class LayoutConstraintsManager
extends java.lang.Object
In the consuming program, the use of this class might look like:
InputStream constraints = this.getClass().getResourceAsStream(xmlFile);
LayoutConstraintsManager layoutConstraintsManager =
LayoutConstraintsManager.getLayoutConstraintsManager(constraints);
LayoutManager layout = layoutConstraintsManager.createLayout("panel", this);
this.setLayout(layout);
[I'm sure there are more elegant ways of handling this (like JAXB) or some other mapping software but this is simple, it works, and we don't have to package a bunch of other software or files.]
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
BOTTOM |
static java.lang.String |
CENTER |
(package private) java.util.Map<ContainerLayout,java.awt.Container> |
containers |
static java.lang.String |
DEFAULT |
(package private) java.lang.String |
defaultColumnSpecs |
(package private) java.lang.String |
defaultRowSpecs |
static java.lang.String |
FILL |
(package private) java.util.List<ContainerLayout> |
layouts |
static java.lang.String |
LEFT |
static java.lang.String |
RIGHT |
(package private) static java.util.Set<java.lang.Class> |
textComponents |
static java.lang.String |
TOP |
Constructor and Description |
---|
LayoutConstraintsManager()
This method will create a LayoutConstraintsManager with default JGoodies
row and column specs that are common in applications.
|
LayoutConstraintsManager(java.lang.String defaultColumnSpecs,
java.lang.String defaultRowSpecs)
This method will create a LayoutConstraintsManager with the JGoodies specs
provided as default
|
Modifier and Type | Method and Description |
---|---|
void |
addLayout(ContainerLayout containerLayout) |
ContainerLayout |
createLayout(java.lang.String name,
java.awt.Container container)
This method creates a layout by first trying to look in memory to see if a
layout has been defined with the given name.
|
static java.lang.String |
getAlignment(CellConstraints.Alignment alignment)
Translates an alignment value to a string.
|
static CellConstraints.Alignment |
getAlignment(java.lang.String value)
Translates a string to an alignment value.
|
java.awt.Container |
getContainer(ContainerLayout layout) |
ContainerLayout |
getContainerLayout(java.lang.String containerName) |
static LayoutConstraintsManager |
getLayoutConstraintsManager(java.io.InputStream stream)
Returns a LayoutConstraintsManager based on an input stream for an xml
file.
|
static LayoutConstraintsManager |
getLayoutConstraintsManager(org.w3c.dom.Node containersNode)
Returns a layout constraints manager given a containers node.
|
java.util.List<ContainerLayout> |
getLayouts() |
java.lang.String |
getXML()
Get an XML representation of the FormLayout constraints for all containers
in this manager.
|
static boolean |
isTextComponent(java.awt.Component component) |
static void |
main(java.lang.String[] args) |
void |
removeLayout(ContainerLayout containerLayout) |
void |
setLayout(java.lang.String name,
java.awt.Container container)
This method will build a layout from the xml file based on the name and
call setLayout on the container passed in.
|
java.lang.String defaultColumnSpecs
java.lang.String defaultRowSpecs
static java.util.Set<java.lang.Class> textComponents
java.util.Map<ContainerLayout,java.awt.Container> containers
java.util.List<ContainerLayout> layouts
public static final java.lang.String DEFAULT
public static final java.lang.String FILL
public static final java.lang.String CENTER
public static final java.lang.String LEFT
public static final java.lang.String RIGHT
public static final java.lang.String TOP
public static final java.lang.String BOTTOM
public LayoutConstraintsManager()
public LayoutConstraintsManager(java.lang.String defaultColumnSpecs, java.lang.String defaultRowSpecs)
public java.util.List<ContainerLayout> getLayouts()
public void setLayout(java.lang.String name, java.awt.Container container)
public ContainerLayout createLayout(java.lang.String name, java.awt.Container container)
public java.awt.Container getContainer(ContainerLayout layout)
public ContainerLayout getContainerLayout(java.lang.String containerName)
public void removeLayout(ContainerLayout containerLayout)
public void addLayout(ContainerLayout containerLayout)
public java.lang.String getXML()
public static boolean isTextComponent(java.awt.Component component)
public static java.lang.String getAlignment(CellConstraints.Alignment alignment)
public static CellConstraints.Alignment getAlignment(java.lang.String value)
public static LayoutConstraintsManager getLayoutConstraintsManager(java.io.InputStream stream)
containers
and should
adhere to the xml format for this tool.public static LayoutConstraintsManager getLayoutConstraintsManager(org.w3c.dom.Node containersNode)
public static void main(java.lang.String[] args)