| | |
| | |
|
| | | private JTextField teamnameField;
|
| | |
|
| | | private JTextField mailingListsField;
|
| | |
|
| | | private JPalette<String> repositoryPalette;
|
| | |
|
| | | private JPalette<String> userPalette;
|
| | |
|
| | | private JPalette<String> preReceivePalette;
|
| | |
|
| | | private JLabel preReceiveInherited;
|
| | |
|
| | | private JPalette<String> postReceivePalette;
|
| | |
|
| | | private JLabel postReceiveInherited;
|
| | |
|
| | | private Set<String> teamnames;
|
| | |
|
| | |
| | | private void initialize(int protocolVersion, TeamModel aTeam) {
|
| | | teamnameField = new JTextField(aTeam.name == null ? "" : aTeam.name, 25);
|
| | |
|
| | | mailingListsField = new JTextField(aTeam.mailingLists == null ? ""
|
| | | : StringUtils.flattenStrings(aTeam.mailingLists, " "), 50);
|
| | |
|
| | | JPanel fieldsPanel = new JPanel(new GridLayout(0, 1));
|
| | | fieldsPanel.add(newFieldPanel(Translation.get("gb.teamName"), teamnameField));
|
| | | fieldsPanel.add(newFieldPanel(Translation.get("gb.mailingLists"), mailingListsField));
|
| | |
|
| | | final Insets _insets = new Insets(5, 5, 5, 5);
|
| | | repositoryPalette = new JPalette<String>();
|
| | | userPalette = new JPalette<String>();
|
| | | |
| | |
|
| | | JPanel fieldsPanelTop = new JPanel(new BorderLayout());
|
| | | fieldsPanelTop.add(fieldsPanel, BorderLayout.NORTH);
|
| | | |
| | |
|
| | | JPanel repositoriesPanel = new JPanel(new BorderLayout()) {
|
| | |
|
| | | private static final long serialVersionUID = 1L;
|
| | |
| | | };
|
| | | usersPanel.add(userPalette, BorderLayout.CENTER);
|
| | |
|
| | | preReceivePalette = new JPalette<String>(true);
|
| | | preReceiveInherited = new JLabel();
|
| | | JPanel preReceivePanel = new JPanel(new BorderLayout(5, 5));
|
| | | preReceivePanel.add(preReceivePalette, BorderLayout.CENTER);
|
| | | preReceivePanel.add(preReceiveInherited, BorderLayout.WEST);
|
| | | |
| | | postReceivePalette = new JPalette<String>(true);
|
| | | postReceiveInherited = new JLabel();
|
| | | JPanel postReceivePanel = new JPanel(new BorderLayout(5, 5));
|
| | | postReceivePanel.add(postReceivePalette, BorderLayout.CENTER); |
| | | postReceivePanel.add(postReceiveInherited, BorderLayout.WEST);
|
| | |
|
| | | JTabbedPane panel = new JTabbedPane(JTabbedPane.TOP);
|
| | | panel.addTab(Translation.get("gb.general"), fieldsPanelTop);
|
| | | panel.addTab(Translation.get("gb.teamMembers"), usersPanel);
|
| | | panel.addTab(Translation.get("gb.restrictedRepositories"), repositoriesPanel);
|
| | |
|
| | | panel.addTab(Translation.get("gb.preReceiveScripts"), preReceivePanel);
|
| | | panel.addTab(Translation.get("gb.postReceiveScripts"), postReceivePanel);
|
| | |
|
| | | JButton createButton = new JButton(Translation.get("gb.save"));
|
| | | createButton.addActionListener(new ActionListener() {
|
| | |
| | | JPanel controls = new JPanel();
|
| | | controls.add(cancelButton);
|
| | | controls.add(createButton);
|
| | | |
| | |
|
| | | JPanel centerPanel = new JPanel(new BorderLayout(5, 5)) {
|
| | |
|
| | | private static final long serialVersionUID = 1L;
|
| | |
| | | }
|
| | | team.name = tname;
|
| | |
|
| | | String ml = mailingListsField.getText();
|
| | | if (!StringUtils.isEmpty(ml)) {
|
| | | Set<String> list = new HashSet<String>();
|
| | | for (String address : ml.split("(,|\\s)")) {
|
| | | if (StringUtils.isEmpty(address)) {
|
| | | continue;
|
| | | }
|
| | | list.add(address.toLowerCase());
|
| | | }
|
| | | team.mailingLists.clear();
|
| | | team.mailingLists.addAll(list);
|
| | | }
|
| | |
|
| | | team.repositories.clear();
|
| | | team.repositories.addAll(repositoryPalette.getSelections());
|
| | | |
| | |
|
| | | team.users.clear();
|
| | | team.users.addAll(userPalette.getSelections());
|
| | |
|
| | | team.preReceiveScripts.clear();
|
| | | team.preReceiveScripts.addAll(preReceivePalette.getSelections());
|
| | |
|
| | | team.postReceiveScripts.clear();
|
| | | team.postReceiveScripts.addAll(postReceivePalette.getSelections());
|
| | |
|
| | | return true;
|
| | | }
|
| | |
|
| | |
| | | }
|
| | | repositoryPalette.setObjects(restricted, selected);
|
| | | }
|
| | | |
| | |
|
| | | public void setUsers(List<String> users, List<String> selected) {
|
| | | Collections.sort(users);
|
| | | if (selected != null) {
|
| | |
| | | userPalette.setObjects(users, selected);
|
| | | }
|
| | |
|
| | | public void setPreReceiveScripts(List<String> unused, List<String> inherited,
|
| | | List<String> selected) {
|
| | | Collections.sort(unused);
|
| | | if (selected != null) {
|
| | | Collections.sort(selected);
|
| | | }
|
| | | preReceivePalette.setObjects(unused, selected);
|
| | | showInherited(inherited, preReceiveInherited);
|
| | | }
|
| | |
|
| | | public void setPostReceiveScripts(List<String> unused, List<String> inherited,
|
| | | List<String> selected) {
|
| | | Collections.sort(unused);
|
| | | if (selected != null) {
|
| | | Collections.sort(selected);
|
| | | }
|
| | | postReceivePalette.setObjects(unused, selected);
|
| | | showInherited(inherited, postReceiveInherited);
|
| | | }
|
| | |
|
| | | private void showInherited(List<String> list, JLabel label) {
|
| | | StringBuilder sb = new StringBuilder();
|
| | | if (list != null && list.size() > 0) {
|
| | | sb.append("<html><body><b>INHERITED</b><ul style=\"margin-left:5px;list-style-type: none;\">");
|
| | | for (String script : list) {
|
| | | sb.append("<li>").append(script).append("</li>");
|
| | | }
|
| | | sb.append("</ul></body></html>");
|
| | | }
|
| | | label.setText(sb.toString());
|
| | | }
|
| | |
|
| | | public TeamModel getTeam() {
|
| | | if (canceled) {
|
| | | return null;
|