You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ha...@apache.org on 2008/11/13 19:18:46 UTC

svn commit: r713769 - in /myfaces/tomahawk/trunk/examples/simple/src/main: java/org/apache/myfaces/examples/renderone/ java/org/apache/myfaces/examples/renderone/RenderOneBean.java webapp/WEB-INF/examples-config.xml webapp/home.jsp webapp/renderOne.jsp

Author: hazems
Date: Thu Nov 13 10:18:45 2008
New Revision: 713769

URL: http://svn.apache.org/viewvc?rev=713769&view=rev
Log:
promoting the renderOne component example to Tomahawk examples.

Added:
    myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/renderone/
    myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/renderone/RenderOneBean.java
    myfaces/tomahawk/trunk/examples/simple/src/main/webapp/renderOne.jsp
Modified:
    myfaces/tomahawk/trunk/examples/simple/src/main/webapp/WEB-INF/examples-config.xml
    myfaces/tomahawk/trunk/examples/simple/src/main/webapp/home.jsp

Added: myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/renderone/RenderOneBean.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/renderone/RenderOneBean.java?rev=713769&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/renderone/RenderOneBean.java (added)
+++ myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/renderone/RenderOneBean.java Thu Nov 13 10:18:45 2008
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.myfaces.examples.renderone;
+
+import java.io.Serializable;
+
+/**
+ * @author Andrew Robinson (latest modification by $Author: skitching $)
+ * @version $Revision: 676967 $ $Date: 2008-07-15 18:57:23 +0200 (Tue, 15 Jul 2008) $
+ */
+public class RenderOneBean implements Serializable
+{
+    private boolean aRendered = false;
+    private boolean cRendered = true;
+    private boolean dRendered = true;
+    private boolean bRendered = true;
+    
+    private Integer index = new Integer("2");
+    
+    /**
+     * @return the index
+     */
+    public Integer getIndex()
+    {
+        return this.index;
+    }
+
+    /**
+     * @return the aRendered
+     */
+    public boolean isARendered()
+    {
+        return this.aRendered;
+    }
+
+    /**
+     * @param rendered the aRendered to set
+     */
+    public void setARendered(boolean rendered)
+    {
+        this.aRendered = rendered;
+    }
+
+    /**
+     * @return the cRendered
+     */
+    public boolean isCRendered()
+    {
+        return this.cRendered;
+    }
+
+    /**
+     * @param rendered the cRendered to set
+     */
+    public void setCRendered(boolean rendered)
+    {
+        this.cRendered = rendered;
+    }
+
+    /**
+     * @return the dRendered
+     */
+    public boolean isDRendered()
+    {
+        return this.dRendered;
+    }
+
+    /**
+     * @param rendered the dRendered to set
+     */
+    public void setDRendered(boolean rendered)
+    {
+        this.dRendered = rendered;
+    }
+
+    /**
+     * @return the bRendered
+     */
+    public boolean isBRendered()
+    {
+        return this.bRendered;
+    }
+
+    /**
+     * @param rendered the bRendered to set
+     */
+    public void setBRendered(boolean rendered)
+    {
+        this.bRendered = rendered;
+    }
+}

Modified: myfaces/tomahawk/trunk/examples/simple/src/main/webapp/WEB-INF/examples-config.xml
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple/src/main/webapp/WEB-INF/examples-config.xml?rev=713769&r1=713768&r2=713769&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple/src/main/webapp/WEB-INF/examples-config.xml (original)
+++ myfaces/tomahawk/trunk/examples/simple/src/main/webapp/WEB-INF/examples-config.xml Thu Nov 13 10:18:45 2008
@@ -615,6 +615,14 @@
         <managed-bean-class>org.apache.myfaces.examples.selectOneRow.SelectOneRowList</managed-bean-class>
         <managed-bean-scope>request</managed-bean-scope>
     </managed-bean>	
+    
+    
+    <!-- managed bean for renderOne -->
+    <managed-bean>
+        <managed-bean-name>renderOne</managed-bean-name>
+        <managed-bean-class>org.apache.myfaces.examples.renderone.RenderOneBean</managed-bean-class>
+        <managed-bean-scope>request</managed-bean-scope>
+    </managed-bean>    
 
     <!-- NAVIGATION RULES -->
 

Modified: myfaces/tomahawk/trunk/examples/simple/src/main/webapp/home.jsp
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple/src/main/webapp/home.jsp?rev=713769&r1=713768&r2=713769&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple/src/main/webapp/home.jsp (original)
+++ myfaces/tomahawk/trunk/examples/simple/src/main/webapp/home.jsp Thu Nov 13 10:18:45 2008
@@ -156,7 +156,14 @@
                     <h:outputLink value="selectOneRow.jsf">
                     	<f:verbatim>selectOneRow - a DataTable Enhancement</f:verbatim>
                     </h:outputLink>                     
-                </h:panelGrid>                             
+                </h:panelGrid>           
+                
+		        <h:outputText value="renderOne"/>
+		        <h:panelGrid style="padding-left:25px">
+		            <h:outputLink value="renderOne.jsf" >
+		                <f:verbatim>renderOne - render the first child component by order or by index</f:verbatim>
+		            </h:outputLink>
+		        </h:panelGrid>                                  
 
         </h:panelGrid>
 

Added: myfaces/tomahawk/trunk/examples/simple/src/main/webapp/renderOne.jsp
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple/src/main/webapp/renderOne.jsp?rev=713769&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple/src/main/webapp/renderOne.jsp (added)
+++ myfaces/tomahawk/trunk/examples/simple/src/main/webapp/renderOne.jsp Thu Nov 13 10:18:45 2008
@@ -0,0 +1,60 @@
+<%@ page session="false" contentType="text/html;charset=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"%>
+<html>
+
+<!--
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+//-->
+
+<%@include file="inc/head.inc" %>
+
+<body>
+<f:view>
+    <h:form>
+
+        <h:outputText value="Output:" />
+        <h:panelGrid columns="2">
+            <h:outputText value="'first' will display the first rendered child component only (will render only B):" />
+            <t:renderOne>
+                <h:outputText value="<b>A - FirstItem</b>" rendered="#{renderOne.ARendered}" escape="false"/>
+                <h:outputText value="<b>B - SecondItem</b>" rendered="#{renderOne.BRendered}" escape="false"/>
+                <h:outputText value="<b>C - ThirdItem</b>" rendered="#{renderOne.CRendered}" escape="false"/>
+                <h:outputText value="<b>D - FourthItem</b>" rendered="#{renderOne.DRendered}" escape="false"/>
+            </t:renderOne>
+
+            <h:outputText value="'index' will display the third component only (will render only C):" />
+            <t:renderOne type="index" value="#{renderOne.index}">
+                <h:outputText value="<b>A - FirstItem</b>" rendered="#{renderOne.ARendered}" escape="false"/>
+                <h:outputText value="<b>B - SecondItem</b>" rendered="#{renderOne.BRendered}" escape="false"/>
+                <h:outputText value="<b>C - ThirdItem</b>" rendered="#{renderOne.CRendered}"  escape="false"/>
+                <h:outputText value="<b>D - FourthItem</b>" rendered="#{renderOne.DRendered}" escape="false"/>
+            </t:renderOne>
+        
+        </h:panelGrid>
+        
+    </h:form>
+</f:view>
+
+<%@include file="inc/page_footer.jsp" %>
+
+</body>
+</html>