001: package com.technoetic.xplanner.forms;
002:
003: import com.technoetic.xplanner.actions.UpdateTimeNotificationReceivers;
004: import org.apache.struts.action.ActionErrors;
005: import org.apache.struts.action.ActionMapping;
006:
007: import java.io.Serializable;
008: import java.util.ArrayList;
009: import javax.servlet.http.HttpServletRequest;
010:
011: public class ProjectEditorForm extends AbstractEditorForm {
012:
013: private String name;
014: private String description;
015: private boolean hidden;
016: private boolean sendemail;
017: private boolean optEscapeBrackets;
018: private String wikiUrl;
019: private String personToDelete;
020: private String personToAddId;
021: private ArrayList people = new ArrayList();
022:
023: public String getWikiUrl() {
024: return this .wikiUrl;
025: }
026:
027: public void setWikiUrl(String wikiUrl) {
028: this .wikiUrl = wikiUrl;
029: }
030:
031: public boolean isSendingMissingTimeEntryReminderToAcceptor() {
032: return sendemail;
033: }
034:
035: public void setSendemail(boolean sendemail) {
036: this .sendemail = sendemail;
037: }
038:
039: public boolean isOptEscapeBrackets() {
040: return optEscapeBrackets;
041: }
042:
043: public void setOptEscapeBrackets(boolean optEscapeBrackets) {
044: this .optEscapeBrackets = optEscapeBrackets;
045: }
046:
047: public String getContainerId() {
048: return null;
049: }
050:
051: public ActionErrors validate(ActionMapping mapping,
052: HttpServletRequest request) {
053: ActionErrors errors = new ActionErrors();
054: if (isSubmitted()
055: && !getAction().equals(
056: UpdateTimeNotificationReceivers.ADD)
057: && !getAction().equals(
058: UpdateTimeNotificationReceivers.DELETE)) {
059: require(errors, name, "project.editor.missing_name");
060: }
061: return errors;
062: }
063:
064: public void reset(ActionMapping mapping, HttpServletRequest request) {
065: super .reset(mapping, request);
066: name = null;
067: description = null;
068: wikiUrl = null;
069: people.clear();
070: personToDelete = null;
071:
072: hidden = false;
073: sendemail = false;
074: optEscapeBrackets = false;
075: }
076:
077: public void reset() {
078:
079: }
080:
081: public String getName() {
082: return name;
083: }
084:
085: public void setName(String name) {
086: this .name = name;
087: }
088:
089: public void setDescription(String description) {
090: this .description = description;
091: }
092:
093: public String getDescription() {
094: return description;
095: }
096:
097: public boolean isHidden() {
098: return hidden;
099: }
100:
101: public void setHidden(boolean hidden) {
102: this .hidden = hidden;
103: }
104:
105: public String getPersonToDelete() {
106: return personToDelete;
107: }
108:
109: public void setPersonToDelete(String personToDelete) {
110: this .personToDelete = personToDelete;
111: }
112:
113: public String getPersonToAddId() {
114: return personToAddId;
115: }
116:
117: public void setPersonToAddId(String personToAddId) {
118: this .personToAddId = personToAddId;
119: }
120:
121: public ArrayList getPeople() {
122: return people;
123: }
124:
125: public void addPersonInfo(String id, String userId,
126: String initials, String name) {
127: PersonInfo personInfo = this .new PersonInfo();
128: personInfo.setId(id);
129: personInfo.setUserId(userId);
130: personInfo.setName(name);
131: personInfo.setInitials(initials);
132: people.add(personInfo);
133: }
134:
135: public void removePersonInfo(int rowNbr) {
136: people.remove(rowNbr);
137: }
138:
139: public class PersonInfo implements Serializable {
140: String id;
141: String userId;
142: String initials;
143: String name;
144:
145: public String getId() {
146: return id;
147: }
148:
149: public void setId(String id) {
150: this .id = id;
151: }
152:
153: public String getUserId() {
154: return userId;
155: }
156:
157: public void setUserId(String userId) {
158: this .userId = userId;
159: }
160:
161: public String getInitials() {
162: return initials;
163: }
164:
165: public void setInitials(String initials) {
166: this .initials = initials;
167: }
168:
169: public String getName() {
170: return name;
171: }
172:
173: public void setName(String name) {
174: this .name = name;
175: }
176:
177: public boolean equals(Object obj) {
178: if (!(obj instanceof PersonInfo)) {
179: return false;
180: }
181: return this .id.equals(((PersonInfo) obj).getId());
182: }
183: }
184:
185: }
|