Author: jflesch
Date: 2006-10-19 22:16:13 +0000 (Thu, 19 Oct 2006)
New Revision: 10677

Added:
   trunk/apps/Thaw/images/index-new.png
Modified:
   trunk/apps/Thaw/src/thaw/core/IconBox.java
   trunk/apps/Thaw/src/thaw/plugins/index/IndexTree.java
Log:
Add a toolbar in the index browser / editor

Added: trunk/apps/Thaw/images/index-new.png
===================================================================
(Binary files differ)


Property changes on: trunk/apps/Thaw/images/index-new.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: trunk/apps/Thaw/src/thaw/core/IconBox.java
===================================================================
--- trunk/apps/Thaw/src/thaw/core/IconBox.java  2006-10-19 21:11:44 UTC (rev 
10676)
+++ trunk/apps/Thaw/src/thaw/core/IconBox.java  2006-10-19 22:16:13 UTC (rev 
10677)
@@ -39,7 +39,10 @@
        public static ImageIcon makeALinkAction;

        public static ImageIcon minIndex;
+       public static ImageIcon indexNew;

+       public static ImageIcon refreshAction;
+
        public static ImageIcon clearAction;

        public static ImageIcon settings;
@@ -93,6 +96,8 @@

                        minIndex =
                                new ImageIcon((new 
IconBox()).getClass().getClassLoader().getResource("index.png"));
+                       indexNew =
+                               new ImageIcon((new 
IconBox()).getClass().getClassLoader().getResource("index-new.png"));

                        downloads =
                                new ImageIcon((new 
IconBox()).getClass().getClassLoader().getResource("go-first.png"));
@@ -132,6 +137,9 @@
                        minReconnectAction =
                                new ImageIcon((new 
IconBox()).getClass().getClassLoader().getResource("min-view-refresh.png"));

+                       refreshAction =
+                               new ImageIcon((new 
IconBox()).getClass().getClassLoader().getResource("index-refresh.png"));
+
                        quitAction =
                                new ImageIcon((new 
IconBox()).getClass().getClassLoader().getResource("system-log-out.png"));
                        minQuitAction =

Modified: trunk/apps/Thaw/src/thaw/plugins/index/IndexTree.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/IndexTree.java       2006-10-19 
21:11:44 UTC (rev 10676)
+++ trunk/apps/Thaw/src/thaw/plugins/index/IndexTree.java       2006-10-19 
22:16:13 UTC (rev 10677)
@@ -38,6 +38,11 @@

 import java.awt.Color;

+
+import javax.swing.JToolBar;
+import javax.swing.JButton;
+
+
 import thaw.plugins.Hsqldb;
 import thaw.core.*;
 import thaw.fcp.*;
@@ -55,6 +60,10 @@
        private JTree tree;
        private IndexCategory root;

+       private JToolBar toolBar;
+       private JButton newIndex;
+       private JButton refreshAll;
+
        private JPopupMenu indexCategoryMenu;
        private JPopupMenu indexMenu;

@@ -174,7 +183,31 @@
                if (selectionOnly)
                        
tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);

-               panel.add(new JScrollPane(tree));
+
+
+               toolBar = new JToolBar();
+
+               newIndex   = new JButton(IconBox.indexNew);
+               if (!modifiables)
+                       
newIndex.setToolTipText(I18n.getMessage("thaw.plugin.index.addIndex"));
+               else
+                       
newIndex.setToolTipText(I18n.getMessage("thaw.plugin.index.createIndex"));
+               newIndex.addActionListener(this);
+
+
+               if (!modifiables) {
+                       refreshAll = new JButton(IconBox.refreshAction);
+                       
refreshAll.setToolTipText(I18n.getMessage("thaw.plugin.index.downloadIndexes"));
+                       refreshAll.addActionListener(this);
+               }
+
+
+               toolBar.add(newIndex);
+               if (!modifiables)
+                       toolBar.add(refreshAll);
+               
+               panel.add(toolBar, BorderLayout.NORTH);
+               panel.add(new JScrollPane(tree), BorderLayout.CENTER);
        }


@@ -260,9 +293,10 @@

        public void actionPerformed(ActionEvent e) {
                if(selectedNode == null)
-                       return;
+                       selectedNode = root;

-               if(e.getSource() == addIndex) {
+               if(e.getSource() == addIndex
+                  || e.getSource() == newIndex) {
                        String name = null;

                        String publicKey = null;
@@ -287,8 +321,13 @@
                        if(name == null)
                                return;

-                       IndexCategory parent = (IndexCategory)selectedNode;
+                       IndexCategory parent;

+                       if (e.getSource() == addIndex)
+                               parent = (IndexCategory)selectedNode;
+                       else
+                               parent = root;
+
                        Index index = new Index(db, queueManager, -2, parent, 
name, name, publicKey, null, 0, null, modifiables);

                        if(modifiables)
@@ -358,6 +397,10 @@
                   || e.getSource() == updateIndexCategory) {
                        selectedNode.update();
                }
+               
+               if (e.getSource() == refreshAll) {
+                       root.update();
+               }

                if(e.getSource() == copyKey
                   || e.getSource() == copyKeys) {


Reply via email to