82 new BasicMutableProperty<char[]>(); |
82 new BasicMutableProperty<char[]>(); |
83 |
83 |
84 private JOptionPane pane; |
84 private JOptionPane pane; |
85 private JDialog dialog; |
85 private JDialog dialog; |
86 private static final String ACTION_ADV_SETTINGS = "settings"; |
86 private static final String ACTION_ADV_SETTINGS = "settings"; |
87 private AdvancedSettingsDialog advDialog = null; |
|
88 private UserMgrPanelDescriptor descriptor = null; |
87 private UserMgrPanelDescriptor descriptor = null; |
89 private ActionString actString = null; |
88 private ActionString actString = null; |
90 |
89 |
91 // |
90 // |
92 // Constructors |
91 // Constructors |
302 gbc.gridy++; // next row |
301 gbc.gridy++; // next row |
303 form.add(passConfirmLabel, gbc); |
302 form.add(passConfirmLabel, gbc); |
304 gbc.gridx = GridBagConstraints.RELATIVE; |
303 gbc.gridx = GridBagConstraints.RELATIVE; |
305 form.add(passConfirmField, gbc); |
304 form.add(passConfirmField, gbc); |
306 |
305 |
307 // Advanced Settings |
306 // Disable password fields if the admin can set password |
308 actString = new ActionString("usermgr.advanced.settings"); |
307 if (descriptor.canChangePassword(null) == false) { |
309 JButton advSettings = new JButton(actString.getString()); |
308 passField.setEnabled(false); |
310 advSettings.setActionCommand(ACTION_ADV_SETTINGS); |
309 passConfirmField.setEnabled(false); |
311 advSettings.addActionListener(this); |
310 } |
312 advSettings.setMnemonic(actString.getMnemonic()); |
|
313 |
|
314 // Add to the layout |
|
315 gbc.gridx = 0; |
|
316 gbc.gridy++; |
|
317 gbc.gridwidth = GridBagConstraints.REMAINDER; |
|
318 gbc.anchor = GridBagConstraints.SOUTHWEST; |
|
319 form.add(advSettings, gbc); |
|
320 |
311 |
321 return form; |
312 return form; |
322 } |
313 } |
323 |
|
324 /** |
|
325 * action listener for Adv settings button |
|
326 */ |
|
327 @Override |
|
328 public void actionPerformed(ActionEvent e) { |
|
329 String actionCmd = e.getActionCommand(); |
|
330 if (actionCmd == ACTION_ADV_SETTINGS) { |
|
331 UserMgrPanelDescriptor descriptor = |
|
332 control.getPanelDescriptor(); |
|
333 if (umo == null || user == null) { |
|
334 user = new UserImpl(); |
|
335 umo = new UserManagedObject(descriptor, user, null); |
|
336 } |
|
337 |
|
338 if (advDialog == null || |
|
339 descriptor.isTypeRole() != advDialog.isTypeRole()) { |
|
340 advDialog = new AdvancedSettingsDialog( |
|
341 getHasComponent().getComponent(), descriptor, umo); |
|
342 } else { |
|
343 advDialog.setUser(umo); |
|
344 } |
|
345 advDialog.show(); |
|
346 if (advDialog.getValue() == JOptionPane.OK_OPTION) { |
|
347 advDialog.update(); |
|
348 } |
|
349 } |
|
350 } |
|
351 } |
314 } |
352 |
315 |
353 // |
316 // |
354 // Static data |
317 // Static data |
355 // |
318 // |
452 user, password); |
415 user, password); |
453 } else { |
416 } else { |
454 umo.setUser(user, password); |
417 umo.setUser(user, password); |
455 } |
418 } |
456 |
419 |
457 descriptor.addToAddList(umo); |
420 descriptor.saveAddedUser(umo); |
458 descriptor.saveAddedUsers(); |
|
459 |
421 |
460 // Navigate to the newly created user |
422 // Navigate to the newly created user |
461 Navigable navigable = new SimpleNavigable( |
423 Navigable navigable = new SimpleNavigable( |
462 UserMgrBasicControl.ID, umo.getName(), |
424 UserMgrBasicControl.ID, umo.getName(), |
463 UserMgrBasicControl.PARAM_USER, umo.getId()); |
425 UserMgrBasicControl.PARAM_USER, umo.getId()); |