Author: gvanmatre Date: Thu Sep 22 18:53:18 2005 New Revision: 291057 URL: http://svn.apache.org/viewcvs?rev=291057&view=rev Log: Added an *extreme* Clay HTML template rolodex example.
Added: struts/shale/trunk/use-cases/src/web/rolodex/xhrolodex.html Modified: struts/shale/trunk/clay-plugin/src/conf/view-config.xml struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/Clay.java struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/faces/ClayViewHandler.java struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/parser/AttributeTokenizer.java struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/parser/Parser.java struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/parser/builder/Builder.java struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/parser/builder/chain/InputBuilderRule.java struts/shale/trunk/clay-plugin/src/test/org/apache/shale/clay/parser/ParserTestCase.java struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/rolodex/Rolodex.java struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/view/Bundle.properties struts/shale/trunk/use-cases/src/web/WEB-INF/faces-config.xml struts/shale/trunk/use-cases/src/web/usecases.jsp Modified: struts/shale/trunk/clay-plugin/src/conf/view-config.xml URL: http://svn.apache.org/viewcvs/struts/shale/trunk/clay-plugin/src/conf/view-config.xml?rev=291057&r1=291056&r2=291057&view=diff ============================================================================== --- struts/shale/trunk/clay-plugin/src/conf/view-config.xml (original) +++ struts/shale/trunk/clay-plugin/src/conf/view-config.xml Thu Sep 22 18:53:18 2005 @@ -154,7 +154,7 @@ <attributes> <set name="rendered" useValueLateBinding="true" /> <set name="value" useValueLateBinding="true" /> - <set name="converter" useMethodLateBinding="true" /> + <set name="converter" useValueLateBinding="true" /> <set name="immediate" useValueLateBinding="true" /> <set name="validator" useMethodLateBinding="true" /> <set name="valueChangeListener" useMethodLateBinding="true" /> @@ -207,7 +207,7 @@ <attributes> <set name="rendered" useValueLateBinding="true" /> <set name="value" useValueLateBinding="true" /> - <set name="converter" useMethodLateBinding="true" /> + <set name="converter" useValueLateBinding="true" /> <set name="immediate" useValueLateBinding="true" /> <set name="validator" useMethodLateBinding="true" /> <set name="valueChangeListener" useMethodLateBinding="true" /> @@ -257,7 +257,7 @@ <attributes> <set name="rendered" useValueLateBinding="true" /> <set name="value" useValueLateBinding="true" /> - <set name="converter" useMethodLateBinding="true" /> + <set name="converter" useValueLateBinding="true" /> <set name="immediate" useValueLateBinding="true" /> <set name="validator" useMethodLateBinding="true" /> <set name="valueChangeListener" useMethodLateBinding="true" /> @@ -306,7 +306,7 @@ <attributes> <set name="rendered" useValueLateBinding="true" /> <set name="value" useValueLateBinding="true" /> - <set name="converter" useMethodLateBinding="true" /> + <set name="converter" useValueLateBinding="true" /> <set name="immediate" useValueLateBinding="true" /> <set name="validator" useMethodLateBinding="true" /> <set name="valueChangeListener" useMethodLateBinding="true" /> @@ -358,7 +358,7 @@ <attributes> <set name="rendered" useValueLateBinding="true" /> <set name="value" useValueLateBinding="true" /> - <set name="converter" useMethodLateBinding="true" /> + <set name="converter" useValueLateBinding="true" /> <set name="immediate" useValueLateBinding="true" /> <set name="validator" useMethodLateBinding="true" /> <set name="valueChangeListener" useMethodLateBinding="true" /> @@ -438,7 +438,7 @@ <attributes> <set name="rendered" useValueLateBinding="true" /> <set name="value" useValueLateBinding="true" /> - <set name="converter" useMethodLateBinding="true" /> + <set name="converter" useValueLateBinding="true" /> <!-- HTML 4.0 universal attributes --> <set name="dir" useValueLateBinding="true" /> @@ -484,7 +484,7 @@ <attributes> <set name="rendered" useValueLateBinding="true" /> <set name="value" useValueLateBinding="true" /> - <set name="converter" useMethodLateBinding="true" /> + <set name="converter" useValueLateBinding="true" /> <!-- HTML 4.0 universal attributes --> <set name="dir" useValueLateBinding="true" /> @@ -523,7 +523,7 @@ <set name="rendered" useValueLateBinding="true" /> <set name="value" useValueLateBinding="true" /> - <set name="converter" useMethodLateBinding="true" /> + <set name="converter" useValueLateBinding="true" /> <set name="immediate" useValueLateBinding="true" /> <set name="validator" useMethodLateBinding="true" /> <set name="valueChangeListener" useMethodLateBinding="true" /> @@ -573,7 +573,7 @@ <attributes> <set name="rendered" useValueLateBinding="true" /> <set name="value" useValueLateBinding="true" /> - <set name="converter" useMethodLateBinding="true" /> + <set name="converter" useValueLateBinding="true" /> <set name="immediate" useValueLateBinding="true" /> <set name="validator" useMethodLateBinding="true" /> <set name="valueChangeListener" useMethodLateBinding="true" /> @@ -630,7 +630,7 @@ <set name="rendered" useValueLateBinding="true" /> <set name="value" useValueLateBinding="true" /> - <set name="converter" useMethodLateBinding="true" /> + <set name="converter" useValueLateBinding="true" /> <set name="immediate" useValueLateBinding="true" /> <set name="validator" useMethodLateBinding="true" /> <set name="valueChangeListener" useMethodLateBinding="true" /> @@ -759,14 +759,14 @@ <set name="rules" useValueLateBinding="true" /> <set name="summary" useValueLateBinding="true" /> <set name="width" useValueLateBinding="true" /> - <set name="value" useMethodLateBinding="true" /> - <set name="var" useMethodLateBinding="false" /> - <set name="rows" useMethodLateBinding="true" /> - <set name="first" useMethodLateBinding="true" /> - <set name="columnClasses" useMethodLateBinding="true" /> - <set name="footerClass" useMethodLateBinding="true" /> - <set name="headerClass" useMethodLateBinding="true" /> - <set name="rowClasses" useMethodLateBinding="true" /> + <set name="value" useValueLateBinding="true" /> + <set name="var" useValueLateBinding="false" /> + <set name="rows" useValueLateBinding="true" /> + <set name="first" useValueLateBinding="true" /> + <set name="columnClasses" useValueLateBinding="true" /> + <set name="footerClass" useValueLateBinding="true" /> + <set name="headerClass" useValueLateBinding="true" /> + <set name="rowClasses" useValueLateBinding="true" /> </attributes> </component> <!-- @@ -833,7 +833,7 @@ <attributes> <set name="rendered" useValueLateBinding="true" /> <set name="value" useValueLateBinding="true" /> - <set name="converter" useMethodLateBinding="true" /> + <set name="converter" useValueLateBinding="true" /> <set name="immediate" useValueLateBinding="true" /> <set name="validator" useMethodLateBinding="true" /> <set name="valueChangeListener" useMethodLateBinding="true" /> @@ -886,7 +886,7 @@ <attributes> <set name="rendered" useValueLateBinding="true" /> <set name="value" useValueLateBinding="true" /> - <set name="converter" useMethodLateBinding="true" /> + <set name="converter" useValueLateBinding="true" /> <!-- HTML 4.0 universal attributes --> <set name="dir" useValueLateBinding="true" /> @@ -1144,11 +1144,9 @@ allowBody="false"> <attributes> <set name="rendered" useValueLateBinding="true" /> - <set name="jsfid" value="RUNTIME"/> - <set name="managedBeanName" useValueLateBinding="false"/> - <!-- + <set name="clayJsfid" value="RUNTIME"/> + <set name="managedBeanName" /> <set name="shapeValidator" useMethodLateBinding="true"/> - --> </attributes> </component> Modified: struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/Clay.java URL: http://svn.apache.org/viewcvs/struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/Clay.java?rev=291057&r1=291056&r2=291057&view=diff ============================================================================== --- struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/Clay.java (original) +++ struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/Clay.java Thu Sep 22 18:53:18 2005 @@ -26,6 +26,7 @@ import javax.faces.component.UINamingContainer; import javax.faces.context.FacesContext; import javax.faces.el.MethodBinding; +import javax.faces.el.ValueBinding; import org.apache.commons.chain.Catalog; import org.apache.commons.chain.CatalogFactory; @@ -37,9 +38,9 @@ import org.apache.shale.clay.component.chain.ClayContext; import org.apache.shale.clay.config.Globals; import org.apache.shale.clay.config.beans.AttributeBean; +import org.apache.shale.clay.config.beans.ComponentBean; import org.apache.shale.clay.config.beans.ConfigBean; import org.apache.shale.clay.config.beans.ConfigBeanFactory; -import org.apache.shale.clay.config.beans.ComponentBean; import org.apache.shale.util.Messages; public class Clay extends UINamingContainer { @@ -141,7 +142,7 @@ public String getJsfid() { return jsfid; } - + /** * <p> * Sets the unique identifier used to build the component subtree @@ -150,7 +151,37 @@ public void setJsfid(String jsfid) { this.jsfid = jsfid; } + + + /** + * <p> + * Sets the unique identifier used to build the component subtree. + * This property is accessible from the JSP tag. + * </p> + */ + public void setClayJsfid(String jsfid) { + this.jsfid = jsfid; + } + + /** + * <p> + * Returns the unique identifier used to build the component subtree. + * This property is accessible from the JSP tag. + * </p> + */ + public String getClayJsfid() { + + if(jsfid != null) + return jsfid; + ValueBinding valuebinding = getValueBinding("clayJsfid"); + if(valuebinding != null) + return (String)valuebinding.getValue(getFacesContext()); + else + return null; + + } + /** * <p> * Retuns the <code>validator</code> signature event that is invoked when @@ -178,7 +209,15 @@ * </p> */ public String getManagedBeanName() { - return managedBeanName; + + if(managedBeanName != null) + return managedBeanName; + ValueBinding valuebinding = getValueBinding("managedBeanName"); + if(valuebinding != null) + return (String)valuebinding.getValue(getFacesContext()); + else + return null; + } /** @@ -364,7 +403,7 @@ * component * </p> */ - public ComponentBean getDisplayElementRoot() { + protected ComponentBean getDisplayElementRoot() { return displayElementRoot; } @@ -374,7 +413,7 @@ * component * </p> */ - public void setDisplayElementRoot(ComponentBean displayElementRoot) { + protected void setDisplayElementRoot(ComponentBean displayElementRoot) { this.displayElementRoot = displayElementRoot; } @@ -424,8 +463,8 @@ * simply invoke encodeChildren(FacesContext).</p> */ public boolean getRendersChildren() { - return true; -} + return true; + } } Modified: struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/faces/ClayViewHandler.java URL: http://svn.apache.org/viewcvs/struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/faces/ClayViewHandler.java?rev=291057&r1=291056&r2=291057&view=diff ============================================================================== --- struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/faces/ClayViewHandler.java (original) +++ struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/faces/ClayViewHandler.java Thu Sep 22 18:53:18 2005 @@ -109,7 +109,11 @@ // Specified by ViewHandler public UIViewRoot createView(FacesContext context, String viewId) { - return original.createView(context, viewId); + String id = viewId; + if (isClayTemplate(context, id)) + id = this.normalizeViewId(id); + + return original.createView(context, id); } /** @@ -194,6 +198,7 @@ StateManager stateManager = context.getApplication().getStateManager(); view = stateManager.restoreView(context, normalizeViewId(viewId), calculateRenderKitId(context)); + } else view = original.restoreView(context, viewId); return view; Modified: struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/parser/AttributeTokenizer.java URL: http://svn.apache.org/viewcvs/struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/parser/AttributeTokenizer.java?rev=291057&r1=291056&r2=291057&view=diff ============================================================================== --- struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/parser/AttributeTokenizer.java (original) +++ struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/parser/AttributeTokenizer.java Thu Sep 22 18:53:18 2005 @@ -250,7 +250,7 @@ while (currOffset < endOffset) { // skip leading spaces int startOffset = currOffset; - while (buffer.charAt(currOffset) == ' ') { + while (Character.isWhitespace(buffer.charAt(currOffset))) { currOffset++; } @@ -340,7 +340,9 @@ int e = currOffset; //forgive an attribute with Inconsistent delimiters, color=red" - if (buffer.charAt(e - 1) == '"') + if (buffer.charAt(e - 1) == '"' || + (Character.isWhitespace(buffer.charAt(e - 1)) && + buffer.charAt(e - 1) != ' ')) --e; Modified: struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/parser/Parser.java URL: http://svn.apache.org/viewcvs/struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/parser/Parser.java?rev=291057&r1=291056&r2=291057&view=diff ============================================================================== --- struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/parser/Parser.java (original) +++ struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/parser/Parser.java Thu Sep 22 18:53:18 2005 @@ -141,7 +141,7 @@ /** * <p>This array of parent tags is cross referenced by the <code>OPTIONAL_ENDING_TAG</code> array</p> */ - private static final String[][] TAG_PARENTS = {{"TABLE"}, {"TABLE"}, {"TR"}, {"OL", "UL"}, {"DL"}, {"DL"}, {"DL"}, {"SELECT"}}; + private static final String[][] TAG_PARENTS = {{"TABLE", "TBODY"}, {"TABLE", "TBODY"}, {"TR"}, {"OL", "UL"}, {"DL"}, {"DL"}, {"DL"}, {"SELECT"}}; /** * <p> Modified: struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/parser/builder/Builder.java URL: http://svn.apache.org/viewcvs/struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/parser/builder/Builder.java?rev=291057&r1=291056&r2=291057&view=diff ============================================================================== --- struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/parser/builder/Builder.java (original) +++ struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/parser/builder/Builder.java Thu Sep 22 18:53:18 2005 @@ -154,6 +154,25 @@ /** * <p> + * Factory method that creates a [EMAIL PROTECTED] AttributeBean} from the <code>original</code> + * replacing the <code>value</code>. + * </p> + */ + protected AttributeBean createAttribute(AttributeBean original, String value, ElementBean target) { + AttributeBean attr = new AttributeBean(); + attr.setName(original.getName()); + attr.setValue(value); + attr.setUseValueLateBinding(original.getUseValueLateBinding()); + attr.setUseMethodLateBinding(original.getUseMethodLateBinding()); + target.addAttribute(attr); + return attr; + } + + + + + /** + * <p> * Recursively builds the clay meta component data from the parse * document of [EMAIL PROTECTED] Node}'s. A similar design pattern found in JSF. * </p> @@ -199,10 +218,11 @@ public ElementBean createElement(Node node) { ElementBean target = new ElementBean(); - if (node.getName() != null) { - target.setJsfid(node.getName()); - } else { - target.setJsfid(getJsfid(node)); + target.setJsfid(getJsfid(node)); + if (!node.isComment() && node.isStart()) { + String jsfid = null; + if ((jsfid = (String) node.getAttributes().get("jsfid")) != null) + target.setJsfid(jsfid); } target.setComponentType(getComponentType(node)); target.setRenderId(getRenderId()); @@ -246,13 +266,9 @@ target.setId(id); // look to see if this node should be bound to a component - if (node.getAttributes().containsKey("jsfid")) { - //get the value of the attribute - String jsfid = (String) node.getAttributes().get("jsfid"); + if (target.getJsfid() != null) { // lookup the ConfigBean that handles the id - ConfigBean config = ConfigBeanFactory.findConfig(jsfid); - // should always return a default, assign the jsfid - target.setJsfid(jsfid); + ConfigBean config = ConfigBeanFactory.findConfig(target.getJsfid()); // disconnect component type target.setComponentType(null); @@ -282,32 +298,25 @@ protected void assignAttributes(Node node, ElementBean target) { // override with html attributes - Iterator ai = node.getAttributes().keySet().iterator(); + Iterator ai = target.getAttributes().entrySet().iterator(); next: while (ai.hasNext()) { - String key = (String) ai.next(); - - if (key.equals("jsfid")) - continue next; - - if (target.getAttributes().containsKey(key)) { - String value = null; - if ((value = (String) node.getAttributes().get(key)) != null) - createAttribute(key, value, target); + Map.Entry e = (Map.Entry) ai.next(); + + if (e.getKey().equals("jsfid")) + continue next; + + AttributeBean original = (AttributeBean) e.getValue(); + String value = null; + if ((value = (String) node.getAttributes().get(original.getName())) != null) { + createAttribute(original, value, target); } } - - if (node.getAttributes().containsKey("allowBody")) - target.setAllowBody((String) node.getAttributes().get("allowBody")); + if (node.getAttributes().containsKey("allowbody")) + target.setAllowBody((String) node.getAttributes().get("allowbody")); - if (node.getAttributes().containsKey("facetName")) - target.setAllowBody((String) node.getAttributes().get("facetName")); - - if (node.getAttributes().containsKey("componentType")) - target.setAllowBody((String) node.getAttributes().get("componentType")); - - if (node.getAttributes().containsKey("id")) - target.setAllowBody((String) node.getAttributes().get("id")); + if (node.getAttributes().containsKey("facetname")) + target.setFacetName((String) node.getAttributes().get("facetname")); } Modified: struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/parser/builder/chain/InputBuilderRule.java URL: http://svn.apache.org/viewcvs/struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/parser/builder/chain/InputBuilderRule.java?rev=291057&r1=291056&r2=291057&view=diff ============================================================================== --- struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/parser/builder/chain/InputBuilderRule.java (original) +++ struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/parser/builder/chain/InputBuilderRule.java Thu Sep 22 18:53:18 2005 @@ -76,8 +76,7 @@ } else if (type != null && type.equalsIgnoreCase("radio")) { builderRuleContext.setBuilder(builders[2]); isFinal = true; - } else if (type != null && type.equalsIgnoreCase("submit") - && node.getAttributes().containsKey("jsfid")) { + } else if (type != null && type.equalsIgnoreCase("submit")) { builderRuleContext.setBuilder(builders[3]); isFinal = true; } Modified: struts/shale/trunk/clay-plugin/src/test/org/apache/shale/clay/parser/ParserTestCase.java URL: http://svn.apache.org/viewcvs/struts/shale/trunk/clay-plugin/src/test/org/apache/shale/clay/parser/ParserTestCase.java?rev=291057&r1=291056&r2=291057&view=diff ============================================================================== --- struts/shale/trunk/clay-plugin/src/test/org/apache/shale/clay/parser/ParserTestCase.java (original) +++ struts/shale/trunk/clay-plugin/src/test/org/apache/shale/clay/parser/ParserTestCase.java Thu Sep 22 18:53:18 2005 @@ -465,10 +465,29 @@ value = (String) node.getAttributes().get("name"); assertEquals("Attribute name", value, "date"); + + //test linespan with bogus whitespace + doc.setLength(0); + doc.append("<input \n type=text \t\r \nsize=\"10\" \nname=date\r>"); + + nodes = p.parse(doc); + assertTrue("1 root node", nodes.size() == 1); + + node = (Node) nodes.get(0); + + value = (String) node.getAttributes().get("type"); + assertEquals("Attribute type", value, "text"); + value = (String) node.getAttributes().get("size"); + assertEquals("Attribute size", value, "10"); + + value = (String) node.getAttributes().get("name"); + assertEquals("Attribute name", value, "date"); + + //test bogus attribute with missing delimiter doc.setLength(0); - doc.append("<input type=text size=\"10 name=date>"); + doc.append("<input type=\"text \" size=\"10 name=date>"); nodes = p.parse(doc); assertTrue("1 root node", nodes.size() == 1); @@ -476,7 +495,7 @@ node = (Node) nodes.get(0); value = (String) node.getAttributes().get("type"); - assertEquals("Attribute type", value, "text"); + assertEquals("Attribute type ", value, "text "); value = (String) node.getAttributes().get("size"); assertEquals("Attribute size", value, "10"); Modified: struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/rolodex/Rolodex.java URL: http://svn.apache.org/viewcvs/struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/rolodex/Rolodex.java?rev=291057&r1=291056&r2=291057&view=diff ============================================================================== --- struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/rolodex/Rolodex.java (original) +++ struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/rolodex/Rolodex.java Thu Sep 22 18:53:18 2005 @@ -248,7 +248,7 @@ attr.setValue(Boolean.FALSE.toString()); text.addAttribute(attr); - // add a escape attribute + // add a isTransient attribute attr = new AttributeBean(); attr.setName("isTransient"); attr.setValue(Boolean.TRUE.toString()); Modified: struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/view/Bundle.properties URL: http://svn.apache.org/viewcvs/struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/view/Bundle.properties?rev=291057&r1=291056&r2=291057&view=diff ============================================================================== --- struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/view/Bundle.properties (original) +++ struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/view/Bundle.properties Thu Sep 22 18:53:18 2005 @@ -130,6 +130,7 @@ usecases.clay=Clay View Use Cases usecases.rolodex1=Rolodex Example (JSP View) usecases.rolodex2=Rolodex Example (HTML View) +usecases.rolodex3=Rolodex Example (Extreme HTML View) # Validation validate.test.title=Shale Validation using Commons Validator Modified: struts/shale/trunk/use-cases/src/web/WEB-INF/faces-config.xml URL: http://svn.apache.org/viewcvs/struts/shale/trunk/use-cases/src/web/WEB-INF/faces-config.xml?rev=291057&r1=291056&r2=291057&view=diff ============================================================================== --- struts/shale/trunk/use-cases/src/web/WEB-INF/faces-config.xml (original) +++ struts/shale/trunk/use-cases/src/web/WEB-INF/faces-config.xml Thu Sep 22 18:53:18 2005 @@ -232,6 +232,40 @@ <from-outcome>rolodex$test</from-outcome> <to-view-id>/rolodex/hrolodex.html</to-view-id> </navigation-case> + + + <!-- Extreme HTML View --> + <navigation-case> + <from-outcome>rolodex$test3</from-outcome> + <to-view-id>/rolodex/xhrolodex.html</to-view-id> + </navigation-case> + <navigation-case> + <from-action>#{rolodex$xhrolodex.selectContact}</from-action> + <from-outcome>rolodex$test</from-outcome> + <to-view-id>/rolodex/xhrolodex.html</to-view-id> + </navigation-case> + <navigation-case> + <from-action>#{rolodex$xhrolodex.saveContact}</from-action> + <from-outcome>rolodex$test</from-outcome> + <to-view-id>/rolodex/xhrolodex.html</to-view-id> + </navigation-case> + <navigation-case> + <from-action>#{rolodex$xhrolodex.deleteContact}</from-action> + <from-outcome>rolodex$test</from-outcome> + <to-view-id>/rolodex/xhrolodex.html</to-view-id> + </navigation-case> + <navigation-case> + <from-action>#{rolodex$xhrolodex.newContact}</from-action> + <from-outcome>rolodex$test</from-outcome> + <to-view-id>/rolodex/xhrolodex.html</to-view-id> + </navigation-case> + <navigation-case> + <from-action>#{rolodex$xhrolodex.changeTab}</from-action> + <from-outcome>rolodex$test</from-outcome> + <to-view-id>/rolodex/xhrolodex.html</to-view-id> + </navigation-case> + + </navigation-rule> <navigation-rule> @@ -478,6 +512,18 @@ </managed-bean-class> <managed-bean-scope>session</managed-bean-scope> </managed-bean> + + <managed-bean> + <description> + View controller for the Extreme HTML view rolodex usecase + </description> + <managed-bean-name>rolodex$xhrolodex</managed-bean-name> + <managed-bean-class> + org.apache.shale.usecases.rolodex.Rolodex + </managed-bean-class> + <managed-bean-scope>session</managed-bean-scope> + </managed-bean> + <managed-bean> <description> Added: struts/shale/trunk/use-cases/src/web/rolodex/xhrolodex.html URL: http://svn.apache.org/viewcvs/struts/shale/trunk/use-cases/src/web/rolodex/xhrolodex.html?rev=291057&view=auto ============================================================================== --- struts/shale/trunk/use-cases/src/web/rolodex/xhrolodex.html (added) +++ struts/shale/trunk/use-cases/src/web/rolodex/xhrolodex.html Thu Sep 22 18:53:18 2005 @@ -0,0 +1,271 @@ +<html> +<head> +<span jsfid="loadBundle" basename="org.apache.shale.usecases.view.Bundle" var="messages"/> +<title>#{messages['usecases.rolodex3']}</title> + +<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> +<style type="text/css" media="screen"> +body { + margin : 10px; + font: Verdana, Helvetica, Arial; + padding: 0px; + background: #fff; +} + +#menu { + border-bottom : 1px solid #ccc; + margin : 0; + padding-bottom : 19px; + padding-left : 10px; +} + +#menu ul, #menu li { + display : inline; + list-style-type : none; + margin : 0; + padding : 0; +} + + +#menu a:link, #menu a:visited { + background : #E8EBF0; + border : 1px solid #ccc; + color : #666; + float : left; + font-size : small; + font-weight : normal; + line-height : 14px; + margin-right : 8px; + padding : 2px 10px 2px 10px; + text-decoration : none; +} + +#menu a:link.active, #menu a:visited.active { + background : #fff; + border-bottom : 1px solid #fff; + color : #000; +} + +#menu a:hover { + color : #f00; +} + +.contacts { + border: 1px solid #fff; +} + +.contactsHeader { + text-align: center; + color: #99CC66; + background: #E5F2D9; +} + +.contactsRow2 { + text-align: left; + color: #99CC66; + background: #D9EEF2; +} + +.contactsRow1 { + text-align: left; + color: #99CC66; + background: #F1F7D4; +} + +body.section-1 #menu li#nav-sel a { + background : #fff; + border-bottom : 1px solid #fff; + color : #000; +} + +li#nav { + background : #red; + border-bottom : 1px solid #000; + color : #000; +} + +#menu ul a:hover { + color : #f00 !important; +} + +#contents { + background : #fff; + border : 1px solid #ccc; + border-top : none; + clear : both; + margin : 0px; + padding : 15px; +} + +input.button { + width: 1.2in; + text-align: center; + color: #99CC66; + font-size: 12px; + font-style: normal; + font-weight: bold +} +</style> +</head> +<body class="section-1"> +<form id="rolodex"> +<span jsfid="clay" allowBody="false" managedBeanName="rolodex$xhrolodex" shapeValidator="#{rolodex$xhrolodex.createTabs}"> +<ul id="menu"> + <li id="nav"><a href="#">Tab 1</a></li> + <li id="nav-sel"><a href="#">Tab 2</a></li> + <li id="nav"><a href="#">Tab 3</a></li> +</ul> +</span> +<div id="contents"> +<table border="0"> + <tr> + <td rowspan="3"> + <table jsfid="dataTable" class="contacts" styleClass="contacts" value="#{managed-bean-name.contactsForTab}" var="e" rows="100" first="0" headerClass="contactsHeader" rowClasses="contactsRow1, contactsRow2" allowBody="true"> + <tbody id="name" jsfid="column" styleClass="contactsHeader" allowBody="true"> + <th jsfid="outputText" facetName="header" allowBody="false" value="#{messages['rolodex.contactTable.nameColumn.title']}"> + Contacts + </th> + <tr jsfid="commandLink" value="#{e.name}" action="#{managed-bean-name.selectContact}" immediate="true" allowBody="true"> + <td jsfid="param" name="selectedName" value="#{e.encodedName}" allowBody="false"> + <a href="#">ABC Company</a> + </td> + </tr> + </tbody> + </table> + </td> + </tr> + <tr> + <td> + + <table border="0"> + <tr> + <td><label id="contactNameLabel" style="color:#99CC66" styleClass="color:#99CC66" allowBody="false" for="contactName" value="#{messages['rolodex.name']}">Name:</label></td> + <td><input id="contactName" type=text size="40" maxlength="50" value="#{managed-bean-name.selectedContact.name}" required="true"></td> + <td><span id="contactNameMessage" style="color:red" styleClass="color:red" jsfid="message" allowBody="false" for="contactName">Mock Error Name</span></td> + </tr> + <tr> + <td><label id=contactEmailLabel style="color:#99CC66" styleClass="color:#99CC66" allowBody="false" for="contactEmail" value="#{messages['rolodex.email']}">Email:</label></td> + <td><input type=text size="30" maxlength="50" id="contactEmail" value="#{managed-bean-name.selectedContact.email}" required=false></td> + <td><span id="contactEmailMessage" style="color:red" styleClass="color:red" jsfid="message" allowBody="false" for="contactEmail">Mock Error Email</span></td> + </tr> + </table> + + </td> + <td> + + <input styleClass="button" class="button" class="button" type="submit" action="#{managed-bean-name.saveContact}" rendered="#{!empty managed-bean-name.selectedContact}" value="#{messages['rolodex.button.save']}"><br> + <input styleClass="button" class="button" type="submit" action="#{managed-bean-name.deleteContact}" rendered="#{!empty managed-bean-name.selectedContact}" value="#{messages['rolodex.button.delete']}"><br> + <input styleClass="button" class="button" type="submit" action="#{managed-bean-name.newContact}" immediate="true" value="#{messages['rolodex.button.new']}"><br> + + </td> + </tr> + <tr> + <td> + + <table border=0> + <tr class="contactsHeader"> + <td colspan="3"><span jsfid="outputText" allowBody="false" value="#{messages['rolodex.address.residentialAddress']}">Residential Address:</span></td> + </tr> + <tr> + <td><label style="color:#99CC66" allowBody="false" for="residentialStreet1" value="#{messages['rolodex.address.street1']}">Address 1:</label></td> + <td><input id=residentialStreet1 value="#{managed-bean-name.selectedContact.residentialAddress.street1}" required="false" type=text size="35" maxlength="50"></td> + <td><span style="color:red" jsfid="message" allowBody="false" for="residentialStreet1">Mock Error Address 1</span></td> + </tr> + <tr> + <td><label style="color:#99CC66" for=residentialStreet2 value="#{messages['rolodex.address.street2']}" allowBody="false">Address 2:</label></td> + <td><input id="residentialStreet2" type=text size="35" maxlength="50" required="false" value="#{managed-bean-name.selectedContact.residentialAddress.street2}"></td> + <td><span style="color:red" jsfid="message" for=residentialStreet2 allowBody=false>Mock Error Address 2</span></td> + </tr> + <tr> + <td><label style="color:#99CC66" allowBody="false" for="residentialCity" value="#{messages['rolodex.address.city']}">City:</label></td> + <td><input id="residentialCity" type=text size="20" maxlength="30" value="#{managed-bean-name.selectedContact.residentialAddress.city}" required=true></td> + <td><span style="color:red" jsfid="message" allowBody="false" for="residentialCity">Mock Error City</span></td> + </tr> + <tr> + <td><label style="color:#99CC66" jsfid="residentialStateLabel" for=residentialState value="#{messages['rolodex.address.state']}" allowBody="false">State:</label></td> + <td><select id="residentialState" value="#{managed-bean-name.selectedContact.residentialAddress.state}" required=true allowBody=true> + <option value="#{rolodexDao.states}"/> + </select> + </td> + <td><span style="color:red" for="residentialState" jsfid=message allowBody=false>Mock Error State</span></td> + </tr> + <tr> + <td><label style="color:#99CC66" for="residentialZip allowBody=false value="#{messages['rolodex.address.zip']}">Zip:</label></td> + <td><input id="residentialZip" type=text size="5" maxlength="9" value="#{managed-bean-name.selectedContact.residentialAddress.zip}"></td> + <td><span style="color:red" jsfid=message for="residentialZip" allowBody=false>Mock Error Zip</span></td> + </tr> + <tr> + <td><label style="color:#99CC66" for="contactResidentialPhone" allowBody=false value="#{messages['rolodex.address.phone']}">Phone:</label></td> + <td><input id="contactResidentialPhone" type=text size="20" maxlength="50" value="#{managed-bean-name.selectedContact.residentialPhone}"/></td> + <td><span style="color:red" jsfid=message for="contactResidentialPhone" allowBody="false" >Mock Error Phone</span></td> + </tr> + <tr> + <td colspan="2"> </td> + </tr> + <tr> + <td colspan="2"> </td> + </tr> + </table> + + </td> + <td> + + <table border=0> + <tr class="contactsHeader"> + <td colspan="3"><span jsfid="outputText" allowBody="false" value="#{messages['rolodex.address.businessAddress']}">Business Address:</span></td> + </tr> + <tr> + <td><label style="color:#99CC66" for=businessStreet1 allowBody=false value="#{messages['rolodex.address.street1']}">Address 1:</label></td> + <td><input id="businessStreet1" type=text size="35" maxlength="50" value="#{managed-bean-name.selectedContact.businessAddress.street1}" required=false></td> + <td><span style="color:red" for="businessStreet1" allowBody=false jsfid=message>Mock Error Address 1</span></td> + </tr> + <tr> + <td><label style="color:#99CC66" for=businessStreet2 value="#{messages['rolodex.address.street2']}" allowBody=false>Address 2:</label></td> + <td><input id="businessStreet2" type=text size="35" maxlength="50" required=false value="#{managed-bean-name.selectedContact.businessAddress.street2}"></td> + <td><span style="color:red" for="businessStreet2" allowBody=false jsfid=message>Mock Error Address 2</span></td> + </tr> + <tr> + <td><label style="color:#99CC66" for="businessCity" allowBody=false value="#{messages['rolodex.address.city']}">City:</label></td> + <td><input id="businessCity" type=text size="20" maxlength="30" value="#{managed-bean-name.selectedContact.businessAddress.city}" required=true></td> + <td><span style="color:red" jsfid=message for="businessCity" allowBody=false>Mock Error City</span></td> + </tr> + <tr> + <td><label style="color:#99CC66" allowBody=false for="businessState" value="#{messages['rolodex.address.state']}">State:</label></td> + <td><select id="businessState" allowBody=true value="#{managed-bean-name.selectedContact.businessAddress.state}" > + <option value="#{rolodexDao.states}"/> + </select> + </td> + <td><span style="color:red" jsfid=message for="businessState" allowBody=false>Mock Error State</span></td> + </tr> + <tr> + <td><label style="color:#99CC66" for="businessProvince" allowBody=false value="#{messages['rolodex.address.province']}">Province:</label></td> + <td><input id="businessProvince" type=text size="20" maxlength="30" value="#{managed-bean-name.selectedContact.businessAddress.province}"></td> + <td><span style="color:red" jsfid=message for="businessProvince" allowBody=false>Mock Error Province</span></td> + </tr> + <tr> + <td><label style="color:#99CC66" for="businessZip" allowBody=false value="#{messages['rolodex.address.zip']}">Zip:</label></td> + <td><input id="businessZip" type=text size="5" maxlength="9" value="#{managed-bean-name.selectedContact.businessAddress.zip}"/></td> + <td><span style="color:red" jsfid=message for="businessZip" allowBody=false>Mock Error Zip</span></td> + </tr> + <tr> + <td><label style="color:#99CC66" allowBody=false for="businessCountry" value="#{messages['rolodex.address.country']}">Country:</label></td> + <td><select id="businessCountry" value="#{managed-bean-name.selectedContact.businessAddress.country}" required=true allowBody=true> + <option value="#{rolodexDao.countries}"/> + </select> + </td> + <td><span for="businessCountry" allowBody=false jsfid=message>Mock Error Country</span></td> + </tr> + <tr> + <td><label style="color:#99CC66" for="contactBusinessPhone" allowBody=true>#{messages['rolodex.address.phone']}</label></td> + <td><input id="contactBusinessPhone" type="text" size="20" maxlength="50" value="#{managed-bean-name.selectedContact.businessPhone}" required=false/></td> + <td><span style="color:red" for="contactBusinessPhone" allowBody=false jsfid=message>Mock Error Phone</span></td> + </tr> + </table> + + </td> + <tr> +</table> +</div> +</form> +</body> +</html> Modified: struts/shale/trunk/use-cases/src/web/usecases.jsp URL: http://svn.apache.org/viewcvs/struts/shale/trunk/use-cases/src/web/usecases.jsp?rev=291057&r1=291056&r2=291057&view=diff ============================================================================== --- struts/shale/trunk/use-cases/src/web/usecases.jsp (original) +++ struts/shale/trunk/use-cases/src/web/usecases.jsp Thu Sep 22 18:53:18 2005 @@ -170,6 +170,12 @@ </h:commandLink> + <h:commandLink id="rolodex3" + action="rolodex$test3"> + <h:outputText value="#{messages['usecases.rolodex3']}"/> + + </h:commandLink> + </h:panelGrid> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]