Re: FormLayout & Swixml Marriage
Brian P Michael <[email protected]>
| Newsgroups | gmane.comp.embedded.carlsbad-cubes |
|---|---|
| Message-ID | <[email protected]> |
Everyone,
I am looking at the code to see what it would take to add an extensible
layout system.
I don't think it would be to hard to complete.
Changes that would need to occur
1) ConstraintsConverter.java class
a) add a set of
registerConstraintHelper("borderlayout",borderConstrainthelper.class)
b) Call those classes based upon which layout it used.
2) LayoutConverter.java
a) add a set of
RegisterLayoutConverter("borderlayout",borderLayoutConverter.class)
b) add a set of LayoutConverters, one converter per class.
Break the routine apart and call the appropriate converter class
3) Parser.java
a) Change the single line
LayoutManager layoutMgr = obj instanceof Container ? (
(Container) obj ).getLayout() : null;
I am not sure what would be needed here yet.
The key to this would be a flexible register function that also accepts
an XML file.
E.g. in SwingTagLibrary
Instead of having
protected void registerTags() {
registerTag( "Applet", JApplet.class );
registerTag( "Button", JButton.class );
registerTag( "ButtonGroup", ButtonGroup.class );
registerTag( "HBox", XHBox.class );
registerTag( "VBox", XVBox.class );
registerTag( "Checkbox", JCheckBox.class );
........
registerLayout("BorderLayout","BorderLayoutConstraints.class",
"BorderLayoutConverter.class");
registerLayout("FlowLayout","FlowLayoutConstraints.class",
"FlowLayoutConverter.class");
We would need:
registerTag("tagfile"); or
SwingEngine("tagfile").
A default filename of swingTaglibrary.xml could be also established.
Where tagfile is a filename with XML in it.
E.g.
<tag name="Applet" class="JApplet.class"/>
<tag name="Button" class="JButton.class"/>
<tag name="ButtonGroup" class="ButtonGroup.class"/>
<layout type="BorderLayout"
constraintHelper="BorderLayoutConstraints.class"
converterClass="BorderLayoutConverter.class"/>
<layout type="FlowLayout"
constraintHelper="FlowLayoutConstraints.class"
converterClass="FlowLayoutConverter.class"/>
<layout type="GridBagLayout"
constraintHelper="GridBagConstraints.class"
converterClass="GridBagLayoutConverter.class"/>
Any comments.
Sincerely,
Brian P Michael
_______________________________________________
Forum mailing list
[email protected]
http://carlsbadcubes.com/mailman/listinfo/forum_carlsbadcubes.com