01: /*
02: * Copyright 2005-2006 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
05: * in compliance with the License. You may obtain a copy of the License at
06: *
07: * http://www.apache.org/licenses/LICENSE-2.0
08: *
09: * Unless required by applicable law or agreed to in writing, software distributed under the License
10: * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11: * or implied. See the License for the specific language governing permissions and limitations under
12: * the License.
13: */
14:
15: package org.strecks.form.impl;
16:
17: import java.util.Map;
18:
19: import org.apache.struts.action.ActionForm;
20: import org.strecks.bind.annotation.BindSelect;
21:
22: /**
23: * @author Phil Zoio
24: */
25: public class SelectForm extends ActionForm {
26:
27: private static final long serialVersionUID = 1L;
28:
29: // the fields which corresponds with the request property
30: private String selectedGender;
31:
32: // the map used to lookup for the dropdown
33: private Map<Long, Gender> availableGenders;
34:
35: // the person to whom we are trying to map a gender
36: private Person person;
37:
38: @BindSelect(targetBeanExpression="person.gender",targetBeanIdProperty="id",lookupMapExpression="availableGenders",idClass=Long.class)
39: public String getSelectedGender() {
40: return selectedGender;
41: }
42:
43: public void setSelectedGender(String selectedGender) {
44: this .selectedGender = selectedGender;
45: }
46:
47: public Map<Long, Gender> getAvailableGenders() {
48: return availableGenders;
49: }
50:
51: public void setAvailableGenders(Map<Long, Gender> availableGenders) {
52: this .availableGenders = availableGenders;
53: }
54:
55: public Person getPerson() {
56: return person;
57: }
58:
59: public void setPerson(Person person) {
60: this.person = person;
61: }
62:
63: }
|