From 699e71e76b15081baf746c6ce9c9144f7e5f1ff9 Mon Sep 17 00:00:00 2001 From: James Moger Date: Mon, 30 Sep 2013 09:30:04 -0400 Subject: Trim trailing whitespace and organize imports Change-Id: I9f91138b20219be6e3c4b28251487df262bff6cc --- .../com/gitblit/client/BooleanCellRenderer.java | 5 +- .../java/com/gitblit/client/BranchRenderer.java | 7 +- .../com/gitblit/client/ClosableTabComponent.java | 4 + .../java/com/gitblit/client/DateCellRenderer.java | 7 +- .../com/gitblit/client/EditRegistrationDialog.java | 8 +- .../com/gitblit/client/EditRepositoryDialog.java | 93 +++++++++++----------- .../java/com/gitblit/client/EditTeamDialog.java | 23 +++--- .../java/com/gitblit/client/EditUserDialog.java | 49 +++++++----- .../com/gitblit/client/FeedEntryTableModel.java | 7 +- src/main/java/com/gitblit/client/FeedsPanel.java | 17 +++- .../java/com/gitblit/client/FeedsTableModel.java | 7 +- .../java/com/gitblit/client/GitblitClient.java | 32 ++++---- .../java/com/gitblit/client/GitblitManager.java | 8 +- .../com/gitblit/client/GitblitManagerLauncher.java | 19 ++--- src/main/java/com/gitblit/client/GitblitPanel.java | 19 ++--- .../com/gitblit/client/GitblitRegistration.java | 4 +- .../java/com/gitblit/client/GitblitWorker.java | 1 + .../com/gitblit/client/IndicatorsRenderer.java | 8 +- src/main/java/com/gitblit/client/JPalette.java | 11 ++- .../java/com/gitblit/client/MessageRenderer.java | 17 ++-- src/main/java/com/gitblit/client/NameRenderer.java | 5 +- .../com/gitblit/client/PropertiesTableModel.java | 7 +- .../gitblit/client/RegistrantPermissionsPanel.java | 27 ++++--- .../client/RegistrantPermissionsTableModel.java | 11 +-- .../com/gitblit/client/RegistrationsDialog.java | 11 ++- .../gitblit/client/RegistrationsTableModel.java | 7 +- .../java/com/gitblit/client/RepositoriesPanel.java | 25 ++++-- .../com/gitblit/client/RepositoriesTableModel.java | 7 +- src/main/java/com/gitblit/client/SearchDialog.java | 13 ++- .../com/gitblit/client/SettingCellRenderer.java | 5 +- src/main/java/com/gitblit/client/SettingPanel.java | 2 +- .../java/com/gitblit/client/SettingsPanel.java | 12 ++- .../com/gitblit/client/SettingsTableModel.java | 7 +- src/main/java/com/gitblit/client/StatusPanel.java | 5 +- .../client/SubscribedRepositoryRenderer.java | 5 +- .../com/gitblit/client/SubscriptionsDialog.java | 8 +- src/main/java/com/gitblit/client/TeamsPanel.java | 16 +++- .../java/com/gitblit/client/TeamsTableModel.java | 7 +- src/main/java/com/gitblit/client/Translation.java | 10 +-- src/main/java/com/gitblit/client/UsersPanel.java | 22 +++-- .../java/com/gitblit/client/UsersTableModel.java | 7 +- src/main/java/com/gitblit/client/Utils.java | 6 +- 42 files changed, 345 insertions(+), 226 deletions(-) (limited to 'src/main/java/com/gitblit/client') diff --git a/src/main/java/com/gitblit/client/BooleanCellRenderer.java b/src/main/java/com/gitblit/client/BooleanCellRenderer.java index c8341df6..65a3c670 100644 --- a/src/main/java/com/gitblit/client/BooleanCellRenderer.java +++ b/src/main/java/com/gitblit/client/BooleanCellRenderer.java @@ -25,9 +25,9 @@ import javax.swing.table.TableCellRenderer; /** * Boolean checkbox cell renderer. - * + * * @author James Moger - * + * */ public class BooleanCellRenderer extends JCheckBox implements TableCellRenderer, Serializable { @@ -39,6 +39,7 @@ public class BooleanCellRenderer extends JCheckBox implements TableCellRenderer, setHorizontalAlignment(SwingConstants.CENTER); } + @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { if (value instanceof Boolean) { diff --git a/src/main/java/com/gitblit/client/BranchRenderer.java b/src/main/java/com/gitblit/client/BranchRenderer.java index 5f12c42c..43352d8f 100644 --- a/src/main/java/com/gitblit/client/BranchRenderer.java +++ b/src/main/java/com/gitblit/client/BranchRenderer.java @@ -26,9 +26,9 @@ import javax.swing.table.DefaultTableCellRenderer; /** * Branch renderer displays refs/heads and refs/remotes in a color similar to * the site. - * + * * @author James Moger - * + * */ public class BranchRenderer extends DefaultTableCellRenderer implements ListCellRenderer { @@ -37,9 +37,10 @@ public class BranchRenderer extends DefaultTableCellRenderer implements ListCell private static final String R_HEADS = "refs/heads/"; private static final String R_REMOTES = "refs/remotes/"; - + private static final String R_CHANGES = "refs/changes/"; + @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); diff --git a/src/main/java/com/gitblit/client/ClosableTabComponent.java b/src/main/java/com/gitblit/client/ClosableTabComponent.java index a121806a..f6bbaebc 100644 --- a/src/main/java/com/gitblit/client/ClosableTabComponent.java +++ b/src/main/java/com/gitblit/client/ClosableTabComponent.java @@ -46,6 +46,7 @@ public class ClosableTabComponent extends JPanel { private static final long serialVersionUID = 1L; private static final MouseListener BUTTON_MOUSE_LISTENER = new MouseAdapter() { + @Override public void mouseEntered(MouseEvent e) { Component component = e.getComponent(); if (component instanceof AbstractButton) { @@ -54,6 +55,7 @@ public class ClosableTabComponent extends JPanel { } } + @Override public void mouseExited(MouseEvent e) { Component component = e.getComponent(); if (component instanceof AbstractButton) { @@ -112,6 +114,7 @@ public class ClosableTabComponent extends JPanel { addActionListener(this); } + @Override public void actionPerformed(ActionEvent e) { int i = pane.indexOfTabComponent(ClosableTabComponent.this); Component c = pane.getComponentAt(i); @@ -123,6 +126,7 @@ public class ClosableTabComponent extends JPanel { } } + @Override public void updateUI() { } diff --git a/src/main/java/com/gitblit/client/DateCellRenderer.java b/src/main/java/com/gitblit/client/DateCellRenderer.java index 751c7dbb..ef5be3a6 100644 --- a/src/main/java/com/gitblit/client/DateCellRenderer.java +++ b/src/main/java/com/gitblit/client/DateCellRenderer.java @@ -26,22 +26,23 @@ import javax.swing.table.DefaultTableCellRenderer; /** * Time ago cell renderer with real date tooltip. - * + * * @author James Moger - * + * */ public class DateCellRenderer extends DefaultTableCellRenderer { private static final long serialVersionUID = 1L; private final String pattern; - + public DateCellRenderer(String pattern, Color foreground) { this.pattern = (pattern == null ? "yyyy-MM-dd HH:mm" : pattern); setForeground(foreground); setHorizontalAlignment(SwingConstants.CENTER); } + @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); diff --git a/src/main/java/com/gitblit/client/EditRegistrationDialog.java b/src/main/java/com/gitblit/client/EditRegistrationDialog.java index 99cd36fa..66bb197a 100644 --- a/src/main/java/com/gitblit/client/EditRegistrationDialog.java +++ b/src/main/java/com/gitblit/client/EditRegistrationDialog.java @@ -42,9 +42,9 @@ import com.gitblit.utils.StringUtils; /** * Dialog to create or edit a Gitblit registration. - * + * * @author James Moger - * + * */ public class EditRegistrationDialog extends JDialog { @@ -71,6 +71,7 @@ public class EditRegistrationDialog extends JDialog { KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0); JRootPane rootPane = new JRootPane(); rootPane.registerKeyboardAction(new ActionListener() { + @Override public void actionPerformed(ActionEvent actionEvent) { setVisible(false); } @@ -98,6 +99,7 @@ public class EditRegistrationDialog extends JDialog { JButton cancel = new JButton(Translation.get("gb.cancel")); cancel.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { setVisible(false); } @@ -105,6 +107,7 @@ public class EditRegistrationDialog extends JDialog { final JButton save = new JButton(Translation.get(isLogin ? "gb.login" : "gb.save")); save.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { if (validateFields()) { canceled = false; @@ -115,6 +118,7 @@ public class EditRegistrationDialog extends JDialog { // on enter in password field, save or login passwordField.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { save.doClick(); } diff --git a/src/main/java/com/gitblit/client/EditRepositoryDialog.java b/src/main/java/com/gitblit/client/EditRepositoryDialog.java index 118c5c82..4a8a2153 100644 --- a/src/main/java/com/gitblit/client/EditRepositoryDialog.java +++ b/src/main/java/com/gitblit/client/EditRepositoryDialog.java @@ -69,7 +69,7 @@ import com.gitblit.utils.StringUtils; /** * Dialog to create/edit a repository. - * + * * @author James Moger */ public class EditRepositoryDialog extends JDialog { @@ -93,7 +93,7 @@ public class EditRepositoryDialog extends JDialog { private JCheckBox useDocs; private JCheckBox useIncrementalPushTags; - + private JCheckBox showRemoteBranches; private JCheckBox showReadme; @@ -107,11 +107,11 @@ public class EditRepositoryDialog extends JDialog { private JTextField mailingListsField; private JComboBox accessRestriction; - + private JRadioButton allowAuthenticated; - + private JRadioButton allowNamed; - + private JCheckBox allowForks; private JCheckBox verifyCommitter; @@ -121,19 +121,19 @@ public class EditRepositoryDialog extends JDialog { private JPalette ownersPalette; private JComboBox headRefField; - + private JComboBox gcPeriod; - + private JTextField gcThreshold; - + private JComboBox maxActivityCommits; - + private RegistrantPermissionsPanel usersPalette; private JPalette setsPalette; private RegistrantPermissionsPanel teamsPalette; - + private JPalette indexedBranchesPalette; private JPalette preReceivePalette; @@ -145,9 +145,9 @@ public class EditRepositoryDialog extends JDialog { private JLabel postReceiveInherited; private Set repositoryNames; - + private JPanel customFieldsPanel; - + private List customTextfields; public EditRepositoryDialog(int protocolVersion) { @@ -175,6 +175,7 @@ public class EditRepositoryDialog extends JDialog { KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0); JRootPane rootPane = new JRootPane(); rootPane.registerKeyboardAction(new ActionListener() { + @Override public void actionPerformed(ActionEvent actionEvent) { setVisible(false); } @@ -194,17 +195,17 @@ public class EditRepositoryDialog extends JDialog { if (ArrayUtils.isEmpty(anRepository.availableRefs)) { headRefField = new JComboBox(); - headRefField.setEnabled(false); + headRefField.setEnabled(false); } else { headRefField = new JComboBox( anRepository.availableRefs.toArray()); headRefField.setSelectedItem(anRepository.HEAD); } - + Integer [] gcPeriods = { 1, 2, 3, 4, 5, 7, 10, 14 }; gcPeriod = new JComboBox(gcPeriods); gcPeriod.setSelectedItem(anRepository.gcPeriod); - + gcThreshold = new JTextField(8); gcThreshold.setText(anRepository.gcThreshold); @@ -250,21 +251,21 @@ public class EditRepositoryDialog extends JDialog { } } }); - - boolean authenticated = anRepository.authorizationControl != null + + boolean authenticated = anRepository.authorizationControl != null && AuthorizationControl.AUTHENTICATED.equals(anRepository.authorizationControl); allowAuthenticated = new JRadioButton(Translation.get("gb.allowAuthenticatedDescription")); allowAuthenticated.setSelected(authenticated); allowAuthenticated.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { - if (e.getStateChange() == ItemEvent.SELECTED) { + if (e.getStateChange() == ItemEvent.SELECTED) { usersPalette.setEnabled(false); teamsPalette.setEnabled(false); } } }); - + allowNamed = new JRadioButton(Translation.get("gb.allowNamedDescription")); allowNamed.setSelected(!authenticated); allowNamed.addItemListener(new ItemListener() { @@ -276,15 +277,15 @@ public class EditRepositoryDialog extends JDialog { } } }); - + ButtonGroup group = new ButtonGroup(); group.add(allowAuthenticated); group.add(allowNamed); - + JPanel authorizationPanel = new JPanel(new GridLayout(0, 1)); authorizationPanel.add(allowAuthenticated); authorizationPanel.add(allowNamed); - + allowForks = new JCheckBox(Translation.get("gb.allowForksDescription"), anRepository.allowForks); verifyCommitter = new JCheckBox(Translation.get("gb.verifyCommitterDescription"), anRepository.verifyCommitter); @@ -387,7 +388,7 @@ public class EditRepositoryDialog extends JDialog { JPanel postReceivePanel = new JPanel(new BorderLayout(5, 5)); postReceivePanel.add(postReceivePalette, BorderLayout.CENTER); postReceivePanel.add(postReceiveInherited, BorderLayout.WEST); - + customFieldsPanel = new JPanel(); customFieldsPanel.setLayout(new BoxLayout(customFieldsPanel, BoxLayout.Y_AXIS)); JScrollPane customFieldsScrollPane = new JScrollPane(customFieldsPanel); @@ -406,14 +407,15 @@ public class EditRepositoryDialog extends JDialog { } panel.addTab(Translation.get("gb.preReceiveScripts"), preReceivePanel); panel.addTab(Translation.get("gb.postReceiveScripts"), postReceivePanel); - + panel.addTab(Translation.get("gb.customFields"), customFieldsScrollPane); - + setupAccessPermissions(anRepository.accessRestriction); JButton createButton = new JButton(Translation.get("gb.save")); createButton.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { if (validateFields()) { canceled = false; @@ -424,6 +426,7 @@ public class EditRepositoryDialog extends JDialog { JButton cancelButton = new JButton(Translation.get("gb.cancel")); cancelButton.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { canceled = true; setVisible(false); @@ -452,7 +455,7 @@ public class EditRepositoryDialog extends JDialog { pack(); nameField.requestFocus(); } - + private JPanel newFieldPanel(String label, JComponent comp) { return newFieldPanel(label, 150, comp); } @@ -466,12 +469,12 @@ public class EditRepositoryDialog extends JDialog { panel.add(comp); return panel; } - + private void setupAccessPermissions(AccessRestrictionType art) { if (AccessRestrictionType.NONE.equals(art)) { usersPalette.setEnabled(false); teamsPalette.setEnabled(false); - + allowAuthenticated.setEnabled(false); allowNamed.setEnabled(false); verifyCommitter.setEnabled(false); @@ -479,7 +482,7 @@ public class EditRepositoryDialog extends JDialog { allowAuthenticated.setEnabled(true); allowNamed.setEnabled(true); verifyCommitter.setEnabled(true); - + if (allowNamed.isSelected()) { usersPalette.setEnabled(true); teamsPalette.setEnabled(true); @@ -575,7 +578,7 @@ public class EditRepositoryDialog extends JDialog { repository.skipSizeCalculation = skipSizeCalculation.isSelected(); repository.skipSummaryMetrics = skipSummaryMetrics.isSelected(); repository.maxActivityCommits = (Integer) maxActivityCommits.getSelectedItem(); - + repository.isFrozen = isFrozen.isSelected(); repository.allowForks = allowForks.isSelected(); repository.verifyCommitter = verifyCommitter.isSelected(); @@ -594,7 +597,7 @@ public class EditRepositoryDialog extends JDialog { repository.accessRestriction = (AccessRestrictionType) accessRestriction .getSelectedItem(); - repository.authorizationControl = allowAuthenticated.isSelected() ? + repository.authorizationControl = allowAuthenticated.isSelected() ? AuthorizationControl.AUTHENTICATED : AuthorizationControl.NAMED; repository.federationStrategy = (FederationStrategy) federationStrategy .getSelectedItem(); @@ -602,11 +605,11 @@ public class EditRepositoryDialog extends JDialog { if (repository.federationStrategy.exceeds(FederationStrategy.EXCLUDE)) { repository.federationSets = setsPalette.getSelections(); } - + repository.indexedBranches = indexedBranchesPalette.getSelections(); repository.preReceiveScripts = preReceivePalette.getSelections(); repository.postReceiveScripts = postReceivePalette.getSelections(); - + // Custom Fields repository.customFields = new LinkedHashMap(); if (customTextfields != null) { @@ -623,7 +626,7 @@ public class EditRepositoryDialog extends JDialog { JOptionPane.showMessageDialog(EditRepositoryDialog.this, message, Translation.get("gb.error"), JOptionPane.ERROR_MESSAGE); } - + public void setAccessRestriction(AccessRestrictionType restriction) { this.accessRestriction.setSelectedItem(restriction); setupAccessPermissions(restriction); @@ -658,7 +661,7 @@ public class EditRepositoryDialog extends JDialog { public void setFederationSets(List all, List selected) { setsPalette.setObjects(all, selected); } - + public void setIndexedBranches(List all, List selected) { indexedBranchesPalette.setObjects(all, selected); } @@ -701,11 +704,11 @@ public class EditRepositoryDialog extends JDialog { public List getTeamAccessPermissions() { return teamsPalette.getPermissions(); } - + public void setCustomFields(RepositoryModel repository, Map customFields) { customFieldsPanel.removeAll(); customTextfields = new ArrayList(); - + final Insets insets = new Insets(5, 5, 5, 5); JPanel fields = new JPanel(new GridLayout(0, 1, 0, 5)) { @@ -715,8 +718,8 @@ public class EditRepositoryDialog extends JDialog { public Insets getInsets() { return insets; } - }; - + }; + for (Map.Entry entry : customFields.entrySet()) { String field = entry.getKey(); String value = ""; @@ -725,14 +728,14 @@ public class EditRepositoryDialog extends JDialog { } JTextField textField = new JTextField(value); textField.setName(field); - + textField.setPreferredSize(new Dimension(450, 26)); - + fields.add(newFieldPanel(entry.getValue(), 250, textField)); - + customTextfields.add(textField); } - JScrollPane jsp = new JScrollPane(fields); + JScrollPane jsp = new JScrollPane(fields); jsp.getVerticalScrollBar().setBlockIncrement(100); jsp.getVerticalScrollBar().setUnitIncrement(100); jsp.setViewportBorder(null); @@ -743,7 +746,7 @@ public class EditRepositoryDialog extends JDialog { /** * ListCellRenderer to display descriptive text about the access * restriction. - * + * */ private class AccessRestrictionRenderer extends DefaultListCellRenderer { @@ -753,7 +756,7 @@ public class EditRepositoryDialog extends JDialog { public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); - + if (value instanceof AccessRestrictionType) { AccessRestrictionType restriction = (AccessRestrictionType) value; switch (restriction) { diff --git a/src/main/java/com/gitblit/client/EditTeamDialog.java b/src/main/java/com/gitblit/client/EditTeamDialog.java index 74640553..3c0b928c 100644 --- a/src/main/java/com/gitblit/client/EditTeamDialog.java +++ b/src/main/java/com/gitblit/client/EditTeamDialog.java @@ -70,11 +70,11 @@ public class EditTeamDialog extends JDialog { private boolean canceled = true; private JTextField teamnameField; - + private JCheckBox canAdminCheckbox; - + private JCheckBox canForkCheckbox; - + private JCheckBox canCreateCheckbox; private JTextField mailingListsField; @@ -117,6 +117,7 @@ public class EditTeamDialog extends JDialog { KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0); JRootPane rootPane = new JRootPane(); rootPane.registerKeyboardAction(new ActionListener() { + @Override public void actionPerformed(ActionEvent actionEvent) { setVisible(false); } @@ -127,7 +128,7 @@ public class EditTeamDialog extends JDialog { private void initialize(int protocolVersion, TeamModel aTeam) { teamnameField = new JTextField(aTeam.name == null ? "" : aTeam.name, 25); - canAdminCheckbox = new JCheckBox(Translation.get("gb.canAdminDescription"), aTeam.canAdmin); + canAdminCheckbox = new JCheckBox(Translation.get("gb.canAdminDescription"), aTeam.canAdmin); canForkCheckbox = new JCheckBox(Translation.get("gb.canForkDescription"), aTeam.canFork); canCreateCheckbox = new JCheckBox(Translation.get("gb.canCreateDescription"), aTeam.canCreate); @@ -146,7 +147,7 @@ public class EditTeamDialog extends JDialog { repositoryPalette = new RegistrantPermissionsPanel(RegistrantType.REPOSITORY); userPalette = new JPalette(); userPalette.setEnabled(settings.supportsTeamMembershipChanges); - + JPanel fieldsPanelTop = new JPanel(new BorderLayout()); fieldsPanelTop.add(fieldsPanel, BorderLayout.NORTH); @@ -154,6 +155,7 @@ public class EditTeamDialog extends JDialog { private static final long serialVersionUID = 1L; + @Override public Insets getInsets() { return _insets; } @@ -164,6 +166,7 @@ public class EditTeamDialog extends JDialog { private static final long serialVersionUID = 1L; + @Override public Insets getInsets() { return _insets; } @@ -175,7 +178,7 @@ public class EditTeamDialog extends JDialog { JPanel preReceivePanel = new JPanel(new BorderLayout(5, 5)); preReceivePanel.add(preReceivePalette, BorderLayout.CENTER); preReceivePanel.add(preReceiveInherited, BorderLayout.WEST); - + postReceivePalette = new JPalette(true); postReceiveInherited = new JLabel(); JPanel postReceivePanel = new JPanel(new BorderLayout(5, 5)); @@ -191,6 +194,7 @@ public class EditTeamDialog extends JDialog { JButton createButton = new JButton(Translation.get("gb.save")); createButton.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { if (validateFields()) { canceled = false; @@ -201,6 +205,7 @@ public class EditTeamDialog extends JDialog { JButton cancelButton = new JButton(Translation.get("gb.cancel")); cancelButton.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { canceled = true; setVisible(false); @@ -317,10 +322,10 @@ public class EditTeamDialog extends JDialog { if (repo.accessRestriction.exceeds(AccessRestrictionType.NONE) && repo.authorizationControl.equals(AuthorizationControl.NAMED)) { restricted.add(repo.name); - } + } } StringUtils.sortRepositorynames(restricted); - + List list = new ArrayList(); // repositories list.add(".*"); @@ -339,7 +344,7 @@ public class EditTeamDialog extends JDialog { // all repositories excluding personal repositories list.add("[^" + prefix + "].*"); } - + String lastProject = null; for (String repo : restricted) { String projectPath = StringUtils.getFirstPathElement(repo); diff --git a/src/main/java/com/gitblit/client/EditUserDialog.java b/src/main/java/com/gitblit/client/EditUserDialog.java index fd6745ea..fd5cf79d 100644 --- a/src/main/java/com/gitblit/client/EditUserDialog.java +++ b/src/main/java/com/gitblit/client/EditUserDialog.java @@ -79,29 +79,29 @@ public class EditUserDialog extends JDialog { private JPasswordField passwordField; private JPasswordField confirmPasswordField; - + private JTextField displayNameField; - + private JTextField emailAddressField; private JCheckBox canAdminCheckbox; - + private JCheckBox canForkCheckbox; - + private JCheckBox canCreateCheckbox; private JCheckBox notFederatedCheckbox; - + private JTextField organizationalUnitField; - + private JTextField organizationField; private JTextField localityField; - + private JTextField stateProvinceField; - + private JTextField countryCodeField; - + private RegistrantPermissionsPanel repositoryPalette; private JPalette teamsPalette; @@ -132,6 +132,7 @@ public class EditUserDialog extends JDialog { KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0); JRootPane rootPane = new JRootPane(); rootPane.registerKeyboardAction(new ActionListener() { + @Override public void actionPerformed(ActionEvent actionEvent) { setVisible(false); } @@ -146,19 +147,19 @@ public class EditUserDialog extends JDialog { 25); displayNameField = new JTextField(anUser.displayName == null ? "" : anUser.displayName, 25); emailAddressField = new JTextField(anUser.emailAddress == null ? "" : anUser.emailAddress, 25); - canAdminCheckbox = new JCheckBox(Translation.get("gb.canAdminDescription"), anUser.canAdmin); + canAdminCheckbox = new JCheckBox(Translation.get("gb.canAdminDescription"), anUser.canAdmin); canForkCheckbox = new JCheckBox(Translation.get("gb.canForkDescription"), anUser.canFork); canCreateCheckbox = new JCheckBox(Translation.get("gb.canCreateDescription"), anUser.canCreate); notFederatedCheckbox = new JCheckBox( Translation.get("gb.excludeFromFederationDescription"), anUser.excludeFromFederation); - + organizationalUnitField = new JTextField(anUser.organizationalUnit == null ? "" : anUser.organizationalUnit, 25); organizationField = new JTextField(anUser.organization == null ? "" : anUser.organization, 25); localityField = new JTextField(anUser.locality == null ? "" : anUser.locality, 25); stateProvinceField = new JTextField(anUser.stateProvince == null ? "" : anUser.stateProvince, 25); countryCodeField = new JTextField(anUser.countryCode == null ? "" : anUser.countryCode, 15); - + // credentials are optionally controlled by 3rd-party authentication usernameField.setEnabled(settings.supportsCredentialChanges); passwordField.setEnabled(settings.supportsCredentialChanges); @@ -166,7 +167,7 @@ public class EditUserDialog extends JDialog { displayNameField.setEnabled(settings.supportsDisplayNameChanges); emailAddressField.setEnabled(settings.supportsEmailAddressChanges); - + organizationalUnitField.setEnabled(settings.supportsDisplayNameChanges); organizationField.setEnabled(settings.supportsDisplayNameChanges); localityField.setEnabled(settings.supportsDisplayNameChanges); @@ -191,7 +192,7 @@ public class EditUserDialog extends JDialog { attributesPanel.add(newFieldPanel(Translation.get("gb.locality") + " (L)", localityField)); attributesPanel.add(newFieldPanel(Translation.get("gb.stateProvince") + " (ST)", stateProvinceField)); attributesPanel.add(newFieldPanel(Translation.get("gb.countryCode") + " (C)", countryCodeField)); - + final Insets _insets = new Insets(5, 5, 5, 5); repositoryPalette = new RegistrantPermissionsPanel(RegistrantType.REPOSITORY); teamsPalette = new JPalette(); @@ -207,6 +208,7 @@ public class EditUserDialog extends JDialog { private static final long serialVersionUID = 1L; + @Override public Insets getInsets() { return _insets; } @@ -217,6 +219,7 @@ public class EditUserDialog extends JDialog { private static final long serialVersionUID = 1L; + @Override public Insets getInsets() { return _insets; } @@ -233,6 +236,7 @@ public class EditUserDialog extends JDialog { JButton createButton = new JButton(Translation.get("gb.save")); createButton.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { if (validateFields()) { canceled = false; @@ -243,6 +247,7 @@ public class EditUserDialog extends JDialog { JButton cancelButton = new JButton(Translation.get("gb.cancel")); cancelButton.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { canceled = true; setVisible(false); @@ -349,7 +354,7 @@ public class EditUserDialog extends JDialog { // no change in password user.password = password; } - + user.displayName = displayNameField.getText().trim(); user.emailAddress = emailAddressField.getText().trim(); @@ -363,7 +368,7 @@ public class EditUserDialog extends JDialog { user.locality = localityField.getText().trim(); user.stateProvince = stateProvinceField.getText().trim(); user.countryCode = countryCodeField.getText().trim(); - + for (RegistrantAccessPermission rp : repositoryPalette.getPermissions()) { user.setRepositoryPermission(rp.registrant, rp.permission); } @@ -394,16 +399,16 @@ public class EditUserDialog extends JDialog { if (repo.accessRestriction.exceeds(AccessRestrictionType.NONE) && repo.authorizationControl.equals(AuthorizationControl.NAMED)) { restricted.add(repo.name); - } + } } repoMap.put(repo.name.toLowerCase(), repo); } StringUtils.sortRepositorynames(restricted); - + List list = new ArrayList(); // repositories list.add(".*"); - + String prefix; if (settings.hasKey(Keys.git.userRepositoryPrefix)) { prefix = settings.get(Keys.git.userRepositoryPrefix).currentValue; @@ -418,7 +423,7 @@ public class EditUserDialog extends JDialog { // all repositories excluding personal repositories list.add("[^" + prefix + "].*"); } - + String lastProject = null; for (String repo : restricted) { String projectPath = StringUtils.getFirstPathElement(repo).toLowerCase(); @@ -440,7 +445,7 @@ public class EditUserDialog extends JDialog { list.remove(rp.registrant.toLowerCase()); } } - + // update owner and missing permissions for editing for (RegistrantAccessPermission permission : permissions) { if (permission.mutable && PermissionType.EXPLICIT.equals(permission.permissionType)) { @@ -471,7 +476,7 @@ public class EditUserDialog extends JDialog { } teamsPalette.setObjects(teams, selected); } - + public UserModel getUser() { if (canceled) { return null; diff --git a/src/main/java/com/gitblit/client/FeedEntryTableModel.java b/src/main/java/com/gitblit/client/FeedEntryTableModel.java index 0b0ef178..2118bc33 100644 --- a/src/main/java/com/gitblit/client/FeedEntryTableModel.java +++ b/src/main/java/com/gitblit/client/FeedEntryTableModel.java @@ -26,9 +26,9 @@ import com.gitblit.models.FeedEntryModel; /** * Table model for a list of retrieved feed entries. - * + * * @author James Moger - * + * */ public class FeedEntryTableModel extends AbstractTableModel { @@ -84,11 +84,12 @@ public class FeedEntryTableModel extends AbstractTableModel { /** * Returns Object.class regardless of columnIndex. - * + * * @param columnIndex * the column being queried * @return the Object.class */ + @Override public Class getColumnClass(int columnIndex) { if (Columns.Date.ordinal() == columnIndex) { return Date.class; diff --git a/src/main/java/com/gitblit/client/FeedsPanel.java b/src/main/java/com/gitblit/client/FeedsPanel.java index 392636e4..3b7959e7 100644 --- a/src/main/java/com/gitblit/client/FeedsPanel.java +++ b/src/main/java/com/gitblit/client/FeedsPanel.java @@ -49,9 +49,9 @@ import com.gitblit.utils.StringUtils; /** * RSS Feeds Panel displays recent entries and launches the browser to view the * commit. commitdiff, or tree of a commit. - * + * * @author James Moger - * + * */ public abstract class FeedsPanel extends JPanel { @@ -95,6 +95,7 @@ public abstract class FeedsPanel extends JPanel { prev.setToolTipText(Translation.get("gb.pagePrevious")); prev.setEnabled(false); prev.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { refreshFeeds(--page); } @@ -104,6 +105,7 @@ public abstract class FeedsPanel extends JPanel { next.setToolTipText(Translation.get("gb.pageNext")); next.setEnabled(false); next.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { refreshFeeds(++page); } @@ -111,6 +113,7 @@ public abstract class FeedsPanel extends JPanel { JButton refreshFeeds = new JButton(Translation.get("gb.refresh")); refreshFeeds.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { refreshFeeds(0); } @@ -119,6 +122,7 @@ public abstract class FeedsPanel extends JPanel { final JButton viewCommit = new JButton(Translation.get("gb.view")); viewCommit.setEnabled(false); viewCommit.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { viewCommit(); } @@ -127,6 +131,7 @@ public abstract class FeedsPanel extends JPanel { final JButton viewCommitDiff = new JButton(Translation.get("gb.commitdiff")); viewCommitDiff.setEnabled(false); viewCommitDiff.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { viewCommitDiff(); } @@ -135,6 +140,7 @@ public abstract class FeedsPanel extends JPanel { final JButton viewTree = new JButton(Translation.get("gb.tree")); viewTree.setEnabled(false); viewTree.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { viewTree(); } @@ -142,6 +148,7 @@ public abstract class FeedsPanel extends JPanel { JButton subscribeFeeds = new JButton(Translation.get("gb.subscribe") + "..."); subscribeFeeds.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { subscribeFeeds(gitblit.getAvailableFeeds()); } @@ -171,6 +178,7 @@ public abstract class FeedsPanel extends JPanel { table.getColumn(name).setCellRenderer(new MessageRenderer(gitblit)); table.addMouseListener(new MouseAdapter() { + @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { if (e.isControlDown()) { @@ -200,6 +208,7 @@ public abstract class FeedsPanel extends JPanel { repositorySelector.setRenderer(nameRenderer); repositorySelector.setForeground(nameRenderer.getForeground()); repositorySelector.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { // repopulate the author list based on repository selection // preserve author selection, if possible @@ -221,6 +230,7 @@ public abstract class FeedsPanel extends JPanel { authorSelector.setRenderer(nameRenderer); authorSelector.setForeground(nameRenderer.getForeground()); authorSelector.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { filterFeeds(); } @@ -371,6 +381,7 @@ public abstract class FeedsPanel extends JPanel { if (repository.equals(ALL)) { // author filter containsFilter = new RowFilter() { + @Override public boolean include( Entry entry) { return entry.getStringValue(authorIndex).equalsIgnoreCase(author); @@ -379,6 +390,7 @@ public abstract class FeedsPanel extends JPanel { } else if (author.equals(ALL)) { // repository filter containsFilter = new RowFilter() { + @Override public boolean include( Entry entry) { return entry.getStringValue(repositoryIndex).equalsIgnoreCase(repository); @@ -387,6 +399,7 @@ public abstract class FeedsPanel extends JPanel { } else { // repository-author filter containsFilter = new RowFilter() { + @Override public boolean include( Entry entry) { boolean authorMatch = entry.getStringValue(authorIndex) diff --git a/src/main/java/com/gitblit/client/FeedsTableModel.java b/src/main/java/com/gitblit/client/FeedsTableModel.java index 0979a4c9..e709b6a4 100644 --- a/src/main/java/com/gitblit/client/FeedsTableModel.java +++ b/src/main/java/com/gitblit/client/FeedsTableModel.java @@ -25,9 +25,9 @@ import com.gitblit.models.FeedModel; /** * Table model of a list of available feeds. - * + * * @author James Moger - * + * */ public class FeedsTableModel extends AbstractTableModel { @@ -77,11 +77,12 @@ public class FeedsTableModel extends AbstractTableModel { /** * Returns Object.class regardless of columnIndex. - * + * * @param columnIndex * the column being queried * @return the Object.class */ + @Override public Class getColumnClass(int columnIndex) { Columns col = Columns.values()[columnIndex]; switch (col) { diff --git a/src/main/java/com/gitblit/client/GitblitClient.java b/src/main/java/com/gitblit/client/GitblitClient.java index 427f45ba..66625a8e 100644 --- a/src/main/java/com/gitblit/client/GitblitClient.java +++ b/src/main/java/com/gitblit/client/GitblitClient.java @@ -55,9 +55,9 @@ import com.gitblit.utils.SyndicationUtils; /** * GitblitClient is a object that retrieves data from a Gitblit server, caches * it for local operations, and allows updating or creating Gitblit objects. - * + * * @author James Moger - * + * */ public class GitblitClient implements Serializable { @@ -191,7 +191,7 @@ public class GitblitClient implements Serializable { return sb.toString(); } } - + public AccessRestrictionType getDefaultAccessRestriction() { String restriction = "PUSH"; if (settings.hasKey(Keys.git.defaultAccessRestriction)) { @@ -211,7 +211,7 @@ public class GitblitClient implements Serializable { /** * Returns the list of pre-receive scripts the repository inherited from the * global settings and team affiliations. - * + * * @param repository * if null only the globally specified scripts are returned * @return a list of scripts @@ -243,7 +243,7 @@ public class GitblitClient implements Serializable { * Returns the list of all available Groovy pre-receive push hook scripts * that are not already inherited by the repository. Script files must have * .groovy extension - * + * * @param repository * optional parameter * @return list of available hook scripts @@ -264,7 +264,7 @@ public class GitblitClient implements Serializable { /** * Returns the list of post-receive scripts the repository inherited from * the global settings and team affiliations. - * + * * @param repository * if null only the globally specified scripts are returned * @return a list of scripts @@ -295,7 +295,7 @@ public class GitblitClient implements Serializable { * Returns the list of unused Groovy post-receive push hook scripts that are * not already inherited by the repository. Script files must have .groovy * extension - * + * * @param repository * optional parameter * @return list of available hook scripts @@ -305,7 +305,7 @@ public class GitblitClient implements Serializable { // create list of available scripts by excluding inherited scripts List scripts = new ArrayList(); - if (!ArrayUtils.isEmpty(settings.pushScripts)) { + if (!ArrayUtils.isEmpty(settings.pushScripts)) { for (String script : settings.pushScripts) { if (!inherited.contains(script)) { scripts.add(script); @@ -478,7 +478,7 @@ public class GitblitClient implements Serializable { public List getUsers() { return allUsers; } - + public UserModel getUser(String username) { for (UserModel user : getUsers()) { if (user.username.equalsIgnoreCase(username)) { @@ -506,11 +506,11 @@ public class GitblitClient implements Serializable { } return usernames; } - + /** * Returns the effective list of permissions for this user, taking into account * team memberships, ownerships. - * + * * @param user * @return the effective list of permissions for the user */ @@ -541,12 +541,12 @@ public class GitblitClient implements Serializable { set.add(rp); } } - + List list = new ArrayList(set); Collections.sort(list); return list; } - + public List getUserAccessPermissions(RepositoryModel repository) { List list = new ArrayList(); if (AccessRestrictionType.NONE.equals(repository.accessRestriction)) { @@ -593,7 +593,7 @@ public class GitblitClient implements Serializable { } return teamnames; } - + public List getTeamAccessPermissions(RepositoryModel repository) { List list = new ArrayList(); for (TeamModel team : allTeams) { @@ -626,7 +626,7 @@ public class GitblitClient implements Serializable { public List getRepositories() { return allRepositories; } - + public RepositoryModel getRepository(String name) { for (RepositoryModel repository : allRepositories) { if (repository.name.equalsIgnoreCase(name)) { @@ -682,7 +682,7 @@ public class GitblitClient implements Serializable { public boolean deleteRepository(RepositoryModel repository) throws IOException { return RpcUtils.deleteRepository(repository, url, account, password); } - + public boolean clearRepositoryCache() throws IOException { return RpcUtils.clearRepositoryCache(url, account, password); } diff --git a/src/main/java/com/gitblit/client/GitblitManager.java b/src/main/java/com/gitblit/client/GitblitManager.java index d2fd7f7b..06e48923 100644 --- a/src/main/java/com/gitblit/client/GitblitManager.java +++ b/src/main/java/com/gitblit/client/GitblitManager.java @@ -70,9 +70,9 @@ import com.gitblit.utils.StringUtils; /** * Gitblit Manager issues JSON RPC requests to a Gitblit server. - * + * * @author James Moger - * + * */ public class GitblitManager extends JFrame implements RegistrationsDialog.RegistrationListener { @@ -173,6 +173,7 @@ public class GitblitManager extends JFrame implements RegistrationsDialog.Regist JMenuItem manage = new JMenuItem(Translation.get("gb.manage") + "..."); manage.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_M, KeyEvent.CTRL_DOWN_MASK, false)); manage.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { manageRegistrations(); } @@ -287,6 +288,7 @@ public class GitblitManager extends JFrame implements RegistrationsDialog.Regist item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_1 + i, KeyEvent.CTRL_DOWN_MASK, false)); item.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { login(reg); } @@ -317,6 +319,7 @@ public class GitblitManager extends JFrame implements RegistrationsDialog.Regist GitblitRegistration reg = new GitblitRegistration(server, url, account, password) { private static final long serialVersionUID = 1L; + @Override protected void cacheFeeds() { writeFeedCache(this); } @@ -444,6 +447,7 @@ public class GitblitManager extends JFrame implements RegistrationsDialog.Regist public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { + @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); diff --git a/src/main/java/com/gitblit/client/GitblitManagerLauncher.java b/src/main/java/com/gitblit/client/GitblitManagerLauncher.java index d0cc8393..8a43c472 100644 --- a/src/main/java/com/gitblit/client/GitblitManagerLauncher.java +++ b/src/main/java/com/gitblit/client/GitblitManagerLauncher.java @@ -36,9 +36,9 @@ import com.gitblit.Constants; /** * Downloads dependencies and launches Gitblit Manager. - * + * * @author James Moger - * + * */ public class GitblitManagerLauncher { @@ -51,10 +51,10 @@ public class GitblitManagerLauncher { public static void main(String[] args) { final SplashScreen splash = SplashScreen.getSplashScreen(); - + File libFolder = new File("ext"); List jars = findJars(libFolder.getAbsoluteFile()); - + // sort the jars by name and then reverse the order so the newer version // of the library gets loaded in the event that this is an upgrade Collections.sort(jars); @@ -67,7 +67,7 @@ public class GitblitManagerLauncher { } } - + updateSplash(splash, Translation.get("gb.starting") + " Gitblit Manager..."); GitblitManager.main(args); } @@ -78,12 +78,13 @@ public class GitblitManagerLauncher { } try { EventQueue.invokeAndWait(new Runnable() { + @Override public void run() { Graphics2D g = splash.createGraphics(); if (g != null) { // Splash is 320x120 FontMetrics fm = g.getFontMetrics(); - + // paint startup status g.setColor(Color.darkGray); int h = fm.getHeight() + fm.getMaxDescent(); @@ -96,7 +97,7 @@ public class GitblitManagerLauncher { g.setColor(Color.WHITE); int xw = fm.stringWidth(string); g.drawString(string, x + ((w - xw) / 2), y - 5); - + // paint version String ver = "v" + Constants.getVersion(); int vw = g.getFontMetrics().stringWidth(ver); @@ -110,7 +111,7 @@ public class GitblitManagerLauncher { t.printStackTrace(); } } - + public static List findJars(File folder) { List jars = new ArrayList(); if (folder.exists()) { @@ -135,7 +136,7 @@ public class GitblitManagerLauncher { /** * Adds a file to the classpath - * + * * @param f * the file to be added * @throws IOException diff --git a/src/main/java/com/gitblit/client/GitblitPanel.java b/src/main/java/com/gitblit/client/GitblitPanel.java index f14ce790..84c79050 100644 --- a/src/main/java/com/gitblit/client/GitblitPanel.java +++ b/src/main/java/com/gitblit/client/GitblitPanel.java @@ -31,9 +31,9 @@ import com.gitblit.models.FeedModel; /** * GitblitPanel is a container for the repository, users, settings, etc panels. - * + * * @author James Moger - * + * */ public class GitblitPanel extends JPanel implements CloseTabListener { @@ -50,7 +50,7 @@ public class GitblitPanel extends JPanel implements CloseTabListener { private FeedsPanel feedsPanel; private UsersPanel usersPanel; - + private TeamsPanel teamsPanel; private SettingsPanel settingsPanel; @@ -69,6 +69,7 @@ public class GitblitPanel extends JPanel implements CloseTabListener { tabs.addTab(Translation.get("gb.settings"), createSettingsPanel()); tabs.addTab(Translation.get("gb.status"), createStatusPanel()); tabs.addChangeListener(new ChangeListener() { + @Override public void stateChanged(ChangeEvent e) { tabs.getSelectedComponent().requestFocus(); } @@ -92,7 +93,7 @@ public class GitblitPanel extends JPanel implements CloseTabListener { protected void updateUsersTable() { usersPanel.updateTable(false); } - + @Override protected void updateTeamsTable() { teamsPanel.updateTable(false); @@ -116,9 +117,9 @@ public class GitblitPanel extends JPanel implements CloseTabListener { private JPanel createUsersPanel() { usersPanel = new UsersPanel(gitblit) { - + private static final long serialVersionUID = 1L; - + @Override protected void updateTeamsTable() { teamsPanel.updateTable(false); @@ -126,10 +127,10 @@ public class GitblitPanel extends JPanel implements CloseTabListener { }; return usersPanel; } - + private JPanel createTeamsPanel() { teamsPanel = new TeamsPanel(gitblit) { - + private static final long serialVersionUID = 1L; @Override @@ -138,7 +139,7 @@ public class GitblitPanel extends JPanel implements CloseTabListener { } }; return teamsPanel; - } + } private JPanel createSettingsPanel() { settingsPanel = new SettingsPanel(gitblit); diff --git a/src/main/java/com/gitblit/client/GitblitRegistration.java b/src/main/java/com/gitblit/client/GitblitRegistration.java index f9d07488..c95f01ac 100644 --- a/src/main/java/com/gitblit/client/GitblitRegistration.java +++ b/src/main/java/com/gitblit/client/GitblitRegistration.java @@ -25,9 +25,9 @@ import com.gitblit.utils.StringUtils; /** * Simple class to encapsulate a Gitblit server registration. - * + * * @author James Moger - * + * */ public class GitblitRegistration implements Serializable, Comparable { diff --git a/src/main/java/com/gitblit/client/GitblitWorker.java b/src/main/java/com/gitblit/client/GitblitWorker.java index 93c35d6b..86ec9204 100644 --- a/src/main/java/com/gitblit/client/GitblitWorker.java +++ b/src/main/java/com/gitblit/client/GitblitWorker.java @@ -50,6 +50,7 @@ public abstract class GitblitWorker extends SwingWorker { return doRequest(); } + @Override protected void done() { parent.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); try { diff --git a/src/main/java/com/gitblit/client/IndicatorsRenderer.java b/src/main/java/com/gitblit/client/IndicatorsRenderer.java index 44b39d01..66cce018 100644 --- a/src/main/java/com/gitblit/client/IndicatorsRenderer.java +++ b/src/main/java/com/gitblit/client/IndicatorsRenderer.java @@ -30,9 +30,9 @@ import com.gitblit.models.RepositoryModel; /** * Renders the type indicators (tickets, frozen, access restriction, etc) in a * single cell. - * + * * @author James Moger - * + * */ public class IndicatorsRenderer extends JPanel implements TableCellRenderer, Serializable { @@ -53,9 +53,9 @@ public class IndicatorsRenderer extends JPanel implements TableCellRenderer, Ser private final ImageIcon frozenIcon; private final ImageIcon federatedIcon; - + private final ImageIcon forkIcon; - + private final ImageIcon sparkleshareIcon; public IndicatorsRenderer() { diff --git a/src/main/java/com/gitblit/client/JPalette.java b/src/main/java/com/gitblit/client/JPalette.java index a0c2b258..47b3f4dd 100644 --- a/src/main/java/com/gitblit/client/JPalette.java +++ b/src/main/java/com/gitblit/client/JPalette.java @@ -58,6 +58,7 @@ public class JPalette extends JPanel { add = new JButton("->"); add.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { List move = new ArrayList(); if (available.getSelectedRowCount() <= 0) { @@ -65,7 +66,7 @@ public class JPalette extends JPanel { } for (int row : available.getSelectedRows()) { int modelIndex = available.convertRowIndexToModel(row); - T item = (T) availableModel.list.get(modelIndex); + T item = availableModel.list.get(modelIndex); move.add(item); } availableModel.list.removeAll(move); @@ -76,6 +77,7 @@ public class JPalette extends JPanel { }); subtract = new JButton("<-"); subtract.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { List move = new ArrayList(); if (selected.getSelectedRowCount() <= 0) { @@ -83,7 +85,7 @@ public class JPalette extends JPanel { } for (int row : selected.getSelectedRows()) { int modelIndex = selected.convertRowIndexToModel(row); - T item = (T) selectedModel.list.get(modelIndex); + T item = selectedModel.list.get(modelIndex); move.add(item); } selectedModel.list.removeAll(move); @@ -96,6 +98,7 @@ public class JPalette extends JPanel { up = new JButton("\u2191"); up.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { int row = selected.getSelectedRow(); if (row > 0) { @@ -108,6 +111,7 @@ public class JPalette extends JPanel { down = new JButton("\u2193"); down.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { int row = selected.getSelectedRow(); if (row < selected.getRowCount() - 1) { @@ -152,7 +156,7 @@ public class JPalette extends JPanel { panel.add(jsp, BorderLayout.CENTER); return panel; } - + @Override public void setEnabled(boolean enabled) { super.setEnabled(enabled); @@ -211,6 +215,7 @@ public class JPalette extends JPanel { return Translation.get("gb.name"); } + @Override public Class getColumnClass(int columnIndex) { return String.class; } diff --git a/src/main/java/com/gitblit/client/MessageRenderer.java b/src/main/java/com/gitblit/client/MessageRenderer.java index 2fe3415a..453c4fcf 100644 --- a/src/main/java/com/gitblit/client/MessageRenderer.java +++ b/src/main/java/com/gitblit/client/MessageRenderer.java @@ -36,20 +36,20 @@ import com.gitblit.models.FeedEntryModel; /** * Message renderer displays the short log message and then any refs in a style * like the site. - * + * * @author James Moger - * + * */ public class MessageRenderer extends JPanel implements TableCellRenderer, Serializable { private static final long serialVersionUID = 1L; private final GitblitClient gitblit; - + private final ImageIcon mergeIcon; - + private final ImageIcon blankIcon; - + private final JLabel messageLabel; private final JLabel headLabel; @@ -67,12 +67,12 @@ public class MessageRenderer extends JPanel implements TableCellRenderer, Serial public MessageRenderer(GitblitClient gitblit) { super(new FlowLayout(FlowLayout.LEFT, Utils.MARGIN, 1)); this.gitblit = gitblit; - + mergeIcon = new ImageIcon(getClass().getResource("/commit_merge_16x16.png")); blankIcon = new ImageIcon(getClass().getResource("/blank.png")); messageLabel = new JLabel(); - + headLabel = newRefLabel(); branchLabel = newRefLabel(); remoteLabel = newRefLabel(); @@ -85,7 +85,7 @@ public class MessageRenderer extends JPanel implements TableCellRenderer, Serial add(tagLabel); } - private JLabel newRefLabel() { + private JLabel newRefLabel() { JLabel label = new JLabel(); label.setOpaque(true); Font font = label.getFont(); @@ -131,6 +131,7 @@ public class MessageRenderer extends JPanel implements TableCellRenderer, Serial label.setVisible(true); } + @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { if (isSelected) diff --git a/src/main/java/com/gitblit/client/NameRenderer.java b/src/main/java/com/gitblit/client/NameRenderer.java index 4cbb5906..29b8f9b8 100644 --- a/src/main/java/com/gitblit/client/NameRenderer.java +++ b/src/main/java/com/gitblit/client/NameRenderer.java @@ -26,9 +26,9 @@ import javax.swing.table.DefaultTableCellRenderer; /** * Repository name cell renderer. This renderer shows the group name in a gray * color and accentuates the repository name in a cornflower blue color. - * + * * @author James Moger - * + * */ public class NameRenderer extends DefaultTableCellRenderer implements ListCellRenderer { @@ -56,6 +56,7 @@ public class NameRenderer extends DefaultTableCellRenderer implements ListCellRe return sb.toString(); } + @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); diff --git a/src/main/java/com/gitblit/client/PropertiesTableModel.java b/src/main/java/com/gitblit/client/PropertiesTableModel.java index 0c803f47..9941ee43 100644 --- a/src/main/java/com/gitblit/client/PropertiesTableModel.java +++ b/src/main/java/com/gitblit/client/PropertiesTableModel.java @@ -25,9 +25,9 @@ import javax.swing.table.AbstractTableModel; /** * Table model of a map of properties. - * + * * @author James Moger - * + * */ public class PropertiesTableModel extends AbstractTableModel { @@ -82,11 +82,12 @@ public class PropertiesTableModel extends AbstractTableModel { /** * Returns Object.class regardless of columnIndex. - * + * * @param columnIndex * the column being queried * @return the Object.class */ + @Override public Class getColumnClass(int columnIndex) { return String.class; } diff --git a/src/main/java/com/gitblit/client/RegistrantPermissionsPanel.java b/src/main/java/com/gitblit/client/RegistrantPermissionsPanel.java index 98dbfb72..3d5aa4a7 100644 --- a/src/main/java/com/gitblit/client/RegistrantPermissionsPanel.java +++ b/src/main/java/com/gitblit/client/RegistrantPermissionsPanel.java @@ -46,7 +46,7 @@ import com.gitblit.utils.StringUtils; public class RegistrantPermissionsPanel extends JPanel { private static final long serialVersionUID = 1L; - + private JTable permissionsTable; private RegistrantPermissionsTableModel tableModel; @@ -67,7 +67,7 @@ public class RegistrantPermissionsPanel extends JPanel { permissionsTable = Utils.newTable(tableModel, Utils.DATE_FORMAT, new RowRenderer() { Color clear = new Color(0, 0, 0, 0); Color iceGray = new Color(0xf0, 0xf0, 0xf0); - + @Override public void prepareRow(Component c, boolean isSelected, int row, int column) { if (isSelected) { @@ -85,19 +85,20 @@ public class RegistrantPermissionsPanel extends JPanel { permissionsTable.setPreferredScrollableViewportSize(new Dimension(400, 150)); JScrollPane jsp = new JScrollPane(permissionsTable); add(jsp, BorderLayout.CENTER); - + permissionsTable.getColumnModel().getColumn(RegistrantPermissionsTableModel.Columns.Registrant.ordinal()) .setCellRenderer(new NameRenderer()); permissionsTable.getColumnModel().getColumn(RegistrantPermissionsTableModel.Columns.Type.ordinal()) .setCellRenderer(new PermissionTypeRenderer()); permissionsTable.getColumnModel().getColumn(RegistrantPermissionsTableModel.Columns.Permission.ordinal()) .setCellEditor(new AccessPermissionEditor()); - + registrantModel = new DefaultComboBoxModel(); registrantSelector = new JComboBox(registrantModel); permissionSelector = new JComboBox(AccessPermission.NEWPERMISSIONS); addButton = new JButton(Translation.get("gb.add")); addButton.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { if (registrantSelector.getSelectedIndex() < 0) { return; @@ -105,7 +106,7 @@ public class RegistrantPermissionsPanel extends JPanel { if (permissionSelector.getSelectedIndex() < 0) { return; } - + RegistrantAccessPermission rp = new RegistrantAccessPermission(registrantType); rp.registrant = registrantSelector.getSelectedItem().toString(); rp.permission = (AccessPermission) permissionSelector.getSelectedItem(); @@ -119,16 +120,16 @@ public class RegistrantPermissionsPanel extends JPanel { tableModel.permissions.add(rp); // resort permissions after insert to convey idea of eval order Collections.sort(tableModel.permissions); - + registrantModel.removeElement(rp.registrant); registrantSelector.setSelectedIndex(-1); registrantSelector.invalidate(); addPanel.setVisible(registrantModel.getSize() > 0); - + tableModel.fireTableDataChanged(); } }); - + addPanel = new JPanel(); addPanel.add(registrantSelector); addPanel.add(permissionSelector); @@ -172,7 +173,7 @@ public class RegistrantPermissionsPanel extends JPanel { registrantModel.addElement(registrant); } tableModel.setPermissions(permissions); - + registrantSelector.setSelectedIndex(-1); permissionSelector.setSelectedIndex(-1); addPanel.setVisible(filtered.size() > 0); @@ -181,16 +182,16 @@ public class RegistrantPermissionsPanel extends JPanel { public List getPermissions() { return tableModel.permissions; } - + private class AccessPermissionEditor extends DefaultCellEditor { - + private static final long serialVersionUID = 1L; public AccessPermissionEditor() { - super(new JComboBox(AccessPermission.values())); + super(new JComboBox(AccessPermission.values())); } } - + private class PermissionTypeRenderer extends DefaultTableCellRenderer { private static final long serialVersionUID = 1L; diff --git a/src/main/java/com/gitblit/client/RegistrantPermissionsTableModel.java b/src/main/java/com/gitblit/client/RegistrantPermissionsTableModel.java index 28d25345..402104df 100644 --- a/src/main/java/com/gitblit/client/RegistrantPermissionsTableModel.java +++ b/src/main/java/com/gitblit/client/RegistrantPermissionsTableModel.java @@ -25,9 +25,9 @@ import com.gitblit.models.RegistrantAccessPermission; /** * Table model of a registrant permissions. - * + * * @author James Moger - * + * */ public class RegistrantPermissionsTableModel extends AbstractTableModel { @@ -82,11 +82,12 @@ public class RegistrantPermissionsTableModel extends AbstractTableModel { /** * Returns Object.class regardless of columnIndex. - * + * * @param columnIndex * the column being queried * @return the Object.class */ + @Override public Class getColumnClass(int columnIndex) { if (columnIndex == Columns.Permission.ordinal()) { return AccessPermission.class; @@ -95,7 +96,7 @@ public class RegistrantPermissionsTableModel extends AbstractTableModel { } return String.class; } - + @Override public boolean isCellEditable(int rowIndex, int columnIndex) { if (columnIndex == Columns.Permission.ordinal()) { @@ -123,7 +124,7 @@ public class RegistrantPermissionsTableModel extends AbstractTableModel { } return null; } - + @Override public void setValueAt(Object o, int rowIndex, int columnIndex) { RegistrantAccessPermission rp = permissions.get(rowIndex); diff --git a/src/main/java/com/gitblit/client/RegistrationsDialog.java b/src/main/java/com/gitblit/client/RegistrationsDialog.java index 9550e97a..edbc8623 100644 --- a/src/main/java/com/gitblit/client/RegistrationsDialog.java +++ b/src/main/java/com/gitblit/client/RegistrationsDialog.java @@ -41,9 +41,9 @@ import javax.swing.event.ListSelectionListener; /** * Displays a list of registrations and allows management of server * registrations. - * + * * @author James Moger - * + * */ public class RegistrationsDialog extends JDialog { @@ -82,6 +82,7 @@ public class RegistrationsDialog extends JDialog { KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0); JRootPane rootPane = new JRootPane(); rootPane.registerKeyboardAction(new ActionListener() { + @Override public void actionPerformed(ActionEvent actionEvent) { setVisible(false); } @@ -98,6 +99,7 @@ public class RegistrationsDialog extends JDialog { .getColumnName(RegistrationsTableModel.Columns.Name.ordinal()); registrationsTable.getColumn(id).setCellRenderer(nameRenderer); registrationsTable.addMouseListener(new MouseAdapter() { + @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { login(); @@ -107,6 +109,7 @@ public class RegistrationsDialog extends JDialog { final JButton create = new JButton(Translation.get("gb.create")); create.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { create(); } @@ -115,6 +118,7 @@ public class RegistrationsDialog extends JDialog { final JButton login = new JButton(Translation.get("gb.login")); login.setEnabled(false); login.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { login(); } @@ -123,6 +127,7 @@ public class RegistrationsDialog extends JDialog { final JButton edit = new JButton(Translation.get("gb.edit")); edit.setEnabled(false); edit.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { edit(); } @@ -131,6 +136,7 @@ public class RegistrationsDialog extends JDialog { final JButton delete = new JButton(Translation.get("gb.delete")); delete.setEnabled(false); delete.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { delete(); } @@ -162,6 +168,7 @@ public class RegistrationsDialog extends JDialog { private static final long serialVersionUID = 1L; + @Override public Insets getInsets() { return insets; } diff --git a/src/main/java/com/gitblit/client/RegistrationsTableModel.java b/src/main/java/com/gitblit/client/RegistrationsTableModel.java index 8c6b34ff..4c106bc7 100644 --- a/src/main/java/com/gitblit/client/RegistrationsTableModel.java +++ b/src/main/java/com/gitblit/client/RegistrationsTableModel.java @@ -23,9 +23,9 @@ import javax.swing.table.AbstractTableModel; /** * Table model of a list of Gitblit server registrations. - * + * * @author James Moger - * + * */ public class RegistrationsTableModel extends AbstractTableModel { @@ -73,11 +73,12 @@ public class RegistrationsTableModel extends AbstractTableModel { /** * Returns Object.class regardless of columnIndex. - * + * * @param columnIndex * the column being queried * @return the Object.class */ + @Override public Class getColumnClass(int columnIndex) { if (columnIndex == Columns.Last_Login.ordinal()) { return Date.class; diff --git a/src/main/java/com/gitblit/client/RepositoriesPanel.java b/src/main/java/com/gitblit/client/RepositoriesPanel.java index 64bde9b8..0fab934d 100644 --- a/src/main/java/com/gitblit/client/RepositoriesPanel.java +++ b/src/main/java/com/gitblit/client/RepositoriesPanel.java @@ -57,9 +57,9 @@ import com.gitblit.utils.StringUtils; /** * RSS Feeds Panel displays recent entries and launches the browser to view the * commit. commitdiff, or tree of a commit. - * + * * @author James Moger - * + * */ public abstract class RepositoriesPanel extends JPanel { @@ -95,6 +95,7 @@ public abstract class RepositoriesPanel extends JPanel { final JButton browseRepository = new JButton(Translation.get("gb.browse")); browseRepository.setEnabled(false); browseRepository.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { RepositoryModel model = getSelectedRepositories().get(0); String url = gitblit.getURL("summary", model.name, null); @@ -104,13 +105,15 @@ public abstract class RepositoriesPanel extends JPanel { JButton refreshRepositories = new JButton(Translation.get("gb.refresh")); refreshRepositories.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { refreshRepositories(); } }); - + clearCache = new JButton(Translation.get("gb.clearCache")); clearCache.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { clearCache(); } @@ -118,6 +121,7 @@ public abstract class RepositoriesPanel extends JPanel { createRepository = new JButton(Translation.get("gb.create")); createRepository.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { createRepository(); } @@ -126,6 +130,7 @@ public abstract class RepositoriesPanel extends JPanel { editRepository = new JButton(Translation.get("gb.edit")); editRepository.setEnabled(false); editRepository.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { editRepository(getSelectedRepositories().get(0)); } @@ -134,6 +139,7 @@ public abstract class RepositoriesPanel extends JPanel { delRepository = new JButton(Translation.get("gb.delete")); delRepository.setEnabled(false); delRepository.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { deleteRepositories(getSelectedRepositories()); } @@ -142,6 +148,7 @@ public abstract class RepositoriesPanel extends JPanel { final JButton subscribeRepository = new JButton(Translation.get("gb.subscribe") + "..."); subscribeRepository.setEnabled(false); subscribeRepository.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { List feeds = gitblit.getAvailableFeeds(getSelectedRepositories().get(0)); subscribeFeeds(feeds); @@ -151,6 +158,7 @@ public abstract class RepositoriesPanel extends JPanel { final JButton logRepository = new JButton(Translation.get("gb.log") + "..."); logRepository.setEnabled(false); logRepository.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { RepositoryModel model = getSelectedRepositories().get(0); showSearchDialog(false, model); @@ -160,6 +168,7 @@ public abstract class RepositoriesPanel extends JPanel { final JButton searchRepository = new JButton(Translation.get("gb.search") + "..."); searchRepository.setEnabled(false); searchRepository.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { RepositoryModel model = getSelectedRepositories().get(0); showSearchDialog(true, model); @@ -223,6 +232,7 @@ public abstract class RepositoriesPanel extends JPanel { }); table.addMouseListener(new MouseAdapter() { + @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2 && gitblit.allowManagement()) { editRepository(getSelectedRepositories().get(0)); @@ -232,11 +242,13 @@ public abstract class RepositoriesPanel extends JPanel { filterTextfield = new JTextField(); filterTextfield.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { filterRepositories(filterTextfield.getText()); } }); filterTextfield.addKeyListener(new KeyAdapter() { + @Override public void keyReleased(KeyEvent e) { filterRepositories(filterTextfield.getText()); } @@ -318,6 +330,7 @@ public abstract class RepositoriesPanel extends JPanel { return; } RowFilter containsFilter = new RowFilter() { + @Override public boolean include(Entry entry) { for (int i = entry.getValueCount() - 1; i >= 0; i--) { if (entry.getStringValue(i).toLowerCase().contains(fragment.toLowerCase())) { @@ -359,7 +372,7 @@ public abstract class RepositoriesPanel extends JPanel { }; worker.execute(); } - + protected void clearCache() { GitblitWorker worker = new GitblitWorker(RepositoriesPanel.this, RpcRequest.CLEAR_REPOSITORY_CACHE) { @@ -383,7 +396,7 @@ public abstract class RepositoriesPanel extends JPanel { /** * Displays the create repository dialog and fires a SwingWorker to update * the server, if appropriate. - * + * */ protected void createRepository() { EditRepositoryDialog dialog = new EditRepositoryDialog(gitblit.getProtocolVersion()); @@ -444,7 +457,7 @@ public abstract class RepositoriesPanel extends JPanel { /** * Displays the edit repository dialog and fires a SwingWorker to update the * server, if appropriate. - * + * * @param repository */ protected void editRepository(final RepositoryModel repository) { diff --git a/src/main/java/com/gitblit/client/RepositoriesTableModel.java b/src/main/java/com/gitblit/client/RepositoriesTableModel.java index 6b295a4b..0d26e42c 100644 --- a/src/main/java/com/gitblit/client/RepositoriesTableModel.java +++ b/src/main/java/com/gitblit/client/RepositoriesTableModel.java @@ -27,9 +27,9 @@ import com.gitblit.utils.ArrayUtils; /** * Table model of a list of repositories. - * + * * @author James Moger - * + * */ public class RepositoriesTableModel extends AbstractTableModel { @@ -85,11 +85,12 @@ public class RepositoriesTableModel extends AbstractTableModel { /** * Returns Object.class regardless of columnIndex. - * + * * @param columnIndex * the column being queried * @return the Object.class */ + @Override public Class getColumnClass(int columnIndex) { Columns col = Columns.values()[columnIndex]; switch (col) { diff --git a/src/main/java/com/gitblit/client/SearchDialog.java b/src/main/java/com/gitblit/client/SearchDialog.java index 829bc52a..71204cba 100644 --- a/src/main/java/com/gitblit/client/SearchDialog.java +++ b/src/main/java/com/gitblit/client/SearchDialog.java @@ -51,9 +51,9 @@ import com.gitblit.utils.StringUtils; /** * The search dialog allows searching of a repository branch. This matches the * search implementation of the site. - * + * * @author James Moger - * + * */ public class SearchDialog extends JFrame { @@ -103,6 +103,7 @@ public class SearchDialog extends JFrame { prev.setToolTipText(Translation.get("gb.pagePrevious")); prev.setEnabled(false); prev.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { search(--page); } @@ -112,6 +113,7 @@ public class SearchDialog extends JFrame { next.setToolTipText(Translation.get("gb.pageNext")); next.setEnabled(false); next.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { search(++page); } @@ -119,6 +121,7 @@ public class SearchDialog extends JFrame { final JButton search = new JButton(Translation.get(isSearch ? "gb.search" : "gb.refresh")); search.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { search(0); } @@ -127,6 +130,7 @@ public class SearchDialog extends JFrame { final JButton viewCommit = new JButton(Translation.get("gb.view")); viewCommit.setEnabled(false); viewCommit.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { viewCommit(); } @@ -135,6 +139,7 @@ public class SearchDialog extends JFrame { final JButton viewCommitDiff = new JButton(Translation.get("gb.commitdiff")); viewCommitDiff.setEnabled(false); viewCommitDiff.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { viewCommitDiff(); } @@ -143,6 +148,7 @@ public class SearchDialog extends JFrame { final JButton viewTree = new JButton(Translation.get("gb.tree")); viewTree.setEnabled(false); viewTree.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { viewTree(); } @@ -171,6 +177,7 @@ public class SearchDialog extends JFrame { table.getColumn(name).setCellRenderer(new MessageRenderer()); table.addMouseListener(new MouseAdapter() { + @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { if (e.isControlDown()) { @@ -199,6 +206,7 @@ public class SearchDialog extends JFrame { repositorySelector.setRenderer(nameRenderer); repositorySelector.setForeground(nameRenderer.getForeground()); repositorySelector.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { // repopulate the branch list based on repository selection // preserve branch selection, if possible @@ -234,6 +242,7 @@ public class SearchDialog extends JFrame { searchFragment = new JTextField(25); searchFragment.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { search(0); } diff --git a/src/main/java/com/gitblit/client/SettingCellRenderer.java b/src/main/java/com/gitblit/client/SettingCellRenderer.java index d164fb1a..2f52ddb0 100644 --- a/src/main/java/com/gitblit/client/SettingCellRenderer.java +++ b/src/main/java/com/gitblit/client/SettingCellRenderer.java @@ -27,9 +27,9 @@ import com.gitblit.models.SettingModel; /** * SettingModel cell renderer that indicates if a setting is the default or * modified. - * + * * @author James Moger - * + * */ public class SettingCellRenderer extends DefaultTableCellRenderer { @@ -44,6 +44,7 @@ public class SettingCellRenderer extends DefaultTableCellRenderer { modifiedFont = defaultFont.deriveFont(Font.BOLD); } + @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); diff --git a/src/main/java/com/gitblit/client/SettingPanel.java b/src/main/java/com/gitblit/client/SettingPanel.java index 6da09e18..9e644004 100644 --- a/src/main/java/com/gitblit/client/SettingPanel.java +++ b/src/main/java/com/gitblit/client/SettingPanel.java @@ -33,7 +33,7 @@ import com.gitblit.utils.StringUtils; /** * This panel displays the metadata for a particular setting. - * + * * @author James Moger */ public class SettingPanel extends JPanel { diff --git a/src/main/java/com/gitblit/client/SettingsPanel.java b/src/main/java/com/gitblit/client/SettingsPanel.java index b0adc0c7..b4129fa0 100644 --- a/src/main/java/com/gitblit/client/SettingsPanel.java +++ b/src/main/java/com/gitblit/client/SettingsPanel.java @@ -50,9 +50,9 @@ import com.gitblit.utils.StringUtils; /** * Settings panel displays a list of server settings and their associated * metadata. This panel also allows editing of a setting. - * + * * @author James Moger - * + * */ public class SettingsPanel extends JPanel { @@ -79,6 +79,7 @@ public class SettingsPanel extends JPanel { private void initialize() { JButton refreshSettings = new JButton(Translation.get("gb.refresh")); refreshSettings.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { refreshSettings(); } @@ -86,6 +87,7 @@ public class SettingsPanel extends JPanel { final JButton editSetting = new JButton(Translation.get("gb.edit")); editSetting.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { int viewRow = table.getSelectedRow(); int modelRow = table.convertRowIndexToModel(viewRow); @@ -125,6 +127,7 @@ public class SettingsPanel extends JPanel { } }); table.addMouseListener(new MouseAdapter() { + @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { int viewRow = table.getSelectedRow(); @@ -137,11 +140,13 @@ public class SettingsPanel extends JPanel { filterTextfield = new JTextField(); filterTextfield.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { filterSettings(filterTextfield.getText()); } }); filterTextfield.addKeyListener(new KeyAdapter() { + @Override public void keyReleased(KeyEvent e) { filterSettings(filterTextfield.getText()); } @@ -166,7 +171,7 @@ public class SettingsPanel extends JPanel { add(settingsTablePanel, BorderLayout.CENTER); add(settingsControls, BorderLayout.SOUTH); } - + @Override public void requestFocus() { filterTextfield.requestFocus(); @@ -192,6 +197,7 @@ public class SettingsPanel extends JPanel { return; } RowFilter containsFilter = new RowFilter() { + @Override public boolean include(Entry entry) { for (int i = entry.getValueCount() - 1; i >= 0; i--) { if (entry.getStringValue(i).toLowerCase().contains(fragment.toLowerCase())) { diff --git a/src/main/java/com/gitblit/client/SettingsTableModel.java b/src/main/java/com/gitblit/client/SettingsTableModel.java index f14eae4b..a781c697 100644 --- a/src/main/java/com/gitblit/client/SettingsTableModel.java +++ b/src/main/java/com/gitblit/client/SettingsTableModel.java @@ -26,9 +26,9 @@ import com.gitblit.models.SettingModel; /** * Table model of Map. - * + * * @author James Moger - * + * */ public class SettingsTableModel extends AbstractTableModel { @@ -89,11 +89,12 @@ public class SettingsTableModel extends AbstractTableModel { /** * Returns Object.class regardless of columnIndex. - * + * * @param columnIndex * the column being queried * @return the Object.class */ + @Override public Class getColumnClass(int columnIndex) { if (Columns.Value.ordinal() == columnIndex) { return SettingModel.class; diff --git a/src/main/java/com/gitblit/client/StatusPanel.java b/src/main/java/com/gitblit/client/StatusPanel.java index 6d004f16..2c061c2d 100644 --- a/src/main/java/com/gitblit/client/StatusPanel.java +++ b/src/main/java/com/gitblit/client/StatusPanel.java @@ -38,7 +38,7 @@ import com.gitblit.utils.ByteFormat; /** * This panel displays the server status. - * + * * @author James Moger */ public class StatusPanel extends JPanel { @@ -65,6 +65,7 @@ public class StatusPanel extends JPanel { private void initialize() { JButton refreshStatus = new JButton(Translation.get("gb.refresh")); refreshStatus.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { refreshStatus(); } @@ -153,7 +154,7 @@ public class StatusPanel extends JPanel { ServerStatus status = gitblit.getStatus(); header.setText(Translation.get("gb.status")); version.setText(Constants.NAME + (status.isGO ? " GO v" : " WAR v") + status.version); - releaseDate.setText(status.releaseDate); + releaseDate.setText(status.releaseDate); bootDate.setText(status.bootDate.toString() + " (" + Translation.getTimeUtils().timeAgo(status.bootDate) + ")"); url.setText(gitblit.url); diff --git a/src/main/java/com/gitblit/client/SubscribedRepositoryRenderer.java b/src/main/java/com/gitblit/client/SubscribedRepositoryRenderer.java index 9943333f..37769f93 100644 --- a/src/main/java/com/gitblit/client/SubscribedRepositoryRenderer.java +++ b/src/main/java/com/gitblit/client/SubscribedRepositoryRenderer.java @@ -25,9 +25,9 @@ import com.gitblit.models.RepositoryModel; /** * Displays a subscribed icon on the left of the repository name, if there is at * least one subscribed branch. - * + * * @author James Moger - * + * */ public class SubscribedRepositoryRenderer extends NameRenderer { @@ -46,6 +46,7 @@ public class SubscribedRepositoryRenderer extends NameRenderer { subscribedIcon = new ImageIcon(getClass().getResource("/bullet_feed.png")); } + @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); diff --git a/src/main/java/com/gitblit/client/SubscriptionsDialog.java b/src/main/java/com/gitblit/client/SubscriptionsDialog.java index 5ae836a5..f348e90b 100644 --- a/src/main/java/com/gitblit/client/SubscriptionsDialog.java +++ b/src/main/java/com/gitblit/client/SubscriptionsDialog.java @@ -40,9 +40,9 @@ import com.gitblit.models.FeedModel; /** * Displays a list of repository branches and allows the user to check or * uncheck branches. - * + * * @author James Moger - * + * */ public abstract class SubscriptionsDialog extends JDialog { @@ -68,6 +68,7 @@ public abstract class SubscriptionsDialog extends JDialog { KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0); JRootPane rootPane = new JRootPane(); rootPane.registerKeyboardAction(new ActionListener() { + @Override public void actionPerformed(ActionEvent actionEvent) { setVisible(false); } @@ -111,6 +112,7 @@ public abstract class SubscriptionsDialog extends JDialog { final JButton cancel = new JButton(Translation.get("gb.cancel")); cancel.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { setVisible(false); } @@ -118,6 +120,7 @@ public abstract class SubscriptionsDialog extends JDialog { final JButton save = new JButton(Translation.get("gb.save")); save.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { save(); } @@ -141,6 +144,7 @@ public abstract class SubscriptionsDialog extends JDialog { private static final long serialVersionUID = 1L; + @Override public Insets getInsets() { return insets; } diff --git a/src/main/java/com/gitblit/client/TeamsPanel.java b/src/main/java/com/gitblit/client/TeamsPanel.java index 92182222..4f52fde0 100644 --- a/src/main/java/com/gitblit/client/TeamsPanel.java +++ b/src/main/java/com/gitblit/client/TeamsPanel.java @@ -47,9 +47,9 @@ import com.gitblit.utils.StringUtils; /** * Users panel displays a list of user accounts and allows management of those * accounts. - * + * * @author James Moger - * + * */ public abstract class TeamsPanel extends JPanel { @@ -76,6 +76,7 @@ public abstract class TeamsPanel extends JPanel { private void initialize() { JButton refreshTeams = new JButton(Translation.get("gb.refresh")); refreshTeams.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { refreshTeams(); } @@ -83,6 +84,7 @@ public abstract class TeamsPanel extends JPanel { JButton createTeam = new JButton(Translation.get("gb.create")); createTeam.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { createTeam(); } @@ -91,6 +93,7 @@ public abstract class TeamsPanel extends JPanel { final JButton editTeam = new JButton(Translation.get("gb.edit")); editTeam.setEnabled(false); editTeam.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { editTeam(getSelectedTeams().get(0)); } @@ -99,6 +102,7 @@ public abstract class TeamsPanel extends JPanel { final JButton delTeam = new JButton(Translation.get("gb.delete")); delTeam.setEnabled(false); delTeam.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { deleteTeams(getSelectedTeams()); } @@ -136,6 +140,7 @@ public abstract class TeamsPanel extends JPanel { }); table.addMouseListener(new MouseAdapter() { + @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { editTeam(getSelectedTeams().get(0)); @@ -145,11 +150,13 @@ public abstract class TeamsPanel extends JPanel { filterTextfield = new JTextField(); filterTextfield.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { filterTeams(filterTextfield.getText()); } }); filterTextfield.addKeyListener(new KeyAdapter() { + @Override public void keyReleased(KeyEvent e) { filterTeams(filterTextfield.getText()); } @@ -204,6 +211,7 @@ public abstract class TeamsPanel extends JPanel { return; } RowFilter containsFilter = new RowFilter() { + @Override public boolean include(Entry entry) { for (int i = entry.getValueCount() - 1; i >= 0; i--) { if (entry.getStringValue(i).toLowerCase().contains(fragment.toLowerCase())) { @@ -247,7 +255,7 @@ public abstract class TeamsPanel extends JPanel { /** * Displays the create team dialog and fires a SwingWorker to update the * server, if appropriate. - * + * */ protected void createTeam() { EditTeamDialog dialog = new EditTeamDialog(gitblit.getProtocolVersion(), @@ -296,7 +304,7 @@ public abstract class TeamsPanel extends JPanel { /** * Displays the edit team dialog and fires a SwingWorker to update the * server, if appropriate. - * + * * @param user */ protected void editTeam(final TeamModel team) { diff --git a/src/main/java/com/gitblit/client/TeamsTableModel.java b/src/main/java/com/gitblit/client/TeamsTableModel.java index e6d8a945..bc43a6cd 100644 --- a/src/main/java/com/gitblit/client/TeamsTableModel.java +++ b/src/main/java/com/gitblit/client/TeamsTableModel.java @@ -25,9 +25,9 @@ import com.gitblit.models.TeamModel; /** * Table model of a list of teams. - * + * * @author James Moger - * + * */ public class TeamsTableModel extends AbstractTableModel { @@ -79,11 +79,12 @@ public class TeamsTableModel extends AbstractTableModel { /** * Returns Object.class regardless of columnIndex. - * + * * @param columnIndex * the column being queried * @return the Object.class */ + @Override public Class getColumnClass(int columnIndex) { return String.class; } diff --git a/src/main/java/com/gitblit/client/Translation.java b/src/main/java/com/gitblit/client/Translation.java index 9f643db4..87e2b83e 100644 --- a/src/main/java/com/gitblit/client/Translation.java +++ b/src/main/java/com/gitblit/client/Translation.java @@ -22,14 +22,14 @@ import com.gitblit.utils.TimeUtils; /** * Loads the Gitblit language resource file. - * + * * @author James Moger - * + * */ public class Translation { private final static ResourceBundle translation; - + private final static TimeUtils timeUtils; static { @@ -42,7 +42,7 @@ public class Translation { bundle = ResourceBundle.getBundle("GitBlitWebApp"); } translation = bundle; - + timeUtils = new TimeUtils(translation, null); } @@ -52,7 +52,7 @@ public class Translation { } return key; } - + public static TimeUtils getTimeUtils() { return timeUtils; } diff --git a/src/main/java/com/gitblit/client/UsersPanel.java b/src/main/java/com/gitblit/client/UsersPanel.java index c53a5791..f947e696 100644 --- a/src/main/java/com/gitblit/client/UsersPanel.java +++ b/src/main/java/com/gitblit/client/UsersPanel.java @@ -48,9 +48,9 @@ import com.gitblit.utils.StringUtils; /** * Users panel displays a list of user accounts and allows management of those * accounts. - * + * * @author James Moger - * + * */ public abstract class UsersPanel extends JPanel { @@ -77,6 +77,7 @@ public abstract class UsersPanel extends JPanel { private void initialize() { JButton refreshUsers = new JButton(Translation.get("gb.refresh")); refreshUsers.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { refreshUsers(); } @@ -84,6 +85,7 @@ public abstract class UsersPanel extends JPanel { JButton createUser = new JButton(Translation.get("gb.create")); createUser.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { createUser(); } @@ -92,6 +94,7 @@ public abstract class UsersPanel extends JPanel { final JButton editUser = new JButton(Translation.get("gb.edit")); editUser.setEnabled(false); editUser.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { editUser(getSelectedUsers().get(0)); } @@ -100,6 +103,7 @@ public abstract class UsersPanel extends JPanel { final JButton delUser = new JButton(Translation.get("gb.delete")); delUser.setEnabled(false); delUser.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { deleteUsers(getSelectedUsers()); } @@ -111,7 +115,7 @@ public abstract class UsersPanel extends JPanel { table = Utils.newTable(tableModel, Utils.DATE_FORMAT); String name = table.getColumnName(UsersTableModel.Columns.Name.ordinal()); table.getColumn(name).setCellRenderer(nameRenderer); - + int w = 130; name = table.getColumnName(UsersTableModel.Columns.Type.ordinal()); table.getColumn(name).setMinWidth(w); @@ -122,7 +126,7 @@ public abstract class UsersPanel extends JPanel { name = table.getColumnName(UsersTableModel.Columns.Repositories.ordinal()); table.getColumn(name).setMinWidth(w); table.getColumn(name).setMaxWidth(w); - + table.setRowSorter(defaultSorter); table.getRowSorter().toggleSortOrder(UsersTableModel.Columns.Name.ordinal()); table.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @@ -140,6 +144,7 @@ public abstract class UsersPanel extends JPanel { }); table.addMouseListener(new MouseAdapter() { + @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { editUser(getSelectedUsers().get(0)); @@ -149,11 +154,13 @@ public abstract class UsersPanel extends JPanel { filterTextfield = new JTextField(); filterTextfield.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { filterUsers(filterTextfield.getText()); } }); filterTextfield.addKeyListener(new KeyAdapter() { + @Override public void keyReleased(KeyEvent e) { filterUsers(filterTextfield.getText()); } @@ -191,7 +198,7 @@ public abstract class UsersPanel extends JPanel { } protected abstract void updateTeamsTable(); - + protected void updateTable(boolean pack) { tableModel.list.clear(); tableModel.list.addAll(gitblit.getUsers()); @@ -208,6 +215,7 @@ public abstract class UsersPanel extends JPanel { return; } RowFilter containsFilter = new RowFilter() { + @Override public boolean include(Entry entry) { for (int i = entry.getValueCount() - 1; i >= 0; i--) { if (entry.getStringValue(i).toLowerCase().contains(fragment.toLowerCase())) { @@ -251,7 +259,7 @@ public abstract class UsersPanel extends JPanel { /** * Displays the create user dialog and fires a SwingWorker to update the * server, if appropriate. - * + * */ protected void createUser() { EditUserDialog dialog = new EditUserDialog(gitblit.getProtocolVersion(), @@ -300,7 +308,7 @@ public abstract class UsersPanel extends JPanel { /** * Displays the edit user dialog and fires a SwingWorker to update the * server, if appropriate. - * + * * @param user */ protected void editUser(final UserModel user) { diff --git a/src/main/java/com/gitblit/client/UsersTableModel.java b/src/main/java/com/gitblit/client/UsersTableModel.java index 439d5afb..aedb9cbb 100644 --- a/src/main/java/com/gitblit/client/UsersTableModel.java +++ b/src/main/java/com/gitblit/client/UsersTableModel.java @@ -25,9 +25,9 @@ import com.gitblit.models.UserModel; /** * Table model of a list of users. - * + * * @author James Moger - * + * */ public class UsersTableModel extends AbstractTableModel { @@ -83,11 +83,12 @@ public class UsersTableModel extends AbstractTableModel { /** * Returns Object.class regardless of columnIndex. - * + * * @param columnIndex * the column being queried * @return the Object.class */ + @Override public Class getColumnClass(int columnIndex) { return String.class; } diff --git a/src/main/java/com/gitblit/client/Utils.java b/src/main/java/com/gitblit/client/Utils.java index 1e6ab2bf..ad3a307d 100644 --- a/src/main/java/com/gitblit/client/Utils.java +++ b/src/main/java/com/gitblit/client/Utils.java @@ -51,14 +51,14 @@ public class Utils { public static JTable newTable(TableModel model, String datePattern) { return newTable(model, datePattern, null); } - + public static JTable newTable(TableModel model, String datePattern, final RowRenderer rowRenderer) { JTable table; if (rowRenderer == null) { table = new JTable(model); } else { table = new JTable(model) { - + @Override public Component prepareRenderer(TableCellRenderer renderer, int row, int column) { Component c = super.prepareRenderer(renderer, row, column); @@ -166,7 +166,7 @@ public class Utils { showException(null, x); } } - + public static abstract class RowRenderer { public abstract void prepareRow(Component c, boolean isSelected, int row, int column); } -- cgit v1.2.3