Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates')
-rw-r--r--examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/button/initControl.jet16
-rw-r--r--examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/button/swtStyles.jet17
-rw-r--r--examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/combo/initControl.jet19
-rw-r--r--examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/combo/swtStyles.jet11
-rw-r--r--examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/composite/initControl.jet10
-rw-r--r--examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/composite/swtStyles.jet5
-rw-r--r--examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/controlData.xml.jet42
-rw-r--r--examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/group/initControl.jet12
-rw-r--r--examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/group/swtStyles.jet8
-rw-r--r--examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/label/initControl.jet10
-rw-r--r--examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/label/swtStyles.jet23
-rw-r--r--examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/link/initControl.jet10
-rw-r--r--examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/link/swtStyles.jet8
-rw-r--r--examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/list/initControl.jet10
-rw-r--r--examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/list/swtStyles.jet11
-rw-r--r--examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/setGridData.jet30
-rw-r--r--examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/setGridLayout.jet27
-rw-r--r--examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/table/initControl.jet13
-rw-r--r--examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/table/swtStyles.jet20
-rw-r--r--examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/tableColumn/initControl.jet19
-rw-r--r--examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/tableColumn/swtStyles.jet8
-rw-r--r--examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/text/initControl.jet16
-rw-r--r--examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/text/swtStyles.jet32
-rw-r--r--examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/dump.jet5
-rw-r--r--examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/event/eventData.xml.jet44
-rw-r--r--examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/main.jet74
-rw-r--r--examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/wizardPage/codeBehind.java.jet39
-rw-r--r--examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/wizardPage/flatten.xml.jet13
-rw-r--r--examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/wizardPage/flattenControl.jet29
-rw-r--r--examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/wizardPage/wizardPage.java.jet124
30 files changed, 705 insertions, 0 deletions
diff --git a/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/button/initControl.jet b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/button/initControl.jet
new file mode 100644
index 0000000..f096295
--- /dev/null
+++ b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/button/initControl.jet
@@ -0,0 +1,16 @@
+<%!
+/* Copyright 2008 IBM Corp. All rights reserved. This source code is made available under the terms of the Eclipse Public License, v1.0. */
+%>
+<%-- button --%>
+<c:if test="$control/@enabled">
+ <c:get select="$control/@name"/>.setEnabled(<c:get select="$control/@enabled"/>);
+</c:if>
+<c:if test="$control/@text">
+ <c:get select="$control/@name"/>.setText("<c:get select="$control/@text"/>");
+</c:if>
+<c:if test="$control/@grayed">
+ <c:get select="$control/@name"/>.setGreyed(<c:get select="$control/@grayed"/>);
+</c:if>
+<c:if test="$control/@selection">
+ <c:get select="$control/@name"/>.setSelection(<c:get select="$control/@selection"/>);
+</c:if>
diff --git a/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/button/swtStyles.jet b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/button/swtStyles.jet
new file mode 100644
index 0000000..6eef889
--- /dev/null
+++ b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/button/swtStyles.jet
@@ -0,0 +1,17 @@
+<%!
+/* Copyright 2008 IBM Corp. All rights reserved. This source code is made available under the terms of the Eclipse Public License, v1.0. */
+%>
+<%-- button --%>
+ SWT.<c:get select="$control/@style"/>
+<c:if test="$control/@border = 'true'">
+ |SWT.BORDER
+</c:if>
+<c:if test="$control/@flat = 'true'">
+ |SWT.FLAT
+</c:if>
+<c:if test="$control/@alignment">
+ |SWT.<c:get select="$control/@alignment"/>
+</c:if>
+<c:if test="$control/@arrowStyle">
+ |SWT.<c:get select="$control/@arrowStyle"/>
+</c:if>
diff --git a/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/combo/initControl.jet b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/combo/initControl.jet
new file mode 100644
index 0000000..3299830
--- /dev/null
+++ b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/combo/initControl.jet
@@ -0,0 +1,19 @@
+<%!
+/* Copyright 2008 IBM Corp. All rights reserved. This source code is made available under the terms of the Eclipse Public License, v1.0. */
+%>
+<%-- combo --%>
+<c:if test="$control/@enabled">
+ <c:get select="$control/@name"/>.setEnabled(<c:get select="$control/@enabled"/>);
+</c:if>
+<c:if test="$control/@visibleItemCount">
+ <c:get select="$control/@message"/>.setVisibleItemCount(<c:get select="$control/@visibleItemCount"/>);
+</c:if>
+<c:if test="$control/@textLimit">
+ <c:get select="$control/@name"/>.setTextLimit(<c:get select="$control/@textLimit"/>);
+</c:if>
+<c:iterate select="$control/item" var="item">
+ <c:get select="$control/@name"/>.add("<c:get select="$item"/>");
+</c:iterate>
+<c:if test="$control/@text">
+ <c:get select="$control/@name"/>.setText("<c:get select="$control/@text"/>");
+</c:if>
diff --git a/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/combo/swtStyles.jet b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/combo/swtStyles.jet
new file mode 100644
index 0000000..bdc3f34
--- /dev/null
+++ b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/combo/swtStyles.jet
@@ -0,0 +1,11 @@
+<%!
+/* Copyright 2008 IBM Corp. All rights reserved. This source code is made available under the terms of the Eclipse Public License, v1.0. */
+%>
+<%-- combo --%>
+ SWT.NONE
+<c:if test="$control/@readOnly = 'true'">
+ |SWT.READ_ONLY
+</c:if>
+<c:if test="$control/@style">
+ |SWT.<c:get select="$control/@style"/>
+</c:if>
diff --git a/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/composite/initControl.jet b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/composite/initControl.jet
new file mode 100644
index 0000000..0a01fcd
--- /dev/null
+++ b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/composite/initControl.jet
@@ -0,0 +1,10 @@
+<%!
+/* Copyright 2008 IBM Corp. All rights reserved. This source code is made available under the terms of the Eclipse Public License, v1.0. */
+%>
+<%-- composite --%>
+<c:if test="$control/@enabled">
+ <c:get select="$control/@name"/>.setEnabled(<c:get select="$control/@enabled"/>);
+</c:if>
+
+ <c:include template="templates/control/setGridLayout.jet"/>
+
diff --git a/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/composite/swtStyles.jet b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/composite/swtStyles.jet
new file mode 100644
index 0000000..524b58b
--- /dev/null
+++ b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/composite/swtStyles.jet
@@ -0,0 +1,5 @@
+<%!
+/* Copyright 2008 IBM Corp. All rights reserved. This source code is made available under the terms of the Eclipse Public License, v1.0. */
+%>
+<%-- composite --%>
+ SWT.NONE
diff --git a/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/controlData.xml.jet b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/controlData.xml.jet
new file mode 100644
index 0000000..3d3d46f
--- /dev/null
+++ b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/controlData.xml.jet
@@ -0,0 +1,42 @@
+<%!
+/* Copyright 2008 IBM Corp. All rights reserved. This source code is made available under the terms of the Eclipse Public License, v1.0. */
+%>
+ <button javaType="org.eclipse.swt.widgets.Button"
+ swtStylesTemplate="templates/control/button/swtStyles.jet"
+ initControlTemplate="templates/control/button/initControl.jet"/>
+
+ <combo javaType="org.eclipse.swt.widgets.Combo"
+ swtStylesTemplate="templates/control/combo/swtStyles.jet"
+ initControlTemplate="templates/control/combo/initControl.jet"/>
+
+ <composite javaType="org.eclipse.swt.widgets.Composite"
+ swtStylesTemplate="templates/control/composite/swtStyles.jet"
+ initControlTemplate="templates/control/composite/initControl.jet"/>
+
+ <group javaType="org.eclipse.swt.widgets.Group"
+ swtStylesTemplate="templates/control/group/swtStyles.jet"
+ initControlTemplate="templates/control/group/initControl.jet"/>
+
+ <label javaType="org.eclipse.swt.widgets.Label"
+ swtStylesTemplate="templates/control/label/swtStyles.jet"
+ initControlTemplate="templates/control/label/initControl.jet"/>
+
+ <link javaType="org.eclipse.swt.widgets.Link"
+ swtStylesTemplate="templates/control/link/swtStyles.jet"
+ initControlTemplate="templates/control/link/initControl.jet"/>
+
+ <list javaType="org.eclipse.swt.widgets.List"
+ swtStylesTemplate="templates/control/list/swtStyles.jet"
+ initControlTemplate="templates/control/list/initControl.jet"/>
+
+ <table javaType="org.eclipse.swt.widgets.Table"
+ swtStylesTemplate="templates/control/table/swtStyles.jet"
+ initControlTemplate="templates/control/table/initControl.jet"/>
+
+ <tableColumn javaType="org.eclipse.swt.widgets.TableColumn"
+ swtStylesTemplate="templates/control/tableColumn/swtStyles.jet"
+ initControlTemplate="templates/control/tableColumn/initControl.jet"/>
+
+ <text javaType="org.eclipse.swt.widgets.Text"
+ swtStylesTemplate="templates/control/text/swtStyles.jet"
+ initControlTemplate="templates/control/text/initControl.jet"/>
diff --git a/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/group/initControl.jet b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/group/initControl.jet
new file mode 100644
index 0000000..bfd3a1d
--- /dev/null
+++ b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/group/initControl.jet
@@ -0,0 +1,12 @@
+<%!
+/* Copyright 2008 IBM Corp. All rights reserved. This source code is made available under the terms of the Eclipse Public License, v1.0. */
+%>
+<%-- group --%>
+<c:if test="$control/@enabled">
+ <c:get select="$control/@name"/>.setEnabled(<c:get select="$control/@enabled"/>);
+</c:if>
+<c:if test="$control/@text">
+ <c:get select="$control/@name"/>.setText("<c:get select="$control/@text"/>");
+</c:if>
+
+ <c:include template="templates/control/setGridLayout.jet"/>
diff --git a/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/group/swtStyles.jet b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/group/swtStyles.jet
new file mode 100644
index 0000000..578fcfe
--- /dev/null
+++ b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/group/swtStyles.jet
@@ -0,0 +1,8 @@
+<%!
+/* Copyright 2008 IBM Corp. All rights reserved. This source code is made available under the terms of the Eclipse Public License, v1.0. */
+%>
+<%-- group --%>
+ SWT.NONE
+<c:if test="$control/@shadow">
+ |SWT.SHADOW_<c:get select="$control/@orientation"/>
+</c:if>
diff --git a/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/label/initControl.jet b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/label/initControl.jet
new file mode 100644
index 0000000..133e87a
--- /dev/null
+++ b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/label/initControl.jet
@@ -0,0 +1,10 @@
+<%!
+/* Copyright 2008 IBM Corp. All rights reserved. This source code is made available under the terms of the Eclipse Public License, v1.0. */
+%>
+<%-- label --%>
+<c:if test="$control/@enabled">
+ <c:get select="$control/@name"/>.setEnabled(<c:get select="$control/@enabled"/>);
+</c:if>
+<c:if test="$control/@text">
+ <c:get select="$control/@name"/>.setText("<c:get select="$control/@text"/>");
+</c:if>
diff --git a/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/label/swtStyles.jet b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/label/swtStyles.jet
new file mode 100644
index 0000000..726804e
--- /dev/null
+++ b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/label/swtStyles.jet
@@ -0,0 +1,23 @@
+<%!
+/* Copyright 2008 IBM Corp. All rights reserved. This source code is made available under the terms of the Eclipse Public License, v1.0. */
+%>
+<%-- label --%>
+ SWT.NONE
+<c:if test="$control/@border = 'true'">
+ |SWT.BORDER
+</c:if>
+<c:if test="$control/@separator = 'true'">
+ |SWT.SEPARATOR
+</c:if>
+<c:if test="$control/@wrap = 'true'">
+ |SWT.WRAP
+</c:if>
+<c:if test="$control/@alignment">
+ |SWT.<c:get select="$control/@alignment"/>
+</c:if>
+<c:if test="$control/@orientation">
+ |SWT.<c:get select="$control/@orientation"/>
+</c:if>
+<c:if test="$control/@shadow">
+ |SWT.SHADOW_<c:get select="$control/@orientation"/>
+</c:if>
diff --git a/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/link/initControl.jet b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/link/initControl.jet
new file mode 100644
index 0000000..224b6f4
--- /dev/null
+++ b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/link/initControl.jet
@@ -0,0 +1,10 @@
+<%!
+/* Copyright 2008 IBM Corp. All rights reserved. This source code is made available under the terms of the Eclipse Public License, v1.0. */
+%>
+<%-- link --%>
+<c:if test="$control/@enabled">
+ <c:get select="$control/@name"/>.setEnabled(<c:get select="$control/@enabled"/>);
+</c:if>
+<c:if test="$control/@text">
+ <c:get select="$control/@name"/>.setText("<c:get select="$control/@text"/>");
+</c:if>
diff --git a/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/link/swtStyles.jet b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/link/swtStyles.jet
new file mode 100644
index 0000000..eb395e8
--- /dev/null
+++ b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/link/swtStyles.jet
@@ -0,0 +1,8 @@
+<%!
+/* Copyright 2008 IBM Corp. All rights reserved. This source code is made available under the terms of the Eclipse Public License, v1.0. */
+%>
+<%-- link --%>
+ SWT.NONE
+<c:if test="$control/@border = 'true'">
+ |SWT.BORDER
+</c:if>
diff --git a/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/list/initControl.jet b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/list/initControl.jet
new file mode 100644
index 0000000..8fa81a9
--- /dev/null
+++ b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/list/initControl.jet
@@ -0,0 +1,10 @@
+<%!
+/* Copyright 2008 IBM Corp. All rights reserved. This source code is made available under the terms of the Eclipse Public License, v1.0. */
+%>
+<%-- list --%>
+<c:if test="$control/@enabled">
+ <c:get select="$control/@name"/>.setEnabled(<c:get select="$control/@enabled"/>);
+</c:if>
+<c:iterate select="$control/item" var="item">
+ <c:get select="$control/@name"/>.add("<c:get select="$item"/>");
+</c:iterate> \ No newline at end of file
diff --git a/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/list/swtStyles.jet b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/list/swtStyles.jet
new file mode 100644
index 0000000..2e82e15
--- /dev/null
+++ b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/list/swtStyles.jet
@@ -0,0 +1,11 @@
+<%!
+/* Copyright 2008 IBM Corp. All rights reserved. This source code is made available under the terms of the Eclipse Public License, v1.0. */
+%>
+<%-- list --%>
+ SWT.NONE
+<c:if test="not($control/@border) or $control/@border = 'true'">
+ |SWT.BORDER
+</c:if>
+<c:if test="$control/@style">
+ |SWT.<c:get select="$control/@style"/>
+</c:if>
diff --git a/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/setGridData.jet b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/setGridData.jet
new file mode 100644
index 0000000..c7ee4c0
--- /dev/null
+++ b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/setGridData.jet
@@ -0,0 +1,30 @@
+<%!
+/* Copyright 2008 IBM Corp. All rights reserved. This source code is made available under the terms of the Eclipse Public License, v1.0. */
+%>
+ <java:import>org.eclipse.jface.layout.GridDataFactory</java:import>.defaultsFor(<c:get select="$control/@name"/>)
+<c:iterate select="$control/gridData/*" var="data">
+<c:choose>
+<c:when test="$data/self::align">
+ .align(SWT.<c:get select="$data/@hAlign"/>, SWT.<c:get select="$data/@vAlign"/>)
+</c:when>
+<c:when test="$data/self::exclude">
+ .exclude(true)
+</c:when>
+<c:when test="$data/self::grab">
+ .grab(<c:get select="$data/@horizontal"/>, <c:get select="$data/@vertical"/>)
+</c:when>
+<c:when test="$data/self::hint">
+ .hint(<c:get select="$data/@xHint"/>, <c:get select="$data/@yHint"/>)
+</c:when>
+<c:when test="$data/self::indent">
+ .indent(<c:get select="$data/@hIndent"/>, <c:get select="$data/@vIndent"/>)
+</c:when>
+<c:when test="$data/self::minSize">
+ .minSize(<c:get select="$data/@minX"/>, <c:get select="$data/@minY"/>)
+</c:when>
+<c:when test="$data/self::span">
+ .span(<c:get select="$data/@hSpan"/>, <c:get select="$data/@vSpan"/>)
+</c:when>
+</c:choose>
+</c:iterate>
+ .applyTo(<c:get select="$control/@name"/>);
diff --git a/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/setGridLayout.jet b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/setGridLayout.jet
new file mode 100644
index 0000000..a1f6b8a
--- /dev/null
+++ b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/setGridLayout.jet
@@ -0,0 +1,27 @@
+<%!
+/* Copyright 2008 IBM Corp. All rights reserved. This source code is made available under the terms of the Eclipse Public License, v1.0. */
+%>
+<c:if test="$control/gridLayout">
+ <java:import>org.eclipse.jface.layout.GridLayoutFactory</java:import>.swtDefaults()
+<c:iterate select="$control/gridLayout/*" var="layout">
+<c:choose>
+<c:when test="$layout/self::equalWidth">
+ .equalWidth(true)
+</c:when>
+<c:when test="$layout/self::extendedMargins">
+ .extendedMargins(<c:get select="$layout/@left"/>, <c:get select="$layout/@right"/>,
+ <c:get select="$layout/@top"/>, <c:get select="$layout/@bottom"/>)
+</c:when>
+<c:when test="$layout/self::margins">
+ .margins(<c:get select="$layout/@width"/>, <c:get select="$layout/@height"/>)
+</c:when>
+<c:when test="$layout/self::numColumns">
+ .numColumns(<c:get select="$layout/@numColumns"/>)
+</c:when>
+<c:when test="$layout/self::spacing">
+ .spacing(<c:get select="$layout/@hSpacing"/>, <c:get select="$layout/@vSpacing"/>)
+</c:when>
+</c:choose>
+</c:iterate>
+ .applyTo(<c:get select="$control/@name"/>);
+</c:if>
diff --git a/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/table/initControl.jet b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/table/initControl.jet
new file mode 100644
index 0000000..2b0064c
--- /dev/null
+++ b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/table/initControl.jet
@@ -0,0 +1,13 @@
+<%!
+/* Copyright 2008 IBM Corp. All rights reserved. This source code is made available under the terms of the Eclipse Public License, v1.0. */
+%>
+<%-- table --%>
+<c:if test="$control/@enabled">
+ <c:get select="$control/@name"/>.setEnabled(<c:get select="$control/@enabled"/>);
+</c:if>
+<c:if test="$control/@headerVisible">
+ <c:get select="$control/@name"/>.setHeaderVisible(<c:get select="$control/@headerVisible"/>);
+</c:if>
+<c:if test="$control/@linesVisible = 'true'">
+ <c:get select="$control/@name"/>.setLinesVisible(<c:get select="$control/@linesVisible"/>);
+</c:if>
diff --git a/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/table/swtStyles.jet b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/table/swtStyles.jet
new file mode 100644
index 0000000..94d4d2e
--- /dev/null
+++ b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/table/swtStyles.jet
@@ -0,0 +1,20 @@
+<%!
+/* Copyright 2008 IBM Corp. All rights reserved. This source code is made available under the terms of the Eclipse Public License, v1.0. */
+%>
+<%-- table --%>
+ SWT.NONE
+<c:if test="not($control/@border) or $control/@border = 'true'">
+ |SWT.BORDER
+</c:if>
+<c:if test="$control/@style">
+ |SWT.<c:get select="$control/@style"/>
+</c:if>
+<c:if test="$control/@fullSelection = 'true'">
+ |SWT.FULL_SELECTION
+</c:if>
+<c:if test="$control/@hideSelection = 'true'">
+ |SWT.HIDE_SELECTION
+</c:if>
+<c:if test="$control/@virtual = 'true'">
+ |SWT.VIRTUAL
+</c:if>
diff --git a/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/tableColumn/initControl.jet b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/tableColumn/initControl.jet
new file mode 100644
index 0000000..4e56208
--- /dev/null
+++ b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/tableColumn/initControl.jet
@@ -0,0 +1,19 @@
+<%!
+/* Copyright 2008 IBM Corp. All rights reserved. This source code is made available under the terms of the Eclipse Public License, v1.0. */
+%>
+<%-- tableColumn --%>
+<c:if test="$control/@text">
+ <c:get select="$control/@name"/>.setText("<c:get select="$control/@text"/>");
+</c:if>
+<c:if test="$control/@toolTipText">
+ <c:get select="$control/@name"/>.setToolTipText("<c:get select="$control/@toolTipText"/>");
+</c:if>
+<c:if test="$control/@width">
+ <c:get select="$control/@name"/>.setWidth(<c:get select="$control/@width"/>);
+</c:if>
+<c:if test="$control/@moveable">
+ <c:get select="$control/@name"/>.setMoveable(<c:get select="$control/@moveable"/>);
+</c:if>
+<c:if test="$control/@resizeable">
+ <c:get select="$control/@name"/>.setResizeable(<c:get select="$control/@resizeable"/>);
+</c:if>
diff --git a/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/tableColumn/swtStyles.jet b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/tableColumn/swtStyles.jet
new file mode 100644
index 0000000..eeda8f4
--- /dev/null
+++ b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/tableColumn/swtStyles.jet
@@ -0,0 +1,8 @@
+<%!
+/* Copyright 2008 IBM Corp. All rights reserved. This source code is made available under the terms of the Eclipse Public License, v1.0. */
+%>
+<%-- tableColumn --%>
+ SWT.NONE
+<c:if test="$control/@alignment">
+ |SWT.<c:get select="$control/@alignment"/>
+</c:if>
diff --git a/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/text/initControl.jet b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/text/initControl.jet
new file mode 100644
index 0000000..8ebf24a
--- /dev/null
+++ b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/text/initControl.jet
@@ -0,0 +1,16 @@
+<%!
+/* Copyright 2008 IBM Corp. All rights reserved. This source code is made available under the terms of the Eclipse Public License, v1.0. */
+%>
+<%-- text --%>
+<c:if test="$control/@enabled">
+ <c:get select="$control/@name"/>.setEnabled(<c:get select="$control/@enabled"/>);
+</c:if>
+<c:if test="$control/@text">
+ <c:get select="$control/@name"/>.setText("<c:get select="$control/@text"/>");
+</c:if>
+<c:if test="$control/@message">
+ <c:get select="$control/@message"/>.setMessage("<c:get select="$control/@message"/>");
+</c:if>
+<c:if test="$control/@textLimit">
+ <c:get select="$control/@name"/>.setTextLimit(<c:get select="$control/@textLimit"/>);
+</c:if>
diff --git a/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/text/swtStyles.jet b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/text/swtStyles.jet
new file mode 100644
index 0000000..8ac2906
--- /dev/null
+++ b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/control/text/swtStyles.jet
@@ -0,0 +1,32 @@
+<%!
+/* Copyright 2008 IBM Corp. All rights reserved. This source code is made available under the terms of the Eclipse Public License, v1.0. */
+%>
+<%-- text --%>
+ SWT.NONE
+<c:if test="$control/@style">
+ |SWT.<c:get select="$control/@style"/>
+</c:if>
+<c:if test="not($control/@border) or $control/@border = 'true'">
+ |SWT.BORDER
+</c:if>
+<c:if test="$control/@readOnly = 'true'">
+ |SWT.READ_ONLY
+</c:if>
+<c:if test="$control/@wrap = 'true'">
+ |SWT.WRAP
+</c:if>
+<c:if test="$control/@search = 'true'">
+ |SWT.SEARCH
+</c:if>
+<c:if test="$control/@cancel = 'true'">
+ |SWT.CANCEL
+</c:if>
+<c:if test="$control/@password = 'true'">
+ |SWT.PASSWORD
+</c:if>
+<c:if test="$control/@alignment">
+ |SWT.<c:get select="$control/@alignment"/>
+</c:if>
+<c:if test="$control/@scroll">
+ |SWT.<c:get select="$control/@scroll"/>
+</c:if>
diff --git a/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/dump.jet b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/dump.jet
new file mode 100644
index 0000000..d21c92b
--- /dev/null
+++ b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/dump.jet
@@ -0,0 +1,5 @@
+<%!
+/* Copyright 2008 IBM Corp. All rights reserved. This source code is made available under the terms of the Eclipse Public License, v1.0. */
+%>
+<?xml version="1.0" encoding="utf-8"?>
+<c:dump select="$flattened/*" format="true" entities="true"/>
diff --git a/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/event/eventData.xml.jet b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/event/eventData.xml.jet
new file mode 100644
index 0000000..5cc218e
--- /dev/null
+++ b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/event/eventData.xml.jet
@@ -0,0 +1,44 @@
+<%!
+/* Copyright 2008 IBM Corp. All rights reserved. This source code is made available under the terms of the Eclipse Public License, v1.0. */
+%>
+<Selection
+ addListenerMethod="addSelectionListener"
+ handlerBaseClass="org.eclipse.swt.events.SelectionAdapter"
+ handlerMethod="widgetSelected"
+ eventClass="org.eclipse.swt.events.SelectionEvent"
+ delegateMethodSuffix="_selected"/>
+
+<DefaultSelection
+ addListenerMethod="addSelectionListener"
+ handlerBaseClass="org.eclipse.swt.events.SelectionAdapter"
+ handlerMethod="widgetDefaultSelected"
+ eventClass="org.eclipse.swt.events.SelectionEvent"
+ delegateMethodSuffix="_defaultSelected"/>
+
+<Modify
+ addListenerMethod="addModifyListener"
+ handlerBaseClass="org.eclipse.swt.events.ModifyListener"
+ handlerMethod="modifyText"
+ eventClass="org.eclipse.swt.events.ModifyEvent"
+ delegateMethodSuffix="_modify"/>
+
+<Move
+ addListenerMethod="addControlListener"
+ handlerBaseClass="org.eclipse.swt.events.ControlAdapter"
+ handlerMethod="controlMoved"
+ eventClass="org.eclipse.swt.events.ControlEvent"
+ delegateMethodSuffix="_moved"/>
+
+<Resize
+ addListenerMethod="addControlListener"
+ handlerBaseClass="org.eclipse.swt.events.ControlAdapter"
+ handlerMethod="controlResized"
+ eventClass="org.eclipse.swt.events.ControlEvent"
+ delegateMethodSuffix="_resized"/>
+
+<Verify
+ addListenerMethod="addVerifyListener"
+ handlerBaseClass="org.eclipse.swt.events.VerifyListener"
+ handlerMethod="verifyText"
+ eventClass="org.eclipse.swt.events.VerifyEvent"
+ delegateMethodSuffix="_verify"/>
diff --git a/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/main.jet b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/main.jet
new file mode 100644
index 0000000..5b8f8bd
--- /dev/null
+++ b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/main.jet
@@ -0,0 +1,74 @@
+<%!
+/* Copyright 2008 IBM Corp. All rights reserved. This source code is made available under the terms of the Eclipse Public License, v1.0. */
+%>
+<%@taglib prefix="ws" id="org.eclipse.jet.workspaceTags" %>
+<%-- Main entry point for org.eclipse.jet.ec2008.swtgen --%>
+
+<%--
+TODO: traverse input model, performing calculations and storing
+the results as model annotations via c:set tag
+--%>
+<%-- Flatten the recurive control sturcture --%>
+<c:loadContent var="flattened"><c:include template="templates/wizardPage/flatten.xml.jet"/></c:loadContent>
+<%-- DEBUG: write the flattend file just so we can see it--%>
+<ws:file template="templates/wizardPage/flatten.xml.jet" path="{$org.eclipse.jet.resource.parent.fullPath}/flattened.xml"/>
+
+<%-- Load control data --%>
+<c:loadContent var="controlData">
+<controls>
+ <c:include template="templates/control/controlData.xml.jet"/>
+</controls>
+</c:loadContent>
+
+<%-- Load event data --%>
+<c:loadContent var="eventData">
+<events>
+ <c:include template="templates/event/eventData.xml.jet"/>
+</events>
+</c:loadContent>
+
+<c:setVariable var="wizardPage" select="$flattened/wizardPage"/>
+
+<%-- do calculations for wizardPage --%>
+<c:set select="$wizardPage" name="codeBehindClass"><c:get select="$wizardPage/@class"/>Code</c:set>
+
+<c:iterate select="$wizardPage/control" var="control">
+ <%-- do calculations for control --%>
+ <c:setVariable var="data" select="$controlData/controls/{$control/@type}"/>
+ <c:set select="$control" name="javaType"><c:get select="$data/@javaType"/></c:set>
+ <c:set select="$control" name="initControlTemplate"><c:get select="$data/@initControlTemplate"/></c:set>
+ <c:set select="$control" name="swtStylesTemplate"><c:get select="$data/@swtStylesTemplate"/></c:set>
+
+ <c:iterate select="$control/event" var="event">
+ <%-- do calculations for event --%>
+ <c:setVariable var="data" select="$eventData/events/{$event/@name}"/>
+ <c:set select="$event" name="addListenerMethod"><c:get select="$data/@addListenerMethod"/></c:set>
+ <c:set select="$event" name="handlerBaseClass"><c:get select="$data/@handlerBaseClass"/></c:set>
+ <c:set select="$event" name="handlerMethod"><c:get select="$data/@handlerMethod"/></c:set>
+ <c:set select="$event" name="eventClass"><c:get select="$data/@eventClass"/></c:set>
+ <c:set select="$event" name="delegateMethod"><c:get select="$control/@name"/><c:get select="$data/@delegateMethodSuffix"/></c:set>
+ </c:iterate>
+</c:iterate>
+
+<%--
+TODO: traverse annotated model, performing text generation actions
+such as ws:file, ws:folder and ws:project
+--%>
+<%-- do actions for wizardPage --%>
+<java:class srcFolder="{$wizardPage/@srcFolder}"
+ package="{$wizardPage/@package}"
+ name="{$wizardPage/@class}"
+ template="templates/wizardPage/wizardPage.java.jet"/>
+<java:class srcFolder="{$wizardPage/@srcFolder}"
+ package="{$wizardPage/@package}"
+ name="{$wizardPage/@codeBehindClass}"
+ template="templates/wizardPage/codeBehind.java.jet"/>
+
+<%-- For debug purposes, dump the annotated input model in
+ the root of the project containing the original input model.
+
+ Note that model formatting may not be identical, and that in
+ the case of non-XML input models, the dump may look quite different.
+--%>
+
+<ws:file template="templates/dump.jet" path="{$org.eclipse.jet.resource.parent.fullPath}/dump.xml"/>
diff --git a/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/wizardPage/codeBehind.java.jet b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/wizardPage/codeBehind.java.jet
new file mode 100644
index 0000000..aa9e02d
--- /dev/null
+++ b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/wizardPage/codeBehind.java.jet
@@ -0,0 +1,39 @@
+<%!
+/* Copyright 2008 IBM Corp. All rights reserved. This source code is made available under the terms of the Eclipse Public License, v1.0. */
+%>
+<java:merge/>
+/*
+ * Generated by <%= context.getJETBundleId() %> from <c:get select="$org.eclipse.jet.resource.fullPath"/>.
+ * This class will not be modified by the transformation
+ */
+package <c:get select="$wizardPage/@package"/>;
+<java:importsLocation package="{$wizardPage/@package}"/>
+
+/**
+ *
+ */
+public class <c:get select="$wizardPage/@codeBehindClass"/> implements <c:get select="$wizardPage/@class"/>.CodeBehind {
+
+ private <c:get select="$wizardPage/@class"/> wizardPage;
+
+ /* (non-Javadoc)
+ * @see <c:get select="$wizardPage/@package"/>.<c:get select="$wizardPage/@class"/>.CodeBehind#setWizardPage(<c:get select="$wizardPage/@package"/>.<c:get select="$wizardPage/@class"/>)
+ */
+ public void setWizardPage(<c:get select="$wizardPage/@class"/> wizardPage) {
+ this.wizardPage = wizardPage;
+ }
+
+ /* (non-Javadoc)
+ * @see <c:get select="$wizardPage/@package"/>.<c:get select="$wizardPage/@class"/>.CodeBehind#doInitControls()
+ */
+ public void doInitControls() {
+ // TODO Generated init method
+ }
+
+<c:iterate select="$wizardPage/control/event" var="event">
+ public void <c:get select="$event/@delegateMethod"/>(<java:import><c:get select="$event/@eventClass"/></java:import> e) {
+ // TODO Generated event handler
+ }
+
+</c:iterate>
+}
diff --git a/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/wizardPage/flatten.xml.jet b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/wizardPage/flatten.xml.jet
new file mode 100644
index 0000000..fcc67d8
--- /dev/null
+++ b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/wizardPage/flatten.xml.jet
@@ -0,0 +1,13 @@
+<%!
+/* Copyright 2008 IBM Corp. All rights reserved. This source code is made available under the terms of the Eclipse Public License, v1.0. */
+%>
+<?xml version="1.0" encoding="UTF-8"?>
+<wizardPage
+ srcFolder="<c:get select="/wizardPage/@srcFolder"/>"
+ package="<c:get select="/wizardPage/@package"/>"
+ class="<c:get select="/wizardPage/@class"/>">
+<c:setVariable var="parentControl" select=" 'parent' "/>
+<c:iterate select="/wizardPage/composite" var="control">
+ <c:include template="templates/wizardPage/flattenControl.jet" passVariables="control,parentControl"/>
+</c:iterate>
+</wizardPage> \ No newline at end of file
diff --git a/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/wizardPage/flattenControl.jet b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/wizardPage/flattenControl.jet
new file mode 100644
index 0000000..15ea6fc
--- /dev/null
+++ b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/wizardPage/flattenControl.jet
@@ -0,0 +1,29 @@
+<%!
+/* Copyright 2008 IBM Corp. All rights reserved. This source code is made available under the terms of the Eclipse Public License, v1.0. */
+%>
+<%-- parentControl : name of parent control or empty string
+ control : current control element or empty string
+--%>
+ <control
+ type="<c:get select="local-name($control)"/>"
+ parent="<c:get select="$parentControl"/>"
+ <%-- copy attributes --%>
+ <c:iterate select="$control/@*" var="attr">
+ <c:get select="local-name($attr)"/>="<f:replaceAll value="&" replacement="&amp;"><c:get select="$attr"/></f:replaceAll>"
+ </c:iterate>
+ >
+<%-- copy elements (gridData|gridLayout|event|item) as child elements --%>
+ <c:iterate select="$control/gridLayout | $control/gridData | $control/event | $control/item"
+ var="childData">
+ <c:dump select="$childData"/>
+ </c:iterate>
+<%-- close control element --%>
+ </control>
+<c:setVariable var="parentControl" select="string($control/@name)"/>
+<%-- process child control elements at same depth as parent --%>
+<c:iterate select="$control/*"
+ var="control">
+ <c:if test="not(local-name($control) = 'gridData' or local-name($control) = 'gridLayout' or local-name($control) = 'event' or local-name($control) = 'item')">
+ <c:include template="templates/wizardPage/flattenControl.jet" passVariables="control,parentControl"/>
+ </c:if>
+</c:iterate>
diff --git a/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/wizardPage/wizardPage.java.jet b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/wizardPage/wizardPage.java.jet
new file mode 100644
index 0000000..b9ff73c
--- /dev/null
+++ b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/wizardPage/wizardPage.java.jet
@@ -0,0 +1,124 @@
+<%!
+/* Copyright 2008 IBM Corp. All rights reserved. This source code is made available under the terms of the Eclipse Public License, v1.0. */
+%>
+/**
+ * Generated by <%= context.getJETBundleId() %> from <c:get select="$org.eclipse.jet.resource.fullPath"/>
+ */
+package <c:get select="$wizardPage/@package"/>;
+
+<java:importsLocation package="{$wizardPage/@package}"/>
+
+import org.eclipse.jface.dialogs.Dialog;<java:impliedImport name="org.eclipse.jface.dialogs.Dialog"/>
+import org.eclipse.jface.resource.ImageDescriptor;<java:impliedImport name="org.eclipse.jface.resource.ImageDescriptor"/>
+import org.eclipse.jface.wizard.WizardPage;<java:impliedImport name="org.eclipse.jface.wizard.WizardPage"/>
+import org.eclipse.swt.widgets.Composite;<java:impliedImport name="org.eclipse.swt.widgets.Composite"/>
+import org.eclipse.swt.SWT;<java:impliedImport name="org.eclipse.swt.SWT"/>
+
+/**
+ *
+ */
+public class <c:get select="$wizardPage/@class"/> extends WizardPage {
+
+ /**
+ * Code behind class for <c:get select="$wizardPage/@class"/>
+ */
+ public static interface CodeBehind {
+
+ /**
+ * Perform any control required initialization. This method is called
+ * by {@link <c:get select="$wizardPage/@class"/>#createControl(Composite parent)}
+ */
+ public abstract void doInitControls();
+
+ /**
+ * Set the wizardPage of the code-behind class. This method is called by the
+ * wizard page constructor on the passed codeBehind class.
+ */
+ public abstract void setWizardPage(<c:get select="$wizardPage/@class"/> wizardPage);
+
+<c:iterate select="$wizardPage/control/event" var="event">
+ /**
+ * Handle <c:get select="$event/@name"/> event for <c:get select="$event/../@name"/>
+ */
+ public abstract void <c:get select="$event/@delegateMethod"/>(<java:import><c:get select="$event/@eventClass"/></java:import> e);
+
+</c:iterate>
+ }
+
+<c:iterate select="$wizardPage/control[@isField = 'true']" var="control">
+ public <java:import><c:get select="$control/@javaType"/></java:import> <c:get select="$control/@name"/>;
+
+</c:iterate>
+
+ private final CodeBehind codeBehind;
+
+ /**
+ * @param pageName
+ */
+ public <c:get select="$wizardPage/@class"/>(String pageName, CodeBehind codeBehind) {
+ super(pageName);
+ this.codeBehind = codeBehind;
+ codeBehind.setWizardPage(this);
+ }
+
+ /**
+ * @param pageName
+ * @param title
+ * @param titleImage
+ */
+ public <c:get select="$wizardPage/@class"/>(String pageName, String title,
+ ImageDescriptor titleImage, CodeBehind codeBehind) {
+ super(pageName, title, titleImage);
+ this.codeBehind = codeBehind;
+ codeBehind.setWizardPage(this);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createControl(Composite parent) {
+ initializeDialogUnits(parent);
+
+<c:iterate select="$wizardPage/control" var="control">
+ <c:if test="not($control/@isField = 'true')"><java:import><c:get select="$control/@javaType"/></java:import> </c:if><c:get select="$control/@name"/>
+ = new <java:import><c:get select="$control/@javaType"/></java:import>(
+ <c:get select="$control/@parent"/>,
+ <c:include template="{$control/@swtStylesTemplate}"/>
+ );
+ <c:include template="{$control/@initControlTemplate}"/>
+ <c:include template="templates/control/setGridData.jet"/>
+ <c:iterate select="$control/event" var="event">
+ <c:get select="$control/@name"/>.<c:get select="$event/@addListenerMethod"/>( new <java:import><c:get select="$event/@handlerBaseClass"/></java:import>() {
+ public void <c:get select="$event/@handlerMethod"/>(<java:import><c:get select="$event/@eventClass"/></java:import> e) {
+ if(codeBehind != null) {
+ codeBehind.<c:get select="$event/@delegateMethod"/>(e);
+ }
+
+ }});
+ </c:iterate>
+
+</c:iterate>
+
+<c:iterate select="$wizardPage/control[@parent='parent']" var="topControl">
+ setControl(<c:get select="$topControl/@name"/>);
+ Dialog.applyDialogFont(<c:get select="$topControl/@name"/>);
+</c:iterate>
+
+ if(codeBehind != null) {
+ codeBehind.doInitControls();
+ }
+ }
+
+<c:if test="$wizardPage/control[@isField = 'true' and (not(@enabled) or @enabled = 'true')]" var="firstControl">
+ @Override
+ public void setVisible(boolean visible) {
+ super.setVisible(visible);
+
+ if(visible) {
+ <c:get select="$firstControl/@name"/>.setFocus();
+ }
+
+ }
+
+</c:if>
+}

Back to the top