After Dave J. Orme XSWT for SWT in XML, Tom Schindl extend it with EXSWT. When i choose RCP to develop my applications, i began directly with XML to design my UI. I think it’s a good way because it reduce your code (even if now you can mask it with your Java editor), but the most important reason is the loosely coupled aspect and the capacity to have more than one version of your UI. For example if you have one application and many customers, it’s sure that some customers want different design or evolution of the UI. An XML UI is the best way to personalize the UI. For example, adding XInclude in your EXSWT file give you the ability to choose within different version of a part of your UI by managing the resolution of the « href » attribute.
This is just a few example of EXSWT code to give you an idea of how it simple to design with :
– Composite, Label, Text, ComboViewer
<w:composite background="#82cff1">
<a:layout x:class="gridLayout" f:numColumns="2" />
<w:label background="#82cff1" text="Raison :">
<a:layoutData x:class="gridData" f:horizontalAlignment="GridData.END" />
</w:label>
<w:text w:style="SWT.BORDER" x:id="callReason" font="Arial,10,SWT.BOLD">
<a:layoutData x:class="gridData" f:widthHint="320" f:horizontalAlignment="GridData.BEGINNING" />
</w:text>
<w:label background="#82cff1" text="Type :">
<a:layoutData x:class="gridData" f:horizontalAlignment="GridData.END" />
</w:label>
<v:comboViewer x:id="missionType" v:style="SWT.READ_ONLY" font="Arial,10,SWT.BOLD">
<a:combo.layoutData x:class="gridData" f:widthHint="120" f:horizontalAlignment="GridData.BEGINNING" />
</v:comboViewer>
</w:composite>
|
|
– TableViewer, Group, ToolBar
<w:group text="Victimes" background="#82cff1" x:id="victimGroup" enabled="false">
<a:layout x:class="gridLayout" f:numColumns="2" f:marginHeight="0" f:marginWidth="0" marginTop="5" f:verticalSpacing="4" />
<v:tableViewer x:id="victims" v:style="SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION | SWT.HIDE_SELECTION" table.linesVisible="true" table.headerVisible="true">
<a:table.layoutData x:class="gridData" f:horizontalAlignment="GridData.FILL" f:grabExcessHorizontalSpace="true" f:heightHint="95" />
<v:tableViewerColumn column.text="Nom" x:id="victim.name" />
<v:tableViewerColumn column.text="Sexe/Age" x:id="victim.sexeAge" v:column.style="SWT.CENTER" />
<v:tableViewerColumn column.text="Motif" x:id="victim.motif" v:column.style="SWT.CENTER" />
<v:tableViewerColumn column.text="Transport" x:id="victim.transport" />
</v:tableViewer>
<w:toolBar background="#82cff1" w:style="SWT.FLAT | SWT.VERTICAL">
<w:toolItem toolTipText="Supprimer" x:id="victim.remove" />
<w:toolItem toolTipText="Ajouter" x:id="victim.add" />
<w:toolItem toolTipText="Exporter" x:id="victim.export" />
</w:toolBar>
</w:group>
|
|
– Combo, ListViewer, CDateTime (Nebula Widget)
<a:layout x:class="fillLayout" />
<w:composite background="#82cff1">
<a:layout x:class="gridLayout" f:marginHeight="0" f:marginWidth="0" />
<w:combo x:id="filter" w:style="SWT.READ_ONLY">
<a:layoutData x:class="gridData" f:horizontalAlignment="GridData.CENTER" f:grabExcessHorizontalSpace="true" f:widthHint="140" />
</w:combo>
<v:listViewer v:style="SWT.MULTI | SWT.BORDER | SWT.V_SCROLL" x:id="resources">
<a:list.layoutData x:class="gridData" f:horizontalAlignment="GridData.CENTER" f:verticalAlignment="GridData.FILL" f:grabExcessVerticalSpace="true" f:widthHint="140" />
</v:listViewer>
</w:composite>
<w:cDateTime background="#82cff1" x:id="takeAt" w:style="CDT.TIME_SHORT | CDT.BORDER | CDT.SIMPLE | CDT.CLOCK_12_HOUR">
</w:cDateTime>
|
|
Now i make the dream that VE could be able to generate EXSWT in WYSIWYG.
Tom also implements JFace Data Binding in EXSWT (XBL) and it’s easy to bind your model directly in your XML.
