Changeset 1202 for branches/3.0-Beta1/components/tools/admin
- Timestamp:
- 01/24/07 11:09:53 (19 months ago)
- Location:
- branches/3.0-Beta1/components/tools/admin/src/adminTool
- Files:
-
- 8 modified
- 1 copied
-
groupPanel/GroupsTab.java (modified) (4 diffs)
-
groupPanel/GroupsTabController.java (modified) (5 diffs)
-
groupPanel/SetDefaultAction.java (copied) (copied from trunk/components/tools/admin/src/adminTool/groupPanel/SetDefaultAction.java)
-
main/AdminWindow.java (modified) (4 diffs)
-
model/Model.java (modified) (1 diff)
-
ui/ImageFactory.java (modified) (1 diff)
-
usersPanel/PasswordAction.java (modified) (2 diffs)
-
usersPanel/UsersTab.java (modified) (10 diffs)
-
usersPanel/UsersTabController.java (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/3.0-Beta1/components/tools/admin/src/adminTool/groupPanel/GroupsTab.java
r1167 r1202 79 79 private JButton saveBtn; 80 80 81 private JButton setDefaultBtn; 82 81 83 private JButton addUserBtn; 82 84 … … 175 177 removeUserBtn.addActionListener(new UserAction(UserAction.REMOVE, 176 178 controller)); 179 setDefaultBtn.addActionListener(new SetDefaultAction(controller)); 177 180 groupList.selectFirstGroup(); 178 181 } … … 223 226 void createActionButtons() { 224 227 saveBtn = new JButton("Save"); 228 setDefaultBtn = new JButton("Set Default Group"); 229 225 230 ImageIcon addUserIcon = ImageFactory.get().image( 231 ImageFactory.RIGHT_ARROW); 232 ImageIcon removeUserIcon = ImageFactory.get().image( 226 233 ImageFactory.LEFT_ARROW); 227 ImageIcon removeUserIcon = ImageFactory.get().image(228 ImageFactory.RIGHT_ARROW);229 234 ImageIcon addGroupIcon = ImageFactory.get() 230 235 .image(ImageFactory.ADD_USER); … … 284 289 JPanel buttonPanel = new JPanel(); 285 290 buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS)); 286 buttonPanel.add(Box.createHorizontalStrut(250)); 291 buttonPanel.add(Box.createHorizontalStrut(100)); 292 buttonPanel.add(setDefaultBtn); 293 buttonPanel.add(Box.createHorizontalStrut(50)); 287 294 buttonPanel.add(saveBtn); 288 295 panel.add(buttonPanel); 289 panel.add(Box.createVerticalStrut( 100));296 panel.add(Box.createVerticalStrut(50)); 290 297 291 298 JPanel userGroupListButtonPanel = new JPanel(); -
branches/3.0-Beta1/components/tools/admin/src/adminTool/groupPanel/GroupsTabController.java
r1167 r1202 29 29 * 30 30 * @author Jean-Marie Burel <a 31 * href="mailto:j.burel@dundee.ac.uk">j.burel@dundee.ac.uk</a>31 * href="mailto:j.burel@dundee.ac.uk">j.burel@dundee.ac.uk</a> 32 32 * @author Donald MacDonald <a 33 * href="mailto:donald@lifesci.dundee.ac.uk">donald@lifesci.dundee.ac.uk</a>33 * href="mailto:donald@lifesci.dundee.ac.uk">donald@lifesci.dundee.ac.uk</a> 34 34 * @version 3.0 <small> (<b>Internal version:</b> $Revision$Date: $) 35 35 * </small> … … 49 49 } 50 50 51 void setDefaultGroup() { 52 String selectedUser = view.getSelectedMember(); 53 try { 54 if (selectedUser == null) { 55 view.showErrorMessage("You must select a user before you set " 56 + "default group."); 57 return; 58 } 59 // Check user exists. 60 if (!model.findUserByName(selectedUser)) { 61 throw new IAdminException( 62 new Exception( 63 "Cannot find user in " 64 + "Database. Admintool may be out " + 65 "of sync with Database.")); 66 } 67 68 // check that the groupslist returns a non-null string. 69 String groupSelected = view.getSelectedGroup(); 70 if (groupSelected == null) { 71 view.showErrorMessage("You must select a group before you set " 72 + "default group."); 73 return; 74 } 75 // Check that group exists. 76 if (!model.findGroupByName(groupSelected)) { 77 throw new IAdminException( 78 new Exception( 79 "Cannot find group in " 80 + "Database. Admintool may be out of " + 81 "sync with Database.")); 82 } 83 } catch (Exception e) { 84 handleException(e, 85 "Admintool seems to be out of sync with database." 86 + "Try restarting Admintool."); 87 } 88 89 // Change the default group for the user to the one selected. 90 try { 91 model.setDefaultGroup(model.getCurrentGroupID()); 92 view.setGroupDetails(model.getCurrentGroup()); 93 } catch (Exception e) { 94 handleException(e, "Set Current Group as Users Default Group"); 95 } 96 } 97 51 98 /* 52 99 * (non-Javadoc) … … 172 219 if (groupSelected == null) { 173 220 view 174 .showErrorMessage("Please select the group you wish add to user."); 221 .showErrorMessage("Please select the group you " + 222 "wish add to user."); 175 223 return; 176 224 } … … 205 253 if (groupSelected == null) { 206 254 view 207 .showErrorMessage("Please select a group to remove from user."); 255 .showErrorMessage("Please select a group to remove " + 256 "from user."); 208 257 return; 209 258 } … … 211 260 if (!model.findGroupByName(groupSelected)) { 212 261 return; 262 } 263 if(model.isDefaultGroup(model.getCurrentGroupID())) 264 { 265 view.showErrorMessage("Cannot remove user from group when it " + 266 "is user\'s default group."); 267 return; 213 268 } 214 269 model.removeGroupFromUser(model.getCurrentGroupID()); -
branches/3.0-Beta1/components/tools/admin/src/adminTool/main/AdminWindow.java
r1167 r1202 35 35 * 36 36 */ 37 public class AdminWindow extends JFrame implements ActionListener { 37 public class AdminWindow 38 extends JFrame 39 implements ActionListener 40 { 38 41 /** 39 42 * … … 58 61 59 62 public AdminWindow() { 60 setTitle(" Admin Tool");63 setTitle("Omero Admin"); 61 64 setLocation(300, 100); 62 setSize(8 00, 500);65 setSize(840, 600); 63 66 createMenu(); 64 67 mainPanel = new MainPanel(this); … … 85 88 help = new JMenuItem("About AdminTool"); 86 89 addComment = new JMenuItem("Send Comment To Developers"); 87 helpMenu.add(help);88 helpMenu.add(new JSeparator());89 90 helpMenu.add(addComment); 90 91 addComment.addActionListener(this); … … 103 104 if (e.getActionCommand().equals("login")) { 104 105 mainPanel.startLogin(); 105 pack();106 // pack(); 106 107 } 107 108 if (e.getActionCommand().equals("exit")) { -
branches/3.0-Beta1/components/tools/admin/src/adminTool/model/Model.java
r1167 r1202 130 130 ExceptionHandler.get().catchException(e); 131 131 } 132 } 133 134 public void changeLoggedInUserPassword(String password) throws IAdminException, 135 UnknownException, PermissionsException 136 { 137 try { 138 iAdmin.changeUserPassword(loggedInUser, password); 139 } catch (Exception e) { 140 ExceptionHandler.get().catchException(e); 141 } 132 142 } 133 143 -
branches/3.0-Beta1/components/tools/admin/src/adminTool/ui/ImageFactory.java
r1167 r1202 58 58 path[REMOVE_USER] = "/resources/graphx/RemoveUser_kusers_nuvola48_mod3.png"; 59 59 path[LEFT_ARROW] = "/resources/graphx/1leftarrow_nuvola32.png"; 60 path[RIGHT_ARROW] = "/resources/graphx/1 leftarrow_nuvola32.png";60 path[RIGHT_ARROW] = "/resources/graphx/1rightarrow_nuvola32.png"; 61 61 path[DEFAULT_GROUP] = "/resources/graphx/kgpg_identity_nuvola32.png"; 62 62 } -
branches/3.0-Beta1/components/tools/admin/src/adminTool/usersPanel/PasswordAction.java
r1167 r1202 26 26 * @since OME3.0 27 27 */ 28 public class PasswordAction implements ActionListener { 28 public class PasswordAction 29 implements ActionListener 30 { 31 public static int CHANGE_SELECTED_USER = 0; 32 public static int CHANGE_CURRENT_USER = 1; 33 29 34 private UsersTabController controller; 35 private int actionType; 30 36 31 PasswordAction(UsersTabController controller) { 37 PasswordAction(int actionType, UsersTabController controller) { 38 this.actionType = actionType; 32 39 this.controller = controller; 33 40 } … … 38 45 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) 39 46 */ 40 public void actionPerformed(ActionEvent e) { 41 controller.changePassword(); 47 public void actionPerformed(ActionEvent e) 48 { 49 if(actionType == CHANGE_SELECTED_USER) 50 controller.changePassword(); 51 if(actionType == CHANGE_CURRENT_USER) 52 controller.changeLoggedInUserPassword(); 53 42 54 43 55 } -
branches/3.0-Beta1/components/tools/admin/src/adminTool/usersPanel/UsersTab.java
r1167 r1202 10 10 11 11 import java.awt.BorderLayout; 12 import java.awt.Dimension; 12 13 import java.util.ArrayList; 13 14 … … 96 97 97 98 private JButton resetPasswordBtn; 99 100 private JButton changeYourPasswordBtn; 98 101 99 102 private JButton setDefaultBtn; … … 215 218 controller)); 216 219 saveBtn.addActionListener(new SaveAction(controller)); 217 resetPasswordBtn.addActionListener(new PasswordAction(controller)); 220 resetPasswordBtn.addActionListener(new PasswordAction(PasswordAction.CHANGE_SELECTED_USER, controller)); 221 changeYourPasswordBtn.addActionListener(new PasswordAction(PasswordAction.CHANGE_CURRENT_USER, controller)); 218 222 setDefaultBtn.addActionListener(new SetDefaultAction(controller)); 219 223 setSystemBtn.addActionListener(new SetSystemAction(controller)); … … 273 277 ImageFactory.DEFAULT_GROUP); 274 278 saveBtn = new JButton("Save"); 275 resetPasswordBtn = new JButton("Reset Password"); 279 resetPasswordBtn = new JButton("Reset User Password"); 280 changeYourPasswordBtn = new JButton("Reset Your Password"); 276 281 setSystemBtn = new JButton("Set System User"); 277 282 addUserBtn = new JButton(addUserIcon); … … 292 297 setDefaultBtn.setEnabled(false); 293 298 setSystemBtn.setEnabled(false); 299 resetPasswordBtn.setEnabled(false); 294 300 } else { 295 301 saveBtn.setEnabled(true); … … 300 306 setDefaultBtn.setEnabled(true); 301 307 setSystemBtn.setEnabled(true); 308 resetPasswordBtn.setEnabled(true); 302 309 } 303 310 } … … 334 341 JPanel buttonPanel = new JPanel(); 335 342 buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS)); 336 buttonPanel.add(Box.createHorizontalStrut( 100));343 buttonPanel.add(Box.createHorizontalStrut(30)); 337 344 buttonPanel.add(resetPasswordBtn); 338 345 buttonPanel.add(Box.createHorizontalStrut(30)); … … 341 348 buttonPanel.add(saveBtn); 342 349 userDataEntryPanel.add(buttonPanel); 343 350 JPanel secondButtonPanel = new JPanel(); 351 secondButtonPanel.setLayout(new BoxLayout(secondButtonPanel, BoxLayout.X_AXIS)); 352 secondButtonPanel.add(changeYourPasswordBtn); 353 userDataEntryPanel.add(secondButtonPanel); 354 355 344 356 // buttons controlling which group user belongs to. 345 357 JPanel userGroupButtonPanel = new JPanel(); … … 356 368 userGroupListPanel.add(userGroupListLabel); 357 369 userGroupListPanel.add(userGroupMembershipList); 370 userGroupMembershipList.setPreferredSize(new Dimension(340,160)); 371 userGroupMembershipList.setMaximumSize(new Dimension(340,160)); 358 372 359 373 // panel holding user group list and buttons. … … 411 425 container.setLayout(new BoxLayout(container, BoxLayout.X_AXIS)); 412 426 container.add(listContainer); 413 container.add(Box.createHorizontalStrut( 50));427 container.add(Box.createHorizontalStrut(30)); 414 428 container.add(userInfoPanel); 415 429 // container.add(Box.createHorizontalStrut(10)); -
branches/3.0-Beta1/components/tools/admin/src/adminTool/usersPanel/UsersTabController.java
r1167 r1202 50 50 void changePassword() { 51 51 String user = view.getSelectedUser(); 52 52 53 if (user == null) { 53 54 view.showErrorMessage("You must select a user before you can" … … 72 73 } 73 74 75 void changeLoggedInUserPassword() { 76 77 PasswordDialog passwordDialog = new PasswordDialog(); 78 Point loc = view.getLocationOnScreen(); 79 int x = loc.x + view.getWidth() / 2 - passwordDialog.getWidth() / 2; 80 int y = loc.y + view.getHeight() / 2 - passwordDialog.getHeight() / 2; 81 passwordDialog.setLocation(x, y); 82 passwordDialog.setVisible(true); 83 if (passwordDialog.OKSelected()) { 84 try { 85 model.changeLoggedInUserPassword(passwordDialog.getPassword()); 86 } catch (Exception e) { 87 handleException(e, "Change User password"); 88 } 89 } 90 } 74 91 void setSystemUser() { 75 92 String selectedUser = view.getSelectedUser(); … … 152 169 if (model.findUserByName("NewUser")) { 153 170 view 154 .showErrorMessage("You have already created a user called \'NewUser\'."155 + "This is the user you should rename/modify.");171 .showErrorMessage("You have already created a user called \'NewUser\'." 172 + "This is the user you should rename/modify."); 156 173 return; 157 174 }
