use of net.sourceforge.processdash.team.group.UserGroup in project processdash by dtuma.
the class UserGroupEditor method createUI.
private Component createUI() {
// create the button panel
JPanel buttonPanel = new JPanel(new GridLayout(2, 2, 5, 5));
buttonPanel.add(new JButton(new AddAction()));
buttonPanel.add(new JButton(copyAction = new CopyAction()));
buttonPanel.add(new JButton(renameAction = new RenameAction()));
buttonPanel.add(new JButton(deleteAction = new DeleteAction()));
// read the known groups, and add them to a list
List<UserGroup> allGroups = new ArrayList<UserGroup>();
allGroups.addAll(UserGroupManager.getInstance().getGroups().values());
Collections.sort(allGroups);
groups = new DefaultListModel();
for (UserGroup g : allGroups) groups.addElement(g);
groupList = new JList(groups);
groupList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
groupList.addListSelectionListener(new SelectionHandler());
JScrollPane gsp = new JScrollPane(groupList);
gsp.setPreferredSize(new Dimension(200, 300));
// create an object for editing the members in the selected group
memberList = new GroupMembershipSelector(readOnlyCode);
JScrollPane msp = new JScrollPane(memberList);
msp.setPreferredSize(new Dimension(200, 300));
// create titles to display on the dialog
JLabel groupTitle = new JLabel(resources.getString("User_Groups"));
JLabel memberTitle = new JLabel(resources.getString("Selected_User_Group"));
Font f = groupTitle.getFont();
f = f.deriveFont(f.getSize2D() * 1.5f);
groupTitle.setFont(f);
memberTitle.setFont(f);
Border b = BorderFactory.createMatteBorder(0, 0, 1, 0, Color.black);
groupTitle.setBorder(b);
memberTitle.setBorder(b);
// arrange the components onto a panel
GridBagLayout layout = new GridBagLayout();
userInterface = new JPanel(layout);
GridBagConstraints c = new GridBagConstraints();
c.gridx = c.gridy = 0;
c.fill = GridBagConstraints.HORIZONTAL;
layout.addLayoutComponent(groupTitle, c);
userInterface.add(groupTitle);
c.gridx = 2;
Component comp = new JOptionPaneTweaker.MakeResizable();
layout.addLayoutComponent(comp, c);
userInterface.add(comp);
c.gridx = 1;
c.insets = new Insets(0, 10, 0, 0);
layout.addLayoutComponent(memberTitle, c);
userInterface.add(memberTitle);
c.gridx = 0;
c.gridy = 1;
c.fill = GridBagConstraints.BOTH;
c.insets = new Insets(10, 20, 0, 0);
layout.addLayoutComponent(buttonPanel, c);
userInterface.add(buttonPanel);
c.gridy = 2;
c.weightx = c.weighty = 1.0;
layout.addLayoutComponent(gsp, c);
userInterface.add(gsp);
c.gridx = c.gridy = 1;
c.insets = new Insets(10, 30, 0, 0);
c.gridheight = 2;
layout.addLayoutComponent(msp, c);
userInterface.add(msp);
// load the preferred size of the window
try {
String[] size = Settings.getVal(SIZE_PREF).split(",");
Dimension d = new Dimension(Integer.parseInt(size[0]), Integer.parseInt(size[1]));
userInterface.setPreferredSize(d);
} catch (Exception e) {
}
return userInterface;
}
use of net.sourceforge.processdash.team.group.UserGroup in project processdash by dtuma.
the class GroupFilterMenu method userGroupEdited.
@Override
public void userGroupEdited(UserGroupEditEvent e) {
if (selectedItem instanceof UserGroup) {
UserGroup selectedGroup = (UserGroup) selectedItem;
UserGroup changedGroup = e.getGroup();
if (selectedGroup.getId().equals(changedGroup.getId())) {
final UserGroup newGroup = (e.isDelete() ? UserGroup.EVERYONE : changedGroup);
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
setSelectedItem(newGroup);
}
});
}
}
}
Aggregations