|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.mlc.swing.layout.LayoutConstraintsManager
public class LayoutConstraintsManager
This class handles the serialization and deserialization of the xml files that we are using to store the layout constraints.
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.]
Field Summary | |
---|---|
static java.lang.String |
BOTTOM
|
static java.lang.String |
CENTER
|
static java.lang.String |
DEFAULT
|
static java.lang.String |
FILL
|
static java.lang.String |
LEFT
|
static java.lang.String |
RIGHT
|
static java.lang.String |
TOP
|
Constructor Summary | |
---|---|
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 |
Method Summary | |
---|---|
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(com.jgoodies.forms.layout.CellConstraints.Alignment alignment)
Translates an alignment value to a string. |
static com.jgoodies.forms.layout.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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
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
Constructor Detail |
---|
public LayoutConstraintsManager()
public LayoutConstraintsManager(java.lang.String defaultColumnSpecs, java.lang.String defaultRowSpecs)
Method Detail |
---|
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(com.jgoodies.forms.layout.CellConstraints.Alignment alignment)
public static com.jgoodies.forms.layout.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)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |