\r
private JComboBox ownerField;\r
\r
+ private JComboBox defaultHeadField;\r
+\r
private JPalette<String> usersPalette;\r
\r
private JPalette<String> setsPalette;\r
setModal(true);\r
setResizable(false);\r
setTitle(Translation.get("gb.edit") + ": " + aRepository.name);\r
- setIconImage(new ImageIcon(getClass().getResource("/gitblt-favicon.png")).getImage());\r
+ setIconImage(new ImageIcon(getClass()\r
+ .getResource("/gitblt-favicon.png")).getImage());\r
}\r
\r
@Override\r
}\r
\r
private void initialize(int protocolVersion, RepositoryModel anRepository) {\r
- nameField = new JTextField(anRepository.name == null ? "" : anRepository.name, 35);\r
+ nameField = new JTextField(anRepository.name == null ? ""\r
+ : anRepository.name, 35);\r
descriptionField = new JTextField(anRepository.description == null ? ""\r
: anRepository.description, 35);\r
\r
- JTextField originField = new JTextField(anRepository.origin == null ? ""\r
- : anRepository.origin, 40);\r
+ JTextField originField = new JTextField(\r
+ anRepository.origin == null ? "" : anRepository.origin, 40);\r
originField.setEditable(false);\r
\r
+ if (ArrayUtils.isEmpty(anRepository.availableHeads)) {\r
+ defaultHeadField = new JComboBox();\r
+ defaultHeadField.setEnabled(false); \r
+ } else {\r
+ defaultHeadField = new JComboBox(\r
+ anRepository.availableHeads.toArray());\r
+ defaultHeadField.setSelectedItem(anRepository.defaultHead);\r
+ }\r
+\r
ownerField = new JComboBox();\r
\r
useTickets = new JCheckBox(Translation.get("gb.useTicketsDescription"),\r
anRepository.useTickets);\r
- useDocs = new JCheckBox(Translation.get("gb.useDocsDescription"), anRepository.useDocs);\r
- showRemoteBranches = new JCheckBox(Translation.get("gb.showRemoteBranchesDescription"),\r
+ useDocs = new JCheckBox(Translation.get("gb.useDocsDescription"),\r
+ anRepository.useDocs);\r
+ showRemoteBranches = new JCheckBox(\r
+ Translation.get("gb.showRemoteBranchesDescription"),\r
anRepository.showRemoteBranches);\r
showReadme = new JCheckBox(Translation.get("gb.showReadmeDescription"),\r
anRepository.showReadme);\r
- skipSizeCalculation = new JCheckBox(Translation.get("gb.skipSizeCalculationDescription"),\r
+ skipSizeCalculation = new JCheckBox(\r
+ Translation.get("gb.skipSizeCalculationDescription"),\r
anRepository.skipSizeCalculation);\r
- skipSummaryMetrics = new JCheckBox(Translation.get("gb.skipSummaryMetricsDescription"),\r
+ skipSummaryMetrics = new JCheckBox(\r
+ Translation.get("gb.skipSummaryMetricsDescription"),\r
anRepository.skipSummaryMetrics);\r
- isFrozen = new JCheckBox(Translation.get("gb.isFrozenDescription"), anRepository.isFrozen);\r
+ isFrozen = new JCheckBox(Translation.get("gb.isFrozenDescription"),\r
+ anRepository.isFrozen);\r
\r
- mailingListsField = new JTextField(ArrayUtils.isEmpty(anRepository.mailingLists) ? ""\r
- : StringUtils.flattenStrings(anRepository.mailingLists, " "), 50);\r
+ mailingListsField = new JTextField(\r
+ ArrayUtils.isEmpty(anRepository.mailingLists) ? ""\r
+ : StringUtils.flattenStrings(anRepository.mailingLists,\r
+ " "), 50);\r
\r
accessRestriction = new JComboBox(AccessRestrictionType.values());\r
accessRestriction.setRenderer(new AccessRestrictionRenderer());\r
\r
JPanel fieldsPanel = new JPanel(new GridLayout(0, 1));\r
fieldsPanel.add(newFieldPanel(Translation.get("gb.name"), nameField));\r
- fieldsPanel.add(newFieldPanel(Translation.get("gb.description"), descriptionField));\r
- fieldsPanel.add(newFieldPanel(Translation.get("gb.origin"), originField));\r
+ fieldsPanel.add(newFieldPanel(Translation.get("gb.description"),\r
+ descriptionField));\r
+ fieldsPanel\r
+ .add(newFieldPanel(Translation.get("gb.origin"), originField));\r
+ fieldsPanel.add(newFieldPanel(Translation.get("gb.defaultHead"),\r
+ defaultHeadField));\r
fieldsPanel.add(newFieldPanel(Translation.get("gb.owner"), ownerField));\r
\r
- fieldsPanel.add(newFieldPanel(Translation.get("gb.enableTickets"), useTickets));\r
- fieldsPanel.add(newFieldPanel(Translation.get("gb.enableDocs"), useDocs));\r
+ fieldsPanel.add(newFieldPanel(Translation.get("gb.enableTickets"),\r
+ useTickets));\r
+ fieldsPanel\r
+ .add(newFieldPanel(Translation.get("gb.enableDocs"), useDocs));\r
+ fieldsPanel.add(newFieldPanel(Translation.get("gb.showRemoteBranches"),\r
+ showRemoteBranches));\r
+ fieldsPanel.add(newFieldPanel(Translation.get("gb.showReadme"),\r
+ showReadme));\r
fieldsPanel\r
- .add(newFieldPanel(Translation.get("gb.showRemoteBranches"), showRemoteBranches));\r
- fieldsPanel.add(newFieldPanel(Translation.get("gb.showReadme"), showReadme));\r
- fieldsPanel.add(newFieldPanel(Translation.get("gb.skipSizeCalculation"),\r
- skipSizeCalculation));\r
+ .add(newFieldPanel(Translation.get("gb.skipSizeCalculation"),\r
+ skipSizeCalculation));\r
+ fieldsPanel.add(newFieldPanel(Translation.get("gb.skipSummaryMetrics"),\r
+ skipSummaryMetrics));\r
fieldsPanel\r
- .add(newFieldPanel(Translation.get("gb.skipSummaryMetrics"), skipSummaryMetrics));\r
- fieldsPanel.add(newFieldPanel(Translation.get("gb.isFrozen"), isFrozen));\r
- fieldsPanel.add(newFieldPanel(Translation.get("gb.mailingLists"), mailingListsField));\r
+ .add(newFieldPanel(Translation.get("gb.isFrozen"), isFrozen));\r
+ fieldsPanel.add(newFieldPanel(Translation.get("gb.mailingLists"),\r
+ mailingListsField));\r
\r
usersPalette = new JPalette<String>();\r
JPanel accessPanel = new JPanel(new BorderLayout(5, 5));\r
- accessPanel.add(newFieldPanel(Translation.get("gb.accessRestriction"), accessRestriction),\r
- BorderLayout.NORTH);\r
- accessPanel.add(newFieldPanel(Translation.get("gb.permittedUsers"), usersPalette),\r
- BorderLayout.CENTER);\r
+ accessPanel.add(\r
+ newFieldPanel(Translation.get("gb.accessRestriction"),\r
+ accessRestriction), BorderLayout.NORTH);\r
+ accessPanel.add(\r
+ newFieldPanel(Translation.get("gb.permittedUsers"),\r
+ usersPalette), BorderLayout.CENTER);\r
\r
teamsPalette = new JPalette<String>();\r
JPanel teamsPanel = new JPanel(new BorderLayout(5, 5));\r
- teamsPanel.add(newFieldPanel(Translation.get("gb.permittedTeams"), teamsPalette),\r
- BorderLayout.CENTER);\r
+ teamsPanel.add(\r
+ newFieldPanel(Translation.get("gb.permittedTeams"),\r
+ teamsPalette), BorderLayout.CENTER);\r
\r
setsPalette = new JPalette<String>();\r
JPanel federationPanel = new JPanel(new BorderLayout(5, 5));\r
federationPanel.add(\r
- newFieldPanel(Translation.get("gb.federationStrategy"), federationStrategy),\r
- BorderLayout.NORTH);\r
- federationPanel.add(newFieldPanel(Translation.get("gb.federationSets"), setsPalette),\r
- BorderLayout.CENTER);\r
+ newFieldPanel(Translation.get("gb.federationStrategy"),\r
+ federationStrategy), BorderLayout.NORTH);\r
+ federationPanel\r
+ .add(newFieldPanel(Translation.get("gb.federationSets"),\r
+ setsPalette), BorderLayout.CENTER);\r
\r
preReceivePalette = new JPalette<String>(true);\r
preReceiveInherited = new JLabel();\r
// confirm valid characters in repository name\r
Character c = StringUtils.findInvalidCharacter(rname);\r
if (c != null) {\r
- error(MessageFormat.format("Illegal character ''{0}'' in repository name!", c));\r
+ error(MessageFormat.format(\r
+ "Illegal character ''{0}'' in repository name!", c));\r
return false;\r
}\r
\r
// is case-insensitive, regardless of the Gitblit server's\r
// filesystem\r
if (repositoryNames.contains(rname.toLowerCase())) {\r
- error(MessageFormat.format(\r
- "Can not create repository ''{0}'' because it already exists.", rname));\r
+ error(MessageFormat\r
+ .format("Can not create repository ''{0}'' because it already exists.",\r
+ rname));\r
return false;\r
}\r
} else {\r
// check rename collision\r
if (!repositoryName.equalsIgnoreCase(rname)) {\r
if (repositoryNames.contains(rname.toLowerCase())) {\r
- error(MessageFormat.format(\r
- "Failed to rename ''{0}'' because ''{1}'' already exists.",\r
- repositoryName, rname));\r
+ error(MessageFormat\r
+ .format("Failed to rename ''{0}'' because ''{1}'' already exists.",\r
+ repositoryName, rname));\r
return false;\r
}\r
}\r
\r
repository.name = rname;\r
repository.description = descriptionField.getText();\r
- repository.owner = ownerField.getSelectedItem() == null ? null : ownerField\r
- .getSelectedItem().toString();\r
+ repository.owner = ownerField.getSelectedItem() == null ? null\r
+ : ownerField.getSelectedItem().toString();\r
+ repository.defaultHead = defaultHeadField.getSelectedItem() == null ? null\r
+ : defaultHeadField.getSelectedItem().toString();\r
repository.useTickets = useTickets.isSelected();\r
repository.useDocs = useDocs.isSelected();\r
repository.showRemoteBranches = showRemoteBranches.isSelected();\r
repository.mailingLists = new ArrayList<String>(list);\r
}\r
\r
- repository.accessRestriction = (AccessRestrictionType) accessRestriction.getSelectedItem();\r
- repository.federationStrategy = (FederationStrategy) federationStrategy.getSelectedItem();\r
+ repository.accessRestriction = (AccessRestrictionType) accessRestriction\r
+ .getSelectedItem();\r
+ repository.federationStrategy = (FederationStrategy) federationStrategy\r
+ .getSelectedItem();\r
\r
if (repository.federationStrategy.exceeds(FederationStrategy.EXCLUDE)) {\r
repository.federationSets = setsPalette.getSelections();\r
setsPalette.setObjects(all, selected);\r
}\r
\r
- public void setPreReceiveScripts(List<String> all, List<String> inherited, List<String> selected) {\r
+ public void setPreReceiveScripts(List<String> all, List<String> inherited,\r
+ List<String> selected) {\r
preReceivePalette.setObjects(all, selected);\r
showInherited(inherited, preReceiveInherited);\r
}\r
* restriction.\r
* \r
*/\r
- private class AccessRestrictionRenderer extends JLabel implements ListCellRenderer {\r
+ private class AccessRestrictionRenderer extends JLabel implements\r
+ ListCellRenderer {\r
\r
private static final long serialVersionUID = 1L;\r
\r
@Override\r
- public Component getListCellRendererComponent(JList list, Object value, int index,\r
- boolean isSelected, boolean cellHasFocus) {\r
+ public Component getListCellRendererComponent(JList list, Object value,\r
+ int index, boolean isSelected, boolean cellHasFocus) {\r
if (value instanceof AccessRestrictionType) {\r
AccessRestrictionType restriction = (AccessRestrictionType) value;\r
switch (restriction) {\r
* ListCellRenderer to display descriptive text about the federation\r
* strategy.\r
*/\r
- private class FederationStrategyRenderer extends JLabel implements ListCellRenderer {\r
+ private class FederationStrategyRenderer extends JLabel implements\r
+ ListCellRenderer {\r
\r
private static final long serialVersionUID = 1L;\r
\r
@Override\r
- public Component getListCellRendererComponent(JList list, Object value, int index,\r
- boolean isSelected, boolean cellHasFocus) {\r
+ public Component getListCellRendererComponent(JList list, Object value,\r
+ int index, boolean isSelected, boolean cellHasFocus) {\r
if (value instanceof FederationStrategy) {\r
FederationStrategy strategy = (FederationStrategy) value;\r
switch (strategy) {\r