| | |
| | | import com.gitblit.Constants.AccessRestrictionType;
|
| | | import com.gitblit.Constants.FederationStrategy;
|
| | | import com.gitblit.models.RepositoryModel;
|
| | | import com.gitblit.models.TeamModel;
|
| | | import com.gitblit.utils.StringUtils;
|
| | |
|
| | | /**
|
| | |
| | | private JComboBox ownerField;
|
| | |
|
| | | private JPalette<String> usersPalette;
|
| | |
|
| | | |
| | | private JPalette<String> setsPalette;
|
| | | |
| | | private JPalette<String> teamsPalette;
|
| | |
|
| | | private Set<String> repositoryNames;
|
| | |
|
| | | public EditRepositoryDialog() {
|
| | | this(new RepositoryModel());
|
| | | public EditRepositoryDialog(int protocolVersion) {
|
| | | this(protocolVersion, new RepositoryModel());
|
| | | this.isCreate = true;
|
| | | setTitle(Translation.get("gb.newRepository"));
|
| | | }
|
| | |
|
| | | public EditRepositoryDialog(RepositoryModel aRepository) {
|
| | | public EditRepositoryDialog(int protocolVersion, RepositoryModel aRepository) {
|
| | | super();
|
| | | this.repositoryName = aRepository.name;
|
| | | this.repository = new RepositoryModel();
|
| | | this.repositoryNames = new HashSet<String>();
|
| | | this.isCreate = false;
|
| | | initialize(aRepository);
|
| | | initialize(protocolVersion, aRepository);
|
| | | setModal(true);
|
| | | setResizable(false);
|
| | | setTitle(Translation.get("gb.edit") + ": " + aRepository.name);
|
| | |
| | | return rootPane;
|
| | | }
|
| | |
|
| | | private void initialize(RepositoryModel anRepository) {
|
| | | private void initialize(int protocolVersion, RepositoryModel anRepository) {
|
| | | nameField = new JTextField(anRepository.name == null ? "" : anRepository.name, 35);
|
| | | descriptionField = new JTextField(anRepository.description == null ? ""
|
| | | : anRepository.description, 35);
|
| | |
| | | accessPanel.add(newFieldPanel(Translation.get("gb.permittedUsers"), usersPalette),
|
| | | BorderLayout.CENTER);
|
| | |
|
| | | teamsPalette = new JPalette<String>();
|
| | | JPanel teamsPanel = new JPanel(new BorderLayout(5, 5));
|
| | | teamsPanel.add(newFieldPanel(Translation.get("gb.permittedTeams"), teamsPalette),
|
| | | BorderLayout.CENTER);
|
| | |
|
| | | setsPalette = new JPalette<String>();
|
| | | JPanel federationPanel = new JPanel(new BorderLayout(5, 5));
|
| | | federationPanel.add(
|
| | |
| | | JTabbedPane panel = new JTabbedPane(JTabbedPane.TOP);
|
| | | panel.addTab(Translation.get("gb.general"), fieldsPanel);
|
| | | panel.addTab(Translation.get("gb.accessRestriction"), accessPanel);
|
| | | if (protocolVersion >= 2) {
|
| | | panel.addTab(Translation.get("gb.teams"), teamsPanel);
|
| | | }
|
| | | panel.addTab(Translation.get("gb.federation"), federationPanel);
|
| | |
|
| | | JButton createButton = new JButton(Translation.get("gb.save"));
|
| | |
| | | }
|
| | | usersPalette.setObjects(all, selected);
|
| | | }
|
| | | |
| | | public void setTeams(List<String> all, List<String> selected) {
|
| | | teamsPalette.setObjects(all, selected);
|
| | | }
|
| | |
|
| | | public void setRepositories(List<RepositoryModel> repositories) {
|
| | | repositoryNames.clear();
|
| | |
| | | return usersPalette.getSelections();
|
| | | }
|
| | |
|
| | | public List<String> getPermittedTeams() {
|
| | | return teamsPalette.getSelections();
|
| | | }
|
| | |
|
| | | /**
|
| | | * ListCellRenderer to display descriptive text about the access
|
| | | * restriction.
|