Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/wizardPage/wizardPage.java.jet')
-rw-r--r--examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/wizardPage/wizardPage.java.jet124
1 files changed, 124 insertions, 0 deletions
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