Changeset 3939
- Timestamp:
- Nov 2, 2010, 1:14:31 PM (13 years ago)
- Location:
- trunk/client/servlet/src/org/proteios
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/client/servlet/src/org/proteios/action/user/SaveMyProfileProperties.java
r3838 r3939 1 1 /* 2 $Id$3 4 Copyright (C) 2006, 2007Gregory Vincic5 6 Files are copyright by their respective authors. The contributions to7 files where copyright is not explicitly stated can be traced with the8 source code revision system.9 10 This file is part of Proteios.11 Available at http://www.proteios.org/12 13 Proteios-2.x is free software; you can redistribute it and/or14 modify it under the terms of the GNU General Public License15 as published by the Free Software Foundation; either version 216 of the License, or (at your option) any later version.17 18 Proteios is distributed in the hope that it will be useful,19 but WITHOUT ANY WARRANTY; without even the implied warranty of20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the21 GNU General Public License for more details.22 23 You should have received a copy of the GNU General Public License24 along with this program; if not, write to the Free Software25 Foundation, Inc., 59 Temple Place - Suite 330,26 Boston, MA 02111-1307, USA.27 2 $Id$ 3 4 Copyright (C) 2006, 2007, 2010 Gregory Vincic 5 6 Files are copyright by their respective authors. The contributions to 7 files where copyright is not explicitly stated can be traced with the 8 source code revision system. 9 10 This file is part of Proteios. 11 Available at http://www.proteios.org/ 12 13 Proteios-2.x is free software; you can redistribute it and/or 14 modify it under the terms of the GNU General Public License 15 as published by the Free Software Foundation; either version 2 16 of the License, or (at your option) any later version. 17 18 Proteios is distributed in the hope that it will be useful, 19 but WITHOUT ANY WARRANTY; without even the implied warranty of 20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 GNU General Public License for more details. 22 23 You should have received a copy of the GNU General Public License 24 along with this program; if not, write to the Free Software 25 Foundation, Inc., 59 Temple Place - Suite 330, 26 Boston, MA 02111-1307, USA. 27 */ 28 28 package org.proteios.action.user; 29 29 … … 35 35 import se.lu.thep.waf.constraints.InvalidParameterValue; 36 36 37 /**38 * @author gregory39 */40 37 public class SaveMyProfileProperties 41 38 extends ProteiosAction<SaveMyProfileProperties> 42 39 { 43 @Override 44 public void runMe() 45 throws ActionException, InvalidParameterValue 46 { 47 Form form; 48 String name, email,descr,phone,address,organisation; 49 DbControl dc; 50 User user; 51 52 form = getFormFactory().getViewUserPropertiesForm(null); 53 verifyParameters(form); 54 55 name = getString(NameField.VPARAM); 56 email = getString(EmailField.VPARAM); 57 descr = getString(DescriptionField.VPARAM); 58 phone = getString(PhoneField.VPARAM); 59 address = getString(AddressField.VPARAM); 60 organisation = getString(OrganisationField.VPARAM); 61 62 // Save user 63 dc = newDbControl(); 64 user = getOwner(); 65 dc.reattachItem(user); 66 67 user.setName(name); 68 user.setEmail(email); 69 user.setDescription(descr); 70 user.setPhone(phone); 71 user.setAddress(address); 72 user.setOrganisation(organisation); 73 dc.commit(); 74 75 setMessage("User properties saved"); 76 77 setForwardTo(ViewMyProfileAction.class); 78 } 40 @Override 41 public void runMe() 42 throws ActionException, InvalidParameterValue 43 { 44 Form form; 45 String name, email,descr,phone,address,organisation; 46 DbControl dc; 47 User user; 48 49 form = getFormFactory().getForm(User.class); 50 verifyParameters(form); 51 52 name = getString(NameField.VPARAM); 53 email = getString(EmailField.VPARAM); 54 descr = getString(DescriptionField.VPARAM); 55 phone = getString(PhoneField.VPARAM); 56 address = getString(AddressField.VPARAM); 57 organisation = getString(OrganisationField.VPARAM); 58 59 user = getOwner(); 60 user.setName(name); 61 user.setEmail(email); 62 user.setDescription(descr); 63 user.setPhone(phone); 64 user.setAddress(address); 65 user.setOrganisation(organisation); 66 67 dc = newDbControl(); 68 dc.reattachItem(user); 69 dc.commit(); 70 71 setMessage("User properties saved"); 72 setForwardTo(ViewMyProfileAction.class); 73 } 79 74 } -
trunk/client/servlet/src/org/proteios/action/user/SaveUserProperties.java
r3838 r3939 1 1 /* 2 $Id$3 4 Copyright (C) 2006, 2007Gregory Vincic5 6 Files are copyright by their respective authors. The contributions to7 files where copyright is not explicitly stated can be traced with the8 source code revision system.9 10 This file is part of Proteios.11 Available at http://www.proteios.org/12 13 Proteios is free software; you can redistribute it and/or14 modify it under the terms of the GNU General Public License15 as published by the Free Software Foundation; either version 216 of the License, or (at your option) any later version.17 18 Proteios is distributed in the hope that it will be useful,19 but WITHOUT ANY WARRANTY; without even the implied warranty of20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the21 GNU General Public License for more details.22 23 You should have received a copy of the GNU General Public License24 along with this program; if not, write to the Free Software25 Foundation, Inc., 59 Temple Place - Suite 330,26 Boston, MA 02111-1307, USA.27 2 $Id$ 3 4 Copyright (C) 2006, 2007, 2010 Gregory Vincic 5 6 Files are copyright by their respective authors. The contributions to 7 files where copyright is not explicitly stated can be traced with the 8 source code revision system. 9 10 This file is part of Proteios. 11 Available at http://www.proteios.org/ 12 13 Proteios is free software; you can redistribute it and/or 14 modify it under the terms of the GNU General Public License 15 as published by the Free Software Foundation; either version 2 16 of the License, or (at your option) any later version. 17 18 Proteios is distributed in the hope that it will be useful, 19 but WITHOUT ANY WARRANTY; without even the implied warranty of 20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 GNU General Public License for more details. 22 23 You should have received a copy of the GNU General Public License 24 along with this program; if not, write to the Free Software 25 Foundation, Inc., 59 Temple Place - Suite 330, 26 Boston, MA 02111-1307, USA. 27 */ 28 28 package org.proteios.action.user; 29 29 … … 35 35 import se.lu.thep.waf.constraints.InvalidParameterValue; 36 36 37 /**38 * @author gregory39 */40 37 public class SaveUserProperties 41 38 extends ProteiosAction<SaveUserProperties> 42 39 { 43 @Override 44 public void runMe() 45 throws ActionException, InvalidParameterValue 46 { 47 Form form; 48 Integer userId; 49 String name, email,descr,phone,address,organisation; 50 DbControl dc; 51 User user; 52 53 form = getFormFactory().getViewUserPropertiesForm(null); 54 verifyParameters(form); 55 56 userId = getValidInteger(FormFactory.VID); 57 name = getString(NameField.VPARAM); 58 email = getString(EmailField.VPARAM); 59 descr = getString(DescriptionField.VPARAM); 60 phone = getString(PhoneField.VPARAM); 61 address = getString(AddressField.VPARAM); 62 organisation = getString(OrganisationField.VPARAM); 63 64 // Save user 65 dc = newDbControl(); 66 user = User.getById(dc, userId); 67 user.setName(name); 68 user.setEmail(email); 69 user.setDescription(descr); 70 user.setPhone(phone); 71 user.setAddress(address); 72 user.setOrganisation(organisation); 73 dc.commit(); 74 75 setMessage("User properties saved"); 76 77 setForwardTo(ViewActiveUser.class); 78 } 40 @Override 41 public void runMe() 42 throws ActionException, InvalidParameterValue 43 { 44 Form form; 45 Integer userId; 46 String name, email,descr,phone,address,organisation; 47 DbControl dc; 48 User user; 49 50 form = getFormFactory().getForm(User.class); 51 verifyParameters(form); 52 53 userId = getValidInteger(FormFactory.VID); 54 name = getString(NameField.VPARAM); 55 email = getString(EmailField.VPARAM); 56 descr = getString(DescriptionField.VPARAM); 57 phone = getString(PhoneField.VPARAM); 58 address = getString(AddressField.VPARAM); 59 organisation = getString(OrganisationField.VPARAM); 60 61 // Save user 62 dc = newDbControl(); 63 user = getItemFactory(dc).getById(dc, userId); 64 user.setName(name); 65 user.setEmail(email); 66 user.setDescription(descr); 67 user.setPhone(phone); 68 user.setAddress(address); 69 user.setOrganisation(organisation); 70 dc.commit(); 71 72 setMessage("User properties saved"); 73 setForwardTo(ViewActiveUser.class); 74 } 79 75 } -
trunk/client/servlet/src/org/proteios/action/user/ViewActiveUser.java
r3801 r3939 1 1 /* 2 $Id$3 4 Copyright (C) 2006, 2007Gregory Vincic5 6 Files are copyright by their respective authors. The contributions to7 files where copyright is not explicitly stated can be traced with the8 source code revision system.9 10 This file is part of Proteios.11 Available at http://www.proteios.org/12 13 Proteios is free software; you can redistribute it and/or14 modify it under the terms of the GNU General Public License15 as published by the Free Software Foundation; either version 216 of the License, or (at your option) any later version.17 18 Proteios is distributed in the hope that it will be useful,19 but WITHOUT ANY WARRANTY; without even the implied warranty of20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the21 GNU General Public License for more details.22 23 You should have received a copy of the GNU General Public License24 along with this program; if not, write to the Free Software25 Foundation, Inc., 59 Temple Place - Suite 330,26 Boston, MA 02111-1307, USA.27 2 $Id$ 3 4 Copyright (C) 2006, 2007, 2010 Gregory Vincic 5 6 Files are copyright by their respective authors. The contributions to 7 files where copyright is not explicitly stated can be traced with the 8 source code revision system. 9 10 This file is part of Proteios. 11 Available at http://www.proteios.org/ 12 13 Proteios is free software; you can redistribute it and/or 14 modify it under the terms of the GNU General Public License 15 as published by the Free Software Foundation; either version 2 16 of the License, or (at your option) any later version. 17 18 Proteios is distributed in the hope that it will be useful, 19 but WITHOUT ANY WARRANTY; without even the implied warranty of 20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 GNU General Public License for more details. 22 23 You should have received a copy of the GNU General Public License 24 along with this program; if not, write to the Free Software 25 Foundation, Inc., 59 Temple Place - Suite 330, 26 Boston, MA 02111-1307, USA. 27 */ 28 28 package org.proteios.action.user; 29 29 … … 33 33 import org.proteios.core.DbControl; 34 34 import org.proteios.core.User; 35 import org.proteios.gui.ColumnContainer; 36 import org.proteios.gui.RowContainer; 37 import org.proteios.gui.Title; 35 38 import org.proteios.gui.Toolbar; 36 import org.proteios.gui.Title;37 import org.proteios.gui.RowContainer;38 import org.proteios.gui.ColumnContainer;39 39 import org.proteios.gui.form.*; 40 40 import org.proteios.gui.layout.RowLayout; … … 43 43 import se.lu.thep.waf.constraints.VInteger; 44 44 45 /**46 * @author gregory47 */48 45 public class ViewActiveUser 49 46 extends ProteiosAction<ViewActiveUser> 50 47 { 51 public static final VInteger VUSERID = new VInteger("active.user.id", 1, 52 true); 53 54 55 @Override 56 public void runMe() 57 throws ActionException, InvalidParameterValue 58 { 59 // Define 60 RowLayout layout; 61 Integer id; 62 DbControl dc; 63 User user; 64 Form propertiesF, passwordF, rolesF, groupsF; 65 Toolbar tb1, tb2, tb3, tb4; 66 ActionLink saveUser, savePwd, saveRoles, saveGroups, newGroup; 67 RowContainer rc, rc1; 68 ColumnContainer cc; 69 Title title; 70 71 // Create 72 verifySessionAttributes(VUSERID); 73 layout = getLayoutFactory().getRowLayout(); 74 id = getSessionAttribute(VUSERID); 75 dc = newDbControl(); 76 user = User.getById(dc, id); 77 tb1 = new Toolbar(); 78 tb2 = new Toolbar(); 79 tb3 = new Toolbar(); 80 tb4 = new Toolbar(); 81 savePwd = getActionFactory().getActionLink(ChangeUserPassword.class, "Save"); 82 saveUser = getActionFactory().getActionLink(SaveUserProperties.class, "Save"); 83 saveRoles = getActionFactory().getActionLink(SaveUserRoles.class, "Save"); 84 saveGroups = getActionFactory().getActionLink(SaveUserGroups.class, "Save"); 85 newGroup = getActionFactory().getActionLink(NewGroup.class, "New"); 86 rc = new RowContainer(); 87 rc1 = new RowContainer(); 88 cc = new ColumnContainer(); 89 title = new Title("User"); 90 91 passwordF = new ProfilePasswordForm(user); 92 rolesF = new UserRolesForm(user); 93 groupsF = new GroupsForm(user); 94 propertiesF = getFormFactory().getViewUserPropertiesForm(user); 95 title.setSubtitle(user.getName()); 96 // The roles form needs an open DbControl to list roles 97 close(dc); 98 99 // Use 100 tb1.add(saveUser); 101 tb2.add(savePwd); 102 tb3.add(saveRoles); 103 tb4.add(saveGroups); 104 tb4.add(newGroup); 105 106 propertiesF.setToolbar(tb1); 107 passwordF.setToolbar(tb2); 108 rolesF.setToolbar(tb3); 109 groupsF.setToolbar(tb4); 110 111 rc.add(propertiesF); 112 113 rc1.add(passwordF); 114 rc1.add(rolesF); 115 rc1.add(groupsF); 116 117 cc.add(rc); 118 cc.add(rc1); 119 120 layout.add(title); 121 layout.add(cc); 122 setLayout(layout); 123 } 48 public static final VInteger VUSERID = new VInteger("active.user.id", 1, 49 true); 50 51 @Override 52 public void runMe() 53 throws ActionException, InvalidParameterValue 54 { 55 RowLayout layout; 56 Integer id; 57 DbControl dc; 58 User user; 59 Form propertiesF, passwordF, rolesF, groupsF; 60 Toolbar tb1, tb2, tb3, tb4; 61 ActionLink saveUser, savePwd, saveRoles, saveGroups, newGroup; 62 RowContainer rc, rc1; 63 ColumnContainer cc; 64 Title title; 65 66 verifySessionAttributes(VUSERID); 67 layout = getLayoutFactory().getRowLayout(); 68 id = getSessionAttribute(VUSERID); 69 dc = newDbControl(); 70 user = User.getById(dc, id); 71 tb1 = new Toolbar(); 72 tb2 = new Toolbar(); 73 tb3 = new Toolbar(); 74 tb4 = new Toolbar(); 75 savePwd = getActionFactory().getActionLink(ChangeUserPassword.class, "Save"); 76 saveUser = getActionFactory().getActionLink(SaveUserProperties.class, "Save"); 77 saveRoles = getActionFactory().getActionLink(SaveUserRoles.class, "Save"); 78 saveGroups = getActionFactory().getActionLink(SaveUserGroups.class, "Save"); 79 newGroup = getActionFactory().getActionLink(NewGroup.class, "New"); 80 rc = new RowContainer(); 81 rc1 = new RowContainer(); 82 cc = new ColumnContainer(); 83 title = new Title("User"); 84 85 passwordF = new ProfilePasswordForm(user); 86 rolesF = new UserRolesForm(user); 87 groupsF = new GroupsForm(user); 88 propertiesF = getFormFactory().getForm(User.class, user); 89 title.setSubtitle(user.getName()); 90 // The roles form needs an open DbControl to list roles 91 close(dc); 92 93 // Use 94 tb1.add(saveUser); 95 tb2.add(savePwd); 96 tb3.add(saveRoles); 97 tb4.add(saveGroups); 98 tb4.add(newGroup); 99 100 propertiesF.setToolbar(tb1); 101 passwordF.setToolbar(tb2); 102 rolesF.setToolbar(tb3); 103 groupsF.setToolbar(tb4); 104 105 rc.add(propertiesF); 106 107 rc1.add(passwordF); 108 rc1.add(rolesF); 109 rc1.add(groupsF); 110 111 cc.add(rc); 112 cc.add(rc1); 113 114 layout.add(title); 115 layout.add(cc); 116 setLayout(layout); 117 } 124 118 } -
trunk/client/servlet/src/org/proteios/action/user/ViewMyProfileAction.java
r3938 r3939 1 1 /* 2 $Id$3 4 Copyright (C) 2006, 2007Gregory Vincic5 6 Files are copyright by their respective authors. The contributions to7 files where copyright is not explicitly stated can be traced with the8 source code revision system.9 10 This file is part of Proteios.11 Available at http://www.proteios.org/12 13 Proteios-2.x is free software; you can redistribute it and/or14 modify it under the terms of the GNU General Public License15 as published by the Free Software Foundation; either version 216 of the License, or (at your option) any later version.17 18 Proteios is distributed in the hope that it will be useful,19 but WITHOUT ANY WARRANTY; without even the implied warranty of20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the21 GNU General Public License for more details.22 23 You should have received a copy of the GNU General Public License24 along with this program; if not, write to the Free Software25 Foundation, Inc., 59 Temple Place - Suite 330,26 Boston, MA 02111-1307, USA.27 2 $Id$ 3 4 Copyright (C) 2006, 2007, 2010 Gregory Vincic 5 6 Files are copyright by their respective authors. The contributions to 7 files where copyright is not explicitly stated can be traced with the 8 source code revision system. 9 10 This file is part of Proteios. 11 Available at http://www.proteios.org/ 12 13 Proteios-2.x is free software; you can redistribute it and/or 14 modify it under the terms of the GNU General Public License 15 as published by the Free Software Foundation; either version 2 16 of the License, or (at your option) any later version. 17 18 Proteios is distributed in the hope that it will be useful, 19 but WITHOUT ANY WARRANTY; without even the implied warranty of 20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 GNU General Public License for more details. 22 23 You should have received a copy of the GNU General Public License 24 along with this program; if not, write to the Free Software 25 Foundation, Inc., 59 Temple Place - Suite 330, 26 Boston, MA 02111-1307, USA. 27 */ 28 28 package org.proteios.action.user; 29 29 … … 31 31 import org.proteios.ActionLink; 32 32 import org.proteios.action.ProteiosAction; 33 import org.proteios.core.DbControl; 34 import org.proteios.core.ItemQuery; 35 import org.proteios.core.Role; 33 36 import org.proteios.core.User; 34 import org.proteios.core.Role; 35 import org.proteios.core.ItemQuery; 36 import org.proteios.core.DbControl; 37 import org.proteios.gui.ColumnContainer; 38 import org.proteios.gui.ListItem; 39 import org.proteios.gui.Listing; 40 import org.proteios.gui.RowContainer; 37 41 import org.proteios.gui.Title; 38 42 import org.proteios.gui.Toolbar; 39 import org.proteios.gui.Listing;40 import org.proteios.gui.ListItem;41 import org.proteios.gui.ColumnContainer;42 import org.proteios.gui.RowContainer;43 43 import org.proteios.gui.form.*; 44 44 import org.proteios.gui.layout.RowLayout; 45 46 45 import se.lu.thep.waf.ActionException; 47 46 import se.lu.thep.waf.constraints.InvalidParameterValue; 48 47 49 48 /** 50 * Displays the currently logged in users profile. 51 * 52 * @author gregory 53 */ 49 Displays the currently logged in users profile. 50 */ 54 51 public class ViewMyProfileAction 55 52 extends ProteiosAction<ViewMyProfileAction> 56 53 { 57 @Override 58 public void runMe() 59 throws ActionException, InvalidParameterValue 60 { 61 // Define 62 User user; 63 RowLayout layout; 64 Title title; 65 Form propertiesForm, pwdForm; 66 Toolbar tb1, tb2; 67 ActionLink save, changePassword; 68 ColumnContainer cc; 69 Listing roles; 70 ListItem li; 71 RowContainer rc; 72 DbControl dc; 73 74 dc = newDbControl(); 75 layout = getLayoutFactory().getRowLayout(); 76 user = getOwner(); 77 title = new Title("Profile"); 78 propertiesForm = getFormFactory().getForm(User.class, user); 79 tb1 = new Toolbar(); 80 save = getActionFactory().getActionLink(SaveMyProfileProperties.class, 81 "Save"); 82 rc = new RowContainer(); 83 cc = new ColumnContainer(); 84 roles = new Listing(); 85 roles.setTitle("Roles"); 86 87 title.setSubtitle(user.getLogin()); 88 propertiesForm.setToolbar(tb1); 89 tb1.add(save); 90 91 pwdForm = null; 92 if (!user.isMultiuserAccount()) 93 { 94 pwdForm = new ProfilePasswordForm(user); 95 tb2 = new Toolbar(); 96 changePassword = getActionFactory().getActionLink( 97 ChangeMyPassword.class, "ChangePassword"); 98 99 pwdForm.setToolbar(tb2); 100 tb2.add(changePassword); 101 } 102 103 for(Role role : user.getRoles().list(dc)) 104 { 105 li = new ListItem(role.getId()); 106 li.setTitle(role.getName()); 107 li.setContent(role.getDescription()); 108 roles.add(li); 109 } 110 layout.add(title); 111 cc.add(propertiesForm); 112 if(pwdForm != null) { rc.add(pwdForm); } 113 rc.add(roles); 114 cc.add(rc); 115 layout.add(cc); 116 setLayout(layout); 117 } 118 119 120 public @Override 121 AbstractLink getHistoryAction() 122 { 123 return getActionFactory().getActionLink(ViewMyProfileAction.class, 124 "Profile"); 125 } 54 @Override 55 public void runMe() 56 throws ActionException, InvalidParameterValue 57 { 58 User user; 59 RowLayout layout; 60 Title title; 61 Form propertiesForm, pwdForm; 62 Toolbar tb1, tb2; 63 ActionLink save, changePassword; 64 ColumnContainer cc; 65 Listing roles; 66 ListItem li; 67 RowContainer rc; 68 DbControl dc; 69 70 dc = newDbControl(); 71 layout = getLayoutFactory().getRowLayout(); 72 user = getOwner(); 73 title = new Title("Profile"); 74 propertiesForm = getFormFactory().getForm(User.class, user); 75 tb1 = new Toolbar(); 76 save = getActionFactory().getActionLink(SaveMyProfileProperties.class, "Save"); 77 rc = new RowContainer(); 78 cc = new ColumnContainer(); 79 roles = new Listing(); 80 roles.setTitle("Roles"); 81 82 title.setSubtitle(user.getLogin()); 83 propertiesForm.setToolbar(tb1); 84 tb1.add(save); 85 86 pwdForm = null; 87 if (!user.isMultiuserAccount()) 88 { 89 changePassword = getActionFactory().getActionLink(ChangeMyPassword.class, "ChangePassword"); 90 tb2 = new Toolbar(); 91 tb2.add(changePassword); 92 93 pwdForm = new ProfilePasswordForm(user); 94 pwdForm.setToolbar(tb2); 95 } 96 97 for(Role role : user.getRoles().list(dc)) 98 { 99 li = new ListItem(role.getId()); 100 li.setTitle(role.getName()); 101 li.setContent(role.getDescription()); 102 roles.add(li); 103 } 104 layout.add(title); 105 cc.add(propertiesForm); 106 if(pwdForm != null) { rc.add(pwdForm); } 107 rc.add(roles); 108 cc.add(rc); 109 layout.add(cc); 110 setLayout(layout); 111 } 126 112 } -
trunk/client/servlet/src/org/proteios/gui/form/FormFactory.java
r3938 r3939 1 1 /* 2 2 $Id$ 3 3 4 4 Copyright (C) 2006, 2007 Fredrik Levander, Gregory Vincic, Olle Mansson 5 5 6 6 Files are copyright by their respective authors. The contributions to 7 7 files where copyright is not explicitly stated can be traced with the 8 8 source code revision system. 9 9 10 10 This file is part of Proteios. 11 11 Available at http://www.proteios.org/ 12 12 13 13 proteios-2.x is free software; you can redistribute it and/or 14 14 modify it under the terms of the GNU General Public License 15 15 as published by the Free Software Foundation; either version 2 16 16 of the License, or (at your option) any later version. 17 17 18 18 Proteios is distributed in the hope that it will be useful, 19 19 but WITHOUT ANY WARRANTY; without even the implied warranty of 20 20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 21 GNU General Public License for more details. 22 22 23 23 You should have received a copy of the GNU General Public License 24 24 along with this program; if not, write to the Free Software … … 173 173 private static final org.apache.log4j.Logger log = org.apache.log4j.LogManager 174 174 .getLogger("org.proteios.gui.form"); 175 175 176 176 /** 177 177 Default constructor. Initializes list excludedDeclMethods. … … 184 184 initExcludedDeclMethods(); 185 185 } 186 186 187 187 /** 188 188 Get list of excluded getter methods declared in current class. 189 189 190 190 @return List<String> of excluded getter methods. 191 191 */ … … 194 194 return this.excludedDeclMethods; 195 195 } 196 196 197 197 /** 198 198 Set list of excluded getter methods declared in current class. 199 199 200 200 @param excludedDeclMethods List<String> of excluded getter methods to 201 201 set. 202 202 */ 203 203 public void setExcludedDeclMethods(List<String> excludedDeclMethods) … … 205 205 this.excludedDeclMethods = excludedDeclMethods; 206 206 } 207 207 208 208 /** 209 209 Add list of excluded getter methods declared in current class. 210 210 211 211 @param excludedDeclMethods List<String> of excluded getter methods to to 212 212 add. 213 213 */ 214 214 public void addExcludedDeclMethods(List<String> excludedDeclMethods) … … 225 225 } 226 226 } 227 227 228 228 public void setActionFactory(ActionFactory af) 229 229 { 230 230 this.actionFactory = af; 231 231 } 232 232 233 233 public String getForwardActionId() 234 234 { 235 235 return this.forwardActionId; 236 236 } 237 237 238 238 public void setForwardActionId(String forwardActionId) 239 239 { 240 240 this.forwardActionId = forwardActionId; 241 241 } 242 242 243 243 public String getSortColumnKey() 244 244 { 245 245 return this.sortColumnKey; 246 246 } 247 247 248 248 public void setSortColumnKey(String sortColumnKey) 249 249 { 250 250 this.sortColumnKey = sortColumnKey; 251 251 } 252 252 253 253 public Integer getFilterListSize() 254 254 { 255 255 return this.filterListSize; 256 256 } 257 257 258 258 public void setFilterListSize(Integer filterListSize) 259 259 { 260 260 this.filterListSize = filterListSize; 261 261 } 262 262 263 263 public List<String> getFilterKeyColumnList() 264 264 { 265 265 return this.filterKeyColumnList; 266 266 } 267 267 268 268 public void setFilterKeyColumnList(List<String> filterKeyColumnList) 269 269 { 270 270 this.filterKeyColumnList = filterKeyColumnList; 271 271 } 272 272 273 273 public HashMap<String, String> getFilterClassColumnHashMap() 274 274 { 275 275 return this.filterClassColumnHashMap; 276 276 } 277 277 278 278 public void setFilterClassColumnHashMap( 279 279 HashMap<String, String> filterClassColumnHashMap) … … 281 281 this.filterClassColumnHashMap = filterClassColumnHashMap; 282 282 } 283 283 284 284 public HashMap<String, String> getFilterConditionColumnHashMap() 285 285 { 286 286 return this.filterConditionColumnHashMap; 287 287 } 288 288 289 289 public void setFilterConditionColumnHashMap( 290 290 HashMap<String, String> filterConditionColumnHashMap) … … 292 292 this.filterConditionColumnHashMap = filterConditionColumnHashMap; 293 293 } 294 294 295 295 public HashMap<String, String> getFilterValueColumnHashMap() 296 296 { 297 297 return this.filterValueColumnHashMap; 298 298 } 299 299 300 300 public void setFilterValueColumnHashMap( 301 301 HashMap<String, String> filterValueColumnHashMap) … … 303 303 this.filterValueColumnHashMap = filterValueColumnHashMap; 304 304 } 305 305 306 306 /** 307 307 Initializes list of excluded getter methods declared in current class. … … 320 320 getExcludedDeclMethods().add("getAnnotatableParents"); 321 321 } 322 322 323 323 public HttpServletRequest getRequest() 324 324 { 325 325 return request; 326 326 } 327 327 328 328 public void setRequest(HttpServletRequest request) 329 329 { 330 330 this.request = request; 331 331 } 332 332 333 333 public void modifyForPopup(Fieldset fs) 334 334 { 335 335 actionFactory.modifyForPopup(fs); 336 336 } 337 337 338 338 private FileField newFileField() 339 339 { … … 342 342 return fileF; 343 343 } 344 344 345 345 public TextField<Integer> newIdField() 346 346 { … … 350 350 return idF; 351 351 } 352 352 353 353 private TextField<String> newValueField(String setValueMethodName, 354 354 Class<?> valueClass) … … 382 382 return valueF; 383 383 } 384 384 385 385 private TextArea newValueTextArea(String setValueMethodName, 386 386 Class<?> valueClass) … … 421 421 return valueF; 422 422 } 423 424 423 425 424 public TextField<Integer> newHiddenItemIdField() 426 425 { … … 428 427 return field; 429 428 } 430 429 431 430 private TextField<Boolean> newHiddenReadOnlyFormField() 432 431 { … … 435 434 return field; 436 435 } 437 436 438 437 private TextField<Integer> newHiddenIntegerField(VInteger vInteger) 439 438 { … … 442 441 return field; 443 442 } 444 443 445 444 private TextField<String> newHiddenStringField(VString vString) 446 445 { … … 449 448 return field; 450 449 } 451 452 450 453 451 public <D extends BasicItem<?>, E extends ProteiosAction<?>> Form getAnnotationsForm( 454 452 DbControl dc, D item, Class<E> forwardAction) … … 500 498 return form; 501 499 } 502 500 503 501 /** 504 502 @return Hidden 505 503 <code>TextField<String> using the valid parameter {@link #VTYPE}. 506 504 */ 507 505 private TextField<String> newTypeField() … … 510 508 return field; 511 509 } 512 513 public Form getViewUserPropertiesForm(User user) 514 { 515 return getForm(User.class, user); 516 } 517 510 518 511 /** 519 512 Form for user preferences configuration settings. Arguments … … 521 514 holders for current values for the notification configuration and table 522 515 preferences configuration form fields. 523 516 524 517 @param nc NotificationConfiguration object (need not be stored in 525 518 database) with default field values. 526 519 @return Form A form for setting user preferences configuration values. 527 520 */ … … 539 532 return form; 540 533 } 541 534 542 535 /** 543 536 Fieldset for notification configuration settings. Argument 544 537 NotificationConfiguration is place holder for current values for the 545 538 notification configuration form fields. 546 539 547 540 @param nc NotificationConfiguration object (need not be stored in 548 541 database) with default field values. 549 542 @return Fieldset A fieldset for setting NotificationConfiguration values. 550 543 */ … … 596 589 return properties; 597 590 } 598 591 599 592 /** 600 593 Creates a select box for notification mode. 601 594 602 595 @param modeValue int Mode value for default selection. 603 596 @return Select<VInteger> Select box for notification mode selection … … 624 617 return modeS; 625 618 } 626 619 627 620 /** 628 621 Fieldset for table preferences configuration settings. Argument 629 622 TablePreferencesConfiguration is place holder for current values for the 630 623 table preferences configuration form fields. 631 624 632 625 @param tpc TablePreferencesConfiguration object (need not be stored in 633 626 database) with default field values. 634 627 @return Fieldset A field set for setting TablePreferencesConfiguration 635 628 values. 636 629 */ 637 630 public Fieldset getTablePreferencesConfigurationFieldset( … … 659 652 return properties; 660 653 } 661 654 662 655 /** 663 656 Creates a select box for table preferences mode. 664 657 665 658 @param modeValue int Mode value for default selection. 666 659 @return Select<VInteger> Select box for table preferences mode selection … … 687 680 return modeS; 688 681 } 689 682 690 683 /** 691 684 This will probably be removed when fixint #691 … … 786 779 return form; 787 780 } 788 781 789 782 /** 790 783 @param hit Current Hit … … 1002 995 return form; 1003 996 } 1004 997 1005 998 /** 1006 999 @param a annotation … … 1015 1008 return sb.toString(); 1016 1009 } 1017 1010 1018 1011 /** 1019 1012 Returns a form for selecting spectrum mass range limits. 1020 1013 1021 1014 @param massCutoffLow String The lower cutoff mass value. 1022 1015 @param massCutoffHigh String The upper cutoff mass value. … … 1064 1057 return form; 1065 1058 } 1066 1059 1067 1060 /** 1068 1061 Returns a form with spectrum properties for a spectrum obtained from a 1069 1062 spectrum file. 1070 1063 1071 1064 @param spectrumFile File Core file with spectrum. 1072 1065 @param spectrumId String Spectrum id string. … … 1277 1270 return form; 1278 1271 } 1279 1272 1280 1273 /** 1281 1274 Returns a form with spectrum file instrument data for a spectrum file. 1282 1275 1283 1276 @param spectrumFileInstrumentList List<SpectrumFileInstrumentInterface> 1284 1277 Spectrum file instrument list. 1285 1278 @return Form for displaying spectrum file instrument data. 1286 1279 */ … … 1465 1458 return form; 1466 1459 } 1467 1460 1468 1461 /** 1469 1462 Adds a table row to a table. A "value" argument that is null will be 1470 1463 represented as an empty string, otherwise by its toString() value. 1471 1464 1472 1465 @param table Table The table to add a row to. 1473 1466 @param nameKey String Property key string. 1474 1467 @param value Object Property value object. 1475 1468 @param actionClass Class<E extends ProteiosAction> Optional value cell 1476 1469 action. 1477 1470 @param itemId int The item id to use for an optional action. 1478 1471 */ … … 1506 1499 table.addRow(row); 1507 1500 } 1508 1501 1509 1502 /** 1510 1503 Returns a form with spectrum file contact data for a spectrum file. 1511 1504 1512 1505 @param spectrumContact Spectrum file contact 1513 1506 data. 1514 1507 @return Form for displaying spectrum file contact data. 1515 1508 */ … … 1592 1585 return form; 1593 1586 } 1594 1587 1595 1588 /** 1596 1589 Returns a form for adding spectrum file sample data for a spectrum file. 1597 1590 1598 1591 @param project Project The project in whose directory a new output 1599 1592 directory is created. 1600 1593 @param outputDirNameDefault String The default name of the output 1601 1594 directory. 1602 1595 @return Form for displaying spectrum file contact data. 1603 1596 */ … … 1685 1678 return form; 1686 1679 } 1687 1680 1688 1681 private <D extends Object> TextField<D> newTextField(String name, D value) 1689 1682 { … … 1694 1687 return field; 1695 1688 } 1696 1689 1697 1690 public Form getPeakListSetForm(PeakListSet pls) 1698 1691 { … … 1762 1755 return form; 1763 1756 } 1764 1757 1765 1758 public Form getExportPeakListSetForm(PeakListSet pls) 1766 1759 { … … 1809 1802 return form; 1810 1803 } 1811 1804 1812 1805 private void addAnnotationsAsFields(Fieldset to, Annotatable item, 1813 1806 DbControl dc) … … 1824 1817 } 1825 1818 } 1826 1819 1827 1820 public Fieldset getProteinAssemblyFieldset(Project project) 1828 1821 { … … 1847 1840 return properties; 1848 1841 } 1849 1842 1850 1843 public Select<VString> selectLocalSampleIdWithAllOption(DbControl dc, 1851 1844 Project project) … … 1861 1854 return select; 1862 1855 } 1863 1856 1864 1857 private Select<VInteger> newSelectLabel(LabeledExtract le, DbControl dc) 1865 1858 { … … 1882 1875 return select; 1883 1876 } 1884 1885 1877 1886 1878 /** 1887 1879 Creates and adds a hidden field with an Integer value to the given form. … … 1895 1887 form.getFieldsets().get(0).add(field); 1896 1888 } 1897 1889 1898 1890 /** 1899 1891 Creates and adds a hidden field with an Integer value to the given table. … … 1907 1899 table.add(field); 1908 1900 } 1909 1901 1910 1902 public Fieldset getUsedSampleFieldset(Sample sample) 1911 1903 { … … 1925 1917 return fs; 1926 1918 } 1927 1919 1928 1920 public Fieldset getUsedExtractFieldset(Extract extract) 1929 1921 { … … 1940 1932 return fs; 1941 1933 } 1942 1934 1943 1935 public Fieldset getUsedLabeledExtractFieldset(LabeledExtract extract) 1944 1936 { … … 1958 1950 return fs; 1959 1951 } 1960 1961 1952 1962 1953 public Form getSecondaryLabeledExtractForm(LabeledExtract extract, 1963 1954 DbControl dc, LabeledExtract fromExtract) … … 2022 2013 return form; 2023 2014 } 2024 2015 2025 2016 public Form getSetFilterForm(String filterName, String filterClass, 2026 2017 String filterCondition, String filterValue) … … 2116 2107 return form; 2117 2108 } 2118 2109 2119 2110 private void addFilterSettingsToFieldset(Fieldset fs) 2120 2111 { … … 2180 2171 } 2181 2172 } 2182 2173 2183 2174 public TextField<Float> newOriginalQuantityField() 2184 2175 { … … 2188 2179 return field; 2189 2180 } 2190 2181 2191 2182 public TextField<Float> newRemainingQuantityField(Float remainingQuantity) 2192 2183 { … … 2199 2190 return field; 2200 2191 } 2201 2202 2192 2203 2193 /** 2204 2194 Get generic form for object. 2205 2195 2206 2196 @param template template for generic form 2207 2197 @return Form for editing the object … … 2212 2202 Analyze object class 2213 2203 */ 2214 2204 2215 2205 /* 2216 2206 Get class from formTemplate itemObject or itemClass. … … 2239 2229 clsName = itemClass.getSimpleName(); 2240 2230 } 2241 2231 2242 2232 /*********************************************************************** 2243 2233 Main fieldset … … 2326 2316 methodArr = itemClass.getMethods(); 2327 2317 } 2328 2318 2329 2319 /* 2330 2320 Methods declared in object class (not inherited) … … 2495 2485 } 2496 2486 } 2497 2487 2498 2488 /* 2499 2489 Check if object supports method getAnnotationSet(). … … 2589 2579 return form; 2590 2580 } 2591 2581 2592 2582 /** 2593 2583 Get DbControl for object. 2594 2584 2595 2585 @return DbControl for the object 2596 2586 */ … … 2647 2637 return dc; 2648 2638 } 2649 2639 2650 2640 /** 2651 2641 Fetch public method for object, or null if not found. 2652 2642 2653 2643 @param publMethodName String Name of public method to search for. 2654 2644 @return Method public method for object with desired name, or null if not 2655 2645 found. 2656 2646 */ 2657 2647 private Method fetchPublicMethodForObject(String publMethodName, … … 2686 2676 return publMethod; 2687 2677 } 2688 2678 2689 2679 /** 2690 2680 Returns a String corresponding to the method modifier: "static", 2691 2681 "public", "protected", or "private". 2692 2682 2693 2683 @param method 2694 2684 @return String for method modifier … … 2716 2706 return modStr; 2717 2707 } 2718 2708 2719 2709 private Localizer getLocale() 2720 2710 { 2721 2711 return locale; 2722 2712 } 2723 2713 2724 2714 public void setLocale(Localizer locale) 2725 2715 { 2726 2716 this.locale = locale; 2727 2717 } 2728 2718 2729 2719 //Cleaning up from here 2730 2720 2731 2721 /** 2732 2722 Form for new Protocol item. The difference between calling … … 2739 2729 a convenient place holder for default values for the Protocol form 2740 2730 fields. 2741 2731 2742 2732 @param protocol Protocol object (need not be stored in database) with 2743 2733 default field values. 2744 2734 @return Form A form for setting protocol values. 2745 2735 */ … … 2824 2814 return form; 2825 2815 } 2826 2816 2817 public Form getForm(Class<?> cls) 2818 { 2819 return getForm(cls, null); 2820 } 2827 2821 /** 2828 2822 Returnes a form for the given class. If obj is supplied the form is … … 2835 2829 { 2836 2830 if (cls == null) 2837 2838 2839 2831 { 2832 return new NullForm(); 2833 } 2840 2834 if (obj != null && !cls.equals(obj.getClass())) 2841 2842 2843 2835 { 2836 return new NullForm(); 2837 } 2844 2838 // Create forms with prefilled values from the given object 2845 2839 if (cls.equals(LabeledExtract.class)) … … 2908 2902 { 2909 2903 TextField<String> loginF = new LoginField(); 2910 2904 loginF.setDisabled(true); 2911 2905 fs.add(fs.size()-2, loginF); // After the itemId field 2912 2906 2913 2907 TextField<String> emailF = new EmailField(); 2914 2908 fs.add(fs.size()-1, emailF); 2915 2909 2916 2910 TextField<String> phoneF = new PhoneField(); 2917 2911 fs.add(phoneF); 2918 2912 2919 2913 TextField<String> addressF = new AddressField(); 2920 2914 fs.add(addressF); 2921 2915 2922 2916 TextField<String> organisationF = new OrganisationField(); 2923 2917 fs.add(organisationF); 2924 2918 2925 2919 if (obj != null) 2926 2920 { 2927 2921 User n = (User) obj; 2928 2922 loginF.setValue(n.getLogin()); 2929 2923 emailF.setValue(n.getEmail()); 2930 2924 phoneF.setValue(n.getPhone()); … … 3253 3247 return form; 3254 3248 } 3255 3249 3256 3250 /** 3257 3251 Creates a select box for protocols. If the class for which the protocol … … 3261 3255 if the protocol is tagged to be removed. However, no other protocols 3262 3256 tagged to be removed should be included in the list. 3263 3257 3264 3258 @param cls Class Class for which a protocol should be selected. 3265 3259 @param obj Object Optional object with attached protocol for setting 3266 3260 default protocol. 3267 3261 @return Select<VInteger> Select box for protocol selection 3268 3262 */ … … 3368 3362 return protocolS; 3369 3363 } 3370 3364 3371 3365 public void setSc(SessionControl sc) 3372 3366 { … … 3375 3369 if (this.sc == null) 3376 3370 this.sc = sc; 3377 } 3371 } 3378 3372 }
Note: See TracChangeset
for help on using the changeset viewer.