001: /*
002: * Copyright 2005-2006 the original author or authors.
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
005: * in compliance with the License. You may obtain a copy of the License at
006: *
007: * http://www.apache.org/licenses/LICENSE-2.0
008: *
009: * Unless required by applicable law or agreed to in writing, software distributed under the License
010: * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
011: * or implied. See the License for the specific language governing permissions and limitations under
012: * the License.
013: */
014:
015: package org.strecks.web.form.impl;
016:
017: import java.util.Map;
018:
019: import org.strecks.bind.annotation.BindSelect;
020: import org.strecks.bind.annotation.BindSimple;
021: import org.strecks.converter.FullDateConverter;
022: import org.strecks.converter.SafeBeanUtilsConverter;
023: import org.strecks.validator.annotation.ValidateDate;
024: import org.strecks.validator.annotation.ValidateRequired;
025:
026: /**
027: * @author Phil Zoio
028: */
029: public class NewProjectForm extends EditProjectForm {
030:
031: private static final long serialVersionUID = 6840278372111325346L;
032:
033: /* ****** form properties ******* */
034:
035: /* ****** domain object properties ******* */
036:
037: private Project project;
038:
039: /* ****** form properties ******* */
040:
041: private String readyDate;
042:
043: private String projectName;
044:
045: private String projectDescription;
046:
047: private String selectedProjectType;
048:
049: /* ****** form getter and setters ******* */
050:
051: @BindSimple(expression="project.projectName")
052: public String getProjectName() {
053: return projectName;
054: }
055:
056: @ValidateRequired(order=1,key="project.name.required")
057: public void setProjectName(String projectName) {
058: this .projectName = projectName;
059: }
060:
061: @BindSimple(expression="project.projectDescription",converter=SafeBeanUtilsConverter.class)
062: public String getProjectDescription() {
063: return projectDescription;
064: }
065:
066: public void setProjectDescription(String projectDescription) {
067: this .projectDescription = projectDescription;
068: }
069:
070: @BindSimple(expression="project.readyDate",converter=FullDateConverter.class)
071: public String getReadyDate() {
072: return readyDate;
073: }
074:
075: @ValidateDate(order=101,key="invalid.full.date.format")
076: public void setReadyDate(String readyDate) {
077: this .readyDate = readyDate;
078: }
079:
080: @BindSelect(targetBeanExpression="project.projectType",targetBeanIdProperty="projectTypeId",lookupMapExpression="availableProjectTypes",idClass=Integer.class)
081: public String getSelectedProjectType() {
082: return selectedProjectType;
083: }
084:
085: @ValidateRequired(order=31,key="project.type.required")
086: public void setSelectedProjectType(String selectedProjectType) {
087: this .selectedProjectType = selectedProjectType;
088: }
089:
090: /* ****** domain object getters and setters ****** */
091:
092: public void setProject(Project project) {
093: this .project = project;
094: }
095:
096: public Project getProject() {
097: return project;
098: }
099:
100: /* ****** lookup maps ******* */
101:
102: private Map<Integer, ProjectType> availableProjectTypes;
103:
104: public Map<Integer, ProjectType> getAvailableProjectTypes() {
105: return availableProjectTypes;
106: }
107:
108: public void setAvailableProjectTypes(
109: Map<Integer, ProjectType> availableProjectTypes) {
110: this.availableProjectTypes = availableProjectTypes;
111: }
112:
113: }
|