click-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sa...@apache.org
Subject svn commit: r826998 - in /incubator/click/trunk/click/examples: src/org/apache/click/examples/page/wizard/WizardPage.java webapp/wizard/wizard.css webapp/wizard/wizard.htm
Date Tue, 20 Oct 2009 08:29:20 GMT
Author: sabob
Date: Tue Oct 20 08:29:20 2009
New Revision: 826998

URL: http://svn.apache.org/viewvc?rev=826998&view=rev
Log:
improved wizard

Modified:
    incubator/click/trunk/click/examples/src/org/apache/click/examples/page/wizard/WizardPage.java
    incubator/click/trunk/click/examples/webapp/wizard/wizard.css
    incubator/click/trunk/click/examples/webapp/wizard/wizard.htm

Modified: incubator/click/trunk/click/examples/src/org/apache/click/examples/page/wizard/WizardPage.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/examples/src/org/apache/click/examples/page/wizard/WizardPage.java?rev=826998&r1=826997&r2=826998&view=diff
==============================================================================
--- incubator/click/trunk/click/examples/src/org/apache/click/examples/page/wizard/WizardPage.java
(original)
+++ incubator/click/trunk/click/examples/src/org/apache/click/examples/page/wizard/WizardPage.java
Tue Oct 20 08:29:20 2009
@@ -22,6 +22,7 @@
 import java.util.Iterator;
 import java.util.List;
 import org.apache.click.examples.page.BorderPage;
+import org.apache.click.util.HtmlStringBuffer;
 
 /**
  * This Page manages steps in a wizard process.
@@ -36,15 +37,15 @@
     private Step currentStep;
 
     /** List of all steps. */
-    private List steps = new ArrayList();
+    private List<Step> steps = new ArrayList<Step>();
 
     /**
      * Default constructor.
      */
     public WizardPage() {
-        steps.add(new Step1("step", "Client", "Step 1 of 3", this));
-        steps.add(new Step2("step", "Address", "Step 2 of 3", this));
-        steps.add(new Step3("step", "Confirmation", "Step 3 of 3", this));
+        steps.add(new Step1("step", "Client", "Step 1", this));
+        steps.add(new Step2("step", "Address", "Step 2", this));
+        steps.add(new Step3("step", "Confirmation", "Step 3", this));
 
         // Set first step as current
         setCurrentStep((Step) steps.get(0));
@@ -75,10 +76,12 @@
         if (this.currentStep != null) {
             // Remove the current step from the page list of controls
             removeControl(this.currentStep);
+            getModel().remove("heading");
         }
         this.currentStep = step;
         // Add the new step to the page list of controls
         addControl(step);
+        addModel("heading", getHeading());
     }
 
     /**
@@ -147,4 +150,28 @@
         return "<link type=\"text/css\" rel=\"stylesheet\" href=\"" + contextPath + "/wizard/wizard.css\"/>";
     }
 
+    /**
+     * Return an HTML representation of the wizard steps as an Html List <ul>.
+     * The current step is assigned a special CSS class so it can be highlighted
+     * through CSS.
+     */
+    private String getHeading() {
+        HtmlStringBuffer buffer = new HtmlStringBuffer();
+        buffer.append("<ul id=\"steps\">");
+        for (Step step : steps) {
+            buffer.elementStart("li");
+            if (step == currentStep) {
+                buffer.appendAttribute("class", "current");
+            }
+            buffer.closeTag();
+            buffer.append(step.getDescription());
+            buffer.elementStart("span");
+            buffer.closeTag();
+            buffer.append(step.getLabel());
+            buffer.elementEnd("span");
+            buffer.elementEnd("li");
+        }
+        buffer.append("</ul>");
+        return buffer.toString();
+    }
 }

Modified: incubator/click/trunk/click/examples/webapp/wizard/wizard.css
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/examples/webapp/wizard/wizard.css?rev=826998&r1=826997&r2=826998&view=diff
==============================================================================
--- incubator/click/trunk/click/examples/webapp/wizard/wizard.css (original)
+++ incubator/click/trunk/click/examples/webapp/wizard/wizard.css Tue Oct 20 08:29:20 2009
@@ -32,10 +32,10 @@
     border: 1px solid gray;
 }
 #wizard-heading {
-    padding: 2px 15px 10px; 
+    padding: 15px 12px 15px 10px;
     margin: 2px;
 }
-h2 {
+#wizard-heading h2 {
     color: #334ECF;
 }
 .buttons input {
@@ -44,3 +44,27 @@
 table.form, table.fields { 
     width: 100%; 
 }
+
+/* Wizard steps */
+#steps {
+    list-style: none;
+    overflow: hidden;
+    width:100%;
+    margin: 0;
+    padding: 0;
+}
+#steps li {
+    float: left;
+    font-size: 24px;
+    color: #CCC;
+    padding: 10px;
+}
+
+#steps li span {
+    display: block;
+    font-size: 9pt;
+}
+
+#steps li.current {
+    color: #000;
+}
\ No newline at end of file

Modified: incubator/click/trunk/click/examples/webapp/wizard/wizard.htm
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/examples/webapp/wizard/wizard.htm?rev=826998&r1=826997&r2=826998&view=diff
==============================================================================
--- incubator/click/trunk/click/examples/webapp/wizard/wizard.htm (original)
+++ incubator/click/trunk/click/examples/webapp/wizard/wizard.htm Tue Oct 20 08:29:20 2009
@@ -17,17 +17,20 @@
    under the License.*#
 -->
 
+<hr/>
+
 <!-- Print any messages -->
 #set ($message = $session.message)
 #if ($message)
-    <h3>$message</h3>
+    <h4>$message</h4>
 #end
 
+$heading
+
 <!-- Some markup -->
 <div id="wizard">
     <div id="wizard-heading">
         <h2>$step.label</h2>
-        $step.description
     </div>
     $step
 </div>



Mime
View raw message