Author: jflesch
Date: 2007-08-08 21:16:24 +0000 (Wed, 08 Aug 2007)
New Revision: 14542

Modified:
   trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties
   trunk/apps/Thaw/src/thaw/i18n/thaw.properties
   trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties
   trunk/apps/Thaw/src/thaw/plugins/IndexBrowser.java
   trunk/apps/Thaw/src/thaw/plugins/index/Index.java
   trunk/apps/Thaw/src/thaw/plugins/index/IndexFolder.java
   trunk/apps/Thaw/src/thaw/plugins/index/IndexManagementHelper.java
   trunk/apps/Thaw/src/thaw/plugins/index/IndexRoot.java
   trunk/apps/Thaw/src/thaw/plugins/index/IndexTree.java
   trunk/apps/Thaw/src/thaw/plugins/index/LinkManagementHelper.java
   trunk/apps/Thaw/src/thaw/plugins/index/SearchBar.java
   trunk/apps/Thaw/src/thaw/plugins/index/UnknownIndexList.java
Log:
Make it possible to sort an index automatically according to its category

Modified: trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties
===================================================================
--- trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties     2007-08-08 
20:51:15 UTC (rev 14541)
+++ trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties     2007-08-08 
21:16:24 UTC (rev 14542)
@@ -404,9 +404,11 @@
 thaw.plugin.index.category=Categorie
 thaw.plugin.index.categories=Categories (S?parateur: '/')
 thaw.plugin.index.noCategory=Vous n'avez sp?cifi? aucune cat?gorie pour 
l'index '?'.\n?tes-vous s?r de vouloir l'ins?rer tel quel ?
+thaw.plugin.index.autoSorting=Essayer de trier automatiquement les indexes
+thaw.plugin.index.automaticallySorted=Automatiquement tri?s
+thaw.plugin.index.autoSortAction=Ranger cet index d'apr?s sa cat?gorie


-
 # Peer monitor

 thaw.plugin.peerMonitor.peerMonitor=Connexion

Modified: trunk/apps/Thaw/src/thaw/i18n/thaw.properties
===================================================================
--- trunk/apps/Thaw/src/thaw/i18n/thaw.properties       2007-08-08 20:51:15 UTC 
(rev 14541)
+++ trunk/apps/Thaw/src/thaw/i18n/thaw.properties       2007-08-08 21:16:24 UTC 
(rev 14542)
@@ -416,10 +416,11 @@
 thaw.plugin.index.category=Category
 thaw.plugin.index.categories=Categories (Separator: '/')
 thaw.plugin.index.noCategory=You didn't specify a category for the index 
'?'.\nAre you sure that you want to insert it as it ?
+thaw.plugin.index.autoSorting=Try to sort automatically the indexes
+thaw.plugin.index.automaticallySorted=Automatically sorted
+thaw.plugin.index.autoSortAction=Sort this index according to its category


-
-
 # Peer monitor

 thaw.plugin.peerMonitor.peerMonitor=Connection

Modified: trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties
===================================================================
--- trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties    2007-08-08 20:51:15 UTC 
(rev 14541)
+++ trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties    2007-08-08 21:16:24 UTC 
(rev 14542)
@@ -404,6 +404,8 @@
 thaw.plugin.index.category=Categorie
 thaw.plugin.index.categories=Categories (S\u00e9parateur: '/')
 thaw.plugin.index.noCategory=Vous n'avez sp\u00e9cifi\u00e9 aucune 
cat\u00e9gorie pour l'index '?'.\n\u00cates-vous s\u00fbr de vouloir 
l'ins\u00e9rer tel quel ?
+thaw.plugin.index.autoSorting=Essayer de trier automatiquement les indexes
+thaw.plugin.index.automaticallySorted=Automatiquement tri\u00e9s




Modified: trunk/apps/Thaw/src/thaw/plugins/IndexBrowser.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/IndexBrowser.java  2007-08-08 20:51:15 UTC 
(rev 14541)
+++ trunk/apps/Thaw/src/thaw/plugins/IndexBrowser.java  2007-08-08 21:16:24 UTC 
(rev 14542)
@@ -95,8 +95,10 @@

                if (newDb) {
                        for (int i = 0 ; i < DEFAULT_INDEXES.length ; i++) {
-                               
IndexManagementHelper.addIndex(core.getQueueManager(), browserPanel, null,
-                                                              
DEFAULT_INDEXES[i]);
+                               
IndexManagementHelper.addIndex(core.getQueueManager(),
+                                                              browserPanel, 
null,
+                                                              
DEFAULT_INDEXES[i],
+                                                              true);
                        }
                }


Modified: trunk/apps/Thaw/src/thaw/plugins/index/Index.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/Index.java   2007-08-08 20:51:15 UTC 
(rev 14541)
+++ trunk/apps/Thaw/src/thaw/plugins/index/Index.java   2007-08-08 21:16:24 UTC 
(rev 14542)
@@ -1883,6 +1883,23 @@
         * create it if it doesn't exist
         */
        public void setCategory(String category) {
+               if (category == null)
+                       return;
+
+               category = category.trim();
+
+               if ("".equals(category))
+                       return;
+
+               category = category.toLowerCase();
+
+               String oldCat;
+
+               do {
+                       oldCat = category;
+                       category = category.replaceAll("//", "/");
+               } while(!oldCat.equals(category));
+
                try {
                        synchronized(db.dbLock) {
                                PreparedStatement st;
@@ -1892,7 +1909,7 @@

                                st = 
db.getConnection().prepareStatement("SELECT id FROM categories "+
                                                                         "WHERE 
name = ? LIMIT 1");
-                               st.setString(1, category.toLowerCase());
+                               st.setString(1, category);

                                set = st.executeQuery();

@@ -1908,7 +1925,7 @@
                                        st = 
db.getConnection().prepareStatement("INSERT INTO categories "+
                                                                                
 "(id, name) VALUES (?, ?)");
                                        st.setInt(1, catId);
-                                       st.setString(2, category.toLowerCase());
+                                       st.setString(2, category);
                                        st.execute();
                                } else {
                                        catId = set.getInt("id");

Modified: trunk/apps/Thaw/src/thaw/plugins/index/IndexFolder.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/IndexFolder.java     2007-08-08 
20:51:15 UTC (rev 14541)
+++ trunk/apps/Thaw/src/thaw/plugins/index/IndexFolder.java     2007-08-08 
21:16:24 UTC (rev 14542)
@@ -8,6 +8,7 @@
 import java.util.Iterator;
 import java.util.Observer;
 import java.util.Vector;
+import java.util.HashMap;

 import javax.swing.tree.MutableTreeNode;
 import javax.swing.tree.TreeNode;
@@ -39,6 +40,7 @@

        private boolean loadOnTheFly = true;

+       private HashMap folders;


        public IndexFolder(final Hsqldb db, Config config,
@@ -48,6 +50,7 @@
                this.config = config;
                this.db = db;
                this.loadOnTheFly = loadOnTheFly;
+               folders = new HashMap();
        }

        /**
@@ -59,6 +62,7 @@

                this.parentNode = parentNode;
                this.name = name;
+               folders = new HashMap();
        }


@@ -84,6 +88,7 @@
                                                    set.getString("name"), 
loadOnTheFly);
                                if (!loadOnTheFly) /* => load immediatly */
                                        ((IndexFolder)n).loadChildren();
+                               
folders.put(set.getString("name").toLowerCase(), n); 
                        }
                        else
                                n = new Index(db, config,
@@ -108,6 +113,11 @@
        }


+       public IndexFolder getFolder(String name) {
+               return (IndexFolder)folders.get(name.toLowerCase());
+       }
+
+
        /** TREENODE **/

        public Enumeration children() {
@@ -281,8 +291,13 @@
         * the target child must be in the database
         */
        public void insert(MutableTreeNode child, int index) {
-               Logger.info(this, "Inserting node at 
"+Integer.toString(index)+" in node "+Integer.toString(id)+" ("+toString()+")");
+               Logger.info(this, "Inserting node at 
"+Integer.toString(index)+" in node "+
+                           Integer.toString(id)+" ("+toString()+")");

+               if (child instanceof IndexFolder && folders != null) {
+                       folders.put( ((IndexFolder)child).toString(), child);
+               }
+
                if (children != null) {

                        synchronized(children) {

Modified: trunk/apps/Thaw/src/thaw/plugins/index/IndexManagementHelper.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/IndexManagementHelper.java   
2007-08-08 20:51:15 UTC (rev 14541)
+++ trunk/apps/Thaw/src/thaw/plugins/index/IndexManagementHelper.java   
2007-08-08 21:16:24 UTC (rev 14542)
@@ -37,6 +37,7 @@
 import javax.swing.JTextField;
 import javax.swing.tree.MutableTreeNode;
 import javax.swing.tree.TreeNode;
+import javax.swing.tree.TreePath;
 import javax.swing.JScrollPane;

 import java.awt.event.KeyEvent;
@@ -345,7 +346,8 @@
                        privateKey = dialog.getPrivateKey();

                        IndexManagementHelper.reuseIndex(getQueueManager(), 
getIndexBrowserPanel(),
-                                                        
(IndexFolder)getTarget(), publicKey, privateKey);
+                                                        
(IndexFolder)getTarget(), publicKey, privateKey,
+                                                        false /* autosort */);
                }
        }

@@ -353,18 +355,24 @@
        public static Index addIndex(final FCPQueueManager queueManager,
                                     final IndexBrowserPanel indexBrowser,
                                     final IndexFolder target,
-                                    final String publicKey) {
+                                    final String publicKey,
+                                    boolean autoSort) {

-               return IndexManagementHelper.reuseIndex(queueManager, 
indexBrowser, target, publicKey, null);
+               return IndexManagementHelper.reuseIndex(queueManager, 
indexBrowser,
+                                                       target, publicKey, null,
+                                                       autoSort);

        }

        public static Index reuseIndex(final FCPQueueManager queueManager,
                                       final IndexBrowserPanel indexBrowser,
                                       final IndexFolder target, String 
publicKey,
-                                      String privateKey) {
+                                      String privateKey,
+                                      boolean autoSort) {

-               return reuseIndex(queueManager, indexBrowser, target, 
publicKey, privateKey, true);
+               return reuseIndex(queueManager, indexBrowser, target,
+                                 publicKey, privateKey, true,
+                                 autoSort);

        }

@@ -376,7 +384,8 @@
                                       final IndexBrowserPanel indexBrowser,
                                       final IndexFolder target,
                                       String publicKey, String privateKey,
-                                      boolean load) {
+                                      boolean load,
+                                      boolean autoSort) {

                publicKey = FreenetURIHelper.cleanURI(publicKey);
                privateKey = FreenetURIHelper.cleanURI(privateKey);
@@ -469,7 +478,7 @@
                indexBrowser.getUnknownIndexList().removeLink(index);

                if (load) {
-                       download(queueManager, indexBrowser, index);
+                       download(queueManager, indexBrowser, index, autoSort);
                }

                return index;
@@ -568,16 +577,30 @@


        public static class IndexDownloader extends BasicIndexAction implements 
Runnable, Observer {
-               public IndexDownloader(FCPQueueManager queueManager, 
IndexBrowserPanel indexBrowser, final AbstractButton actionSource) {
+               private boolean autoSort = false;
+
+               public IndexDownloader(FCPQueueManager queueManager,
+                                      IndexBrowserPanel indexBrowser,
+                                      final AbstractButton actionSource) {
                        super(queueManager, indexBrowser, actionSource);
                }

+               public IndexDownloader(FCPQueueManager queueManager,
+                                      IndexBrowserPanel indexBrowser,
+                                      final AbstractButton actionSource,
+                                      boolean autoSort) {
+                       this(queueManager, indexBrowser, actionSource);
+                       this.autoSort = autoSort;
+               }
+
                public void setTarget(final IndexTreeNode node) {
                        super.setTarget(node);
                }

                public void apply() {
-                       getTarget().downloadFromFreenet(this, 
getIndexBrowserPanel().getIndexTree(), getQueueManager());
+                       getTarget().downloadFromFreenet(this,
+                                                       
getIndexBrowserPanel().getIndexTree(),
+                                                       getQueueManager());
                        
getIndexBrowserPanel().getIndexTree().redraw(getTarget());
                }

@@ -594,6 +617,20 @@
                        }

                        
getIndexBrowserPanel().getUnknownIndexList().addLinks((LinkList)o);
+
+                       if (((Index)o).hasChanged() && autoSort) {
+                               Index index = (Index)o;
+
+                               String cat;
+
+                               if ( (cat = index.getCategory()) == null) {
+                                       Logger.notice(this, "No category 
defined ; Can't autosort "+
+                                                     "the index 
'"+index.toString(false)+"'");
+                                       return;
+                               }
+
+                               autoSortIndex(getIndexBrowserPanel(), index, 
cat);
+                       }
                }
        }

@@ -601,10 +638,13 @@

        public static boolean download(FCPQueueManager queueManager,
                                       IndexBrowserPanel indexBrowser,
-                                      IndexTreeNode target) {
+                                      IndexTreeNode target,
+                                      boolean autoSort) {

-               IndexDownloader downloader = new IndexDownloader(queueManager, 
indexBrowser,
-                                                                null);
+               IndexDownloader downloader = new IndexDownloader(queueManager,
+                                                                indexBrowser,
+                                                                null,
+                                                                autoSort);
                downloader.setTarget(target);

                Thread th = new Thread(downloader);
@@ -614,8 +654,116 @@
        }


+       /**
+        * @param cat Example: "Automatically sorted/freenet/thaw" (only 
folders !)
+        * @return the path in the tree
+        */
+       public static TreePath makeMyPath(IndexBrowserPanel indexBrowser, 
String cat) {
+               String[] split = cat.split("/");
+
+               if (split == null) return null;
+
+               IndexFolder currentFolder = 
indexBrowser.getIndexTree().getRoot();
+               TreePath path = new TreePath(currentFolder);
+               path = path.pathByAddingChild(currentFolder);
+
+               for (int i = 0 ; i < split.length ; i++) {
+                       if (split[i] == null || "".equals(split[i].trim()))
+                               continue;
+                       String folder = split[i].trim().toLowerCase();
+
+                       IndexFolder nextFolder = 
currentFolder.getFolder(folder);
+
+                       if (nextFolder == null) {
+                               nextFolder = addIndexFolder(indexBrowser,
+                                                           currentFolder,
+                                                           folder);
+                       }
+
+                       path = path.pathByAddingChild(nextFolder);
+
+                       currentFolder = nextFolder;
+               }
+
+               return path;
+       }
+
+
+       public static boolean moveIndexTo(IndexBrowserPanel indexBrowser,
+                                         Index index,
+                                         IndexFolder dst) {
+               IndexFolder oldParent = (IndexFolder)index.getParent();
+
+               if (oldParent == dst) {
+                       Logger.notice(new IndexManagementHelper(), "Index 
already sorted.");
+                       return false;
+               }
+
+               index.removeFromParent();
+               dst.insert(index, 0);
+
+               if (oldParent != null) {
+                       indexBrowser.getIndexTree().refresh(oldParent);
+               } else {
+                       indexBrowser.getIndexTree().refresh();
+               }
+
+               indexBrowser.getIndexTree().refresh(dst);
+
+               return true;
+       }
+
+
+       public static boolean autoSortIndex(IndexBrowserPanel indexBrowser,
+                                           Index index,
+                                           String cat) {
+               if (cat == null) {
+                       Logger.warning(new IndexManagementHelper(), "No 
category ; Can't sort the index");
+                       return false;
+               }
+
+               cat = 
I18n.getMessage("thaw.plugin.index.automaticallySorted")+"/"+cat;
+
+               TreePath path = makeMyPath(indexBrowser, cat);
+
+               if (path == null) {
+                       return false;
+               }
+
+               IndexFolder dst = (IndexFolder)path.getLastPathComponent();
+
+               return moveIndexTo(indexBrowser, index, dst);
+       }
+
+
+
+       public static class IndexSorter extends BasicIndexAction implements 
Runnable {
+               public IndexSorter(IndexBrowserPanel indexBrowser,
+                                  final AbstractButton actionSource) {
+
+                       super(null, indexBrowser, actionSource);
+               }
+
+               public void setTarget(final IndexTreeNode node) {
+                       super.setTarget(node);
+
+                       if (getActionSource() != null)
+                               getActionSource().setEnabled((node != null) && 
node instanceof Index);
+               }
+
+               public void apply() {
+                       autoSortIndex(getIndexBrowserPanel(),
+                                     (Index)getTarget(),
+                                     ((Index)getTarget()).getCategory());
+               }
+       }
+
+
        public static class IndexUploader extends BasicIndexAction implements 
Runnable, Observer {
-               public IndexUploader(FCPQueueManager queueManager, 
IndexBrowserPanel indexBrowser, final AbstractButton actionSource) {
+               public IndexUploader(FCPQueueManager queueManager,
+                                    IndexBrowserPanel indexBrowser,
+                                    final AbstractButton actionSource) {
+
                        super(queueManager, indexBrowser, actionSource);
                }


Modified: trunk/apps/Thaw/src/thaw/plugins/index/IndexRoot.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/IndexRoot.java       2007-08-08 
20:51:15 UTC (rev 14541)
+++ trunk/apps/Thaw/src/thaw/plugins/index/IndexRoot.java       2007-08-08 
21:16:24 UTC (rev 14542)
@@ -97,7 +97,8 @@

                for (int i = 0 ; i < 
thaw.plugins.IndexBrowser.DEFAULT_INDEXES.length ; i++) {
                        IndexManagementHelper.addIndex(queueManager, 
indexBrowser, null,
-                                                      
thaw.plugins.IndexBrowser.DEFAULT_INDEXES[i]);
+                                                      
thaw.plugins.IndexBrowser.DEFAULT_INDEXES[i],
+                                                      true);
                }

                forceReload();

Modified: trunk/apps/Thaw/src/thaw/plugins/index/IndexTree.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/IndexTree.java       2007-08-08 
20:51:15 UTC (rev 14541)
+++ trunk/apps/Thaw/src/thaw/plugins/index/IndexTree.java       2007-08-08 
21:16:24 UTC (rev 14542)
@@ -231,6 +231,10 @@
                indexMenu.add(item);
                indexAndFileActions.add(new 
IndexManagementHelper.IndexUploader(queueManager, indexBrowser, item));

+               item = new 
JMenuItem(I18n.getMessage("thaw.plugin.index.autoSortAction"));
+               indexMenu.add(item);
+               indexAndFileActions.add(new 
IndexManagementHelper.IndexSorter(indexBrowser, item));
+
                item = new 
JMenuItem(I18n.getMessage("thaw.plugin.index.rename"));
                indexMenu.add(item);
                indexAndFileActions.add(new 
IndexManagementHelper.IndexRenamer(indexBrowser, item));

Modified: trunk/apps/Thaw/src/thaw/plugins/index/LinkManagementHelper.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/LinkManagementHelper.java    
2007-08-08 20:51:15 UTC (rev 14541)
+++ trunk/apps/Thaw/src/thaw/plugins/index/LinkManagementHelper.java    
2007-08-08 21:16:24 UTC (rev 14542)
@@ -104,7 +104,9 @@
                private Vector t;

                private boolean addToParent; /* (== add to the same parent 
folder) */
+               private boolean autoSorting;

+
                public IndexAdder(final AbstractButton actionSource,
                                  final FCPQueueManager queueManager,
                                  final IndexBrowserPanel indexBrowser,
@@ -124,6 +126,9 @@
                        src.setEnabled((targets != null) && (targets.size() > 
0));
                }

+               public void setAutoSorting(boolean b) {
+                       autoSorting = b;
+               }

                public void apply() {
                        for (final Iterator it = t.iterator();
@@ -131,9 +136,12 @@
                                final Link link = (Link)it.next();
                                if (link != null) {
                                        if (addToParent && link.getTreeParent() 
!= null)
-                                               
IndexManagementHelper.addIndex(queueManager, indexBrowser, 
((IndexFolder)link.getTreeParent().getParent()), link.getPublicKey());
+                                               
IndexManagementHelper.addIndex(queueManager, indexBrowser,
+                                                                              
((IndexFolder)link.getTreeParent().getParent()),
+                                                                              
link.getPublicKey(), autoSorting);
                                        else
-                                               
IndexManagementHelper.addIndex(queueManager, indexBrowser, null, 
link.getPublicKey());
+                                               
IndexManagementHelper.addIndex(queueManager, indexBrowser,
+                                                                              
null, link.getPublicKey(), autoSorting);
                                }
                        }
                }

Modified: trunk/apps/Thaw/src/thaw/plugins/index/SearchBar.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/SearchBar.java       2007-08-08 
20:51:15 UTC (rev 14541)
+++ trunk/apps/Thaw/src/thaw/plugins/index/SearchBar.java       2007-08-08 
21:16:24 UTC (rev 14542)
@@ -28,7 +28,8 @@
                panel.setLayout(new BorderLayout(0, 0));

                userText = new JTextField("");
-               validationButton = new JButton("  
"+I18n.getMessage("thaw.common.search")+"  ");
+               validationButton = new 
JButton(I18n.getMessage("thaw.common.search"),
+                                              thaw.gui.IconBox.minSearch);

                final JLabel label = new 
JLabel(I18n.getMessage("thaw.plugin.index.search.label"));


Modified: trunk/apps/Thaw/src/thaw/plugins/index/UnknownIndexList.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/UnknownIndexList.java        
2007-08-08 20:51:15 UTC (rev 14541)
+++ trunk/apps/Thaw/src/thaw/plugins/index/UnknownIndexList.java        
2007-08-08 21:16:24 UTC (rev 14542)
@@ -15,6 +15,7 @@
 import javax.swing.JPanel;
 import javax.swing.JPopupMenu;
 import javax.swing.JScrollPane;
+import javax.swing.JCheckBox;

 import java.awt.event.MouseAdapter;
 import javax.swing.SwingConstants;
@@ -43,6 +44,8 @@

        private JScrollPane scrollPane;

+       private JCheckBox autoSorting;
+
        private JPopupMenu rightClickMenu = null;
        private Vector rightClickActions = null;

@@ -74,9 +77,14 @@
                panel = new JPanel(new BorderLayout());
                panel.add(new 
JLabel(I18n.getMessage("thaw.plugin.index.unknownIndexes")),
                          BorderLayout.NORTH);
+
                scrollPane = new JScrollPane(list);
-               panel.add(scrollPane);
+               panel.add(scrollPane, BorderLayout.CENTER);

+               autoSorting = new 
JCheckBox(I18n.getMessage("thaw.plugin.index.autoSorting"));
+               autoSorting.addActionListener(this);
+               panel.add(autoSorting, BorderLayout.SOUTH);
+
                JButton button;

                toolbarModifier = new 
ToolbarModifier(indexBrowser.getMainWindow());
@@ -88,6 +96,8 @@
                toolbarModifier.addButtonToTheToolbar(button);

                list.addMouseListener(this);
+
+               applyAutoSortingSetting();
        }


@@ -232,7 +242,8 @@

                        item = new 
JMenuItem(I18n.getMessage("thaw.plugin.index.addIndexesFromLink"), 
IconBox.minAdd);
                        rightClickMenu.add(item);
-                       rightClickActions.add(new 
LinkManagementHelper.IndexAdder(item, queueManager, indexBrowser, false));
+                       rightClickActions.add(new 
LinkManagementHelper.IndexAdder(item, queueManager,
+                                                                               
  indexBrowser, false));

                        sortItem = new 
JMenuItem(I18n.getMessage("thaw.plugin.index.sortAlphabetically"));
                        rightClickMenu.add(sortItem);
@@ -296,6 +307,27 @@
        }


+       public void applyAutoSortingSetting() {
+               LinkManagementHelper.LinkAction action;
+
+               if (rightClickActions != null) {
+                       for (Iterator it = rightClickActions.iterator();
+                            it.hasNext();) {
+                               action = 
(LinkManagementHelper.LinkAction)it.next();
+                               if (action instanceof 
LinkManagementHelper.IndexAdder)
+                                       
((LinkManagementHelper.IndexAdder)action).setAutoSorting(autoSorting.isSelected());
+                       }
+               }
+
+               for(final Iterator it = toolbarActions.iterator();
+                   it.hasNext(); ) {
+                       action = (LinkManagementHelper.LinkAction)it.next();
+                       if (action instanceof LinkManagementHelper.IndexAdder)
+                               
((LinkManagementHelper.IndexAdder)action).setAutoSorting(autoSorting.isSelected());
+               }
+
+       }
+
        public void actionPerformed(ActionEvent e) {
                if (e.getSource() == sortItem) {

@@ -323,6 +355,11 @@
                                vList = v;

                        refresh();
+
+               } else if (e.getSource() == autoSorting) {
+
+                       applyAutoSortingSetting();
+
                }
        }



Reply via email to