Author: ilya_shaikovsky
Date: 2010-08-19 03:44:52 -0400 (Thu, 19 Aug 2010)
New Revision: 18794
Modified:
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/common/SelectsBean.java
Log:
https://jira.jboss.org/browse/RF-9113
Modified:
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/common/SelectsBean.java
===================================================================
---
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/common/SelectsBean.java 2010-08-19
06:02:37 UTC (rev 18793)
+++
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/common/SelectsBean.java 2010-08-19
07:44:52 UTC (rev 18794)
@@ -10,13 +10,13 @@
/**
* @author Ilya Shaikovsky
- *
+ *
*/
@ManagedBean(name = "selectsBean")
@RequestScoped
public class SelectsBean {
- private static final String[] FRUITS = {"", "Banana",
"Cranberry", "Blueberry", "Orange"};
- private static final String[] VEGETABLES = {"", "Potatoes",
"Broccoli", "Garlic", "Carrot"};
+ private static final String[] FRUITS = { "", "Banana",
"Cranberry", "Blueberry", "Orange" };
+ private static final String[] VEGETABLES = { "", "Potatoes",
"Broccoli", "Garlic", "Carrot" };
private String currentItem = "";
private String currentType = "";
private List<SelectItem> firstList = new ArrayList<SelectItem>();
@@ -54,19 +54,20 @@
public void valueChanged(ValueChangeEvent event) {
secondList.clear();
+ if (null != event.getNewValue()) {
+ String[] currentItems;
- String[] currentItems;
+ if (((String) event.getNewValue()).equals("fruits")) {
+ currentItems = FRUITS;
+ } else {
+ currentItems = VEGETABLES;
+ }
- if (((String) event.getNewValue()).equals("fruits")) {
- currentItems = FRUITS;
- } else {
- currentItems = VEGETABLES;
- }
+ for (int i = 0; i < currentItems.length; i++) {
+ SelectItem item = new SelectItem(currentItems[i]);
- for (int i = 0; i < currentItems.length; i++) {
- SelectItem item = new SelectItem(currentItems[i]);
-
- secondList.add(item);
+ secondList.add(item);
+ }
}
}