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/09/04 09:20:35 UTC
svn commit: r572556 - in /myfaces/orchestra/trunk/examples/src/main:
java/org/apache/myfaces/examples/mops/backings/EditProduct.java
java/org/apache/myfaces/examples/mops/model/CustomerGroup.java
webapp/WEB-INF/faces-config.xml webapp/mops/EditProduct.jsp
Author: imario
Date: Tue Sep 4 00:20:34 2007
New Revision: 572556
URL: http://svn.apache.org/viewvc?rev=572556&view=rev
Log:
more petstore progress
Modified:
myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/backings/EditProduct.java
myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/model/CustomerGroup.java
myfaces/orchestra/trunk/examples/src/main/webapp/WEB-INF/faces-config.xml
myfaces/orchestra/trunk/examples/src/main/webapp/mops/EditProduct.jsp
Modified: myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/backings/EditProduct.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/backings/EditProduct.java?rev=572556&r1=572555&r2=572556&view=diff
==============================================================================
--- myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/backings/EditProduct.java (original)
+++ myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/backings/EditProduct.java Tue Sep 4 00:20:34 2007
@@ -70,7 +70,11 @@
{
setProduct(new Product());
}
- }
+ else if (getProductPrice() == null)
+ {
+ initNewProductPrice();
+ }
+ }
public ProductDao getProductDao()
{
@@ -134,7 +138,7 @@
{
productDao.save(product);
initNewProductPrice();
-
+
return FacesConst.SUCCESS;
}
@@ -161,7 +165,13 @@
productPrice.setProduct(getProduct());
}
- @Transactional()
+ @Transactional()
+ public String savePricesAction()
+ {
+ return FacesConst.SUCCESS;
+ }
+
+ @Transactional()
public String savePriceAction()
{
getProduct().addProductPrice(productPrice);
Modified: myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/model/CustomerGroup.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/model/CustomerGroup.java?rev=572556&r1=572555&r2=572556&view=diff
==============================================================================
--- myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/model/CustomerGroup.java (original)
+++ myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/model/CustomerGroup.java Tue Sep 4 00:20:34 2007
@@ -35,8 +35,6 @@
)
public class CustomerGroup
{
- private static final long serialVersionUID = 1L;
-
private Long id;
private String description;
@@ -75,4 +73,4 @@
{
this.version = version;
}
-}
\ No newline at end of file
+}
Modified: myfaces/orchestra/trunk/examples/src/main/webapp/WEB-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/examples/src/main/webapp/WEB-INF/faces-config.xml?rev=572556&r1=572555&r2=572556&view=diff
==============================================================================
--- myfaces/orchestra/trunk/examples/src/main/webapp/WEB-INF/faces-config.xml (original)
+++ myfaces/orchestra/trunk/examples/src/main/webapp/WEB-INF/faces-config.xml Tue Sep 4 00:20:34 2007
@@ -151,12 +151,12 @@
</navigation-case>
<navigation-case>
<from-outcome>ProductDetails</from-outcome>
- <to-view-id>/mops/ProductDetail.jsp?productId=#{productId}</to-view-id>
+ <to-view-id>/mops/ProductDetail.jsp?productId=#{param.productId}</to-view-id>
<redirect/>
</navigation-case>
<navigation-case>
<from-outcome>EditSelectedProduct</from-outcome>
- <to-view-id>/mops/EditProduct.jsp?productId=#{productId}</to-view-id>
+ <to-view-id>/mops/EditProduct.jsp?productId=#{param.productId}</to-view-id>
<redirect/>
</navigation-case>
</navigation-rule>
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=572556&r1=572555&r2=572556&view=diff
==============================================================================
--- myfaces/orchestra/trunk/examples/src/main/webapp/mops/EditProduct.jsp (original)
+++ myfaces/orchestra/trunk/examples/src/main/webapp/mops/EditProduct.jsp Tue Sep 4 00:20:34 2007
@@ -25,131 +25,150 @@
<%@ taglib uri="http://myfaces.apache.org/orchestra15" prefix="ox" %>
<f:view>
- <%@ include file="../header.jspf" %>
+<%@ include file="../header.jspf" %>
- <h:form>
+<h:form>
- <t:htmlTag value="h3">
- <h:outputText value="Edit Product"/>
- </t:htmlTag>
-
- <ox:dynaForm
- id="product"
- var="product"
- uri="org.apache.myfaces.examples.mops.model.Product"
- valueBindingPrefix="mopsEditProduct.product">
- <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>
-
- <ox:dynaForm
- id="prices"
- var="prices"
- uri="org.apache.myfaces.examples.mops.backings.EditProduct$ProductPriceWrapper"
- rendered="#{mopsEditProduct.savedProduct}">
- <t:dataTable
- id="prices-layout"
- var="price"
- value="#{mopsEditProduct.productPrices}">
-
- <f:facet name="header">
- <h:outputText
- value="Product prices" />
- </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="edit" />
- <h:commandButton
- value="delete">
- <t:updateActionListener
- property="#{mopsEditProduct.productPrice}"
- value="#{price.productPrice}" />
- </h:commandButton>
- </h:panelGrid>
- </t:column>
-
- </t:dataTable>
- </ox:dynaForm>
-
- <ox:dynaForm
- id="newPrice"
- var="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 product"
- action="#{mopsEditProduct.newPriceAction}" />
- <h:commandButton
- value="Save product"
- action="#{mopsEditProduct.savePriceAction}" />
- </h:panelGrid>
- </h:panelGrid>
- </ox:dynaForm>
+<t:htmlTag value="h3">
+ <h:outputText value="Edit Product"/>
+</t:htmlTag>
+
+<s:subForm id="newProductFrm">
+ <ox:dynaForm
+ id="product"
+ var="product"
+ uri="org.apache.myfaces.examples.mops.model.Product"
+ valueBindingPrefix="mopsEditProduct.product">
+ <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>
+</s:subForm>
+
+<s:subForm id="editPriceFrm">
+ <ox:dynaForm
+ id="prices"
+ var="prices"
+ uri="org.apache.myfaces.examples.mops.backings.EditProduct$ProductPriceWrapper"
+ rendered="#{mopsEditProduct.savedProduct}">
+ <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>
+
+ </t:dataTable>
+ </ox:dynaForm>
+</s:subForm>
+
+<s:subForm id="newPriceFrm">
+ <ox:dynaForm
+ id="newPrice"
+ var="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>
- </h:form>
+</h:form>
- <%@ include file="../footer.jspf" %>
+<%@ include file="../footer.jspf" %>
</f:view>