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 2006/05/04 23:39:56 UTC
svn commit: r399866 - in /myfaces/tomahawk/trunk/sandbox/examples/src/main:
java/org/apache/myfaces/examples/ajaxchildcombobox/ webapp/ webapp/WEB-INF/
Author: imario
Date: Thu May 4 14:39:54 2006
New Revision: 399866
URL: http://svn.apache.org/viewcvs?rev=399866&view=rev
Log:
TOMAHAWK-408: missing files
Added:
myfaces/tomahawk/trunk/sandbox/examples/src/main/java/org/apache/myfaces/examples/ajaxchildcombobox/
myfaces/tomahawk/trunk/sandbox/examples/src/main/java/org/apache/myfaces/examples/ajaxchildcombobox/AjaxChildComboBoxBean.java (with props)
myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/ajaxChildComboBox.jsp (with props)
Modified:
myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/WEB-INF/examples-config.xml
Added: myfaces/tomahawk/trunk/sandbox/examples/src/main/java/org/apache/myfaces/examples/ajaxchildcombobox/AjaxChildComboBoxBean.java
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/sandbox/examples/src/main/java/org/apache/myfaces/examples/ajaxchildcombobox/AjaxChildComboBoxBean.java?rev=399866&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/examples/src/main/java/org/apache/myfaces/examples/ajaxchildcombobox/AjaxChildComboBoxBean.java (added)
+++ myfaces/tomahawk/trunk/sandbox/examples/src/main/java/org/apache/myfaces/examples/ajaxchildcombobox/AjaxChildComboBoxBean.java Thu May 4 14:39:54 2006
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2005 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.
+ */
+package org.apache.myfaces.examples.ajaxchildcombobox;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.faces.model.SelectItem;
+
+/**
+ * Backing Bean for AjaxChildComboBox component example
+ * @author Sharath
+ */
+public class AjaxChildComboBoxBean
+{
+ private String _selectedCountry;
+ private String _selectedCity;
+
+ private static Map _countryInfo = new HashMap();
+
+ private static String USA = "U.S.A";
+ private static String GER = "Germany";
+ private static String IND = "India";
+
+ static {
+ _countryInfo.put(USA, new String [] { "Boston", "New York", "Chicago" } );
+ _countryInfo.put(GER, new String [] { "Berlin", "Frankfurt", "Munich" } );
+ _countryInfo.put(IND, new String [] { "Delhi", "Bombay", "Hyderabad" } );
+ }
+
+ public AjaxChildComboBoxBean()
+ {
+ _selectedCountry = USA;
+ _selectedCity = "New York";
+ }
+
+ public SelectItem [] getCountries()
+ {
+ SelectItem [] countries = new SelectItem[3];
+
+ countries[0] = new SelectItem(USA, USA);
+ countries[1] = new SelectItem(GER, GER);
+ countries[2] = new SelectItem(IND, IND);
+
+ return countries;
+ }
+
+ public SelectItem [] getCities()
+ {
+ System.out.println("getting cities");
+ return getCitiesOfSelectedCountry(getSelectedCountry());
+ }
+
+ public String getSelectedCountry()
+ {
+ return _selectedCountry;
+ }
+
+ public void setSelectedCountry(String selectedCountry)
+ {
+ System.out.println("setting selected country " + selectedCountry);
+ _selectedCountry = selectedCountry;
+ }
+
+
+ public String getSelectedCity()
+ {
+ return _selectedCity;
+ }
+
+ public void setSelectedCity(String selectedCity)
+ {
+ _selectedCity = selectedCity;
+ }
+
+ public SelectItem [] getCitiesOfSelectedCountry(String country)
+ {
+ String [] cities = (String[]) _countryInfo.get(country);
+
+ SelectItem [] siCities = new SelectItem[cities.length];
+
+ for (int i = 0; i < siCities.length; i++) {
+ siCities[i] = new SelectItem(cities[i], cities[i]);
+ }
+
+ return siCities;
+
+ }
+}
Propchange: myfaces/tomahawk/trunk/sandbox/examples/src/main/java/org/apache/myfaces/examples/ajaxchildcombobox/AjaxChildComboBoxBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tomahawk/trunk/sandbox/examples/src/main/java/org/apache/myfaces/examples/ajaxchildcombobox/AjaxChildComboBoxBean.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/tomahawk/trunk/sandbox/examples/src/main/java/org/apache/myfaces/examples/ajaxchildcombobox/AjaxChildComboBoxBean.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/WEB-INF/examples-config.xml
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/WEB-INF/examples-config.xml?rev=399866&r1=399865&r2=399866&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/WEB-INF/examples-config.xml (original)
+++ myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/WEB-INF/examples-config.xml Thu May 4 14:39:54 2006
@@ -68,8 +68,13 @@
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
-
-
+ <!-- managed bean for ajax child combo box component -->
+ <managed-bean>
+ <managed-bean-name>ajaxChildComboBoxBean</managed-bean-name>
+ <managed-bean-class>org.apache.myfaces.examples.ajaxchildcombobox.AjaxChildComboBoxBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+
<managed-bean>
<managed-bean-name>userHandler</managed-bean-name>
<managed-bean-class>org.apache.myfaces.examples.inputsuggest.UserHandler</managed-bean-class>
@@ -562,6 +567,7 @@
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
+
<!-- conversation -->
<managed-bean>
<managed-bean-name>convData</managed-bean-name>
@@ -569,6 +575,7 @@
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
+
<!-- navigation rules -->
<navigation-rule>
<navigation-case>
@@ -731,4 +738,12 @@
</navigation-case>
</navigation-rule>
<!-- navigational rules for the wizard end -->
+ <!--<application>-->
+ <!--<navigation-handler>-->
+ <!--org.apache.myfaces.sandbox.application.jsp.RequestParameterProviderNavigationHandler-->
+ <!--</navigation-handler>-->
+ <!--<view-handler>-->
+ <!--org.apache.myfaces.sandbox.application.jsp.RequestParameterProviderViewHandler-->
+ <!--</view-handler>-->
+ <!--</application>-->
</faces-config>
Added: myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/ajaxChildComboBox.jsp
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/ajaxChildComboBox.jsp?rev=399866&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/ajaxChildComboBox.jsp (added)
+++ myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/ajaxChildComboBox.jsp Thu May 4 14:39:54 2006
@@ -0,0 +1,83 @@
+<%@ 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"%>
+
+<!--
+/*
+ * Copyright 2006 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.
+ */
+//-->
+
+<html>
+<head>
+<meta HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=UTF-8" />
+<title>MyFaces - the free JSF Implementation</title>
+<link rel="stylesheet" type="text/css" href="css/basic.css" />
+<style>
+
+body {
+ font-family: Arial, Helvetica, sans-serif;
+ padding: 0;
+ margin: 0;
+}
+
+.page {
+ padding: 60px 20px 20px 20px;
+}
+
+.main {
+ padding: 20px 20px 20px 20px;
+}
+
+
+</style>
+</head>
+<body>
+<f:view>
+
+ <h:messages/>
+
+ <t:div styleClass="page">
+ <h:form>
+
+ <h:selectOneMenu value="#{ajaxChildComboBoxBean.selectedCountry}" id="parentCombo">
+ <f:selectItems value="#{ajaxChildComboBoxBean.countries}"/>
+ </h:selectOneMenu>
+
+ <f:verbatim>
+ <br/><br/>
+ </f:verbatim>
+
+ <s:ajaxChildComboBox value="#{ajaxChildComboBoxBean.selectedCity}" parentComboBox="parentCombo"
+ ajaxSelectItemsMethod="#{ajaxChildComboBoxBean.getCitiesOfSelectedCountry}">
+ <f:selectItems value="#{ajaxChildComboBoxBean.cities}"/>
+ </s:ajaxChildComboBox>
+
+ <f:verbatim>
+ <br/><br/>
+ </f:verbatim>
+
+ <h:commandButton value="Submit"/>
+
+ </h:form>
+ </t:div>
+
+ <t:div styleClass="page">
+ <%@include file="../inc/page_footer.jsp"%>
+ </t:div>
+</f:view>
+</body>
+</html>
Propchange: myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/ajaxChildComboBox.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/ajaxChildComboBox.jsp
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/ajaxChildComboBox.jsp
------------------------------------------------------------------------------
svn:mime-type = text/plain