You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by sv...@apache.org on 2005/05/17 06:11:13 UTC

svn commit: r170511 - /myfaces/trunk/webapps/simple /myfaces/trunk/webapps/simple/WEB-INF /myfaces/trunk/webapps/src/example/org/apache/myfaces/examples/displayValueOnly

Author: svieujot
Date: Mon May 16 21:11:12 2005
New Revision: 170511

URL: http://svn.apache.org/viewcvs?rev=170511&view=rev
Log:
First draft of displayValueOnly page in simple webapp.

Added:
    myfaces/trunk/webapps/simple/displayValueOnly.jsp   (with props)
    myfaces/trunk/webapps/src/example/org/apache/myfaces/examples/displayValueOnly/
    myfaces/trunk/webapps/src/example/org/apache/myfaces/examples/displayValueOnly/DVOFace.java   (with props)
Modified:
    myfaces/trunk/webapps/simple/WEB-INF/examples-config.xml
    myfaces/trunk/webapps/simple/home.jsp

Modified: myfaces/trunk/webapps/simple/WEB-INF/examples-config.xml
URL: http://svn.apache.org/viewcvs/myfaces/trunk/webapps/simple/WEB-INF/examples-config.xml?rev=170511&r1=170510&r2=170511&view=diff
==============================================================================
--- myfaces/trunk/webapps/simple/WEB-INF/examples-config.xml (original)
+++ myfaces/trunk/webapps/simple/WEB-INF/examples-config.xml Mon May 16 21:11:12 2005
@@ -165,6 +165,14 @@
         <managed-bean-scope>request</managed-bean-scope>
     </managed-bean>
 
+    <!-- Managed Beans for date.jsp -->
+
+    <managed-bean>
+        <managed-bean-name>dvoFace</managed-bean-name>
+        <managed-bean-class>org.apache.myfaces.examples.displayValueOnly.DVOFace</managed-bean-class>
+        <managed-bean-scope>request</managed-bean-scope>
+    </managed-bean>
+
     <!-- Managed Beans for inputHtml.jsp -->
 
     <managed-bean>

Added: myfaces/trunk/webapps/simple/displayValueOnly.jsp
URL: http://svn.apache.org/viewcvs/myfaces/trunk/webapps/simple/displayValueOnly.jsp?rev=170511&view=auto
==============================================================================
--- myfaces/trunk/webapps/simple/displayValueOnly.jsp (added)
+++ myfaces/trunk/webapps/simple/displayValueOnly.jsp Mon May 16 21:11:12 2005
@@ -0,0 +1,105 @@
+<%@ 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/extensions" prefix="x"%>
+<html>
+
+<%@include file="inc/head.inc" %>
+
+<!--
+/*
+ * Copyright 2004 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.
+ */
+//-->
+
+<body>
+
+<f:view>
+
+    <h1>Usage of the displayValueOnly attribute</h1>
+
+    <h:form>
+	    <x:saveState value="#{dvoFace.attribute}"/>
+	    
+    	<h:selectBooleanCheckbox
+	    	id="displayValueOnlyCheckBox"
+	    	title="displayValueOnly"
+			value="#{dvoFace.attribute}"/>
+		<h:outputLabel for="displayValueOnlyCheckBox" value="displayValueOnly attribute"/>
+
+		<br/>
+		
+		<h:panelGrid columns="2">
+	        <h:outputLabel for="inputText" value="inputText"/>
+	        <x:inputText id="inputText" value="#{dvoFace.map['inputText']}" displayValueOnly="#{dvoFace.attribute}"/>
+	        
+	        <h:outputLabel for="inputTextarea" value="inputTextarea"/>
+	        <x:inputTextarea id="inputTextarea" value="#{dvoFace.map['inputTextarea']}" displayValueOnly="#{dvoFace.attribute}"/>
+	        
+	        <h:outputLabel for="selectManyCheckbox" value="selectManyCheckbox"/>
+	        <x:selectManyCheckbox id="selectManyCheckbox" value="#{dvoFace.map['selectManyCheckboxList']}" displayValueOnly="#{dvoFace.attribute}">
+			  	<f:selectItem itemLabel="Value 1" itemValue="1"/>
+			  	<f:selectItem itemLabel="Value 2" itemValue="2"/>
+			  	<f:selectItem itemLabel="Value 3" itemValue="3"/>
+			</x:selectManyCheckbox>
+
+	        <h:outputLabel for="selectOneMenu" value="selectOneMenu"/>
+			<x:selectManyMenu id="selectOneMenu" value="#{dvoFace.map['selectOneMenuList']}" displayValueOnly="#{dvoFace.attribute}">
+			  	<f:selectItem itemLabel="Value 1" itemValue="1"/>
+			  	<f:selectItem itemLabel="Value 2" itemValue="2"/>
+			  	<f:selectItem itemLabel="Value 3" itemValue="3"/>
+			</x:selectManyMenu>
+				
+	        <h:outputLabel for="selectManyMenu" value="selectManyMenu"/>
+			<x:selectManyMenu id="selectManyMenu" value="#{dvoFace.map['selectManyMenuList']}" displayValueOnly="#{dvoFace.attribute}">
+			  	<f:selectItem itemLabel="Value 1" itemValue="1"/>
+			  	<f:selectItem itemLabel="Value 2" itemValue="2"/>
+			  	<f:selectItem itemLabel="Value 3" itemValue="3"/>
+			</x:selectManyMenu>
+			
+			<%-- h:outputLabel for="selectOneListbox" value="selectOneListbox"/>
+			<x:selectOneListbox id="selectOneListbox" value="#{dvoFace.map['selectOneListbox']}" displayValueOnly="#{dvoFace.attribute}">
+			  	<f:selectItem itemLabel="Value 1" itemValue="1"/>
+			  	<f:selectItem itemLabel="Value 2" itemValue="2"/>
+			  	<f:selectItem itemLabel="Value 3" itemValue="3"/>
+			</x:selectOneListbox --%>
+			
+			<h:outputLabel for="inputHtml" value="inputHtml"/>
+	        <x:inputHtml id="inputHtml" value="#{dvoFace.map['inputHtml']}" displayValueOnly="#{dvoFace.attribute}"/>
+			
+		</h:panelGrid>
+        <br/><br/>
+        
+        <h2>The attribute can also be set for a whole section</h2>
+        
+        <x:panelGrid columns="2" displayValueOnly="#{dvoFace.attribute}">
+	        <h:outputLabel for="inputText2" value="inputText"/>
+	        <x:inputText id="inputText2" value="#{dvoFace.map['inputText2']}"/>
+	        
+	        <h:outputLabel for="inputTextarea2" value="inputTextarea"/>
+	        <x:inputTextarea id="inputTextarea2" value="#{dvoFace.map['inputTextarea2']}"/>
+	    </x:panelGrid>
+        
+
+        <h:commandButton/>
+    </h:form>
+
+</f:view>
+
+<%@include file="inc/page_footer.jsp" %>
+
+</body>
+
+</html>

Propchange: myfaces/trunk/webapps/simple/displayValueOnly.jsp
------------------------------------------------------------------------------
    svn:keywords = LastChangedDate LastChangedBy LastChangedRevision Author Id

Modified: myfaces/trunk/webapps/simple/home.jsp
URL: http://svn.apache.org/viewcvs/myfaces/trunk/webapps/simple/home.jsp?rev=170511&r1=170510&r2=170511&view=diff
==============================================================================
Binary files - no diff available.

Added: myfaces/trunk/webapps/src/example/org/apache/myfaces/examples/displayValueOnly/DVOFace.java
URL: http://svn.apache.org/viewcvs/myfaces/trunk/webapps/src/example/org/apache/myfaces/examples/displayValueOnly/DVOFace.java?rev=170511&view=auto
==============================================================================
--- myfaces/trunk/webapps/src/example/org/apache/myfaces/examples/displayValueOnly/DVOFace.java (added)
+++ myfaces/trunk/webapps/src/example/org/apache/myfaces/examples/displayValueOnly/DVOFace.java Mon May 16 21:11:12 2005
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2005 Your Corporation. All Rights Reserved.
+ */
+package org.apache.myfaces.examples.displayValueOnly;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Sylvain Vieujot (latest modification by $Author$)
+ * @version $Revision$ $Date: 2005-03-24 12:47:11 -0400 (Thu, 24 Mar 2005) $
+ */
+public class DVOFace implements Serializable
+{
+    private boolean attribute = false;
+    
+    private Map map = new HashMap(){
+    	public Object get(Object key){
+    		Object held = super.get( key );
+    		if( held != null )
+    			return held;
+    		if( key.toString().toLowerCase().contains("list") )
+    			return new ArrayList();
+    		
+    		return null;	
+    	}
+    };
+
+	public boolean isAttribute() {
+		return attribute;
+	}
+	public void setAttribute(boolean attribute) {
+		this.attribute = attribute;
+	}
+	public Map getMap() {
+		return map;
+	}
+	public void setMap(Map map) {
+		this.map = map;
+	}
+}
\ No newline at end of file

Propchange: myfaces/trunk/webapps/src/example/org/apache/myfaces/examples/displayValueOnly/DVOFace.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/trunk/webapps/src/example/org/apache/myfaces/examples/displayValueOnly/DVOFace.java
------------------------------------------------------------------------------
    svn:keywords = "LastChangedDate LastChangedBy LastChangedRevision Author Id"

Propchange: myfaces/trunk/webapps/src/example/org/apache/myfaces/examples/displayValueOnly/DVOFace.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain