You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by im...@apache.org on 2007/10/25 12:16:41 UTC

svn commit: r588191 - in /myfaces/orchestra/trunk: core15/src/main/java/org/apache/myfaces/orchestra/dynaForm/component/dynaForm/ core15/src/main/resources/META-INF/ core15/src/main/tld/ examples/src/main/webapp/dynaForm/ examples/src/main/webapp/mops/

Author: imario
Date: Thu Oct 25 03:16:33 2007
New Revision: 588191

URL: http://svn.apache.org/viewvc?rev=588191&view=rev
Log:
create JSF tree on "compile time" instead of render time to be more JSF compliant

Removed:
    myfaces/orchestra/trunk/core15/src/main/java/org/apache/myfaces/orchestra/dynaForm/component/dynaForm/DynaFormRenderer.java
Modified:
    myfaces/orchestra/trunk/core15/src/main/java/org/apache/myfaces/orchestra/dynaForm/component/dynaForm/DynaForm.java
    myfaces/orchestra/trunk/core15/src/main/java/org/apache/myfaces/orchestra/dynaForm/component/dynaForm/DynaFormTag.java
    myfaces/orchestra/trunk/core15/src/main/resources/META-INF/faces-config.xml
    myfaces/orchestra/trunk/core15/src/main/tld/myfaces_orchestra15.tld
    myfaces/orchestra/trunk/examples/src/main/webapp/dynaForm/Form.jsp
    myfaces/orchestra/trunk/examples/src/main/webapp/mops/CustomerLogin.jsp
    myfaces/orchestra/trunk/examples/src/main/webapp/mops/EditCustomerGroup.jsp
    myfaces/orchestra/trunk/examples/src/main/webapp/mops/EditProduct.jsp

Modified: myfaces/orchestra/trunk/core15/src/main/java/org/apache/myfaces/orchestra/dynaForm/component/dynaForm/DynaForm.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core15/src/main/java/org/apache/myfaces/orchestra/dynaForm/component/dynaForm/DynaForm.java?rev=588191&r1=588190&r2=588191&view=diff
==============================================================================
--- myfaces/orchestra/trunk/core15/src/main/java/org/apache/myfaces/orchestra/dynaForm/component/dynaForm/DynaForm.java (original)
+++ myfaces/orchestra/trunk/core15/src/main/java/org/apache/myfaces/orchestra/dynaForm/component/dynaForm/DynaForm.java Thu Oct 25 03:16:33 2007
@@ -18,16 +18,31 @@
  */
 package org.apache.myfaces.orchestra.dynaForm.component.dynaForm;
 
+import org.apache.myfaces.orchestra.dynaForm.guiBuilder.Slipstream;
+import org.apache.myfaces.orchestra.dynaForm.guiBuilder.impl.jsf.JsfGuiBuilder;
+import org.apache.myfaces.orchestra.dynaForm.guiBuilder.impl.jsf.JsfGuiBuilderFactory;
+import org.apache.myfaces.orchestra.dynaForm.guiBuilder.impl.jsf.NewComponentListener;
+import org.apache.myfaces.orchestra.dynaForm.lib.ViewType;
+import org.apache.myfaces.orchestra.dynaForm.lib._FacesUtils;
 import org.apache.myfaces.orchestra.dynaForm.metadata.Extractor;
+import org.apache.myfaces.orchestra.dynaForm.metadata.MetaData;
+import org.apache.myfaces.orchestra.dynaForm.metadata.impl.jsf.JsfExclusiveExtractor;
+import org.apache.myfaces.orchestra.dynaForm.metadata.impl.jsf.JsfExtractor;
+import org.apache.myfaces.orchestra.dynaForm.metadata.impl.jsf.JsfRequestFieldExtractor;
 import org.apache.myfaces.orchestra.dynaForm.uri.FacesUriResolver;
 import org.apache.myfaces.orchestra.dynaForm.uri.UriResolver;
 
 import javax.el.ELContext;
+import javax.faces.component.UIColumn;
 import javax.faces.component.UIComponent;
 import javax.faces.component.UIComponentBase;
+import javax.faces.component.UIData;
 import javax.faces.context.FacesContext;
 import javax.faces.el.ValueBinding;
 import javax.persistence.Transient;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
 
 /**
  * the dynaForm component<br />
@@ -55,6 +70,65 @@
 	private transient DynaConfigs formConfigs = null;
 	private transient ELContext elcontext;
 
+
+	private final class AddComponentToTable implements NewComponentListener
+	{
+		private final UIComponent destCmp;
+
+		private AddComponentToTable(UIComponent component)
+		{
+			super();
+			this.destCmp = component;
+		}
+
+		@SuppressWarnings("unchecked")
+		public void newComponent(String fieldName, UIComponent label, UIComponent component)
+		{
+			UIColumn column = new UIColumn();
+			column.getChildren().add(component);
+			column.setHeader(label);
+			column.getAttributes().put(DynaForm.DYNA_FORM_CREATED, Boolean.TRUE);
+
+			/*
+			int addPos = -1;
+			UIComponent dataIndicator = this.destCmp.findComponent("data");
+			if (dataIndicator != null)
+			{
+				addPos = this.destCmp.getChildren().indexOf(dataIndicator);
+			}
+
+			if (addPos > -1)
+			{
+				this.destCmp.getChildren().add(addPos, column);
+			}
+			else
+			{
+				this.destCmp.getChildren().add(column);
+			}
+			*/
+
+			this.destCmp.getChildren().add(column);
+		}
+	}
+
+	protected static class AddComponentSimple implements NewComponentListener
+	{
+		private final UIComponent destCmp;
+
+		protected AddComponentSimple(UIComponent component)
+		{
+			super();
+			this.destCmp = component;
+		}
+
+		@SuppressWarnings("unchecked")
+		public void newComponent(String fieldName, UIComponent label, UIComponent component)
+		{
+			this.destCmp.getChildren().add(label);
+			this.destCmp.getChildren().add(component);
+		}
+	}
+
 	public DynaForm()
 	{
 		super();
@@ -364,5 +438,222 @@
 	public void setELContext(ELContext elcontext)
 	{
 		this.elcontext = elcontext;
+	}
+
+	@Override
+	public boolean isRendered()
+	{
+		// ensure we are not treated as a rendering component
+		return false;
+	}
+
+	public void initView(FacesContext context)
+	{
+		UIComponent layoutComponent = getParent();
+		ViewType viewType = getViewType(layoutComponent);
+
+		// check if the uri has changed since the last rendering. This can happen
+		// if the uri points to a value-binding
+		String previousUri = (String) getAttributes().get(DynaForm.DYNA_FORM_URI);
+		if (previousUri != null && !previousUri.equals(getUri()))
+		{
+			removeDynaFormCreatedComponents(layoutComponent);
+		}
+
+		// create & add components
+		boolean needAdd = processPreviouslyAdded(context, layoutComponent);
+		if (needAdd)
+		{
+			getAttributes().put(DynaForm.DYNA_FORM_URI, getUri());
+			addComponents(context, this, layoutComponent, viewType);
+		}
+	}
+
+	public void removeDynaFormCreatedComponents(UIComponent base)
+	{
+		List children = base.getChildren();
+		if (children == null || children.size() < 1 )
+		{
+			return;
+		}
+
+		Iterator iterChildren = children.iterator();
+		while (iterChildren.hasNext())
+		{
+			UIComponent component = (UIComponent) iterChildren.next();
+
+			if (Boolean.TRUE.equals(component.getAttributes().get(DynaForm.DYNA_FORM_CREATED)))
+			{
+				iterChildren.remove();
+			}
+			else
+			{
+				removeDynaFormCreatedComponents(component);
+			}
+		}
+	}
+
+	/**
+	 * determine the current view type
+	 * <ul>
+	 * <li>"list" means: the layout component "is a" or "is embedded in an" list component (UIData)</li>
+	 * <li>"form" means: anything else</li>
+	 * </ul>
+	 */
+	protected ViewType getViewType(UIComponent startComponent)
+	{
+		UIComponent component = startComponent;
+		while (component != null && !(component instanceof DynaForm))
+		{
+			if (isTable(component))
+			{
+				return ViewType.LIST;
+			}
+
+			component = component.getParent();
+		}
+
+		return ViewType.FORM;
+	}
+
+	/**
+	 * create and add the components to the layout component
+	 */
+	protected void addComponents(final FacesContext context,
+								 final DynaForm dynaForm, final UIComponent layoutComponent,
+								 final ViewType viewType)
+	{
+		MetaData metaData = extractMetaData(dynaForm);
+
+		Slipstream slipstream = new Slipstream();
+		slipstream.setModelMetaData(metaData);
+		slipstream.setDisplayOnly(dynaForm.isDisplayOnly());
+        slipstream.setIdAsDisplayOnly(dynaForm.isIdAsDisplayOnly());
+
+		if (dynaForm.getBundle() != null)
+		{
+			// get the bundle and attach it
+			Map bundleMap = (Map) context.getApplication().createValueBinding("#{" + dynaForm.getBundle() + "}").getValue(context);
+			slipstream.setLabelBundle(bundleMap);
+		}
+
+		JsfGuiBuilder guiBuilder = createGuiBuilder(context);
+
+		if (_FacesUtils.useValueExpression())
+		{
+			guiBuilder.setELContext(dynaForm.getELContext());
+		}
+		guiBuilder.setContext(context);
+		// guiBuilder.setBackingBeanPrefix(dynaForm.getVar());
+
+		if (isTable(layoutComponent))
+		{
+			guiBuilder.setNewComponentListener(new AddComponentToTable(layoutComponent));
+		}
+		else
+		{
+			guiBuilder.setNewComponentListener(new AddComponentSimple(layoutComponent));
+		}
+
+		String valueBindingPrefix = getValueBindingPrefix(dynaForm, layoutComponent);
+		if (valueBindingPrefix == null)
+		{
+			throw new UnsupportedOperationException("can't determine the value binding prefix");
+		}
+		guiBuilder.setBackingEntityPrefix(valueBindingPrefix);
+
+		slipstream.setGuiBuilder(guiBuilder);
+		slipstream.process();
+	}
+
+	private boolean isTable(UIComponent layoutComponent)
+	{
+		return layoutComponent instanceof UIData || UIData.COMPONENT_FAMILY.equals(layoutComponent.getFamily());
+	}
+
+	protected String getValueBindingPrefix(DynaForm dynaForm, UIComponent layoutComponent)
+	{
+		String valueBindingPrefix = dynaForm.getValueBindingPrefix();
+		if (valueBindingPrefix == null)
+		{
+			valueBindingPrefix = (String) layoutComponent.getAttributes().get("var");
+		}
+
+		return valueBindingPrefix;
+	}
+
+	private MetaData extractMetaData(final DynaForm dynaForm)
+	{
+		MetaData metaData = new MetaData();
+
+		try
+		{
+			// lookup which fields to process
+			new JsfRequestFieldExtractor().getMetaData(metaData, dynaForm);
+
+			if (dynaForm.isExclusiveFields())
+			{
+				// the same as above, but keep their ordering and some additional metadata
+				new JsfExclusiveExtractor().getMetaData(metaData, dynaForm);
+				metaData.setLockFields(true);
+			}
+
+			// use the users extractor
+			dynaForm.getExtractor().getMetaData(metaData, dynaForm.getConfiguration().getEntity());
+
+			// processs the jsf stuff
+			new JsfExtractor().getMetaData(metaData, dynaForm);
+
+		}
+		finally
+		{
+			metaData.setLockFields(false);
+		}
+
+		return metaData;
+	}
+
+	protected JsfGuiBuilder createGuiBuilder(final FacesContext facesContext)
+	{
+		return JsfGuiBuilderFactory.create(facesContext);
+	}
+
+	/**
+	 * check if we already added components to the layout component.<br />
+	 * <p/>
+	 * if this is the case then:
+	 * <ul>
+	 * <li>keep them cached and avoid readd</li>
+	 * <li><strike>in development mode: remove the components</strike></li>
+	 * <li><strike>in production mode: keep them cached</strike></li>
+	 * </ul>
+	 * <p/>
+	 * TODO: need to figure out whats the best way to recreate the components
+	 *
+	 * @return true if we have to add our components again
+	 */
+	protected boolean processPreviouslyAdded(FacesContext context,
+											 UIComponent root)
+	{
+		List rootComponentChildren = root.getChildren();
+		if (rootComponentChildren != null)
+		{
+			for (Object component : rootComponentChildren)
+			{
+				UIComponent child = (UIComponent) component;
+				if (Boolean.TRUE.equals(child.getAttributes().get(
+					DynaForm.DYNA_FORM_CREATED)))
+				{
+					return false;
+				}
+
+				if (!processPreviouslyAdded(context, child))
+				{
+					return false;
+				}
+			}
+		}
+
+		return true;
 	}
 }

Modified: myfaces/orchestra/trunk/core15/src/main/java/org/apache/myfaces/orchestra/dynaForm/component/dynaForm/DynaFormTag.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core15/src/main/java/org/apache/myfaces/orchestra/dynaForm/component/dynaForm/DynaFormTag.java?rev=588191&r1=588190&r2=588191&view=diff
==============================================================================
--- myfaces/orchestra/trunk/core15/src/main/java/org/apache/myfaces/orchestra/dynaForm/component/dynaForm/DynaFormTag.java (original)
+++ myfaces/orchestra/trunk/core15/src/main/java/org/apache/myfaces/orchestra/dynaForm/component/dynaForm/DynaFormTag.java Thu Oct 25 03:16:33 2007
@@ -21,6 +21,8 @@
 import org.apache.myfaces.shared_orchestra.taglib.UIComponentBodyTagBase;
 
 import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.servlet.jsp.JspException;
 
 public class DynaFormTag extends UIComponentBodyTagBase
 {
@@ -176,6 +178,20 @@
 
 	public String getRendererType()
 	{
-		return DynaForm.DEFAULT_RENDERER_TYPE;
+		return null;
 	}
-}
+
+	public int doEndTag() throws JspException
+	{
+		// first, save the component, doEndTag will reset the reference to it
+		DynaForm component = (DynaForm) findComponent(getFacesContext());
+		FacesContext context = getFacesContext();
+
+		int ret = super.doEndTag();
+
+		// now the component should be cleaned-up and ready to be populated again
+		component.initView(context);
+
+		return ret;
+	}
+}
\ No newline at end of file

Modified: myfaces/orchestra/trunk/core15/src/main/resources/META-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core15/src/main/resources/META-INF/faces-config.xml?rev=588191&r1=588190&r2=588191&view=diff
==============================================================================
--- myfaces/orchestra/trunk/core15/src/main/resources/META-INF/faces-config.xml (original)
+++ myfaces/orchestra/trunk/core15/src/main/resources/META-INF/faces-config.xml Thu Oct 25 03:16:33 2007
@@ -119,7 +119,7 @@
         </property>
     </component>
 
-    <!-- render kits -->
+    <!-- render kits
     <render-kit>
       <renderer>
         <description>
@@ -130,6 +130,7 @@
         <renderer-class>org.apache.myfaces.orchestra.dynaForm.component.dynaForm.DynaFormRenderer</renderer-class>
       </renderer>
     </render-kit>
+     -->
 
 	<!--  converters -->
 	<converter>

Modified: myfaces/orchestra/trunk/core15/src/main/tld/myfaces_orchestra15.tld
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core15/src/main/tld/myfaces_orchestra15.tld?rev=588191&r1=588190&r2=588191&view=diff
==============================================================================
--- myfaces/orchestra/trunk/core15/src/main/tld/myfaces_orchestra15.tld (original)
+++ myfaces/orchestra/trunk/core15/src/main/tld/myfaces_orchestra15.tld Thu Oct 25 03:16:33 2007
@@ -123,7 +123,7 @@
       </description>
     </attribute>
 -->
-
+<!--
 	  <attribute>
 		<name>rendered</name>
 		<required>false</required>
@@ -132,6 +132,7 @@
 		false if the component should not be rendered
 		</description>
 	  </attribute>
+-->	  
 
 	<attribute>
       <name>valueBindingPrefix</name>

Modified: myfaces/orchestra/trunk/examples/src/main/webapp/dynaForm/Form.jsp
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/examples/src/main/webapp/dynaForm/Form.jsp?rev=588191&r1=588190&r2=588191&view=diff
==============================================================================
--- myfaces/orchestra/trunk/examples/src/main/webapp/dynaForm/Form.jsp (original)
+++ myfaces/orchestra/trunk/examples/src/main/webapp/dynaForm/Form.jsp Thu Oct 25 03:16:33 2007
@@ -33,18 +33,16 @@
 			<h:outputText value="Form"/>
 		</t:htmlTag>
 
-		<ox:dynaForm
-			id="entity"
-			uri="org.apache.myfaces.examples.dynaForm.model.SimpleEntity"
-			valueBindingPrefix="simpleForm">
+		<h:panelGrid
+			id="entity-layout"
+			columns="2">
 
-			<h:panelGrid
-				id="entity-layout"
-				columns="2">
-
-			</h:panelGrid>
-
-		</ox:dynaForm>
+			<ox:dynaForm
+				id="entity"
+				uri="org.apache.myfaces.examples.dynaForm.model.SimpleEntity"
+				valueBindingPrefix="simpleForm" />
+			
+		</h:panelGrid>
 
 	</h:form>
 

Modified: myfaces/orchestra/trunk/examples/src/main/webapp/mops/CustomerLogin.jsp
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/examples/src/main/webapp/mops/CustomerLogin.jsp?rev=588191&r1=588190&r2=588191&view=diff
==============================================================================
--- myfaces/orchestra/trunk/examples/src/main/webapp/mops/CustomerLogin.jsp (original)
+++ myfaces/orchestra/trunk/examples/src/main/webapp/mops/CustomerLogin.jsp Thu Oct 25 03:16:33 2007
@@ -17,60 +17,59 @@
   under the License.
   --%>
 
-<%@ page pageEncoding="UTF-8"%>
-<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
-<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
-<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
-<%@ taglib uri="http://myfaces.apache.org/sandbox" prefix="s"%>
-<%@ taglib uri="http://myfaces.apache.org/orchestra15" prefix="ox"%>
+<%@ page pageEncoding="UTF-8" %>
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
+<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t" %>
+<%@ taglib uri="http://myfaces.apache.org/sandbox" prefix="s" %>
+<%@ taglib uri="http://myfaces.apache.org/orchestra15" prefix="ox" %>
 
 <f:view>
 	<t:documentHead>
 		<f:verbatim>
-			<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
+			<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
 		</f:verbatim>
-		<t:stylesheet path="../styles/mops_default.css" media="screen" />
+		<t:stylesheet path="../styles/mops_default.css" media="screen"/>
 		<f:verbatim>
 			<title>Apache MyFaces Orchestra</title>
 		</f:verbatim>
 	</t:documentHead>
 	<t:div styleClass="login_position">
-	<t:div styleClass="login_content">
-		<h:form>
+		<t:div styleClass="login_content">
+			<h:form>
 
-			<h:outputText
-				value="This is not a real login thing, just create a new customer and press login" />
-
-			<ox:dynaForm id="customer"
-				uri="org.apache.myfaces.examples.mops.model.ShopCustomer"
-				valueBindingPrefix="mopsCustomerLogin.shopCustomer">
+				<h:outputText
+					value="This is not a real login thing, just create a new customer and press login"/>
 
 				<h:panelGrid columns="1" rowClasses="formData,formAction"
-					styleClass="formInput" width="40%">
+							 styleClass="formInput" width="40%">
 
 					<f:facet name="header">
-						<h:outputText value="Enter your informations" />
+						<h:outputText value="Enter your informations"/>
 					</f:facet>
 
 					<h:panelGrid id="customer-layout" columns="2" rowClasses="TR1,TR2"
-						width="100%">
+								 width="100%">
+
+						<ox:dynaForm id="customer"
+									 uri="org.apache.myfaces.examples.mops.model.ShopCustomer"
+									 valueBindingPrefix="mopsCustomerLogin.shopCustomer"/>
+
 					</h:panelGrid>
 
 					<h:panelGrid columns="1" rowClasses="formAction">
 						<h:commandButton styleClass="btn" value="login"
-							action="#{mopsCustomerLogin.loginAction}"
-							rendered="#{!mopsCustomerLogin.loggedIn}" />
+										 action="#{mopsCustomerLogin.loginAction}"
+										 rendered="#{!mopsCustomerLogin.loggedIn}"/>
 						<h:commandButton styleClass="btn" value="save"
-							action="#{mopsCustomerLogin.saveAction}"
-							rendered="#{mopsCustomerLogin.loggedIn}" />
+										 action="#{mopsCustomerLogin.saveAction}"
+										 rendered="#{mopsCustomerLogin.loggedIn}"/>
 					</h:panelGrid>
 
 				</h:panelGrid>
 
-			</ox:dynaForm>
-
-		</h:form>
-	</t:div>
+			</h:form>
+		</t:div>
 	</t:div>
-	<%@ include file="../footer.jspf"%>
+	<%@ include file="../footer.jspf" %>
 </f:view>

Modified: myfaces/orchestra/trunk/examples/src/main/webapp/mops/EditCustomerGroup.jsp
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/examples/src/main/webapp/mops/EditCustomerGroup.jsp?rev=588191&r1=588190&r2=588191&view=diff
==============================================================================
--- myfaces/orchestra/trunk/examples/src/main/webapp/mops/EditCustomerGroup.jsp (original)
+++ myfaces/orchestra/trunk/examples/src/main/webapp/mops/EditCustomerGroup.jsp Thu Oct 25 03:16:33 2007
@@ -34,90 +34,89 @@
 		</t:htmlTag>
 
 		<s:subForm>
-			<ox:dynaForm
-				id="customerGroup"
-				uri="org.apache.myfaces.examples.mops.model.CustomerGroup"
-				valueBindingPrefix="mopsEditCustomerGroup.customerGroup">
 
-				<h:panelGrid
-					columns="1"
-					rowClasses="formData,formAction"
-					styleClass="formInput"
-					width="40%">
+			<h:panelGrid
+				columns="1"
+				rowClasses="formData,formAction"
+				styleClass="formInput"
+				width="40%">
+
+				<f:facet name="header">
+					<h:panelGroup>
+						<h:outputText
+							value="New Customer-Group"
+							rendered="#{!mopsEditCustomerGroup.savedCustomerGroup}"/>
 
-					<f:facet name="header">
-						<h:panelGroup>
-							<h:outputText
-								value="New Customer-Group"
-								rendered="#{!mopsEditCustomerGroup.savedCustomerGroup}"/>
-
-							<h:outputText
-								value="Edit Customer-Group"
-								rendered="#{mopsEditCustomerGroup.savedCustomerGroup}"/>
-						</h:panelGroup>
-					</f:facet>
+						<h:outputText
+							value="Edit Customer-Group"
+							rendered="#{mopsEditCustomerGroup.savedCustomerGroup}"/>
+					</h:panelGroup>
+				</f:facet>
 
-					<h:panelGrid
-						id="customerGroup-layout"
-						columns="2"
-						rowClasses="TR1,TR2"
-						width="100%">
-					</h:panelGrid>
+				<h:panelGrid
+					id="customerGroup-layout"
+					columns="2"
+					rowClasses="TR1,TR2"
+					width="100%">
+
+					<ox:dynaForm
+						id="customerGroup"
+						uri="org.apache.myfaces.examples.mops.model.CustomerGroup"
+						valueBindingPrefix="mopsEditCustomerGroup.customerGroup"/>
 
-					<h:panelGrid
-						columns="2"
-						rowClasses="formAction">
-						<h:commandButton styleClass="btn"
-							value="New Customer-Group"
-							action="#{mopsEditCustomerGroup.newCustomerGroupAction}" />
-						<h:commandButton styleClass="btn"
-							value="Save Customer-Group"
-							action="#{mopsEditCustomerGroup.saveCustomerGroupAction}" />
-					</h:panelGrid>
 				</h:panelGrid>
 
-			</ox:dynaForm>
+				<h:panelGrid
+					columns="2"
+					rowClasses="formAction">
+					<h:commandButton styleClass="btn"
+									 value="New Customer-Group"
+									 action="#{mopsEditCustomerGroup.newCustomerGroupAction}"/>
+					<h:commandButton styleClass="btn"
+									 value="Save Customer-Group"
+									 action="#{mopsEditCustomerGroup.saveCustomerGroupAction}"/>
+				</h:panelGrid>
+			</h:panelGrid>
+
 		</s:subForm>
 
 		<s:subForm>
-			<ox:dynaForm
-				id="customerGroups"
-				uri="org.apache.myfaces.examples.mops.model.CustomerGroup">
-
-				<h:dataTable
-					id="customerGroups-layout"
-					var="entity"
-					value="#{mopsEditCustomerGroup.customerGroups}">
-
-					<f:facet name="footer">
-
-						<h:commandButton  styleClass="btn"
-							value="Save Customer-Groups"
-							action="#{mopsEditCustomerGroup.saveCustomerGroupsAction}" />
 
-					</f:facet>
+			<h:dataTable
+				id="customerGroups-layout"
+				var="entity"
+				value="#{mopsEditCustomerGroup.customerGroups}">
 
-					<t:column id="data" />
+				<f:facet name="footer">
 
-					<t:column>
-						<f:facet name="header">
-							<h:outputText value="action" />
-						</f:facet>
-
-						<h:panelGrid
-							columns="2"
-							rowClasses="formAction">
-							<h:commandButton styleClass="btn"
-								value="Delete"
-								action="#{mopsEditCustomerGroup.deleteCustomerGroupAction}">
-								<t:updateActionListener
-									property="#{mopsEditCustomerGroup.customerGroup}"
-									value="#{entity}" />
-							</h:commandButton>
-						</h:panelGrid>
-					</t:column>
-				</h:dataTable>
-			</ox:dynaForm>
+					<h:commandButton styleClass="btn"
+									 value="Save Customer-Groups"
+									 action="#{mopsEditCustomerGroup.saveCustomerGroupsAction}"/>
+
+				</f:facet>
+
+				<ox:dynaForm
+					id="customerGroups"
+					uri="org.apache.myfaces.examples.mops.model.CustomerGroup"/>
+
+				<t:column>
+					<f:facet name="header">
+						<h:outputText value="action"/>
+					</f:facet>
+
+					<h:panelGrid
+						columns="2"
+						rowClasses="formAction">
+						<h:commandButton styleClass="btn"
+										 value="Delete"
+										 action="#{mopsEditCustomerGroup.deleteCustomerGroupAction}">
+							<t:updateActionListener
+								property="#{mopsEditCustomerGroup.customerGroup}"
+								value="#{entity}"/>
+						</h:commandButton>
+					</h:panelGrid>
+				</t:column>
+			</h:dataTable>
 		</s:subForm>
 
 	</h:form>

Modified: myfaces/orchestra/trunk/examples/src/main/webapp/mops/EditProduct.jsp
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/examples/src/main/webapp/mops/EditProduct.jsp?rev=588191&r1=588190&r2=588191&view=diff
==============================================================================
--- myfaces/orchestra/trunk/examples/src/main/webapp/mops/EditProduct.jsp (original)
+++ myfaces/orchestra/trunk/examples/src/main/webapp/mops/EditProduct.jsp Thu Oct 25 03:16:33 2007
@@ -30,145 +30,147 @@
 <h:form>
 
 <t:htmlTag value="h3">
-    <h:outputText value="Edit Product"/>
+	<h:outputText value="Edit Product"/>
 </t:htmlTag>
 
 <s:subForm id="newProductFrm">
-    <ox:dynaForm
-            id="product"
-            uri="org.apache.myfaces.examples.mops.model.Product"
-            valueBindingPrefix="mopsEditProduct.product">
-		<ox:dynaFormConfigs>
-			<ox:dynaFormConfig for="longDescription">
-				<t:inputHtml/>
-			</ox:dynaFormConfig>
-		</ox:dynaFormConfigs>
-        <h:panelGrid
-                columns="1"
-                rowClasses="formData,formAction"
-                styleClass="formInput"
-                width="40%">
-
-            <f:facet name="header">
-                <h:panelGroup>
-                    <h:outputText
-                            value="New product"
-                            rendered="#{!mopsEditProduct.savedProduct}"/>
-
-                    <h:outputText
-                            value="Edit product"
-                            rendered="#{mopsEditProduct.savedProduct}"/>
-                </h:panelGroup>
-            </f:facet>
-
-            <h:panelGrid
-                    id="product-layout"
-                    columns="2"
-                    rowClasses="TR1,TR2"
-                    width="100%">
-            </h:panelGrid>
-
-            <h:panelGrid
-                    columns="2"
-                    rowClasses="formAction">
-                <h:commandButton
-                        value="New product"
-                        action="#{mopsEditProduct.newProductAction}"/>
-                <h:commandButton
-                        value="Save product"
-                        action="#{mopsEditProduct.saveProductAction}"/>
-            </h:panelGrid>
-        </h:panelGrid>
-    </ox:dynaForm>
+	<h:panelGrid
+		columns="1"
+		rowClasses="formData,formAction"
+		styleClass="formInput"
+		width="40%">
+
+		<f:facet name="header">
+			<h:panelGroup>
+				<h:outputText
+					value="New product"
+					rendered="#{!mopsEditProduct.savedProduct}"/>
+
+				<h:outputText
+					value="Edit product"
+					rendered="#{mopsEditProduct.savedProduct}"/>
+			</h:panelGroup>
+		</f:facet>
+
+		<h:panelGrid
+			id="product-layout"
+			columns="2"
+			rowClasses="TR1,TR2"
+			width="100%">
+
+			<ox:dynaForm
+				id="product"
+				uri="org.apache.myfaces.examples.mops.model.Product"
+				valueBindingPrefix="mopsEditProduct.product">
+				<ox:dynaFormConfigs>
+					<ox:dynaFormConfig for="longDescription">
+						<t:inputHtml/>
+					</ox:dynaFormConfig>
+				</ox:dynaFormConfigs>
+			</ox:dynaForm>
+
+		</h:panelGrid>
+
+		<h:panelGrid
+			columns="2"
+			rowClasses="formAction">
+			<h:commandButton
+				value="New product"
+				action="#{mopsEditProduct.newProductAction}"/>
+			<h:commandButton
+				value="Save product"
+				action="#{mopsEditProduct.saveProductAction}"/>
+		</h:panelGrid>
+	</h:panelGrid>
 </s:subForm>
 
-<s:subForm id="editPriceFrm">
-    <ox:dynaForm
-            id="prices"
-            uri="org.apache.myfaces.examples.mops.backings.EditProduct$ProductPriceWrapper"
-            rendered="#{mopsEditProduct.savedProduct}"
+<s:subForm
+		id="editPriceFrm"
+		rendered="#{mopsEditProduct.savedProduct}">
+	<t:dataTable
+		id="prices-layout"
+		var="price"
+		value="#{mopsEditProduct.productPrices}">
+
+		<f:facet name="header">
+			<h:outputText
+				value="Product prices for product #{price.productPrice.product.productNumber}/#{price.productPrice.product.description}"/>
+		</f:facet>
+
+		<f:facet name="footer">
+			<h:commandButton
+				value="save"
+				action="#{mopsEditProduct.savePricesAction}">
+			</h:commandButton>
+		</f:facet>
+
+		<ox:dynaForm
+			id="prices"
+			uri="org.apache.myfaces.examples.mops.backings.EditProduct$ProductPriceWrapper"
 			exclusiveFields="true">
-        <ox:dynaFormConfigs>
-            <ox:dynaFormConfig for="productPrice.id" displayOnly="true"/>
-            <ox:dynaFormConfig for="productPrice.customerGroup"/>
-            <ox:dynaFormConfig for="productPrice.validFrom"/>
-            <ox:dynaFormConfig for="productPrice.validTo"/>
-            <ox:dynaFormConfig for="productPrice.price"/>
-        </ox:dynaFormConfigs>
-        <t:dataTable
-                id="prices-layout"
-                var="price"
-                value="#{mopsEditProduct.productPrices}">
-
-            <f:facet name="header">
-                <h:outputText
-                        value="Product prices for product #{price.productPrice.product.productNumber}/#{price.productPrice.product.description}"/>
-            </f:facet>
-
-            <f:facet name="footer">
-                <h:commandButton
-                        value="save"
-                        action="#{mopsEditProduct.savePricesAction}">
-                </h:commandButton>
-            </f:facet>
-
-            <t:column id="data"/>
-
-            <t:column>
-                <f:facet name="header">
-                    <h:outputText value="actions"/>
-                </f:facet>
-                <h:panelGrid columns="2">
-                    <h:commandButton
-                            value="delete"
-                            action="#{mopsEditProduct.deletePriceAction}">
-                        <t:updateActionListener
-                                property="#{mopsEditProduct.productPrice}"
-                                value="#{price.productPrice}"/>
-                    </h:commandButton>
-                </h:panelGrid>
-            </t:column>
+			<ox:dynaFormConfigs>
+				<ox:dynaFormConfig for="productPrice.id" displayOnly="true"/>
+				<ox:dynaFormConfig for="productPrice.customerGroup"/>
+				<ox:dynaFormConfig for="productPrice.validFrom"/>
+				<ox:dynaFormConfig for="productPrice.validTo"/>
+				<ox:dynaFormConfig for="productPrice.price"/>
+			</ox:dynaFormConfigs>
+		</ox:dynaForm>
+
+		<t:column>
+			<f:facet name="header">
+				<h:outputText value="actions"/>
+			</f:facet>
+			<h:panelGrid columns="2">
+				<h:commandButton
+					value="delete"
+					action="#{mopsEditProduct.deletePriceAction}">
+					<t:updateActionListener
+						property="#{mopsEditProduct.productPrice}"
+						value="#{price.productPrice}"/>
+				</h:commandButton>
+			</h:panelGrid>
+		</t:column>
 
-        </t:dataTable>
-    </ox:dynaForm>
+	</t:dataTable>
 </s:subForm>
 
-<s:subForm id="newPriceFrm">
-    <ox:dynaForm
-            id="newPrice"
-            uri="org.apache.myfaces.examples.mops.model.ProductPrice"
-            valueBindingPrefix="mopsEditProduct.productPrice"
-            rendered="#{mopsEditProduct.savedProduct}">
-        <h:panelGrid
-                columns="1"
-                rowClasses="formData,formAction"
-                styleClass="formInput"
-                width="40%">
-
-            <f:facet name="header">
-                <h:outputText
-                        value="New price"/>
-            </f:facet>
-
-            <h:panelGrid
-                    id="newPrice-layout"
-                    columns="2"
-                    rowClasses="TR1,TR2"
-                    width="100%">
-            </h:panelGrid>
-
-            <h:panelGrid
-                    columns="2"
-                    rowClasses="formAction">
-                <h:commandButton
-                        value="New price"
-                        action="#{mopsEditProduct.newPriceAction}"/>
-                <h:commandButton
-                        value="Save price"
-                        action="#{mopsEditProduct.savePriceAction}"/>
-            </h:panelGrid>
-        </h:panelGrid>
-    </ox:dynaForm>
+<s:subForm id="newPriceFrm" rendered="#{mopsEditProduct.savedProduct}">
+	<h:panelGrid
+		columns="1"
+		rowClasses="formData,formAction"
+		styleClass="formInput"
+		width="40%">
+
+		<f:facet name="header">
+			<h:outputText
+				value="New price"/>
+		</f:facet>
+
+		<h:panelGrid
+			id="newPrice-layout"
+			columns="2"
+			rowClasses="TR1,TR2"
+			width="100%">
+
+			<ox:dynaForm
+				id="newPrice"
+				uri="org.apache.myfaces.examples.mops.model.ProductPrice"
+				valueBindingPrefix="mopsEditProduct.productPrice"/>
+
+		</h:panelGrid>
+
+		<h:panelGrid
+			columns="2"
+			rowClasses="formAction">
+			<h:commandButton
+				value="New price"
+				action="#{mopsEditProduct.newPriceAction}"/>
+			<h:commandButton
+				value="Save price"
+				action="#{mopsEditProduct.savePriceAction}"/>
+		</h:panelGrid>
+	</h:panelGrid>
 </s:subForm>
 
 </h:form>