Author: abelevich
Date: 2008-01-10 10:17:54 -0500 (Thu, 10 Jan 2008)
New Revision: 5272
Modified:
trunk/sandbox/samples/combobox-sample/src/main/java/org/richfaces/samples/Bean.java
trunk/sandbox/samples/combobox-sample/src/main/webapp/WEB-INF/web.xml
trunk/sandbox/samples/combobox-sample/src/main/webapp/pages/index.jsp
Log:
new values
Modified:
trunk/sandbox/samples/combobox-sample/src/main/java/org/richfaces/samples/Bean.java
===================================================================
---
trunk/sandbox/samples/combobox-sample/src/main/java/org/richfaces/samples/Bean.java 2008-01-10
15:17:02 UTC (rev 5271)
+++
trunk/sandbox/samples/combobox-sample/src/main/java/org/richfaces/samples/Bean.java 2008-01-10
15:17:54 UTC (rev 5272)
@@ -26,6 +26,7 @@
import java.util.Collections;
import java.util.List;
+import javax.faces.event.ValueChangeEvent;
import javax.faces.model.SelectItem;
/**
@@ -36,7 +37,16 @@
String suggestions =
"Alabama,Alaska,Arizona,Arkansas,California,Colorado,Connecticut,Delaware,Florida,Maryland,Massachusetts,Michigan,Georgia,Hawaii,Idaho,Indiana,Iowa,Kansas,Kentucky,Louisiana,Maine,Minnesota,Mississippi,Missouri,Montana,Nebraska";
List selectItems = new ArrayList();
+ private String state="";
+ public String getState() {
+ return state;
+ }
+
+ public void setState(String state) {
+ this.state = state;
+ }
+
public Bean() {
selectItems.add(new SelectItem("District of Columbia"));
selectItems.add(new SelectItem("Illinois"));
@@ -45,7 +55,17 @@
selectItems.add(new SelectItem("New Hampshire"));
selectItems.add(new SelectItem("New Jersey"));
}
+
+ public void selectionChanged(ValueChangeEvent evt) {
+ String selectedValue = (String) evt.getNewValue();
+ if (selectedValue.equals("")) {
+ state = "No selected state";
+ } else {
+ state = selectedValue;
+ }
+ }
+
public List getSuggestions() {
List result = Arrays.asList(suggestions.split(","));
Collections.shuffle(result);
Modified: trunk/sandbox/samples/combobox-sample/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/sandbox/samples/combobox-sample/src/main/webapp/WEB-INF/web.xml 2008-01-10
15:17:02 UTC (rev 5271)
+++ trunk/sandbox/samples/combobox-sample/src/main/webapp/WEB-INF/web.xml 2008-01-10
15:17:54 UTC (rev 5272)
@@ -7,6 +7,10 @@
<param-value>/WEB-INF/faces-config.xml</param-value>
</context-param>
<context-param>
+ <param-name>org.ajax4jsf.SKIN</param-name>
+ <param-value>blueSky</param-value>
+ </context-param>
+ <context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
Modified: trunk/sandbox/samples/combobox-sample/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/sandbox/samples/combobox-sample/src/main/webapp/pages/index.jsp 2008-01-10
15:17:02 UTC (rev 5271)
+++ trunk/sandbox/samples/combobox-sample/src/main/webapp/pages/index.jsp 2008-01-10
15:17:54 UTC (rev 5272)
@@ -8,16 +8,17 @@
<body>
<f:view>
<h:form>
- <cmb:comboBox suggestionValues="#{bean.suggestions}"
- listWidth="300"
- listHeight="200"
- inputSize="30">
+ <cmb:comboBox value="#{bean.state}"
valueChangeListener="#{bean.selectionChanged}"
suggestionValues="#{bean.suggestions}" listWidth="150px">
<f:selectItems value="#{bean.selectItems}"/>
<f:selectItem itemValue="Oregon"/>
<f:selectItem itemValue="Pennsylvania"/>
<f:selectItem itemValue="Rhode Island"/>
<f:selectItem itemValue="South Carolina"/>
</cmb:comboBox>
+ <br/>
+ <h:commandButton action="none"
value="submit"></h:commandButton>
+ <br>
+ <h:outputText value="Selected state is:
#{bean.state}"></h:outputText>
</h:form>
</f:view>
</body>