001: /*
002: * $Id: MoreSelectsAction.java 495341 2007-01-11 19:25:30Z ddewolf $
003: *
004: * Licensed to the Apache Software Foundation (ASF) under one
005: * or more contributor license agreements. See the NOTICE file
006: * distributed with this work for additional information
007: * regarding copyright ownership. The ASF licenses this file
008: * to you under the Apache License, Version 2.0 (the
009: * "License"); you may not use this file except in compliance
010: * with the License. You may obtain a copy of the License at
011: *
012: * http://www.apache.org/licenses/LICENSE-2.0
013: *
014: * Unless required by applicable law or agreed to in writing,
015: * software distributed under the License is distributed on an
016: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017: * KIND, either express or implied. See the License for the
018: * specific language governing permissions and limitations
019: * under the License.
020: */
021: package org.apache.struts2.showcase;
022:
023: import com.opensymphony.xwork2.ActionSupport;
024:
025: import java.util.List;
026: import java.util.Map;
027: import java.util.LinkedHashMap;
028: import java.util.ArrayList;
029:
030: /**
031: */
032: public class MoreSelectsAction extends ActionSupport {
033:
034: private List _prioritisedFavouriteCartoonCharacters;
035: private List _prioritisedFavouriteCars;
036: private List _prioritisedFavouriteCountries;
037: private List favouriteNumbers;
038:
039: // Cartoon Characters
040: public Map getDefaultFavouriteCartoonCharacters() {
041: Map m = new LinkedHashMap();
042: m.put("heMan", "He-Man");
043: m.put("popeye", "Popeye");
044: m.put("mockeyMouse", "Mickey Mouse");
045: return m;
046: }
047:
048: // Cars
049: public Map getDefaultFavouriteCars() {
050: Map m = new LinkedHashMap();
051: m.put("alfaRomeo", "Alfa Romeo");
052: m.put("Toyota", "Toyota");
053: m.put("Mitsubitshi", "Mitsubitshi");
054: return m;
055: }
056:
057: // Countries
058: public Map getDefaultFavouriteCountries() {
059: Map m = new LinkedHashMap();
060: m.put("england", "England");
061: m.put("america", "America");
062: m.put("brazil", "Brazil");
063: return m;
064: }
065:
066: public List getDefaultFavouriteNumbers() {
067: List list = new ArrayList();
068: list.add("Three");
069: list.add("Seven");
070: return list;
071: }
072:
073: public List getPrioritisedFavouriteCartoonCharacters() {
074: return _prioritisedFavouriteCartoonCharacters;
075: }
076:
077: public void setPrioritisedFavouriteCartoonCharacters(
078: List prioritisedFavouriteCartoonCharacters) {
079: _prioritisedFavouriteCartoonCharacters = prioritisedFavouriteCartoonCharacters;
080: }
081:
082: public List getPrioritisedFavouriteCars() {
083: return _prioritisedFavouriteCars;
084: }
085:
086: public void setPrioritisedFavouriteCars(
087: List prioritisedFavouriteCars) {
088: _prioritisedFavouriteCars = prioritisedFavouriteCars;
089: }
090:
091: public List getPrioritisedFavouriteCountries() {
092: return _prioritisedFavouriteCountries;
093: }
094:
095: public void setPrioritisedFavouriteCountries(
096: List prioritisedFavouriteCountries) {
097: _prioritisedFavouriteCountries = prioritisedFavouriteCountries;
098: }
099:
100: public List getFavouriteNumbers() {
101: return favouriteNumbers;
102: }
103:
104: public void setFavouriteNumbers(List favouriteNumbers) {
105: this .favouriteNumbers = favouriteNumbers;
106: }
107:
108: public Map getAvailableCities() {
109: Map map = new LinkedHashMap();
110: map.put("boston", "Boston");
111: map.put("new york", "New York");
112: map.put("london", "London");
113: map.put("rome", "Rome");
114: return map;
115: }
116:
117: public List getDefaultFavouriteCities() {
118: List list = new ArrayList();
119: list.add("boston");
120: list.add("rome");
121: return list;
122: }
123:
124: // actions
125:
126: public String input() throws Exception {
127: return SUCCESS;
128: }
129:
130: public String submit() throws Exception {
131: return SUCCESS;
132: }
133: }
|