Author: craigmcc
Date: Mon Sep 11 10:55:33 2006
New Revision: 442277

URL: http://svn.apache.org/viewvc?view=rev&rev=442277
Log:
Add a pop-up dialog example to exercise the parent dialog context
functionality.  FIXME - although the state on the server is successfully
updated when a Select button is pushed, this is not reflected in the
client yet.  We need some JavaScript magic to update the client side
view when the "finished" page is displayed.

Added:
    
shale/sandbox/shale-test-dialog2-legacy/src/main/java/org/apache/shale/examples/test/dialog2/legacy/City.java
    
shale/sandbox/shale-test-dialog2-legacy/src/main/java/org/apache/shale/examples/test/dialog2/legacy/Popup.java
    
shale/sandbox/shale-test-dialog2-legacy/src/main/java/org/apache/shale/examples/test/dialog2/legacy/PopupData.java
    shale/sandbox/shale-test-dialog2-legacy/src/main/webapp/popupCancelled.jsp
    shale/sandbox/shale-test-dialog2-legacy/src/main/webapp/popupFinished.jsp
    shale/sandbox/shale-test-dialog2-legacy/src/main/webapp/popuppage1.jsp
Modified:
    
shale/sandbox/shale-dialog2/src/main/java/org/apache/shale/dialog2/faces/Dialog2NavigationHandler.java
    
shale/sandbox/shale-dialog2/src/main/java/org/apache/shale/dialog2/faces/Dialog2PhaseListener.java
    
shale/sandbox/shale-test-dialog2-legacy/src/main/java/org/apache/shale/examples/test/dialog2/legacy/Wizard.java
    
shale/sandbox/shale-test-dialog2-legacy/src/main/java/org/apache/shale/examples/test/dialog2/legacy/WizardData.java
    
shale/sandbox/shale-test-dialog2-legacy/src/main/webapp/WEB-INF/dialog-config.xml
    
shale/sandbox/shale-test-dialog2-legacy/src/main/webapp/WEB-INF/faces-config.xml
    shale/sandbox/shale-test-dialog2-legacy/src/main/webapp/wizardpage2.jsp

Modified: 
shale/sandbox/shale-dialog2/src/main/java/org/apache/shale/dialog2/faces/Dialog2NavigationHandler.java
URL: 
http://svn.apache.org/viewvc/shale/sandbox/shale-dialog2/src/main/java/org/apache/shale/dialog2/faces/Dialog2NavigationHandler.java?view=diff&rev=442277&r1=442276&r2=442277
==============================================================================
--- 
shale/sandbox/shale-dialog2/src/main/java/org/apache/shale/dialog2/faces/Dialog2NavigationHandler.java
 (original)
+++ 
shale/sandbox/shale-dialog2/src/main/java/org/apache/shale/dialog2/faces/Dialog2NavigationHandler.java
 Mon Sep 11 10:55:33 2006
@@ -138,6 +138,9 @@
             if (viewId == null) {
                 original.handleNavigation(context, fromAction, outcome);
             }
+            if (viewId == null) {
+                return; // Stay on the same view
+            }
         }
         navigate(context, viewId);
 

Modified: 
shale/sandbox/shale-dialog2/src/main/java/org/apache/shale/dialog2/faces/Dialog2PhaseListener.java
URL: 
http://svn.apache.org/viewvc/shale/sandbox/shale-dialog2/src/main/java/org/apache/shale/dialog2/faces/Dialog2PhaseListener.java?view=diff&rev=442277&r1=442276&r2=442277
==============================================================================
--- 
shale/sandbox/shale-dialog2/src/main/java/org/apache/shale/dialog2/faces/Dialog2PhaseListener.java
 (original)
+++ 
shale/sandbox/shale-dialog2/src/main/java/org/apache/shale/dialog2/faces/Dialog2PhaseListener.java
 Mon Sep 11 10:55:33 2006
@@ -17,6 +17,8 @@
 package org.apache.shale.dialog2.faces;
 
 import java.util.Map;
+import javax.faces.application.ViewHandler;
+import javax.faces.component.UIViewRoot;
 import javax.faces.context.FacesContext;
 import javax.faces.event.PhaseEvent;
 import javax.faces.event.PhaseId;
@@ -160,22 +162,7 @@
         String id = (String)
           context.getViewRoot().getAttributes().get(Constants.CONTEXT_ID_ATTR);
         if (id != null) {
-            DialogContextManager manager = (DialogContextManager)
-              context.getApplication().getVariableResolver().
-                    resolveVariable(context, Constants.MANAGER_BEAN);
-            if (manager == null) {
-                return;
-            }
-            DialogContext dcontext = manager.get(id);
-            if (dcontext == null) {
-                return;
-            }
-            if (log.isDebugEnabled()) {
-                log.debug("afterPhase() restoring dialog context with id '"
-                          + id + "' for FacesContext instance '"
-                          + context + "'");
-            }
-            
context.getExternalContext().getRequestMap().put(Constants.CONTEXT_BEAN, 
dcontext);
+            restore(context, id);
             return;
         }
 
@@ -190,28 +177,105 @@
         String parentId = (String) context.getExternalContext().
                 getRequestParameterMap().get(Constants.PARENT_ID);
         if (dialogName != null) {
-            DialogContextManager manager = (DialogContextManager)
-              context.getApplication().getVariableResolver().
-                    resolveVariable(context, Constants.MANAGER_BEAN);
-            if (manager == null) {
-                return;
-            }
-            DialogContext parent = null;
-            if (parentId != null) {
-                parent = manager.get(parentId);
-            }
-            DialogContext dcontext = manager.create(context, dialogName, 
parent);
+
+            DialogContext dcontext = create(context, dialogName, parentId);
             if (dcontext == null) {
                 return;
             }
+
+            // Advance the new DialogContext through its start state
+            // and navigate to the resulting viewId (if any)
+            String viewId = dcontext.advance(context, null);
             if (log.isDebugEnabled()) {
                 log.debug("afterPhase() creating dialog context with id '"
                           + id + "' for FacesContext instance '"
-                          + context + "' associated with parent dialog context 
'"
-                          + ((parent != null) ? parent.getId() : "NONE") + 
"'");
+                          + context + "' associated with parent dialog context 
id '"
+                          + parentId
+                          + "' and advancing to viewId '" + viewId + "'");
             }
+            navigate(context, viewId);
+
         }
         
+    }
+
+
+    /**
+     * <p>Create and return a new [EMAIL PROTECTED] DialogContext} for the 
specified
+     * dialog name and optional parent id.  If no such [EMAIL PROTECTED] 
DialogContext}
+     * can be created, return <code>null</code> instead.</p>
+     *
+     * @param context FacesContext for the current request
+     * @param dialogName Logical name of the dialog to be created
+     * @param parentId Parent dialog context instance (if any)
+     */
+    private DialogContext create(FacesContext context, String dialogName,
+                                 String parentId) {
+
+        DialogContextManager manager = (DialogContextManager)
+          context.getApplication().getVariableResolver().
+                resolveVariable(context, Constants.MANAGER_BEAN);
+        if (manager == null) {
+            return null;
+        }
+        DialogContext parent = null;
+        if (parentId != null) {
+            parent = manager.get(parentId);
+        }
+        DialogContext dcontext = manager.create(context, dialogName, parent);
+        return dcontext;
+
+    }
+
+
+    /**
+     * <p>Navigate to the specified view identifier (if any).</p>
+     *
+     * @param context FacesContext for the current request
+     * @param viewId View identifier to navigate to (if any)
+     */
+    private void navigate(FacesContext context, String viewId) {
+
+        if (viewId == null) {
+            return;
+        }
+
+        ViewHandler vh = context.getApplication().getViewHandler();
+        UIViewRoot view = vh.createView(context, viewId);
+        view.setViewId(viewId);
+        context.setViewRoot(view);
+        context.renderResponse();
+
+    }
+
+
+    /**
+     * <p>Restore access to the [EMAIL PROTECTED] DialogContext} with the 
specified id,
+     * if possible.</p>
+     *
+     * @param context FacesContext for the current request
+     * @param dialogId Dialog identifier of the [EMAIL PROTECTED] 
DialogContext}
+     *  to be restored
+     */
+    private void restore(FacesContext context, String dialogId) {
+
+        DialogContextManager manager = (DialogContextManager)
+          context.getApplication().getVariableResolver().
+                resolveVariable(context, Constants.MANAGER_BEAN);
+        if (manager == null) {
+            return;
+        }
+        DialogContext dcontext = manager.get(dialogId);
+        if (dcontext == null) {
+            return;
+        }
+        if (log.isDebugEnabled()) {
+            log.debug("afterPhase() restoring dialog context with id '"
+                      + dialogId + "' for FacesContext instance '"
+                      + context + "'");
+        }
+        
context.getExternalContext().getRequestMap().put(Constants.CONTEXT_BEAN, 
dcontext);
+
     }
 
 

Added: 
shale/sandbox/shale-test-dialog2-legacy/src/main/java/org/apache/shale/examples/test/dialog2/legacy/City.java
URL: 
http://svn.apache.org/viewvc/shale/sandbox/shale-test-dialog2-legacy/src/main/java/org/apache/shale/examples/test/dialog2/legacy/City.java?view=auto&rev=442277
==============================================================================
--- 
shale/sandbox/shale-test-dialog2-legacy/src/main/java/org/apache/shale/examples/test/dialog2/legacy/City.java
 (added)
+++ 
shale/sandbox/shale-test-dialog2-legacy/src/main/java/org/apache/shale/examples/test/dialog2/legacy/City.java
 Mon Sep 11 10:55:33 2006
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ * 
+ * Licensed 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.
+ *
+ * $Id: Wizard.java 442088 2006-09-11 04:18:44Z craigmcc $
+ */
+
+package org.apache.shale.examples.test.dialog2.legacy;
+
+import java.io.Serializable;
+
+/**
+ * <p>Model bean for a city/state/zipcode combination.</pL>
+ */
+public class City implements Serializable {
+    
+    public City(String city, String state, String zipCode) {
+        this.city = city;
+        this.state = state;
+        this.zipCode = zipCode;
+    }
+
+    private String city;
+    private String state;
+    private String zipCode;
+
+    public String getCity() {
+        return city;
+    }
+
+    public String getState() {
+        return state;
+    }
+
+    public String getZipCode() {
+        return zipCode;
+    }
+
+
+    public String toString() {
+        return "City[city=" + city + ",state=" + state + ",zipCode=" + zipCode 
+ "]";
+    }
+
+
+}

Added: 
shale/sandbox/shale-test-dialog2-legacy/src/main/java/org/apache/shale/examples/test/dialog2/legacy/Popup.java
URL: 
http://svn.apache.org/viewvc/shale/sandbox/shale-test-dialog2-legacy/src/main/java/org/apache/shale/examples/test/dialog2/legacy/Popup.java?view=auto&rev=442277
==============================================================================
--- 
shale/sandbox/shale-test-dialog2-legacy/src/main/java/org/apache/shale/examples/test/dialog2/legacy/Popup.java
 (added)
+++ 
shale/sandbox/shale-test-dialog2-legacy/src/main/java/org/apache/shale/examples/test/dialog2/legacy/Popup.java
 Mon Sep 11 10:55:33 2006
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ * 
+ * Licensed 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.
+ *
+ * $Id: Wizard.java 442088 2006-09-11 04:18:44Z craigmcc $
+ */
+
+package org.apache.shale.examples.test.dialog2.legacy;
+
+import javax.faces.context.FacesContext;
+import javax.faces.el.ValueBinding;
+import org.apache.shale.dialog2.Constants;
+import org.apache.shale.dialog2.DialogContext;
+
+/**
+ * <p>Event handlers for the "PopUp" dialog.</p>
+ */
+public class Popup {
+    
+
+    /**
+     * <p>Cancel the popup dialog.</p>
+     */
+    public String cancel() {
+
+        // Do not copy anything back to our parent dialog's data
+        return "cancelled";
+
+    }
+
+
+    /**
+     * <p>Refresh the list of cities for the currently selected state.</p>
+     */
+    public String refresh() {
+
+        // The act of updating our selected state is all we need to do
+        return null;
+
+    }
+
+
+    /**
+     * <p>Set up the data for this dialog.</p>
+     */
+    public String setup() {
+
+        // Import the currently selected state from our parent dialog
+        FacesContext context = FacesContext.getCurrentInstance();
+        ValueBinding vb = 
context.getApplication().createValueBinding("#{dialog2.parent.data.state}");
+        String state = (String) vb.getValue(context);
+
+        // Set the currently selected state into our dialog data
+        DialogContext dcontext = (DialogContext)
+          context.getApplication().getVariableResolver().
+          resolveVariable(context, Constants.CONTEXT_BEAN);
+        PopupData data = (PopupData) dcontext.getData();
+        data.setState(state);
+
+        // Proceed to the first page of the popup
+        return "success";
+
+    }
+
+
+    /**
+     * <p>Select the row corresponding to this button.</p>
+     */
+    public String select() {
+
+        // Identify the selected row from the table
+        FacesContext context = FacesContext.getCurrentInstance();
+        City city = (City)
+          context.getApplication().getVariableResolver().
+          resolveVariable(context, "city");
+
+        // Copy relevant values back to our parent dialog's data
+        ValueBinding vb = null;
+        vb = 
context.getApplication().createValueBinding("#{dialog2.parent.data.city}");
+        vb.setValue(context, city.getCity());
+        vb = 
context.getApplication().createValueBinding("#{dialog2.parent.data.state}");
+        vb.setValue(context, city.getState());
+        vb = 
context.getApplication().createValueBinding("#{dialog2.parent.data.zipCode}");
+        vb.setValue(context, city.getZipCode());
+
+        // Exit the dialog now that we have copied back the relevant values
+        return "finished";
+
+    }
+
+
+}

Added: 
shale/sandbox/shale-test-dialog2-legacy/src/main/java/org/apache/shale/examples/test/dialog2/legacy/PopupData.java
URL: 
http://svn.apache.org/viewvc/shale/sandbox/shale-test-dialog2-legacy/src/main/java/org/apache/shale/examples/test/dialog2/legacy/PopupData.java?view=auto&rev=442277
==============================================================================
--- 
shale/sandbox/shale-test-dialog2-legacy/src/main/java/org/apache/shale/examples/test/dialog2/legacy/PopupData.java
 (added)
+++ 
shale/sandbox/shale-test-dialog2-legacy/src/main/java/org/apache/shale/examples/test/dialog2/legacy/PopupData.java
 Mon Sep 11 10:55:33 2006
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ * 
+ * Licensed 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.
+ *
+ * $Id: Wizard.java 442088 2006-09-11 04:18:44Z craigmcc $
+ */
+
+package org.apache.shale.examples.test.dialog2.legacy;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import javax.faces.model.SelectItem;
+
+/**
+ * <p>Model data backing the "popup" dialog.</p>
+ */
+public class PopupData implements Serializable {
+    
+
+    /**
+     * <p>The set of all known cities.</p>
+     */
+    private static City[] cities = new City[] {
+        new City("Beaverton", "OR", "97005"),
+        new City("Beaverton", "OR", "97006"),
+        new City("Beaverton", "OR", "97007"),
+        new City("Beaverton", "OR", "97008"),
+        new City("Beaverton", "OR", "97075"),
+        new City("Beaverton", "OR", "97076"),
+        new City("Beaverton", "OR", "97077"),
+        new City("Beaverton", "OR", "97078"),
+        new City("Lake Oswego", "OR", "97034"),
+        new City("Lake Oswego", "OR", "97035"),
+        new City("Sherwood", "OR", "97140"),
+        new City("Tigard", "OR", "97223"),
+        new City("Tigard", "OR", "97224"),
+        new City("Tigard", "OR", "97281"),
+        new City("Tualatin", "OR", "97062"),
+        new City("West Linn", "OR", "97068"),
+    };
+
+
+    /**
+     * <p>Return a list of cities for the currently selected state.</p>
+     */
+    public City[] getCities() {
+        if (state == null) {
+            return new City[0];
+        }
+        List results = new ArrayList();
+        for (int i = 0; i < cities.length; i++) {
+            if (state.equals(cities[i].getState())) {
+                results.add(cities[i]);
+            }
+        }
+        return (City[]) results.toArray(new City[results.size()]);
+    }
+
+    /**
+     * <p>The currently selected state.</p>
+     */
+    private String state = null;
+    
+    public String getState() { return this.state; }
+    
+    public void setState(String state) { this.state = state; }
+
+
+    /**
+     * <p>The set of valid states.</p>
+     */
+    private SelectItem[] states = null;
+
+    public SelectItem[] getStates() {
+        if (states == null) {
+            states = new SelectItem[3];
+            states[0] = new SelectItem("CA", "California");
+            states[1] = new SelectItem("OR", "Oregon");
+            states[2] = new SelectItem("WA", "Washington");
+        }
+        return states;
+    }
+
+
+}

Modified: 
shale/sandbox/shale-test-dialog2-legacy/src/main/java/org/apache/shale/examples/test/dialog2/legacy/Wizard.java
URL: 
http://svn.apache.org/viewvc/shale/sandbox/shale-test-dialog2-legacy/src/main/java/org/apache/shale/examples/test/dialog2/legacy/Wizard.java?view=diff&rev=442277&r1=442276&r2=442277
==============================================================================
--- 
shale/sandbox/shale-test-dialog2-legacy/src/main/java/org/apache/shale/examples/test/dialog2/legacy/Wizard.java
 (original)
+++ 
shale/sandbox/shale-test-dialog2-legacy/src/main/java/org/apache/shale/examples/test/dialog2/legacy/Wizard.java
 Mon Sep 11 10:55:33 2006
@@ -96,7 +96,7 @@
         data.setAddress2("initAddress2");
         data.setCity("initCity");
         data.setState("initState");
-        data.setZipcode("initZipcode");
+        data.setZipCode("initZipCode");
         data.setAdministrator(false);
         data.setEnabled(true);
 

Modified: 
shale/sandbox/shale-test-dialog2-legacy/src/main/java/org/apache/shale/examples/test/dialog2/legacy/WizardData.java
URL: 
http://svn.apache.org/viewvc/shale/sandbox/shale-test-dialog2-legacy/src/main/java/org/apache/shale/examples/test/dialog2/legacy/WizardData.java?view=diff&rev=442277&r1=442276&r2=442277
==============================================================================
--- 
shale/sandbox/shale-test-dialog2-legacy/src/main/java/org/apache/shale/examples/test/dialog2/legacy/WizardData.java
 (original)
+++ 
shale/sandbox/shale-test-dialog2-legacy/src/main/java/org/apache/shale/examples/test/dialog2/legacy/WizardData.java
 Mon Sep 11 10:55:33 2006
@@ -32,7 +32,7 @@
     private String address2;
     private String city;
     private String state;
-    private String zipcode;
+    private String zipCode;
     private boolean administrator;
     private boolean enabled;
 
@@ -92,12 +92,12 @@
         this.state = state;
     }
 
-    public String getZipcode() {
-        return zipcode;
+    public String getZipCode() {
+        return zipCode;
     }
 
-    public void setZipcode(String zipcode) {
-        this.zipcode = zipcode;
+    public void setZipCode(String zipCode) {
+        this.zipCode = zipCode;
     }
 
     public boolean isAdministrator() {

Modified: 
shale/sandbox/shale-test-dialog2-legacy/src/main/webapp/WEB-INF/dialog-config.xml
URL: 
http://svn.apache.org/viewvc/shale/sandbox/shale-test-dialog2-legacy/src/main/webapp/WEB-INF/dialog-config.xml?view=diff&rev=442277&r1=442276&r2=442277
==============================================================================
--- 
shale/sandbox/shale-test-dialog2-legacy/src/main/webapp/WEB-INF/dialog-config.xml
 (original)
+++ 
shale/sandbox/shale-test-dialog2-legacy/src/main/webapp/WEB-INF/dialog-config.xml
 Mon Sep 11 10:55:33 2006
@@ -110,101 +110,33 @@
     </dialog>
 
 
-    <!-- Log On / Create Profile Dialog -->
-<!--
-  <dialog                name="LogOn"
-                        start="CheckCookie">
-
-    <action              name="CheckCookie"
-                       method="#{profile$logon.check}">
-      <transition     outcome="authenticated"
-                       target="Exit"/>
-      <transition     outcome="unauthenticated"
-                       target="LogonForm"/>
-    </action>
-
-    <view                name="LogonForm"
-                       viewId="/profile/logon.jsp">
-      <transition     outcome="authenticated"
-                       target="Exit"/>
-      <transition     outcome="create"
-                       target="CreateProfile"/>
-      <transition     outcome="cancel"
-                       target="Exit"/>
-    </view>
-
-    <subdialog           name="CreateProfile"
-                   dialogName="EditProfile">
-      <transition     outcome="next"
-                       target="Exit"/>
-      <transition     outcome="success"
-                       target="Exit"/>
-    </subdialog>
-
-    <end                 name="Exit"
-                       viewId="/usecases.jsp"/>
-
-  </dialog>
--->
-
-  <!-- Edit Profile Dialog -->
-<!--
-  <dialog                name="EditProfile"
-                        start="Setup">
-
-    <transition       outcome="cancel"
-                       target="Cancel"/>
-    <transition       outcome="finish"
-                       target="Finish"/>
-
-    <action              name="Setup"
-                       method="#{profile$edit.setup}">
-      <transition     outcome="success"
-                       target="Page 1"/>
-    </action>
-
-    <view                name="Page1"
-                       viewId="/profile/profile1.jsp">
-      <transition     outcome="next"
-                       target="Page2"/>
-    </view>
-
-    <view                name="Page2"
-                       viewId="/profile/profile2.jsp">
-      <transition     outcome="next"
-                       target="Page3"/>
-      <transition     outcome="previous"
-                       target="Page1"/>
-    </view>
-
-    <view                name="Page3"
-                       viewId="/profile/profile3.jsp">
-      <transition     outcome="next"
-                       target="Exit"/>
-      <transition     outcome="previous"
-                       target="Page2"/>
-    </view>
-
-    <action              name="Cancel"
-                       method="#{profile$edit.cancel}">
-      <transition     outcome="success"
-                       target="Exit"/>
-    </action>
-
-    <action              name="Finish"
-                       method="#{profile$edit.finish}">
-      <transition     outcome="password"
-                       target="Page1"/>
-      <transition     outcome="success"
-                       target="Exit"/>
-      <transition     outcome="username"
-                       target="Page1"/>
-    </action>
+    <!-- Pop Up Dialog for City/State/Zip Configuration -->
+    <dialog              name="popup"
+                
dataClassName="org.apache.shale.examples.test.dialog2.legacy.PopupData"
+                        start="setup">
+
+      <action            name="setup"
+                       method="#{popup.setup}">
+        <transition   outcome="success"
+                       target="page1"/>
+      </action>
+
+      <view              name="page1"
+                       viewId="/popuppage1.jsp">
+        <transition   outcome="cancelled"
+                       target="cancelled"/>
+        <transition   outcome="finished"
+                       target="finished"/>
+      </view>
+
+      <end               name="cancelled"
+                       viewId="/popupCancelled.jsp"/>
+
+      <end               name="finished"
+                       viewId="/popupFinished.jsp"/>
+
+    </dialog>
 
-    <end                 name="Exit"
-                       viewId="/usecases.jsp"/>
 
-  </dialog>
--->
 
 </dialogs>

Modified: 
shale/sandbox/shale-test-dialog2-legacy/src/main/webapp/WEB-INF/faces-config.xml
URL: 
http://svn.apache.org/viewvc/shale/sandbox/shale-test-dialog2-legacy/src/main/webapp/WEB-INF/faces-config.xml?view=diff&rev=442277&r1=442276&r2=442277
==============================================================================
--- 
shale/sandbox/shale-test-dialog2-legacy/src/main/webapp/WEB-INF/faces-config.xml
 (original)
+++ 
shale/sandbox/shale-test-dialog2-legacy/src/main/webapp/WEB-INF/faces-config.xml
 Mon Sep 11 10:55:33 2006
@@ -27,6 +27,12 @@
 <faces-config>
 
     <managed-bean>
+        <managed-bean-name>popup</managed-bean-name>
+        
<managed-bean-class>org.apache.shale.examples.test.dialog2.legacy.Popup</managed-bean-class>
+        <managed-bean-scope>request</managed-bean-scope>
+    </managed-bean>
+
+    <managed-bean>
         <managed-bean-name>wizard</managed-bean-name>
         
<managed-bean-class>org.apache.shale.examples.test.dialog2.legacy.Wizard</managed-bean-class>
         <managed-bean-scope>request</managed-bean-scope>

Added: 
shale/sandbox/shale-test-dialog2-legacy/src/main/webapp/popupCancelled.jsp
URL: 
http://svn.apache.org/viewvc/shale/sandbox/shale-test-dialog2-legacy/src/main/webapp/popupCancelled.jsp?view=auto&rev=442277
==============================================================================
--- shale/sandbox/shale-test-dialog2-legacy/src/main/webapp/popupCancelled.jsp 
(added)
+++ shale/sandbox/shale-test-dialog2-legacy/src/main/webapp/popupCancelled.jsp 
Mon Sep 11 10:55:33 2006
@@ -0,0 +1,35 @@
+<%--
+
+ Copyright 2006 The Apache Software Foundation.
+ 
+ Licensed 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.
+
+ $Id: wizardpage1.jsp 439545 2006-09-02 06:06:45Z craigmcc $
+
+--%>
+
+<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"; %>
+<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"; %>
+
+<f:view>
+<html>
+<head>
+    <title>ZipCode Pop Up Dialog Cancelled</title>
+</head>
+<body>
+
+    <h:outputText       value="Pop Up Dialog has been cancelled"/>
+
+</body>
+</html>
+</f:view>

Added: shale/sandbox/shale-test-dialog2-legacy/src/main/webapp/popupFinished.jsp
URL: 
http://svn.apache.org/viewvc/shale/sandbox/shale-test-dialog2-legacy/src/main/webapp/popupFinished.jsp?view=auto&rev=442277
==============================================================================
--- shale/sandbox/shale-test-dialog2-legacy/src/main/webapp/popupFinished.jsp 
(added)
+++ shale/sandbox/shale-test-dialog2-legacy/src/main/webapp/popupFinished.jsp 
Mon Sep 11 10:55:33 2006
@@ -0,0 +1,35 @@
+<%--
+
+ Copyright 2006 The Apache Software Foundation.
+ 
+ Licensed 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.
+
+ $Id: wizardpage1.jsp 439545 2006-09-02 06:06:45Z craigmcc $
+
+--%>
+
+<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"; %>
+<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"; %>
+
+<f:view>
+<html>
+<head>
+    <title>ZipCode Pop Up Dialog Finished</title>
+</head>
+<body>
+
+    <h:outputText       value="Pop Up Dialog has been finished"/>
+
+</body>
+</html>
+</f:view>

Added: shale/sandbox/shale-test-dialog2-legacy/src/main/webapp/popuppage1.jsp
URL: 
http://svn.apache.org/viewvc/shale/sandbox/shale-test-dialog2-legacy/src/main/webapp/popuppage1.jsp?view=auto&rev=442277
==============================================================================
--- shale/sandbox/shale-test-dialog2-legacy/src/main/webapp/popuppage1.jsp 
(added)
+++ shale/sandbox/shale-test-dialog2-legacy/src/main/webapp/popuppage1.jsp Mon 
Sep 11 10:55:33 2006
@@ -0,0 +1,90 @@
+<%--
+
+ Copyright 2006 The Apache Software Foundation.
+ 
+ Licensed 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.
+
+ $Id: wizardpage1.jsp 439545 2006-09-02 06:06:45Z craigmcc $
+
+--%>
+
+<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"; %>
+<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"; %>
+
+<f:view>
+<html>
+<head>
+    <title>ZipCode Pop Up Dialog</title>
+</head>
+<body>
+
+  <h:form                id="form">
+
+    <h:messages            id="messages"/>
+
+    <h:panelGrid      columns="3">
+
+        <h:outputLabel    for="state"
+                        value="State:"/>
+        <h:selectOneMenu   id="state"
+                        value="#{dialog2.data.state}">
+          <f:selectItems
+                        value="#{dialog2.data.states}"/>
+        </h:selectOneMenu>
+        <h:commandButton   id="refresh"
+                       action="#{popup.refresh}"
+                        value="Refresh"/>
+
+
+    </h:panelGrid>
+
+    <h:dataTable           id="table"
+                        value="#{dialog2.data.cities}"
+                          var="city">
+      <h:column>
+        <f:facet         name="header">
+          <h:outputText value="City"/>
+        </f:facet>
+        <h:outputText   value="#{city.city}"/>
+      </h:column>
+      <h:column>
+        <f:facet         name="header">
+          <h:outputText value="State"/>
+        </f:facet>
+        <h:outputText   value="#{city.state}"/>
+      </h:column>
+      <h:column>
+        <f:facet         name="header">
+          <h:outputText value="Zip Code"/>
+        </f:facet>
+        <h:outputText   value="#{city.zipCode}"/>
+      </h:column>
+      <h:column>
+        <f:facet         name="header">
+          <h:outputText value="Action"/>
+        </f:facet>
+        <h:commandButton   id="select"
+                       action="#{popup.select}"
+                        value="Select"/>
+      </h:column>
+    </h:dataTable>
+
+    <h:commandButton       id="cancel"
+                        value="Cancel"
+                       action="#{popup.cancel}"/>
+
+  </h:form>
+
+</body>
+</html>
+</f:view>

Modified: 
shale/sandbox/shale-test-dialog2-legacy/src/main/webapp/wizardpage2.jsp
URL: 
http://svn.apache.org/viewvc/shale/sandbox/shale-test-dialog2-legacy/src/main/webapp/wizardpage2.jsp?view=diff&rev=442277&r1=442276&r2=442277
==============================================================================
--- shale/sandbox/shale-test-dialog2-legacy/src/main/webapp/wizardpage2.jsp 
(original)
+++ shale/sandbox/shale-test-dialog2-legacy/src/main/webapp/wizardpage2.jsp Mon 
Sep 11 10:55:33 2006
@@ -68,12 +68,21 @@
                         value="#{dialog2.data.state}"/>
         <h:message        for="state"/>
 
-        <h:outputLabel    for="zipcode"
+        <h:outputLabel    for="zipCode"
                         value="Zip Code:"/>
-        <h:inputText       id="zipcode"
+        <h:panelGroup>
+          <h:inputText     id="zipCode"
                      required="true"
-                        value="#{dialog2.data.zipcode}"/>
-        <h:message        for="zipcode"/>
+                        value="#{dialog2.data.zipCode}"/>
+          <h:outputLink    id="zipCodePopup"
+                        value="#"
+                      
onclick="javascript:window.open('popuppage1.faces?org.apache.shale.dialog2.PARENT_ID=#{dialog2.id}&org.apache.shale.dialog2.DIALOG_NAME=popup','popup','height=600,width=800')">
+            <h:outputText
+                        value="Pop Up"/>
+          </h:outputLink>
+                      <%-- FIXME - add parameters to the above URL --%>
+        </h:panelGroup>
+        <h:message        for="zipCode"/>
 
         <h:outputText   value=""/>
         <h:panelGroup>


Reply via email to