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.web.form.impl;
16:
17: import java.util.Map;
18:
19: import javax.servlet.http.HttpServletRequest;
20:
21: import org.apache.struts.action.ActionForm;
22: import org.apache.struts.action.ActionMapping;
23: import org.strecks.bind.annotation.BindSelect;
24: import org.strecks.bind.annotation.BindSimple;
25: import org.strecks.validator.annotation.ValidateRequired;
26:
27: /**
28: * @author Phil Zoio
29: */
30: public class EditProjectForm extends ActionForm {
31:
32: private static final long serialVersionUID = 6840278372111325346L;
33:
34: @Override
35: public void reset(ActionMapping mapping, HttpServletRequest request) {
36: super .reset(mapping, request);
37: }
38:
39: /* ****** domain object properties ******* */
40:
41: private Project project;
42:
43: /* ****** form properties ******* */
44:
45: private String projectName;
46:
47: private String selectedProjectType;
48:
49: /* ****** lookup maps ******* */
50:
51: private Map<Integer, ProjectType> availableProjectTypes;
52:
53: /* ****** form getter and setters ******* */
54:
55: @BindSimple(expression="project.projectName")
56: public String getProjectName() {
57: return projectName;
58: }
59:
60: @ValidateRequired(order=1,key="project.name.required")
61: public void setProjectName(String projectName) {
62: this .projectName = projectName;
63: }
64:
65: @BindSelect(targetBeanExpression="project.projectType",targetBeanIdProperty="projectTypeId",lookupMapExpression="availableProjectTypes",idClass=Integer.class)
66: public String getSelectedProjectType() {
67: return selectedProjectType;
68: }
69:
70: @ValidateRequired(order=31,key="project.type.required")
71: public void setSelectedProjectType(String selectedProjectType) {
72: this .selectedProjectType = selectedProjectType;
73: }
74:
75: /* ****** domain object getters and setters ****** */
76:
77: public void setProject(Project project) {
78: this .project = project;
79: }
80:
81: public Project getProject() {
82: return project;
83: }
84:
85: /* ****** lookup getter and setters ****** */
86:
87: public Map<Integer, ProjectType> getAvailableProjectTypes() {
88: return availableProjectTypes;
89: }
90:
91: public void setAvailableProjectTypes(
92: Map<Integer, ProjectType> availableProjectTypes) {
93: this.availableProjectTypes = availableProjectTypes;
94: }
95:
96: }
|