]> source.dussan.org Git - gitblit.git/commitdiff
Search added to gbapi. Search dialog for Manager. Misc Manager fixes.
authorJames Moger <james.moger@gitblit.com>
Fri, 4 Nov 2011 21:24:45 +0000 (17:24 -0400)
committerJames Moger <james.moger@gitblit.com>
Fri, 4 Nov 2011 21:24:45 +0000 (17:24 -0400)
build.xml
src/com/gitblit/client/BranchRenderer.java
src/com/gitblit/client/GitblitClient.java
src/com/gitblit/client/MessageRenderer.java
src/com/gitblit/client/RepositoriesPanel.java
src/com/gitblit/client/SearchDialog.java [new file with mode: 0644]
src/com/gitblit/client/SubscriptionsDialog.java
src/com/gitblit/wicket/GitBlitWebApp.properties
src/com/gitblit/wicket/pages/BasePage.java

index 854b5f1ea7910ccaf773946f4da16a755282e491..085bc280f3b2056e25053596913e3d326b1a4f87 100644 (file)
--- a/build.xml
+++ b/build.xml
                        <resource file="${basedir}/resources/health_16x16.png" />\r
                        <resource file="${basedir}/resources/feed_16x16.png" />\r
                        <resource file="${basedir}/resources/bullet_feed.png" />\r
+                       <resource file="${basedir}/resources/search-icon.png" />\r
                        <resource file="${basedir}/resources/blank.png" />\r
                        <resource file="${basedir}/src/com/gitblit/wicket/GitBlitWebApp.properties" />\r
                                \r
                                <classpath refid="master-classpath" />\r
                                <classfilter>\r
                                        <exclude name="com.google.gson." />\r
+                                       <exclude name="com.sun.syndication." />\r
                                </classfilter>\r
                                <manifest>\r
                                        <attribute name="Specification-Version" value="${gb.version}" />\r
                                        <include name="gson*.jar" />\r
                                        <exclude name="gson*-sources.jar" />\r
                                        <exclude name="gson*-javadoc.jar" />\r
+                                       <include name="rome*.jar" />\r
+                                       <exclude name="rome*-sources.jar" />\r
+                                       <exclude name="rome*-javadoc.jar" />\r
                                </fileset>\r
                        </zip>\r
                </target>\r
index 532a432e6afeb47acb080c3389f7c1f455ca4ccd..586d0500c99d9b1c9be7911750d532fd912bf8e0 100644 (file)
@@ -18,7 +18,9 @@ package com.gitblit.client;
 import java.awt.Color;\r
 import java.awt.Component;\r
 \r
+import javax.swing.JList;\r
 import javax.swing.JTable;\r
+import javax.swing.ListCellRenderer;\r
 import javax.swing.table.DefaultTableCellRenderer;\r
 \r
 /**\r
@@ -28,7 +30,7 @@ import javax.swing.table.DefaultTableCellRenderer;
  * @author James Moger\r
  * \r
  */\r
-public class BranchRenderer extends DefaultTableCellRenderer {\r
+public class BranchRenderer extends DefaultTableCellRenderer implements ListCellRenderer {\r
 \r
        private static final long serialVersionUID = 1L;\r
 \r
@@ -39,7 +41,32 @@ public class BranchRenderer extends DefaultTableCellRenderer {
        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,\r
                        boolean hasFocus, int row, int column) {\r
                super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);\r
-               String name = value.toString();\r
+               if (value == null) {\r
+                       return this;\r
+               }\r
+               setText(value.toString());\r
+               if (isSelected) {\r
+                       setForeground(table.getSelectionForeground());\r
+               }\r
+               return this;\r
+       }\r
+\r
+       @Override\r
+       public Component getListCellRendererComponent(JList list, Object value, int index,\r
+                       boolean isSelected, boolean cellHasFocus) {\r
+               setText(value.toString());\r
+               if (isSelected) {\r
+                       setBackground(list.getSelectionBackground());\r
+                       setForeground(list.getSelectionForeground());\r
+               } else {\r
+                       setBackground(list.getBackground());\r
+               }\r
+               return this;\r
+       }\r
+\r
+       @Override\r
+       public void setText(String text) {\r
+               String name = text;\r
                Color fg = getForeground();\r
                if (name.startsWith(R_HEADS)) {\r
                        name = name.substring(R_HEADS.length());\r
@@ -48,8 +75,7 @@ public class BranchRenderer extends DefaultTableCellRenderer {
                        name = name.substring(R_REMOTES.length());\r
                        fg = Color.decode("#6C6CBF");\r
                }\r
-               setText(name);\r
-               setForeground(isSelected ? table.getSelectionForeground() : fg);\r
-               return this;\r
+               setForeground(fg);\r
+               super.setText(name);\r
        }\r
 }
\ No newline at end of file
index dcc7dfc5af90c819298e2d62f6bdc4130b74b52e..e8460f5fb0ce1b94f4c6abc2d5208c78e9c191f6 100644 (file)
@@ -25,6 +25,7 @@ import java.util.List;
 import java.util.Map;\r
 import java.util.Set;\r
 \r
+import com.gitblit.Constants;\r
 import com.gitblit.GitBlitException.ForbiddenException;\r
 import com.gitblit.GitBlitException.NotAllowedException;\r
 import com.gitblit.GitBlitException.UnauthorizedException;\r
@@ -213,17 +214,31 @@ public class GitblitClient implements Serializable {
                return status;\r
        }\r
 \r
+       public List<String> getBranches(String repository) {\r
+               List<FeedModel> feeds = getAvailableFeeds(repository);\r
+               List<String> branches = new ArrayList<String>();\r
+               for (FeedModel feed : feeds) {\r
+                       branches.add(feed.branch);\r
+               }\r
+               Collections.sort(branches);\r
+               return branches;\r
+       }\r
+\r
        public List<FeedModel> getAvailableFeeds() {\r
                return availableFeeds;\r
        }\r
 \r
        public List<FeedModel> getAvailableFeeds(RepositoryModel repository) {\r
+               return getAvailableFeeds(repository.name);\r
+       }\r
+\r
+       public List<FeedModel> getAvailableFeeds(String repository) {\r
                List<FeedModel> repositoryFeeds = new ArrayList<FeedModel>();\r
                if (repository == null) {\r
                        return repositoryFeeds;\r
                }\r
                for (FeedModel feed : availableFeeds) {\r
-                       if (feed.repository.equalsIgnoreCase(repository.name)) {\r
+                       if (feed.repository.equalsIgnoreCase(repository)) {\r
                                repositoryFeeds.add(feed);\r
                        }\r
                }\r
@@ -292,6 +307,12 @@ public class GitblitClient implements Serializable {
                return syndicatedEntries;\r
        }\r
 \r
+       public List<SyndicatedEntryModel> search(String repository, String branch, String fragment,\r
+                       Constants.SearchType type, int numberOfEntries) throws IOException {\r
+               return SyndicationUtils.readSearchFeed(url, repository, branch, fragment, type,\r
+                               numberOfEntries, account, password);\r
+       }\r
+\r
        public List<FederationModel> refreshFederationRegistrations() throws IOException {\r
                List<FederationModel> list = RpcUtils.getFederationRegistrations(url, account, password);\r
                federationRegistrations.clear();\r
index c848cefc22999003e97d23f11f2b35b650a74316..2ff352794024352be00a6553afd587e3ca322e47 100644 (file)
@@ -53,6 +53,10 @@ public class MessageRenderer extends JPanel implements TableCellRenderer, Serial
 \r
        private final JLabel branchLabel;\r
 \r
+       public MessageRenderer() {\r
+               this(null);\r
+       }\r
+\r
        public MessageRenderer(GitblitClient gitblit) {\r
                super(new FlowLayout(FlowLayout.LEFT, 10, 1));\r
                this.gitblit = gitblit;\r
@@ -75,12 +79,17 @@ public class MessageRenderer extends JPanel implements TableCellRenderer, Serial
                messageLabel.setForeground(isSelected ? table.getSelectionForeground() : table\r
                                .getForeground());\r
                SyndicatedEntryModel entry = (SyndicatedEntryModel) value;\r
-               \r
-               // show message in BOLD if its a new entry\r
-               if (entry.published.after(gitblit.getLastFeedRefresh(entry.repository, entry.branch))) {\r
-                       messageLabel.setText("<html><body><b>" + entry.title);\r
-               } else {\r
+\r
+               if (gitblit == null) {\r
+                       // no gitblit client, just display message\r
                        messageLabel.setText(entry.title);\r
+               } else {\r
+                       // show message in BOLD if its a new entry\r
+                       if (entry.published.after(gitblit.getLastFeedRefresh(entry.repository, entry.branch))) {\r
+                               messageLabel.setText("<html><body><b>" + entry.title);\r
+                       } else {\r
+                               messageLabel.setText(entry.title);\r
+                       }\r
                }\r
 \r
                // reset ref label\r
index 20b90807f38a2bd7061d205c62e2ff5812a0d6ae..3e156e97a387f8470851444475e6d57235954ed3 100644 (file)
@@ -134,6 +134,15 @@ public abstract class RepositoriesPanel extends JPanel {
                        }\r
                });\r
 \r
+               final JButton searchRepository = new JButton(Translation.get("gb.search") + "...");\r
+               searchRepository.setEnabled(false);\r
+               searchRepository.addActionListener(new ActionListener() {\r
+                       public void actionPerformed(ActionEvent e) {\r
+                               RepositoryModel model = getSelectedRepositories().get(0);\r
+                               searchRepository(model);\r
+                       }\r
+               });\r
+\r
                SubscribedRepositoryRenderer nameRenderer = new SubscribedRepositoryRenderer(gitblit);\r
                IndicatorsRenderer typeRenderer = new IndicatorsRenderer();\r
 \r
@@ -164,10 +173,18 @@ public abstract class RepositoriesPanel extends JPanel {
                                        return;\r
                                }\r
                                boolean singleSelection = table.getSelectedRowCount() == 1;\r
-                               boolean selected = table.getSelectedRow() > -1;\r
-                               browseRepository.setEnabled(singleSelection);\r
-                               delRepository.setEnabled(selected);\r
-                               subscribeRepository.setEnabled(singleSelection);\r
+                               boolean selected = table.getSelectedRow() > -1;                         \r
+                               if (singleSelection) {\r
+                                       RepositoryModel repository = getSelectedRepositories().get(0);\r
+                                       browseRepository.setEnabled(repository.hasCommits);\r
+                                       searchRepository.setEnabled(repository.hasCommits);\r
+                                       subscribeRepository.setEnabled(repository.hasCommits);\r
+                               } else {\r
+                                       browseRepository.setEnabled(false);\r
+                                       searchRepository.setEnabled(false);\r
+                                       subscribeRepository.setEnabled(false);\r
+                               }\r
+                               delRepository.setEnabled(selected);                             \r
                                if (selected) {\r
                                        int viewRow = table.getSelectedRow();\r
                                        int modelRow = table.convertRowIndexToModel(viewRow);\r
@@ -216,6 +233,7 @@ public abstract class RepositoriesPanel extends JPanel {
                repositoryControls.add(editRepository);\r
                repositoryControls.add(delRepository);\r
                repositoryControls.add(subscribeRepository);\r
+               repositoryControls.add(searchRepository);\r
 \r
                setLayout(new BorderLayout(Utils.MARGIN, Utils.MARGIN));\r
                header = new HeaderPanel(Translation.get("gb.repositories"), "gitweb-favicon.png");\r
@@ -449,4 +467,12 @@ public abstract class RepositoriesPanel extends JPanel {
                }\r
        }\r
 \r
+       protected void searchRepository(final RepositoryModel repository) {\r
+               SearchDialog searchDialog = new SearchDialog(gitblit);\r
+               if (repository != null) {\r
+                       searchDialog.selectRepository(repository);\r
+               }\r
+               searchDialog.setLocationRelativeTo(this);\r
+               searchDialog.setVisible(true);\r
+       }\r
 }\r
diff --git a/src/com/gitblit/client/SearchDialog.java b/src/com/gitblit/client/SearchDialog.java
new file mode 100644 (file)
index 0000000..2f45611
--- /dev/null
@@ -0,0 +1,329 @@
+/*\r
+ * Copyright 2011 gitblit.com.\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *     http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+package com.gitblit.client;\r
+\r
+import java.awt.BorderLayout;\r
+import java.awt.FlowLayout;\r
+import java.awt.Insets;\r
+import java.awt.event.ActionEvent;\r
+import java.awt.event.ActionListener;\r
+import java.awt.event.MouseAdapter;\r
+import java.awt.event.MouseEvent;\r
+import java.awt.event.WindowAdapter;\r
+import java.awt.event.WindowEvent;\r
+import java.io.IOException;\r
+import java.util.List;\r
+\r
+import javax.swing.DefaultComboBoxModel;\r
+import javax.swing.ImageIcon;\r
+import javax.swing.JButton;\r
+import javax.swing.JComboBox;\r
+import javax.swing.JFrame;\r
+import javax.swing.JLabel;\r
+import javax.swing.JPanel;\r
+import javax.swing.JScrollPane;\r
+import javax.swing.JTable;\r
+import javax.swing.JTextField;\r
+import javax.swing.SwingWorker;\r
+import javax.swing.event.ListSelectionEvent;\r
+import javax.swing.event.ListSelectionListener;\r
+\r
+import com.gitblit.Constants;\r
+import com.gitblit.models.RepositoryModel;\r
+import com.gitblit.models.SyndicatedEntryModel;\r
+import com.gitblit.utils.StringUtils;\r
+\r
+/**\r
+ * The search dialog allows searching of a repository branch. This matches the\r
+ * search implementation of the site.\r
+ * \r
+ * @author James Moger\r
+ * \r
+ */\r
+public class SearchDialog extends JFrame {\r
+\r
+       private static final long serialVersionUID = 1L;\r
+\r
+       private final GitblitClient gitblit;\r
+\r
+       private SyndicatedEntryTableModel tableModel;\r
+\r
+       private HeaderPanel header;\r
+\r
+       private JTable table;\r
+\r
+       private JComboBox repositorySelector;\r
+\r
+       private DefaultComboBoxModel branchChoices;\r
+\r
+       private JComboBox branchSelector;\r
+\r
+       private JComboBox searchTypeSelector;\r
+\r
+       private JTextField searchFragment;\r
+\r
+       private JComboBox maxHitsSelector;\r
+\r
+       public SearchDialog(GitblitClient gitblit) {\r
+               super();\r
+               this.gitblit = gitblit;\r
+               setTitle(Translation.get("gb.search"));\r
+               setIconImage(new ImageIcon(getClass().getResource("/gitblt-favicon.png")).getImage());\r
+               initialize();\r
+               setSize(900, 400);\r
+       }\r
+\r
+       private void initialize() {\r
+\r
+               final JButton search = new JButton(Translation.get("gb.search"));\r
+               search.addActionListener(new ActionListener() {\r
+                       public void actionPerformed(ActionEvent e) {\r
+                               search();\r
+                       }\r
+               });\r
+\r
+               final JButton viewCommit = new JButton(Translation.get("gb.view"));\r
+               viewCommit.setEnabled(false);\r
+               viewCommit.addActionListener(new ActionListener() {\r
+                       public void actionPerformed(ActionEvent e) {\r
+                               viewCommit();\r
+                       }\r
+               });\r
+\r
+               final JButton viewCommitDiff = new JButton(Translation.get("gb.commitdiff"));\r
+               viewCommitDiff.setEnabled(false);\r
+               viewCommitDiff.addActionListener(new ActionListener() {\r
+                       public void actionPerformed(ActionEvent e) {\r
+                               viewCommitDiff();\r
+                       }\r
+               });\r
+\r
+               final JButton viewTree = new JButton(Translation.get("gb.tree"));\r
+               viewTree.setEnabled(false);\r
+               viewTree.addActionListener(new ActionListener() {\r
+                       public void actionPerformed(ActionEvent e) {\r
+                               viewTree();\r
+                       }\r
+               });\r
+\r
+               JPanel controls = new JPanel(new FlowLayout(FlowLayout.CENTER, Utils.MARGIN, 0));\r
+               controls.add(viewCommit);\r
+               controls.add(viewCommitDiff);\r
+               controls.add(viewTree);\r
+\r
+               NameRenderer nameRenderer = new NameRenderer();\r
+               tableModel = new SyndicatedEntryTableModel();\r
+               header = new HeaderPanel(Translation.get("gb.search"), "search-icon.png");\r
+               table = Utils.newTable(tableModel, Utils.DATE_FORMAT);\r
+\r
+               String name = table.getColumnName(SyndicatedEntryTableModel.Columns.Author.ordinal());\r
+               table.setRowHeight(nameRenderer.getFont().getSize() + 8);\r
+               table.getColumn(name).setCellRenderer(nameRenderer);\r
+               name = table.getColumnName(SyndicatedEntryTableModel.Columns.Repository.ordinal());\r
+               table.getColumn(name).setCellRenderer(nameRenderer);\r
+\r
+               name = table.getColumnName(SyndicatedEntryTableModel.Columns.Branch.ordinal());\r
+               table.getColumn(name).setCellRenderer(new BranchRenderer());\r
+\r
+               name = table.getColumnName(SyndicatedEntryTableModel.Columns.Message.ordinal());\r
+               table.getColumn(name).setCellRenderer(new MessageRenderer());\r
+\r
+               table.addMouseListener(new MouseAdapter() {\r
+                       public void mouseClicked(MouseEvent e) {\r
+                               if (e.getClickCount() == 2) {\r
+                                       if (e.isControlDown()) {\r
+                                               viewCommitDiff();\r
+                                       } else {\r
+                                               viewCommit();\r
+                                       }\r
+                               }\r
+                       }\r
+               });\r
+\r
+               table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {\r
+                       @Override\r
+                       public void valueChanged(ListSelectionEvent e) {\r
+                               if (e.getValueIsAdjusting()) {\r
+                                       return;\r
+                               }\r
+                               boolean singleSelection = table.getSelectedRowCount() == 1;\r
+                               viewCommit.setEnabled(singleSelection);\r
+                               viewCommitDiff.setEnabled(singleSelection);\r
+                               viewTree.setEnabled(singleSelection);\r
+                       }\r
+               });\r
+\r
+               repositorySelector = new JComboBox(gitblit.getRepositories().toArray());\r
+               repositorySelector.setRenderer(nameRenderer);\r
+               repositorySelector.setForeground(nameRenderer.getForeground());\r
+               repositorySelector.addActionListener(new ActionListener() {\r
+                       public void actionPerformed(ActionEvent event) {\r
+                               // repopulate the branch list based on repository selection\r
+                               // preserve branch selection, if possible\r
+                               String selectedBranch = null;\r
+                               if (branchSelector.getSelectedIndex() > -1) {\r
+                                       selectedBranch = branchSelector.getSelectedItem().toString();\r
+                               }\r
+                               updateBranches();\r
+                               if (selectedBranch != null) {\r
+                                       if (branchChoices.getIndexOf(selectedBranch) > -1) {\r
+                                               branchChoices.setSelectedItem(selectedBranch);\r
+                                       }\r
+                               }\r
+                       }\r
+               });\r
+\r
+               branchChoices = new DefaultComboBoxModel();\r
+               branchSelector = new JComboBox(branchChoices);\r
+               branchSelector.setRenderer(new BranchRenderer());\r
+\r
+               searchTypeSelector = new JComboBox(Constants.SearchType.values());\r
+               searchTypeSelector.setSelectedItem(Constants.SearchType.COMMIT);\r
+\r
+               maxHitsSelector = new JComboBox(new Integer[] { 25, 50, 75, 100 });\r
+               maxHitsSelector.setSelectedIndex(-1);\r
+\r
+               searchFragment = new JTextField(25);\r
+               searchFragment.addActionListener(new ActionListener() {\r
+                       public void actionPerformed(ActionEvent event) {\r
+                               search();\r
+                       }\r
+               });\r
+\r
+               JPanel northControls = new JPanel(new FlowLayout(FlowLayout.LEFT, Utils.MARGIN, 0));\r
+               northControls.add(new JLabel(Translation.get("gb.repository")));\r
+               northControls.add(repositorySelector);\r
+               northControls.add(new JLabel(Translation.get("gb.branch")));\r
+               northControls.add(branchSelector);\r
+               northControls.add(new JLabel(Translation.get("gb.type")));\r
+               northControls.add(searchTypeSelector);\r
+               northControls.add(new JLabel(Translation.get("gb.maxHits")));\r
+               northControls.add(maxHitsSelector);\r
+               northControls.add(searchFragment);\r
+               northControls.add(search);\r
+\r
+               JPanel northPanel = new JPanel(new BorderLayout(0, Utils.MARGIN));\r
+               northPanel.add(header, BorderLayout.NORTH);\r
+               northPanel.add(northControls, BorderLayout.CENTER);\r
+\r
+               JPanel contentPanel = new JPanel() {\r
+\r
+                       private static final long serialVersionUID = 1L;\r
+\r
+                       @Override\r
+                       public Insets getInsets() {\r
+                               return Utils.INSETS;\r
+                       }\r
+               };\r
+               contentPanel.setLayout(new BorderLayout(Utils.MARGIN, Utils.MARGIN));\r
+               contentPanel.add(northPanel, BorderLayout.NORTH);\r
+               contentPanel.add(new JScrollPane(table), BorderLayout.CENTER);\r
+               contentPanel.add(controls, BorderLayout.SOUTH);\r
+               setLayout(new BorderLayout());\r
+               add(contentPanel, BorderLayout.CENTER);\r
+               addWindowListener(new WindowAdapter() {\r
+                       @Override\r
+                       public void windowOpened(WindowEvent event) {\r
+                               searchFragment.requestFocus();\r
+                       }\r
+\r
+                       @Override\r
+                       public void windowActivated(WindowEvent event) {\r
+                               searchFragment.requestFocus();\r
+                       }\r
+               });\r
+       }\r
+\r
+       public void selectRepository(RepositoryModel repository) {\r
+               repositorySelector.setSelectedItem(repository);\r
+       }\r
+\r
+       private void updateBranches() {\r
+               String repository = null;\r
+               if (repositorySelector.getSelectedIndex() > -1) {\r
+                       repository = repositorySelector.getSelectedItem().toString();\r
+               }\r
+               List<String> branches = gitblit.getBranches(repository);\r
+               branchChoices.removeAllElements();\r
+               for (String branch : branches) {\r
+                       branchChoices.addElement(branch);\r
+               }\r
+       }\r
+\r
+       protected void search() {\r
+               final String repository = repositorySelector.getSelectedItem().toString();\r
+               final String branch = branchSelector.getSelectedIndex() > -1 ? branchSelector\r
+                               .getSelectedItem().toString() : null;\r
+               final Constants.SearchType searchType = (Constants.SearchType) searchTypeSelector\r
+                               .getSelectedItem();\r
+               final String fragment = searchFragment.getText();\r
+               final int maxEntryCount = maxHitsSelector.getSelectedIndex() > -1 ? ((Integer) maxHitsSelector\r
+                               .getSelectedItem()) : -1;\r
+               if (StringUtils.isEmpty(fragment)) {\r
+                       return;\r
+               }\r
+               SwingWorker<List<SyndicatedEntryModel>, Void> worker = new SwingWorker<List<SyndicatedEntryModel>, Void>() {\r
+                       @Override\r
+                       protected List<SyndicatedEntryModel> doInBackground() throws IOException {\r
+                               return gitblit.search(repository, branch, fragment, searchType, maxEntryCount);\r
+                       }\r
+\r
+                       @Override\r
+                       protected void done() {\r
+                               try {\r
+                                       List<SyndicatedEntryModel> results = get();\r
+                                       updateTable(true, fragment, results);\r
+                               } catch (Throwable t) {\r
+                                       Utils.showException(SearchDialog.this, t);\r
+                               }\r
+                       }\r
+               };\r
+               worker.execute();\r
+       }\r
+\r
+       protected void updateTable(boolean pack, String fragment, List<SyndicatedEntryModel> entries) {\r
+               tableModel.entries.clear();\r
+               tableModel.entries.addAll(entries);\r
+               tableModel.fireTableDataChanged();\r
+               setTitle(Translation.get("gb.search") + ": " + fragment + " (" + entries.size() + ")");\r
+               header.setText(getTitle());\r
+               if (pack) {\r
+                       Utils.packColumns(table, Utils.MARGIN);\r
+               }\r
+       }\r
+\r
+       protected SyndicatedEntryModel getSelectedSyndicatedEntry() {\r
+               int viewRow = table.getSelectedRow();\r
+               int modelRow = table.convertRowIndexToModel(viewRow);\r
+               SyndicatedEntryModel entry = tableModel.get(modelRow);\r
+               return entry;\r
+       }\r
+\r
+       protected void viewCommit() {\r
+               SyndicatedEntryModel entry = getSelectedSyndicatedEntry();\r
+               Utils.browse(entry.link);\r
+       }\r
+\r
+       protected void viewCommitDiff() {\r
+               SyndicatedEntryModel entry = getSelectedSyndicatedEntry();\r
+               Utils.browse(entry.link.replace("/commit/", "/commitdiff/"));\r
+       }\r
+\r
+       protected void viewTree() {\r
+               SyndicatedEntryModel entry = getSelectedSyndicatedEntry();\r
+               Utils.browse(entry.link.replace("/commit/", "/tree/"));\r
+       }\r
+}\r
index 64a88d9c0d3817baecae375069009afc069ff34f..20a6429220ffa5693f58157073c73f68e698dd5a 100644 (file)
@@ -101,7 +101,7 @@ public abstract class SubscriptionsDialog extends JDialog {
                feedsTable.getColumn(repository).setCellRenderer(nameRenderer);\r
 \r
                String branch = feedsTable.getColumnName(FeedsTableModel.Columns.Branch.ordinal());\r
-               feedsTable.getColumn(branch).setCellRenderer(nameRenderer);\r
+               feedsTable.getColumn(branch).setCellRenderer(new BranchRenderer());\r
 \r
                String subscribed = feedsTable.getColumnName(FeedsTableModel.Columns.Subscribed.ordinal());\r
                feedsTable.getColumn(subscribed).setCellRenderer(new BooleanCellRenderer());\r
index 3ab1b7a4f16886d18918149ca265d15247b7ed2c..51938433f0bac59e89b27bb88e40cd38bd61cd11 100644 (file)
@@ -179,4 +179,5 @@ gb.releaseDate = release date
 gb.date = date\r
 gb.activity = activity\r
 gb.subscribe = subscribe\r
-gb.branch = branch
\ No newline at end of file
+gb.branch = branch\r
+gb.maxHits = max hits
\ No newline at end of file
index d31979ddf9e128eb518de4ec8d08dc1bd94bec8c..f98e8830a6d91ee61e5c73e217673b852215b468 100644 (file)
@@ -84,6 +84,7 @@ public abstract class BasePage extends WebPage {
                        // Set Cookie\r
                        WebResponse response = (WebResponse) getRequestCycle().getResponse();\r
                        GitBlit.self().setCookie(response, user);\r
+                       continueToOriginalDestination();\r
                }\r
        }\r
 \r