click-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sa...@apache.org
Subject svn commit: r728320 [1/2] - in /incubator/click/trunk/click/examples/src/net/sf/click/examples: control/ control/cayenne/ page/table/ page/tree/ page/wizard/
Date Sat, 20 Dec 2008 17:44:11 GMT
Author: sabob
Date: Sat Dec 20 09:44:11 2008
New Revision: 728320

URL: http://svn.apache.org/viewvc?rev=728320&view=rev
Log:
removed whitespaces

Modified:
    incubator/click/trunk/click/examples/src/net/sf/click/examples/control/SimplePanel.java
    incubator/click/trunk/click/examples/src/net/sf/click/examples/control/cayenne/CayenneIntegerField.java
    incubator/click/trunk/click/examples/src/net/sf/click/examples/control/cayenne/NestedCayenneForm.java
    incubator/click/trunk/click/examples/src/net/sf/click/examples/page/table/EditFormTablePage.java
    incubator/click/trunk/click/examples/src/net/sf/click/examples/page/tree/PageLinkTreePage.java
    incubator/click/trunk/click/examples/src/net/sf/click/examples/page/tree/PlainTreePage.java
    incubator/click/trunk/click/examples/src/net/sf/click/examples/page/wizard/SelectPostCode.java
    incubator/click/trunk/click/examples/src/net/sf/click/examples/page/wizard/Step.java
    incubator/click/trunk/click/examples/src/net/sf/click/examples/page/wizard/Step1.java
    incubator/click/trunk/click/examples/src/net/sf/click/examples/page/wizard/Step2.java
    incubator/click/trunk/click/examples/src/net/sf/click/examples/page/wizard/Step3.java
    incubator/click/trunk/click/examples/src/net/sf/click/examples/page/wizard/WizardPage.java

Modified: incubator/click/trunk/click/examples/src/net/sf/click/examples/control/SimplePanel.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/examples/src/net/sf/click/examples/control/SimplePanel.java?rev=728320&r1=728319&r2=728320&view=diff
==============================================================================
--- incubator/click/trunk/click/examples/src/net/sf/click/examples/control/SimplePanel.java (original)
+++ incubator/click/trunk/click/examples/src/net/sf/click/examples/control/SimplePanel.java Sat Dec 20 09:44:11 2008
@@ -1,148 +1,148 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package net.sf.click.examples.control;
-
-import java.net.MalformedURLException;
-import net.sf.click.Context;
-import net.sf.click.control.Panel;
-import net.sf.click.util.ClickUtils;
-import net.sf.click.util.HtmlStringBuffer;
-import org.apache.commons.lang.ClassUtils;
-
-/**
- * A panel with fallback render functionality which allows the panel controls
- * to be rendered if its template is not available.
- * <p/>
- * By default Panel will render its template or throw exception if template is
- * not found. Thus if you do not define a template for the Panel, an exception
- * is raised.
- * <p/>
- * SimplePanel on the other hand first checks if the template is
- * available on the servlet context path or classpath and if template is not
- * found, the panel controls are simply rendered in the order they were added.
- * <p/>
- * In effect SimplePanel falls back to the default rendering of
- * AbstractContainer if the Panel template is not found.
- *
- * @author Bob Schellink
- */
-public class SimplePanel extends Panel {
-
-    /**
-     * Default empty constructor.
-     */
-    public SimplePanel() {
-    }
-
-    /**
-     * Construct a new panel with the specified name.
-     *
-     * @param name name of the panel
-     */
-    public SimplePanel(String name) {
-        super(name);
-    }
-
-    /**
-     * Render the AbstractTablePanel's internal HtmlTable.
-     * <p/>
-     * However like its superclass {@link net.sf.click.control.Panel} it is
-     * possible to override the default rendering by either specifying a
-     * {@link #template} or specifying a template based on the
-     * {@link #getClass() classes} name.
-     *
-     * @see net.sf.click.control.Panel#render(net.sf.click.util.HtmlStringBuffer)
-     *
-     * @param buffer the specified buffer to render the Panel's output to
-     */
-    public void render(HtmlStringBuffer buffer) {
-
-        if (getTemplate() != null) {
-            super.render(buffer);
-
-        } else {
-            boolean hasTemplate = hasTemplate();
-            if (hasTemplate) {
-                super.render(buffer);
-            } else {
-                ClickUtils.getLogService().info("   No template was found for"
-                    + " panel " + ClassUtils.getShortClassName(getClass())
-                    + ". Rendering controls in the order they were added.");
-                renderContainer(buffer);
-            }
-        }
-    }
-    
-    /**
-     * Return true if the panel template is available, false otherwise.
-     *
-     * @return true if the panel template is available, false otherwise
-     */
-    protected boolean hasTemplate() {
-        boolean hasTemplate = false;
-        
-        if (getTemplate() != null) {
-            hasTemplate = true;
-
-        } else {
-            String templatePath = getClass().getName();
-            templatePath = '/' + templatePath.replace('.', '/') + ".htm";
-
-            try {
-                Context context = getContext();
-                
-                // First check on the servlet context path
-                hasTemplate = context.getServletContext().getResource(templatePath) != null;
-                if (!hasTemplate) {
-                    // Second check on the classpath
-                    hasTemplate = ClickUtils.getResource(templatePath, getClass()) != null;
-                }
-
-            } catch (MalformedURLException e) {
-                throw new RuntimeException(e);
-            }
-        }
-
-        return hasTemplate;
-    }
-
-    /**
-     * Render the panel as a normal Container.
-     * 
-     * @param buffer to buffer to render output to
-     */
-    protected void renderContainer(HtmlStringBuffer buffer) {
-        // If a template cannot be found for the panel, use default container
-        // rendering
-        if (getTag() != null) {
-            renderTagBegin(getTag(), buffer);
-            buffer.closeTag();
-            if (hasControls()) {
-                buffer.append("\n");
-            }
-            renderContent(buffer);
-            renderTagEnd(getTag(), buffer);
-
-        } else {
-
-            //render only content because no tag is specified
-            renderContent(buffer);
-        }
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package net.sf.click.examples.control;
+
+import java.net.MalformedURLException;
+import net.sf.click.Context;
+import net.sf.click.control.Panel;
+import net.sf.click.util.ClickUtils;
+import net.sf.click.util.HtmlStringBuffer;
+import org.apache.commons.lang.ClassUtils;
+
+/**
+ * A panel with fallback render functionality which allows the panel controls
+ * to be rendered if its template is not available.
+ * <p/>
+ * By default Panel will render its template or throw exception if template is
+ * not found. Thus if you do not define a template for the Panel, an exception
+ * is raised.
+ * <p/>
+ * SimplePanel on the other hand first checks if the template is
+ * available on the servlet context path or classpath and if template is not
+ * found, the panel controls are simply rendered in the order they were added.
+ * <p/>
+ * In effect SimplePanel falls back to the default rendering of
+ * AbstractContainer if the Panel template is not found.
+ *
+ * @author Bob Schellink
+ */
+public class SimplePanel extends Panel {
+
+    /**
+     * Default empty constructor.
+     */
+    public SimplePanel() {
+    }
+
+    /**
+     * Construct a new panel with the specified name.
+     *
+     * @param name name of the panel
+     */
+    public SimplePanel(String name) {
+        super(name);
+    }
+
+    /**
+     * Render the AbstractTablePanel's internal HtmlTable.
+     * <p/>
+     * However like its superclass {@link net.sf.click.control.Panel} it is
+     * possible to override the default rendering by either specifying a
+     * {@link #template} or specifying a template based on the
+     * {@link #getClass() classes} name.
+     *
+     * @see net.sf.click.control.Panel#render(net.sf.click.util.HtmlStringBuffer)
+     *
+     * @param buffer the specified buffer to render the Panel's output to
+     */
+    public void render(HtmlStringBuffer buffer) {
+
+        if (getTemplate() != null) {
+            super.render(buffer);
+
+        } else {
+            boolean hasTemplate = hasTemplate();
+            if (hasTemplate) {
+                super.render(buffer);
+            } else {
+                ClickUtils.getLogService().info("   No template was found for"
+                    + " panel " + ClassUtils.getShortClassName(getClass())
+                    + ". Rendering controls in the order they were added.");
+                renderContainer(buffer);
+            }
+        }
+    }
+
+    /**
+     * Return true if the panel template is available, false otherwise.
+     *
+     * @return true if the panel template is available, false otherwise
+     */
+    protected boolean hasTemplate() {
+        boolean hasTemplate = false;
+
+        if (getTemplate() != null) {
+            hasTemplate = true;
+
+        } else {
+            String templatePath = getClass().getName();
+            templatePath = '/' + templatePath.replace('.', '/') + ".htm";
+
+            try {
+                Context context = getContext();
+
+                // First check on the servlet context path
+                hasTemplate = context.getServletContext().getResource(templatePath) != null;
+                if (!hasTemplate) {
+                    // Second check on the classpath
+                    hasTemplate = ClickUtils.getResource(templatePath, getClass()) != null;
+                }
+
+            } catch (MalformedURLException e) {
+                throw new RuntimeException(e);
+            }
+        }
+
+        return hasTemplate;
+    }
+
+    /**
+     * Render the panel as a normal Container.
+     *
+     * @param buffer to buffer to render output to
+     */
+    protected void renderContainer(HtmlStringBuffer buffer) {
+        // If a template cannot be found for the panel, use default container
+        // rendering
+        if (getTag() != null) {
+            renderTagBegin(getTag(), buffer);
+            buffer.closeTag();
+            if (hasControls()) {
+                buffer.append("\n");
+            }
+            renderContent(buffer);
+            renderTagEnd(getTag(), buffer);
+
+        } else {
+
+            //render only content because no tag is specified
+            renderContent(buffer);
+        }
+    }
+}

Modified: incubator/click/trunk/click/examples/src/net/sf/click/examples/control/cayenne/CayenneIntegerField.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/examples/src/net/sf/click/examples/control/cayenne/CayenneIntegerField.java?rev=728320&r1=728319&r2=728320&view=diff
==============================================================================
--- incubator/click/trunk/click/examples/src/net/sf/click/examples/control/cayenne/CayenneIntegerField.java (original)
+++ incubator/click/trunk/click/examples/src/net/sf/click/examples/control/cayenne/CayenneIntegerField.java Sat Dec 20 09:44:11 2008
@@ -1,60 +1,60 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package net.sf.click.examples.control.cayenne;
-
-import net.sf.click.extras.control.IntegerField;
-
-/**
- * This IntegerField class preserves its value when it is copied from
- * an entity property that is null.
- * 
- * @author Bob Schellink
- */
-public class CayenneIntegerField extends IntegerField {
-
-    /**
-     * Construct a new field for the specified name and label.
-     *
-     * @param name the field name
-     * @param label the field label
-     */
-    public CayenneIntegerField(String name, String label) {
-        super(name, label);
-    }
-
-    /**
-     * #setValueObject is invoked when a Form attempts to bind an Object to its
-     * fields.
-     * 
-     * When a bean property with value 'null' is bound to IntegerField,
-     * setValueObject will nullify the Integer value. This is not always
-     * desirable as sometimes we want the value to be preserved.
-     * 
-     * Here we override #setValueObject and explicitly check if the passed in
-     * object is null. If it is we return without changing the value object.
-     * 
-     * @param object the object value to set
-     */
-    public void setValueObject(Object object) {
-        if (object == null) {
-            return;
-        }
-        super.setValueObject(object);
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package net.sf.click.examples.control.cayenne;
+
+import net.sf.click.extras.control.IntegerField;
+
+/**
+ * This IntegerField class preserves its value when it is copied from
+ * an entity property that is null.
+ *
+ * @author Bob Schellink
+ */
+public class CayenneIntegerField extends IntegerField {
+
+    /**
+     * Construct a new field for the specified name and label.
+     *
+     * @param name the field name
+     * @param label the field label
+     */
+    public CayenneIntegerField(String name, String label) {
+        super(name, label);
+    }
+
+    /**
+     * #setValueObject is invoked when a Form attempts to bind an Object to its
+     * fields.
+     *
+     * When a bean property with value 'null' is bound to IntegerField,
+     * setValueObject will nullify the Integer value. This is not always
+     * desirable as sometimes we want the value to be preserved.
+     *
+     * Here we override #setValueObject and explicitly check if the passed in
+     * object is null. If it is we return without changing the value object.
+     *
+     * @param object the object value to set
+     */
+    public void setValueObject(Object object) {
+        if (object == null) {
+            return;
+        }
+        super.setValueObject(object);
+    }
+}

Modified: incubator/click/trunk/click/examples/src/net/sf/click/examples/control/cayenne/NestedCayenneForm.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/examples/src/net/sf/click/examples/control/cayenne/NestedCayenneForm.java?rev=728320&r1=728319&r2=728320&view=diff
==============================================================================
--- incubator/click/trunk/click/examples/src/net/sf/click/examples/control/cayenne/NestedCayenneForm.java (original)
+++ incubator/click/trunk/click/examples/src/net/sf/click/examples/control/cayenne/NestedCayenneForm.java Sat Dec 20 09:44:11 2008
@@ -1,103 +1,103 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package net.sf.click.examples.control.cayenne;
-
-import net.sf.click.extras.cayenne.CayenneForm;
-import org.apache.cayenne.DataObject;
-import org.apache.cayenne.access.DataContext;
-
-/**
- * Provides a CayenneForm which uses a Nested DataContext that is created as a
- * child of the DataContext bound to the current Thread.
- * <p/>
- * Using a nested DataContext allows the form to keep its state across multiple
- * requests even if <tt>net.sf.click.extras.cayenne.DataContextFilter</tt> is
- * configured to rollback changes after each request, which is the case for
- * click-examples.
- *
- * @author Bob Schellink
- */
-public class NestedCayenneForm extends CayenneForm {
-
-    /** A transient reference to a nested DataContext. */
-    protected transient DataContext nestedDataContext;
-
-    /**
-     * Construct a form for the specified name and DataObject class.
-     * 
-     * @param name the form name
-     * @param dataObjectClass the DataObject class
-     */
-    public NestedCayenneForm(String name, Class dataObjectClass) {
-        super(name, dataObjectClass);
-    }
-    
-    /**
-     * Construct a form for the specified DataObject class.
-     * 
-     * @param dataObjectClass the DataObject class
-     */
-    public NestedCayenneForm(Class dataObjectClass) {
-        super(dataObjectClass);
-    }
-
-    /**
-     * Default constructor.
-     */
-    public NestedCayenneForm() {
-    }
-
-    /**
-     * Return the DataContext for this Form using the following heuristics:
-     * 
-     * #1. return the dataObject DataContext if set
-     * #2. return the {@link #nestedDataContext} instance if set
-     * #3. return a nested DataContext of the thread local DataContext
-     * 
-     * @return a DataContext based on heuristics
-     */
-    public DataContext getDataContext() {
-        // #1 Use DataContext associated with DataObject
-        if (dataObject != null) {
-            if (dataObject.getDataContext() != null) {
-                return dataObject.getDataContext();
-            }
-        }
-        // #2 Use nestedDataContext
-        if (nestedDataContext != null) {
-            return nestedDataContext;
-        }
-
-        DataContext dc = super.getDataContext();
-
-        // #3 Create a nested DataContext and cache the reference
-        return nestedDataContext = dc.createChildDataContext();
-    }
-
-    /**
-     * Override onDestroy not to nullify the dataObject instance each request.
-     */
-    public void onDestroy() {
-        // CayenneForm.onDestroy nullifies the dataObject. Below a
-        // reference is kept to the cached dataObject
-        DataObject temp = dataObject;
-        super.onDestroy();
-        dataObject = temp;
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package net.sf.click.examples.control.cayenne;
+
+import net.sf.click.extras.cayenne.CayenneForm;
+import org.apache.cayenne.DataObject;
+import org.apache.cayenne.access.DataContext;
+
+/**
+ * Provides a CayenneForm which uses a Nested DataContext that is created as a
+ * child of the DataContext bound to the current Thread.
+ * <p/>
+ * Using a nested DataContext allows the form to keep its state across multiple
+ * requests even if <tt>net.sf.click.extras.cayenne.DataContextFilter</tt> is
+ * configured to rollback changes after each request, which is the case for
+ * click-examples.
+ *
+ * @author Bob Schellink
+ */
+public class NestedCayenneForm extends CayenneForm {
+
+    /** A transient reference to a nested DataContext. */
+    protected transient DataContext nestedDataContext;
+
+    /**
+     * Construct a form for the specified name and DataObject class.
+     *
+     * @param name the form name
+     * @param dataObjectClass the DataObject class
+     */
+    public NestedCayenneForm(String name, Class dataObjectClass) {
+        super(name, dataObjectClass);
+    }
+
+    /**
+     * Construct a form for the specified DataObject class.
+     *
+     * @param dataObjectClass the DataObject class
+     */
+    public NestedCayenneForm(Class dataObjectClass) {
+        super(dataObjectClass);
+    }
+
+    /**
+     * Default constructor.
+     */
+    public NestedCayenneForm() {
+    }
+
+    /**
+     * Return the DataContext for this Form using the following heuristics:
+     *
+     * #1. return the dataObject DataContext if set
+     * #2. return the {@link #nestedDataContext} instance if set
+     * #3. return a nested DataContext of the thread local DataContext
+     *
+     * @return a DataContext based on heuristics
+     */
+    public DataContext getDataContext() {
+        // #1 Use DataContext associated with DataObject
+        if (dataObject != null) {
+            if (dataObject.getDataContext() != null) {
+                return dataObject.getDataContext();
+            }
+        }
+        // #2 Use nestedDataContext
+        if (nestedDataContext != null) {
+            return nestedDataContext;
+        }
+
+        DataContext dc = super.getDataContext();
+
+        // #3 Create a nested DataContext and cache the reference
+        return nestedDataContext = dc.createChildDataContext();
+    }
+
+    /**
+     * Override onDestroy not to nullify the dataObject instance each request.
+     */
+    public void onDestroy() {
+        // CayenneForm.onDestroy nullifies the dataObject. Below a
+        // reference is kept to the cached dataObject
+        DataObject temp = dataObject;
+        super.onDestroy();
+        dataObject = temp;
+    }
+}

Modified: incubator/click/trunk/click/examples/src/net/sf/click/examples/page/table/EditFormTablePage.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/examples/src/net/sf/click/examples/page/table/EditFormTablePage.java?rev=728320&r1=728319&r2=728320&view=diff
==============================================================================
--- incubator/click/trunk/click/examples/src/net/sf/click/examples/page/table/EditFormTablePage.java (original)
+++ incubator/click/trunk/click/examples/src/net/sf/click/examples/page/table/EditFormTablePage.java Sat Dec 20 09:44:11 2008
@@ -1,255 +1,255 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package net.sf.click.examples.page.table;
-
-import java.util.Date;
-import java.util.List;
-
-import net.sf.click.control.ActionLink;
-import net.sf.click.control.Checkbox;
-import net.sf.click.control.Column;
-import net.sf.click.control.FieldSet;
-import net.sf.click.control.Form;
-import net.sf.click.control.Submit;
-import net.sf.click.control.Table;
-import net.sf.click.control.TextField;
-import net.sf.click.examples.control.InvestmentSelect;
-import net.sf.click.examples.domain.Customer;
-import net.sf.click.examples.page.BorderPage;
-import net.sf.click.extras.control.DateField;
-import net.sf.click.extras.control.DoubleField;
-import net.sf.click.extras.control.EmailField;
-import net.sf.click.extras.control.FieldColumn;
-import net.sf.click.extras.control.FormTable;
-import net.sf.click.extras.control.LinkDecorator;
-import net.sf.click.extras.control.NumberField;
-
-/**
- * Provides a CRUD demonstration using Form and FormTable.
- * <p/>
- * Note the following:
- *
- * #1. Form child controls are only processed on Form submission. In order to
- * process Form child controls when form is *not* submitted, Form.onProcess
- * must be overridden and the controls explicitly processed.
- *
- * #2. By default FormTable creates an internal Form for submissions. However
- * it is possible to use the FormTable constructor which accepts a Form so that
- * FormTable can be added to this "external" Form.
- *
- * 
- * @author Malcolm Edgar
- * @author Bob Schellink
- */
-public class EditFormTablePage extends BorderPage {
-
-    private static final int NUM_ROWS = 20;
-
-    private FormTable table;
-
-    private ActionLink deleteCustomer = new ActionLink("delete", "Delete", this, "onDeleteClick");
-    
-    private Form customerForm = new Form("customerForm");
-
-    private Form form = new Form("form") {
-
-        /**
-         * #1. PLEASE NOTE: FormTable will only be processed by form if the
-         * Form is submitted. Thus paging and sorting won't work by default.
-         *
-         * Here we override the default behavior and explicitly process
-         * FormTable (table) so that paging and sorting will still work, even
-         * if the Form was not submitted.
-         */
-        public boolean onProcess() {
-            if (form.isFormSubmission()) {
-                return super.onProcess();
-            } else {
-                deleteCustomer.onProcess();
-                return table.onProcess();
-            }
-        }
-    };
-
-    // ------------------------------------------------------------ Constructor
-
-    public EditFormTablePage() {
-        // Setup customers form
-        FieldSet fieldSet = new FieldSet("customer");
-        fieldSet.add(new TextField("name")).setRequired(true);
-        fieldSet.add(new EmailField("email")).setRequired(true);
-        fieldSet.add(new InvestmentSelect("investments")).setRequired(true);
-        fieldSet.add(new DoubleField("holdings"));
-        DateField dateJoined = new DateField("dateJoined");
-        dateJoined.setDate(new Date());
-        fieldSet.add(dateJoined);
-        customerForm.add(fieldSet);
-        customerForm.add(new Submit("add", "Add Customer", this, "onAddClick"));
-
-        // * #2. Create the FormTable and pass in the existing Form into the
-        // constructor. FormTable now knows it should not create an internal
-        // Form instance.
-        table = new FormTable("table", form);
-
-        // Assemble the FormTable columns
-        table.setClass(Table.CLASS_SIMPLE);
-        table.setWidth("700px");
-        table.setPageSize(5);
-        table.setShowBanner(true);
-
-        table.addColumn(new Column("id"));
-
-        FieldColumn column = new FieldColumn("name", new TextField());
-        column.setVerticalAlign("baseline");
-        table.addColumn(column);
-
-        column = new FieldColumn("email", new EmailField());
-        column.getField().setRequired(true);
-        table.addColumn(column);
-
-        column = new FieldColumn("investments", new InvestmentSelect());
-        column.getField().setRequired(true);
-        table.addColumn(column);
-
-        NumberField numberField = new NumberField();
-        numberField.setSize(5);
-        column = new FieldColumn("holdings", numberField);
-        column.setTextAlign("right");
-        table.addColumn(column);
-
-        column = new FieldColumn("dateJoined", new DateField());
-        column.setDataStyle("white-space", "nowrap");
-        table.addColumn(column);
-
-        column = new FieldColumn("active", new Checkbox());
-        column.setTextAlign("center");
-        table.addColumn(column);
-
-        Column actionColumn = new Column("Action");
-        actionColumn.setSortable(false);
-        ActionLink[] links = new ActionLink[]{deleteCustomer};
-        actionColumn.setDecorator(new LinkDecorator(table, links, "id"));
-        table.addColumn(actionColumn);
-
-        deleteCustomer.setAttribute("onclick", "return window.confirm('Please confirm delete');");
-
-        table.getForm().add(new Submit("update", "Update Customers", this, "onUpdateCustomersClick"));
-        table.getForm().add(new Submit("cancel", this, "onCancelClick"));
-
-        table.setSortable(true);
-
-        fieldSet = new FieldSet("customers");
-        form.add(fieldSet);
-
-        // Add FormTable to FieldSet which is attached to Form
-        fieldSet.add(table);
-
-        addControl(customerForm);
-        addControl(form);
-    }
-
-    // --------------------------------------------------------- Event Handlers
-
-    public boolean onSecurityCheck() {
-        String pagePath = getContext().getPagePath(getClass());
-
-        // In this demo we protect against duplicate post submissions
-        if (form.onSubmitCheck(this, pagePath)) {
-            return true;
-        } else {
-            getContext().setFlashAttribute("error", getMessage("invalid.form.submit"));
-            return false;
-        }
-    }
-
-    /**
-     * @see net.sf.click.Page#onInit()
-     */
-    public void onInit() {
-        super.onInit();
-
-        refreshTableCustomers();
-    }
-
-    public boolean onUpdateCustomersClick() {
-        if (form.isValid()) {
-            // Please note with Cayenne ORM this will persist any changes
-            // to data objects submitted by the form.
-            getDataContext().commitChanges();
-        }
-        return true;
-    }
-
-    public boolean onCancelClick() {
-        // Rollback any changes made to the customers, which are stored in
-        // the data context
-        getDataContext().rollbackChanges();
-
-        refreshTableCustomers();
-
-        table.setRenderSubmittedValues(false);
-
-        form.clearErrors();
-
-        return true;
-    }
-
-    public boolean onDeleteClick() {
-        Integer id = deleteCustomer.getValueInteger();
-        getCustomerService().deleteCustomer(id);
-
-        // The FormTable customer were already set in the onInit phase. Because
-        // a customer was deleted we refresh the FormTable row list
-        refreshTableCustomers();
-
-        return true;
-    }
-
-     public boolean onInsertClick() {
-        Customer customer = new Customer();
-        customer.setName("Alpha");
-        customer.setDateJoined(new Date());
-        getCustomerService().saveCustomer(customer);
-
-        // The FormTable customer were already set in the onInit phase. Because
-        // a customer was deleted we refresh the FormTable row list
-        refreshTableCustomers();
-
-        return true;
-    }
-
-    public boolean onAddClick() {
-        if (customerForm.isValid()) {
-            Customer customer = new Customer();
-            customerForm.copyTo(customer);
-            getCustomerService().saveCustomer(customer);
-
-            // The FormTable customer was set in the onInit phase. Since we just
-            // added a new customer we refresh the FormTable row list
-            refreshTableCustomers();
-        }
-        return true;
-    }
-    
-    private void refreshTableCustomers() {
-        List allCustomers = getCustomerService().getCustomersSortedBy(Customer.DATE_JOINED_PROPERTY, false);
-        List customers = allCustomers.subList(0, NUM_ROWS);
-        table.setRowList(customers);
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package net.sf.click.examples.page.table;
+
+import java.util.Date;
+import java.util.List;
+
+import net.sf.click.control.ActionLink;
+import net.sf.click.control.Checkbox;
+import net.sf.click.control.Column;
+import net.sf.click.control.FieldSet;
+import net.sf.click.control.Form;
+import net.sf.click.control.Submit;
+import net.sf.click.control.Table;
+import net.sf.click.control.TextField;
+import net.sf.click.examples.control.InvestmentSelect;
+import net.sf.click.examples.domain.Customer;
+import net.sf.click.examples.page.BorderPage;
+import net.sf.click.extras.control.DateField;
+import net.sf.click.extras.control.DoubleField;
+import net.sf.click.extras.control.EmailField;
+import net.sf.click.extras.control.FieldColumn;
+import net.sf.click.extras.control.FormTable;
+import net.sf.click.extras.control.LinkDecorator;
+import net.sf.click.extras.control.NumberField;
+
+/**
+ * Provides a CRUD demonstration using Form and FormTable.
+ * <p/>
+ * Note the following:
+ *
+ * #1. Form child controls are only processed on Form submission. In order to
+ * process Form child controls when form is *not* submitted, Form.onProcess
+ * must be overridden and the controls explicitly processed.
+ *
+ * #2. By default FormTable creates an internal Form for submissions. However
+ * it is possible to use the FormTable constructor which accepts a Form so that
+ * FormTable can be added to this "external" Form.
+ *
+ *
+ * @author Malcolm Edgar
+ * @author Bob Schellink
+ */
+public class EditFormTablePage extends BorderPage {
+
+    private static final int NUM_ROWS = 20;
+
+    private FormTable table;
+
+    private ActionLink deleteCustomer = new ActionLink("delete", "Delete", this, "onDeleteClick");
+
+    private Form customerForm = new Form("customerForm");
+
+    private Form form = new Form("form") {
+
+        /**
+         * #1. PLEASE NOTE: FormTable will only be processed by form if the
+         * Form is submitted. Thus paging and sorting won't work by default.
+         *
+         * Here we override the default behavior and explicitly process
+         * FormTable (table) so that paging and sorting will still work, even
+         * if the Form was not submitted.
+         */
+        public boolean onProcess() {
+            if (form.isFormSubmission()) {
+                return super.onProcess();
+            } else {
+                deleteCustomer.onProcess();
+                return table.onProcess();
+            }
+        }
+    };
+
+    // ------------------------------------------------------------ Constructor
+
+    public EditFormTablePage() {
+        // Setup customers form
+        FieldSet fieldSet = new FieldSet("customer");
+        fieldSet.add(new TextField("name")).setRequired(true);
+        fieldSet.add(new EmailField("email")).setRequired(true);
+        fieldSet.add(new InvestmentSelect("investments")).setRequired(true);
+        fieldSet.add(new DoubleField("holdings"));
+        DateField dateJoined = new DateField("dateJoined");
+        dateJoined.setDate(new Date());
+        fieldSet.add(dateJoined);
+        customerForm.add(fieldSet);
+        customerForm.add(new Submit("add", "Add Customer", this, "onAddClick"));
+
+        // * #2. Create the FormTable and pass in the existing Form into the
+        // constructor. FormTable now knows it should not create an internal
+        // Form instance.
+        table = new FormTable("table", form);
+
+        // Assemble the FormTable columns
+        table.setClass(Table.CLASS_SIMPLE);
+        table.setWidth("700px");
+        table.setPageSize(5);
+        table.setShowBanner(true);
+
+        table.addColumn(new Column("id"));
+
+        FieldColumn column = new FieldColumn("name", new TextField());
+        column.setVerticalAlign("baseline");
+        table.addColumn(column);
+
+        column = new FieldColumn("email", new EmailField());
+        column.getField().setRequired(true);
+        table.addColumn(column);
+
+        column = new FieldColumn("investments", new InvestmentSelect());
+        column.getField().setRequired(true);
+        table.addColumn(column);
+
+        NumberField numberField = new NumberField();
+        numberField.setSize(5);
+        column = new FieldColumn("holdings", numberField);
+        column.setTextAlign("right");
+        table.addColumn(column);
+
+        column = new FieldColumn("dateJoined", new DateField());
+        column.setDataStyle("white-space", "nowrap");
+        table.addColumn(column);
+
+        column = new FieldColumn("active", new Checkbox());
+        column.setTextAlign("center");
+        table.addColumn(column);
+
+        Column actionColumn = new Column("Action");
+        actionColumn.setSortable(false);
+        ActionLink[] links = new ActionLink[]{deleteCustomer};
+        actionColumn.setDecorator(new LinkDecorator(table, links, "id"));
+        table.addColumn(actionColumn);
+
+        deleteCustomer.setAttribute("onclick", "return window.confirm('Please confirm delete');");
+
+        table.getForm().add(new Submit("update", "Update Customers", this, "onUpdateCustomersClick"));
+        table.getForm().add(new Submit("cancel", this, "onCancelClick"));
+
+        table.setSortable(true);
+
+        fieldSet = new FieldSet("customers");
+        form.add(fieldSet);
+
+        // Add FormTable to FieldSet which is attached to Form
+        fieldSet.add(table);
+
+        addControl(customerForm);
+        addControl(form);
+    }
+
+    // --------------------------------------------------------- Event Handlers
+
+    public boolean onSecurityCheck() {
+        String pagePath = getContext().getPagePath(getClass());
+
+        // In this demo we protect against duplicate post submissions
+        if (form.onSubmitCheck(this, pagePath)) {
+            return true;
+        } else {
+            getContext().setFlashAttribute("error", getMessage("invalid.form.submit"));
+            return false;
+        }
+    }
+
+    /**
+     * @see net.sf.click.Page#onInit()
+     */
+    public void onInit() {
+        super.onInit();
+
+        refreshTableCustomers();
+    }
+
+    public boolean onUpdateCustomersClick() {
+        if (form.isValid()) {
+            // Please note with Cayenne ORM this will persist any changes
+            // to data objects submitted by the form.
+            getDataContext().commitChanges();
+        }
+        return true;
+    }
+
+    public boolean onCancelClick() {
+        // Rollback any changes made to the customers, which are stored in
+        // the data context
+        getDataContext().rollbackChanges();
+
+        refreshTableCustomers();
+
+        table.setRenderSubmittedValues(false);
+
+        form.clearErrors();
+
+        return true;
+    }
+
+    public boolean onDeleteClick() {
+        Integer id = deleteCustomer.getValueInteger();
+        getCustomerService().deleteCustomer(id);
+
+        // The FormTable customer were already set in the onInit phase. Because
+        // a customer was deleted we refresh the FormTable row list
+        refreshTableCustomers();
+
+        return true;
+    }
+
+     public boolean onInsertClick() {
+        Customer customer = new Customer();
+        customer.setName("Alpha");
+        customer.setDateJoined(new Date());
+        getCustomerService().saveCustomer(customer);
+
+        // The FormTable customer were already set in the onInit phase. Because
+        // a customer was deleted we refresh the FormTable row list
+        refreshTableCustomers();
+
+        return true;
+    }
+
+    public boolean onAddClick() {
+        if (customerForm.isValid()) {
+            Customer customer = new Customer();
+            customerForm.copyTo(customer);
+            getCustomerService().saveCustomer(customer);
+
+            // The FormTable customer was set in the onInit phase. Since we just
+            // added a new customer we refresh the FormTable row list
+            refreshTableCustomers();
+        }
+        return true;
+    }
+
+    private void refreshTableCustomers() {
+        List allCustomers = getCustomerService().getCustomersSortedBy(Customer.DATE_JOINED_PROPERTY, false);
+        List customers = allCustomers.subList(0, NUM_ROWS);
+        table.setRowList(customers);
+    }
+}

Modified: incubator/click/trunk/click/examples/src/net/sf/click/examples/page/tree/PageLinkTreePage.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/examples/src/net/sf/click/examples/page/tree/PageLinkTreePage.java?rev=728320&r1=728319&r2=728320&view=diff
==============================================================================
--- incubator/click/trunk/click/examples/src/net/sf/click/examples/page/tree/PageLinkTreePage.java (original)
+++ incubator/click/trunk/click/examples/src/net/sf/click/examples/page/tree/PageLinkTreePage.java Sat Dec 20 09:44:11 2008
@@ -1,114 +1,114 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package net.sf.click.examples.page.tree;
-
-import net.sf.click.Page;
-import net.sf.click.control.PageLink;
-import net.sf.click.examples.page.introduction.AdvancedForm;
-import net.sf.click.examples.page.introduction.AdvancedTable;
-import net.sf.click.examples.page.introduction.ControlListenerPage;
-import net.sf.click.examples.page.introduction.HelloWorld;
-import net.sf.click.examples.page.introduction.SimpleForm;
-import net.sf.click.examples.page.velocity.SimpleTable;
-import net.sf.click.extras.tree.Tree;
-import net.sf.click.extras.tree.TreeNode;
-import net.sf.click.util.HtmlStringBuffer;
-import org.springframework.util.ClassUtils;
-
-/**
- * Demonstrates how to customize the rendering of tree nodes.
- * <p/>
- * In this example tree nodes render links to Pages.
- *
- * @author Bob Schellink
- */
-public class PageLinkTreePage extends PlainTreePage {
-
-    public static final String TREE_NODES_SESSION_KEY = "pageLinkTreeNodes";
-
-    // --------------------------------------------------------- Protected Methods
-
-    /**
-     * Creates and return a new tree instance.
-     */
-    protected Tree createTree() {
-        return new Tree("tree") {
-
-            protected void renderValue(HtmlStringBuffer buffer, TreeNode treeNode) {
-                Object nodeValue = treeNode.getValue();
-                Class cls = null;
-                if(nodeValue instanceof Class) {
-                    cls = (Class) nodeValue;
-                }
-
-                // If node value is a Page class, render a PageLink, otherwise
-                // render the node value
-                if (cls != null && Page.class.isAssignableFrom(cls)) {
-                    String shortName = ClassUtils.getShortName(cls);
-                    PageLink link = new PageLink(shortName, cls);
-                    buffer.append(link);
-                } else {
-                    buffer.append(nodeValue);
-                }
-            }
-        };
-    }
-
-    /**
-     * Build the tree model and stores it in the session. This model represents
-     * nodes which link to other example Pages.
-     */
-    protected TreeNode createNodes() {
-
-        //Create a node representing the root directory with the specified
-        //parameter as the value. Because an id is not specified, a random
-        //one will be generated by the node. By default the root node is
-        //not rendered by the tree. This can be changed by calling
-        //tree.setRootNodeDisplayed(true).
-        TreeNode root = new TreeNode("Pages");
-
-        //Create a new directory, setting the root directory as its parent. Here
-        //we do specify a id as the 2nd argument, so no id is generated.
-        TreeNode general = new TreeNode("Intro", "1", root);
-
-        boolean supportsChildNodes = false;
-        
-        new TreeNode(HelloWorld.class, "1.1", general, supportsChildNodes);
-        new TreeNode(ControlListenerPage.class, "1.2", general, supportsChildNodes);
-
-        TreeNode forms = new TreeNode("Forms", "2", root);
-        new TreeNode(SimpleForm.class, "2.1", forms, supportsChildNodes);
-        new TreeNode(AdvancedForm.class, "2.2", forms, supportsChildNodes);
-        
-        TreeNode tables = new TreeNode("Tables", "3", root);
-        new TreeNode(SimpleTable.class, "3.1", tables, supportsChildNodes);
-        new TreeNode(AdvancedTable.class, "3.2", tables, supportsChildNodes);
-
-        return root;
-    }
-
-    /**
-     * Return the string under which the nodes are stored in the session.
-     * 
-     * @return the string under which the nodes are stored in the session
-     */
-    protected String getSessionKey() {
-        return TREE_NODES_SESSION_KEY;
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package net.sf.click.examples.page.tree;
+
+import net.sf.click.Page;
+import net.sf.click.control.PageLink;
+import net.sf.click.examples.page.introduction.AdvancedForm;
+import net.sf.click.examples.page.introduction.AdvancedTable;
+import net.sf.click.examples.page.introduction.ControlListenerPage;
+import net.sf.click.examples.page.introduction.HelloWorld;
+import net.sf.click.examples.page.introduction.SimpleForm;
+import net.sf.click.examples.page.velocity.SimpleTable;
+import net.sf.click.extras.tree.Tree;
+import net.sf.click.extras.tree.TreeNode;
+import net.sf.click.util.HtmlStringBuffer;
+import org.springframework.util.ClassUtils;
+
+/**
+ * Demonstrates how to customize the rendering of tree nodes.
+ * <p/>
+ * In this example tree nodes render links to Pages.
+ *
+ * @author Bob Schellink
+ */
+public class PageLinkTreePage extends PlainTreePage {
+
+    public static final String TREE_NODES_SESSION_KEY = "pageLinkTreeNodes";
+
+    // --------------------------------------------------------- Protected Methods
+
+    /**
+     * Creates and return a new tree instance.
+     */
+    protected Tree createTree() {
+        return new Tree("tree") {
+
+            protected void renderValue(HtmlStringBuffer buffer, TreeNode treeNode) {
+                Object nodeValue = treeNode.getValue();
+                Class cls = null;
+                if(nodeValue instanceof Class) {
+                    cls = (Class) nodeValue;
+                }
+
+                // If node value is a Page class, render a PageLink, otherwise
+                // render the node value
+                if (cls != null && Page.class.isAssignableFrom(cls)) {
+                    String shortName = ClassUtils.getShortName(cls);
+                    PageLink link = new PageLink(shortName, cls);
+                    buffer.append(link);
+                } else {
+                    buffer.append(nodeValue);
+                }
+            }
+        };
+    }
+
+    /**
+     * Build the tree model and stores it in the session. This model represents
+     * nodes which link to other example Pages.
+     */
+    protected TreeNode createNodes() {
+
+        //Create a node representing the root directory with the specified
+        //parameter as the value. Because an id is not specified, a random
+        //one will be generated by the node. By default the root node is
+        //not rendered by the tree. This can be changed by calling
+        //tree.setRootNodeDisplayed(true).
+        TreeNode root = new TreeNode("Pages");
+
+        //Create a new directory, setting the root directory as its parent. Here
+        //we do specify a id as the 2nd argument, so no id is generated.
+        TreeNode general = new TreeNode("Intro", "1", root);
+
+        boolean supportsChildNodes = false;
+
+        new TreeNode(HelloWorld.class, "1.1", general, supportsChildNodes);
+        new TreeNode(ControlListenerPage.class, "1.2", general, supportsChildNodes);
+
+        TreeNode forms = new TreeNode("Forms", "2", root);
+        new TreeNode(SimpleForm.class, "2.1", forms, supportsChildNodes);
+        new TreeNode(AdvancedForm.class, "2.2", forms, supportsChildNodes);
+
+        TreeNode tables = new TreeNode("Tables", "3", root);
+        new TreeNode(SimpleTable.class, "3.1", tables, supportsChildNodes);
+        new TreeNode(AdvancedTable.class, "3.2", tables, supportsChildNodes);
+
+        return root;
+    }
+
+    /**
+     * Return the string under which the nodes are stored in the session.
+     *
+     * @return the string under which the nodes are stored in the session
+     */
+    protected String getSessionKey() {
+        return TREE_NODES_SESSION_KEY;
+    }
+}

Modified: incubator/click/trunk/click/examples/src/net/sf/click/examples/page/tree/PlainTreePage.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/examples/src/net/sf/click/examples/page/tree/PlainTreePage.java?rev=728320&r1=728319&r2=728320&view=diff
==============================================================================
--- incubator/click/trunk/click/examples/src/net/sf/click/examples/page/tree/PlainTreePage.java (original)
+++ incubator/click/trunk/click/examples/src/net/sf/click/examples/page/tree/PlainTreePage.java Sat Dec 20 09:44:11 2008
@@ -120,7 +120,7 @@
      * @return the root tree node
      */
     protected TreeNode createNodes() {
-        
+
         //Create a node representing the root directory with the specified
         //parameter as the value. Because an id is not specified, a random
         //one will be generated by the node. By default the root node is
@@ -168,7 +168,7 @@
 
     /**
      * Return the string under which the nodes are stored in the session.
-     * 
+     *
      * @return the string under which the nodes are stored in the session
      */
     protected String getSessionKey() {

Modified: incubator/click/trunk/click/examples/src/net/sf/click/examples/page/wizard/SelectPostCode.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/examples/src/net/sf/click/examples/page/wizard/SelectPostCode.java?rev=728320&r1=728319&r2=728320&view=diff
==============================================================================
--- incubator/click/trunk/click/examples/src/net/sf/click/examples/page/wizard/SelectPostCode.java (original)
+++ incubator/click/trunk/click/examples/src/net/sf/click/examples/page/wizard/SelectPostCode.java Sat Dec 20 09:44:11 2008
@@ -1,87 +1,87 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package net.sf.click.examples.page.wizard;
-
-import java.util.List;
-import net.sf.click.Context;
-import net.sf.click.control.AbstractLink;
-import net.sf.click.control.Column;
-import net.sf.click.control.PageLink;
-import net.sf.click.control.Table;
-import net.sf.click.examples.domain.PostCode;
-import net.sf.click.examples.page.BorderPage;
-import net.sf.click.extras.control.LinkDecorator;
-import net.sf.click.util.HtmlStringBuffer;
-
-/**
- * This Page provides a table to select the postal code from.
- *
- * It also acts as a fork in step 2, to show how one can navigate away from
- * a stateful page and then go back, with the components on the WizardPage still
- * populated with their old values.
- *
- * @author Bob Schellink
- */
-public class SelectPostCode extends BorderPage {
-
-    /** Reference to the table. */
-    private Table table = new Table("table");
-
-    /**
-     * Default constructor.
-     */
-    public SelectPostCode() {
-        table.addColumn(new Column("postCode"));
-        table.addColumn(new Column("state"));
-        table.addColumn(new Column("locality"));
-        PageLink selectState = new PageLink("select", WizardPage.class);
-        Column action = new Column("action");
-        LinkDecorator decorator = new LinkDecorator(table, selectState, "postCode") {
-
-            /**
-             * Override default implementation to send parameters
-             * address.postCode and address.state to the WizardPage.
-             */
-            protected void renderActionLink(HtmlStringBuffer buffer,
-                AbstractLink link, Context context, Object row, Object value) {
-                // Remove the default parameter name set for the value
-                String idPropertyValue = (String) link.getParameters().remove(idProperty);
-                
-                // Add extra parameters for each row to the rendered action link
-                link.setParameter("address.postCode", idPropertyValue);
-                link.setParameter("address.state", ((PostCode) row).getState());
-                super.renderActionLink(buffer, link, context, row, value);
-            }
-        };
-
-        action.setDecorator(decorator);
-        table.addColumn(action);
-
-        table.setClass(Table.CLASS_BLUE2);
-        addControl(table);
-    }
-
-    /**
-     * Override onRender to populate the table row data.
-     */
-    public void onRender() {
-        List states = getPostCodeService().getPostCodes();
-        table.setRowList(states);
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package net.sf.click.examples.page.wizard;
+
+import java.util.List;
+import net.sf.click.Context;
+import net.sf.click.control.AbstractLink;
+import net.sf.click.control.Column;
+import net.sf.click.control.PageLink;
+import net.sf.click.control.Table;
+import net.sf.click.examples.domain.PostCode;
+import net.sf.click.examples.page.BorderPage;
+import net.sf.click.extras.control.LinkDecorator;
+import net.sf.click.util.HtmlStringBuffer;
+
+/**
+ * This Page provides a table to select the postal code from.
+ *
+ * It also acts as a fork in step 2, to show how one can navigate away from
+ * a stateful page and then go back, with the components on the WizardPage still
+ * populated with their old values.
+ *
+ * @author Bob Schellink
+ */
+public class SelectPostCode extends BorderPage {
+
+    /** Reference to the table. */
+    private Table table = new Table("table");
+
+    /**
+     * Default constructor.
+     */
+    public SelectPostCode() {
+        table.addColumn(new Column("postCode"));
+        table.addColumn(new Column("state"));
+        table.addColumn(new Column("locality"));
+        PageLink selectState = new PageLink("select", WizardPage.class);
+        Column action = new Column("action");
+        LinkDecorator decorator = new LinkDecorator(table, selectState, "postCode") {
+
+            /**
+             * Override default implementation to send parameters
+             * address.postCode and address.state to the WizardPage.
+             */
+            protected void renderActionLink(HtmlStringBuffer buffer,
+                AbstractLink link, Context context, Object row, Object value) {
+                // Remove the default parameter name set for the value
+                String idPropertyValue = (String) link.getParameters().remove(idProperty);
+
+                // Add extra parameters for each row to the rendered action link
+                link.setParameter("address.postCode", idPropertyValue);
+                link.setParameter("address.state", ((PostCode) row).getState());
+                super.renderActionLink(buffer, link, context, row, value);
+            }
+        };
+
+        action.setDecorator(decorator);
+        table.addColumn(action);
+
+        table.setClass(Table.CLASS_BLUE2);
+        addControl(table);
+    }
+
+    /**
+     * Override onRender to populate the table row data.
+     */
+    public void onRender() {
+        List states = getPostCodeService().getPostCodes();
+        table.setRowList(states);
+    }
+}

Modified: incubator/click/trunk/click/examples/src/net/sf/click/examples/page/wizard/Step.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/examples/src/net/sf/click/examples/page/wizard/Step.java?rev=728320&r1=728319&r2=728320&view=diff
==============================================================================
--- incubator/click/trunk/click/examples/src/net/sf/click/examples/page/wizard/Step.java (original)
+++ incubator/click/trunk/click/examples/src/net/sf/click/examples/page/wizard/Step.java Sat Dec 20 09:44:11 2008
@@ -1,295 +1,295 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package net.sf.click.examples.page.wizard;
-
-import net.sf.click.examples.control.SimplePanel;
-import net.sf.click.ActionListener;
-import net.sf.click.Control;
-import net.sf.click.control.Button;
-import net.sf.click.control.Form;
-import net.sf.click.control.Submit;
-import net.sf.click.examples.control.cayenne.NestedCayenneForm;
-import net.sf.click.examples.domain.Client;
-import net.sf.click.extras.cayenne.CayenneForm;
-import org.apache.commons.lang.ClassUtils;
-
-/**
- * Provides common functionality for each step in the wizard.
- * 
- * @author Bob Schellink
- */
-public abstract class Step extends SimplePanel {
-
-    // -------------------------------------------------------------- Variables
-
-    /** Reference to the form. */
-    private CayenneForm form = new NestedCayenneForm("form"
-        + ClassUtils.getShortClassName(getClass()), Client.class);
-
-    /** Reference to the wizard page. */
-    private WizardPage wizardPage;
-
-    /** Reference to the step description. */
-    private String description;
-
-    /** Reference to the next button. */
-    private Button next;
-
-    /** Reference to the previous button. */
-    private Button previous;
-
-    /** Reference to the finish button. */
-    private Button finish;
-    
-    /** Reference to the cancel button. */
-    private Button cancel;
-
-    // ------------------------------------------------------------ Constructor
-
-    /**
-     * Constructs a Step for the specified name and page.
-     *
-     * @param name the step name
-     * @param label the step label
-     * @param description the step description
-     * @param page the wizard page
-     */
-    public Step(String name, String label, String description, WizardPage page) {
-        super(name);
-        setWizardPage(page);
-        setLabel(label);
-        setDescription(description);
-    }
-
-    // ------------------------------------------------------ Public Properties
-
-    /**
-     * Return the Step form instance.
-     * 
-     * @return the Step form instance
-     */
-    public CayenneForm getForm() {
-        return form;
-    }
-
-    /**
-     * Set the form instance.
-     * 
-     * @param form the form for this Step
-     */
-    public void setForm(CayenneForm form) {
-        this.form = form;
-    }
-
-    /**
-     * Return the Step WizardPage instance.
-     * 
-     * @return the WizardPage instance
-     */
-    public WizardPage getWizardPage() {
-        return wizardPage;
-    }
-
-    /**
-     * Set the WizardPage instance.
-     * 
-     * @param wizardPage the WizardPage instance for this Step
-     */
-    public void setWizardPage(WizardPage wizardPage) {
-        this.wizardPage = wizardPage;
-    }
-
-    /**
-     * Return the Step description.
-     * 
-     * @return the Step description
-     */
-    public String getDescription() {
-        return description;
-    }
-
-    /**
-     * Set the Step visual description.
-     * 
-     * @param description the visual description
-     */
-    public void setDescription(String description) {
-        this.description = description;
-    }
-
-    /**
-     * Return the Client instance.
-     * 
-     * @return the Client instance
-     */
-    public Client getClient() {
-        // form.getDataObject ensures that latest field values are copied to
-        // domain object
-        return (Client) getForm().getDataObject();
-    }
-
-    /**
-     * Set the Client instance.
-     * 
-     * @param client the client for this Step
-     */
-    public void setClient(Client client) {
-        getForm().setDataObject(client);
-    }
-
-    /**
-     * Return the button representing the next action.
-     * 
-     * @return the button representing the next action
-     */
-    public Button getNextButton() {
-        return next;
-    }
-
-    /**
-     * Return the button representing the previous action.
-     * 
-     * @return the button representing the previous action
-     */
-    public Button getPreviousButton() {
-        return previous;
-    }
-
-    /**
-     * Return the button representing the next action.
-     * 
-     * @return the button representing the next action
-     */
-    public Button getFinishButton() {
-        return finish;
-    }
-
-    /**
-     * Return the button representing the cancel action.
-     * 
-     * @return the button representing the cancel action
-     */
-    public Button getCancelButton() {
-        return cancel;
-    }
-
-    // --------------------------------------------------------- Public Methods
-
-    /**
-     * The onNext action. Subclasses can override this method to implement
-     * custom logic.
-     * 
-     * @return true if Page processing should continue, false otherwise
-     */
-    public boolean onNext() {
-        return true;
-    }
-
-    /**
-     * The onPrevious action. Subclasses can override this method to implement
-     * custom logic.
-     * 
-     * @return true if Page processing should continue, false otherwise
-     */
-    public boolean onPrevious() {
-        return true;
-    }
-
-    /**
-     * The onFinish action. Subclasses can override this method to implement
-     * custom logic.
-     * 
-     * @return true if Page processing should continue, false otherwise
-     */
-    public boolean onFinish() {
-        return true;
-    }
-
-    /**
-     * The onCancel action. Subclasses can override this method to implement
-     * custom logic.
-     * 
-     * @return true if Page processing should continue, false otherwise
-     */
-    public boolean onCancel() {
-        // Set a flash cancel message
-        getContext().setFlashAttribute("message", "You have cancelled the "
-            + "client creation process.");
-
-        // Set page state to stateless which removes the page from
-        // the session
-        getWizardPage().setStateful(false);
-        getWizardPage().setRedirect(WizardPage.class);
-        return false;
-    }
-
-    /**
-     * Step up and initializes the Step. This method must be called before
-     * the Step can be used.
-     */
-    public final void init() {
-        getForm().setButtonAlign(Form.ALIGN_RIGHT);
-        getForm().setErrorsPosition(Form.POSITION_MIDDLE);
-
-        previous = new Submit("previous");
-        previous.setLabel("< Previous");
-        getPreviousButton().setActionListener(new ActionListener() {
-            public boolean onAction(Control source) {
-                return onPrevious();
-            }
-        });
-        form.add(previous);
-        if (!getWizardPage().hasPreviousStep(this)) {
-            previous.setDisabled(true);
-        }
-
-        next = new Submit("next");
-        next.setLabel("Next >");
-        getNextButton().setActionListener(new ActionListener() {
-            public boolean onAction(Control source) {
-                return onNext();
-            }
-        });
-        form.add(next);
-        if (!getWizardPage().hasNextStep(this)) {
-            next.setDisabled(true);
-        }
-
-        finish = new Submit("Finish");
-        getFinishButton().setActionListener(new ActionListener() {
-            public boolean onAction(Control source) {
-                return onFinish();
-            }
-        });
-        form.add(finish);
-        if (!getWizardPage().isLastStep(this)) {
-            finish.setDisabled(true);
-        }
-
-        cancel = new Submit("Cancel");
-        getCancelButton().setActionListener(new ActionListener() {
-            public boolean onAction(Control source) {
-                return onCancel();
-            }
-        });
-        form.add(cancel);
-
-        add(form);
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package net.sf.click.examples.page.wizard;
+
+import net.sf.click.examples.control.SimplePanel;
+import net.sf.click.ActionListener;
+import net.sf.click.Control;
+import net.sf.click.control.Button;
+import net.sf.click.control.Form;
+import net.sf.click.control.Submit;
+import net.sf.click.examples.control.cayenne.NestedCayenneForm;
+import net.sf.click.examples.domain.Client;
+import net.sf.click.extras.cayenne.CayenneForm;
+import org.apache.commons.lang.ClassUtils;
+
+/**
+ * Provides common functionality for each step in the wizard.
+ *
+ * @author Bob Schellink
+ */
+public abstract class Step extends SimplePanel {
+
+    // -------------------------------------------------------------- Variables
+
+    /** Reference to the form. */
+    private CayenneForm form = new NestedCayenneForm("form"
+        + ClassUtils.getShortClassName(getClass()), Client.class);
+
+    /** Reference to the wizard page. */
+    private WizardPage wizardPage;
+
+    /** Reference to the step description. */
+    private String description;
+
+    /** Reference to the next button. */
+    private Button next;
+
+    /** Reference to the previous button. */
+    private Button previous;
+
+    /** Reference to the finish button. */
+    private Button finish;
+
+    /** Reference to the cancel button. */
+    private Button cancel;
+
+    // ------------------------------------------------------------ Constructor
+
+    /**
+     * Constructs a Step for the specified name and page.
+     *
+     * @param name the step name
+     * @param label the step label
+     * @param description the step description
+     * @param page the wizard page
+     */
+    public Step(String name, String label, String description, WizardPage page) {
+        super(name);
+        setWizardPage(page);
+        setLabel(label);
+        setDescription(description);
+    }
+
+    // ------------------------------------------------------ Public Properties
+
+    /**
+     * Return the Step form instance.
+     *
+     * @return the Step form instance
+     */
+    public CayenneForm getForm() {
+        return form;
+    }
+
+    /**
+     * Set the form instance.
+     *
+     * @param form the form for this Step
+     */
+    public void setForm(CayenneForm form) {
+        this.form = form;
+    }
+
+    /**
+     * Return the Step WizardPage instance.
+     *
+     * @return the WizardPage instance
+     */
+    public WizardPage getWizardPage() {
+        return wizardPage;
+    }
+
+    /**
+     * Set the WizardPage instance.
+     *
+     * @param wizardPage the WizardPage instance for this Step
+     */
+    public void setWizardPage(WizardPage wizardPage) {
+        this.wizardPage = wizardPage;
+    }
+
+    /**
+     * Return the Step description.
+     *
+     * @return the Step description
+     */
+    public String getDescription() {
+        return description;
+    }
+
+    /**
+     * Set the Step visual description.
+     *
+     * @param description the visual description
+     */
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    /**
+     * Return the Client instance.
+     *
+     * @return the Client instance
+     */
+    public Client getClient() {
+        // form.getDataObject ensures that latest field values are copied to
+        // domain object
+        return (Client) getForm().getDataObject();
+    }
+
+    /**
+     * Set the Client instance.
+     *
+     * @param client the client for this Step
+     */
+    public void setClient(Client client) {
+        getForm().setDataObject(client);
+    }
+
+    /**
+     * Return the button representing the next action.
+     *
+     * @return the button representing the next action
+     */
+    public Button getNextButton() {
+        return next;
+    }
+
+    /**
+     * Return the button representing the previous action.
+     *
+     * @return the button representing the previous action
+     */
+    public Button getPreviousButton() {
+        return previous;
+    }
+
+    /**
+     * Return the button representing the next action.
+     *
+     * @return the button representing the next action
+     */
+    public Button getFinishButton() {
+        return finish;
+    }
+
+    /**
+     * Return the button representing the cancel action.
+     *
+     * @return the button representing the cancel action
+     */
+    public Button getCancelButton() {
+        return cancel;
+    }
+
+    // --------------------------------------------------------- Public Methods
+
+    /**
+     * The onNext action. Subclasses can override this method to implement
+     * custom logic.
+     *
+     * @return true if Page processing should continue, false otherwise
+     */
+    public boolean onNext() {
+        return true;
+    }
+
+    /**
+     * The onPrevious action. Subclasses can override this method to implement
+     * custom logic.
+     *
+     * @return true if Page processing should continue, false otherwise
+     */
+    public boolean onPrevious() {
+        return true;
+    }
+
+    /**
+     * The onFinish action. Subclasses can override this method to implement
+     * custom logic.
+     *
+     * @return true if Page processing should continue, false otherwise
+     */
+    public boolean onFinish() {
+        return true;
+    }
+
+    /**
+     * The onCancel action. Subclasses can override this method to implement
+     * custom logic.
+     *
+     * @return true if Page processing should continue, false otherwise
+     */
+    public boolean onCancel() {
+        // Set a flash cancel message
+        getContext().setFlashAttribute("message", "You have cancelled the "
+            + "client creation process.");
+
+        // Set page state to stateless which removes the page from
+        // the session
+        getWizardPage().setStateful(false);
+        getWizardPage().setRedirect(WizardPage.class);
+        return false;
+    }
+
+    /**
+     * Step up and initializes the Step. This method must be called before
+     * the Step can be used.
+     */
+    public final void init() {
+        getForm().setButtonAlign(Form.ALIGN_RIGHT);
+        getForm().setErrorsPosition(Form.POSITION_MIDDLE);
+
+        previous = new Submit("previous");
+        previous.setLabel("< Previous");
+        getPreviousButton().setActionListener(new ActionListener() {
+            public boolean onAction(Control source) {
+                return onPrevious();
+            }
+        });
+        form.add(previous);
+        if (!getWizardPage().hasPreviousStep(this)) {
+            previous.setDisabled(true);
+        }
+
+        next = new Submit("next");
+        next.setLabel("Next >");
+        getNextButton().setActionListener(new ActionListener() {
+            public boolean onAction(Control source) {
+                return onNext();
+            }
+        });
+        form.add(next);
+        if (!getWizardPage().hasNextStep(this)) {
+            next.setDisabled(true);
+        }
+
+        finish = new Submit("Finish");
+        getFinishButton().setActionListener(new ActionListener() {
+            public boolean onAction(Control source) {
+                return onFinish();
+            }
+        });
+        form.add(finish);
+        if (!getWizardPage().isLastStep(this)) {
+            finish.setDisabled(true);
+        }
+
+        cancel = new Submit("Cancel");
+        getCancelButton().setActionListener(new ActionListener() {
+            public boolean onAction(Control source) {
+                return onCancel();
+            }
+        });
+        form.add(cancel);
+
+        add(form);
+    }
+}

Modified: incubator/click/trunk/click/examples/src/net/sf/click/examples/page/wizard/Step1.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/examples/src/net/sf/click/examples/page/wizard/Step1.java?rev=728320&r1=728319&r2=728320&view=diff
==============================================================================
--- incubator/click/trunk/click/examples/src/net/sf/click/examples/page/wizard/Step1.java (original)
+++ incubator/click/trunk/click/examples/src/net/sf/click/examples/page/wizard/Step1.java Sat Dec 20 09:44:11 2008
@@ -1,75 +1,75 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package net.sf.click.examples.page.wizard;
-
-import net.sf.click.control.TextField;
-import net.sf.click.extras.cayenne.QuerySelect;
-import net.sf.click.extras.control.DateField;
-import net.sf.click.extras.control.EmailField;
-
-/**
- * The first step in the 3 step process is to capture the Client details.
- * <p/>
- * Note this Panel has no associated template.
- *
- * @author Bob Schellink
- */
-public class Step1 extends Step {
-
-    /**
-     * Construct Step1 with the specified name, label, description and page.
-     * 
-     * @param name the step name
-     * @param label the step label
-     * @param description the step description
-     * @param page the wizard page
-     */
-    public Step1(String name, String label, String description, WizardPage page) {
-        super(name, label, description, page);
-
-        QuerySelect querySelect = new QuerySelect("title", true);
-        querySelect.setQueryValueLabel("titles", "value", "label");
-        getForm().add(querySelect);
-
-        getForm().add(new TextField("firstName"));
-        getForm().add(new TextField("lastName"));
-        getForm().add(new DateField("dateJoined"));
-        getForm().add(new EmailField("email"));
-    }
-
-    /**
-     * The onNext action of Step1 sets the Page to stateful, checks if the form
-     * is valid, moves to the next step in the process and passes the client to
-     * the next step.
-     * 
-     * @return true if page processing should continue or not
-     */
-    public boolean onNext() {
-        // Set the page to stateful so the same Page is available throughout the
-        // Wizard steps
-        getWizardPage().setStateful(true);
-
-        if (getForm().isValid()) {
-            // Pass the client to Panel2
-            getWizardPage().next();
-            getWizardPage().getCurrentStep().setClient(getClient());
-        }
-        return true;
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package net.sf.click.examples.page.wizard;
+
+import net.sf.click.control.TextField;
+import net.sf.click.extras.cayenne.QuerySelect;
+import net.sf.click.extras.control.DateField;
+import net.sf.click.extras.control.EmailField;
+
+/**
+ * The first step in the 3 step process is to capture the Client details.
+ * <p/>
+ * Note this Panel has no associated template.
+ *
+ * @author Bob Schellink
+ */
+public class Step1 extends Step {
+
+    /**
+     * Construct Step1 with the specified name, label, description and page.
+     *
+     * @param name the step name
+     * @param label the step label
+     * @param description the step description
+     * @param page the wizard page
+     */
+    public Step1(String name, String label, String description, WizardPage page) {
+        super(name, label, description, page);
+
+        QuerySelect querySelect = new QuerySelect("title", true);
+        querySelect.setQueryValueLabel("titles", "value", "label");
+        getForm().add(querySelect);
+
+        getForm().add(new TextField("firstName"));
+        getForm().add(new TextField("lastName"));
+        getForm().add(new DateField("dateJoined"));
+        getForm().add(new EmailField("email"));
+    }
+
+    /**
+     * The onNext action of Step1 sets the Page to stateful, checks if the form
+     * is valid, moves to the next step in the process and passes the client to
+     * the next step.
+     *
+     * @return true if page processing should continue or not
+     */
+    public boolean onNext() {
+        // Set the page to stateful so the same Page is available throughout the
+        // Wizard steps
+        getWizardPage().setStateful(true);
+
+        if (getForm().isValid()) {
+            // Pass the client to Panel2
+            getWizardPage().next();
+            getWizardPage().getCurrentStep().setClient(getClient());
+        }
+        return true;
+    }
+}



Mime
View raw message