Design Challenge: XML Format for GridLayout Wanted
Gerald Bauer <[email protected]> Fri, 24 Oct 2003 10:12:46 -0700 (PDT)
| Newsgroups | gmane.comp.java.luxor-xul.user |
|---|---|
| Message-ID | <[email protected]> |
Hi,
I'm currently adding a new tag library to Luxor that
supports all Standard Widget Toolkit (SWT) layout
managers (with the exception of FormsLayout).
Now the challenge is to design an easy to use XML
format for GridLayout.
Here's my first shot:
<gridbag colums="3" margin="10,10" />
<jlabel text="label0" />
<griddata colspan="2" fill="HORZ"> <jtext
text="text1" /> </griddata>
<griddata colspan="3" halign="MAX">
<jtable>
<jtableitem text="item1" />
<jtableitem text="item2" />
</jtable>
</griddata>
<jbutton text="button3" />
<jbutton text="button4" />
<griddata halign="CENTER"> <jbutton text="button5"
/> </griddata>
</gridbag>
And for comparision here's the plain old Java
spaghetti code:
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 3;
gridLayout.marginHeight = 10;
gridLayout.marginWidth = 10;
composite.setLayout( gridLayout );
Label label0 = new Label( composite, SWT.NONE );
label0.setText( "label0" );
Text text1 = new Text( composite, SWT.BORDER );
text1.setText( "text1" );
GridData data = new GridData();
data.horizontalAlignment = GridData.FILL;
data.horizontalSpan = 2;
data.grabExcessHorizontalSpace = true;
text1.setLayoutData( data );
Table table2 = new Table( composite, SWT.BORDER );
TableItem tableItem1 = new TableItem( table2,
SWT.NONE );
tableItem1.setText( "Item1" );
TableItem tableItem2 = new TableItem( table2,
SWT.NONE );
tableItem2.setText( "Item2" );
data = new GridData();
data.horizontalAlignment = GridData.FILL;
data.horizontalSpan = 3;
table2.setLayoutData( data );
Button button3 = new Button( composite, SWT.PUSH );
button3.setText( "button3" );
Button button4 = new Button( composite, SWT.PUSH );
button4.setText( "button4" );
Button button5 = new Button( composite, SWT.PUSH );
button5.setText( "button5" );
data = new GridData();
data.horizontalAlignment = GridData.CENTER;
button.setLayoutData( data );
I guess by now everybody can see that the XML
formats cuts down the clutter. Can you do better? Post
your XML format for GridLayout today and help shape
the future of rich UIs using XML.
- Gerald
-------------------------------------------------------
This SF.net email is sponsored by: The SF.net Donation Program.
Do you like what SourceForge.net is doing for the Open
Source Community? Make a contribution, and help us add new
features and functionality. Click here: http://sourceforge.net/donate/