Author: jflesch
Date: 2007-04-02 11:33:12 +0000 (Mon, 02 Apr 2007)
New Revision: 12522

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/PeerMonitor.java
   trunk/apps/Thaw/src/thaw/plugins/QueueWatcher.java
   trunk/apps/Thaw/src/thaw/plugins/index/IndexManagementHelper.java
   trunk/apps/Thaw/src/thaw/plugins/peerMonitor/PeerHelper.java
   trunk/apps/Thaw/src/thaw/plugins/peerMonitor/PeerMonitorPanel.java
   trunk/apps/Thaw/src/thaw/plugins/queueWatcher/DetailPanel.java
Log:
Fix index creation

Modified: trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties
===================================================================
--- trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties     2007-04-02 
00:53:44 UTC (rev 12521)
+++ trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties     2007-04-02 
11:33:12 UTC (rev 12522)
@@ -336,6 +336,11 @@
 thaw.plugin.peerMonitor.nodeInfos=Informations sur votre noeud :
 thaw.plugin.peerMonitor.peerInfos=Informations relatives au peer

+
+thaw.plugin.peerMonitor.addPeer=Ajouter un peer
+thaw.plugin.peerMonitor.removePeer=Enlever ce peer
+thaw.plugin.peerMonitor.enterRef=R?f?rence:
+
 thaw.plugin.peerMonitor.infos.peer.lastRoutingBackoffReason=Dernier motif de 
saturation
 thaw.plugin.peerMonitor.infos.peer.routingBackoffPercent=Pourcentage de 
saturation
 thaw.plugin.peerMonitor.infos.peer.version=Version du noeud
@@ -349,6 +354,7 @@
 thaw.plugin.peerMonitor.infos.node.uptimeSeconds=Uptime
 thaw.plugin.peerMonitor.infos.node.networkSizeEstimateSession=Estimation de la 
taille du r?seau
 thaw.plugin.peerMonitor.infos.node.myName=Nom du noeud
+thaw.plugin.peerMonitor.infos.node.runningThreads=Nombre de threads

 thaw.plugin.peerMonitor.infos.nodeMemory=Memoire du noeud
 thaw.plugin.peerMonitor.infos.thawMemory=Memoire de Thaw

Modified: trunk/apps/Thaw/src/thaw/i18n/thaw.properties
===================================================================
--- trunk/apps/Thaw/src/thaw/i18n/thaw.properties       2007-04-02 00:53:44 UTC 
(rev 12521)
+++ trunk/apps/Thaw/src/thaw/i18n/thaw.properties       2007-04-02 11:33:12 UTC 
(rev 12522)
@@ -343,12 +343,16 @@
 thaw.plugin.peerMonitor.infos.node.uptimeSeconds=Uptime
 thaw.plugin.peerMonitor.infos.node.networkSizeEstimateSession=Network size 
estimation
 thaw.plugin.peerMonitor.infos.node.myName=Node name
+thaw.plugin.peerMonitor.infos.node.runningThreads=Running threads

 thaw.plugin.peerMonitor.infos.nodeMemory=Node memory
 thaw.plugin.peerMonitor.infos.thawMemory=Thaw memory
 thaw.plugin.peerMonitor.infos.nodeThreads=Node threads
 thaw.plugin.peerMonitor.infos.thawThreads=Thaw threads

+thaw.plugin.peerMonitor.addPeer=Add a peer
+thaw.plugin.peerMonitor.removePeer=Remove this peer
+thaw.plugin.peerMonitor.enterRef=Reference:

 thaw.plugin.themeSelector.themeSelector=Theme selector
 thaw.plugin.themeSelector.selectATheme=Select a theme:

Modified: trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties
===================================================================
--- trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties    2007-04-02 00:53:44 UTC 
(rev 12521)
+++ trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties    2007-04-02 11:33:12 UTC 
(rev 12522)
@@ -336,6 +336,11 @@
 thaw.plugin.peerMonitor.nodeInfos=Informations sur votre noeud :
 thaw.plugin.peerMonitor.peerInfos=Informations relatives au peer

+
+thaw.plugin.peerMonitor.addPeer=Ajouter un peer
+thaw.plugin.peerMonitor.removePeer=Enlever ce peer
+thaw.plugin.peerMonitor.enterRef=R\u00e9f\u00e9rence:
+
 thaw.plugin.peerMonitor.infos.peer.lastRoutingBackoffReason=Dernier motif de 
saturation
 thaw.plugin.peerMonitor.infos.peer.routingBackoffPercent=Pourcentage de 
saturation
 thaw.plugin.peerMonitor.infos.peer.version=Version du noeud
@@ -349,6 +354,7 @@
 thaw.plugin.peerMonitor.infos.node.uptimeSeconds=Uptime
 thaw.plugin.peerMonitor.infos.node.networkSizeEstimateSession=Estimation de la 
taille du r\u00e9seau
 thaw.plugin.peerMonitor.infos.node.myName=Nom du noeud
+thaw.plugin.peerMonitor.infos.node.runningThreads=Nombre de threads

 thaw.plugin.peerMonitor.infos.nodeMemory=Memoire du noeud
 thaw.plugin.peerMonitor.infos.thawMemory=Memoire de Thaw

Modified: trunk/apps/Thaw/src/thaw/plugins/PeerMonitor.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/PeerMonitor.java   2007-04-02 00:53:44 UTC 
(rev 12521)
+++ trunk/apps/Thaw/src/thaw/plugins/PeerMonitor.java   2007-04-02 11:33:12 UTC 
(rev 12522)
@@ -102,7 +102,7 @@
                advancedMode = 
Boolean.valueOf(core.getConfig().getValue("advancedMode")).booleanValue();


-               peerPanel = new PeerMonitorPanel(core.getConfig());
+               peerPanel = new PeerMonitorPanel(core.getQueueManager(), 
core.getConfig(), core.getMainWindow());

                
core.getMainWindow().addTab(I18n.getMessage("thaw.plugin.peerMonitor.peerMonitor"),
                                            thaw.gui.IconBox.minPeerMonitor,

Modified: trunk/apps/Thaw/src/thaw/plugins/QueueWatcher.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/QueueWatcher.java  2007-04-02 00:53:44 UTC 
(rev 12521)
+++ trunk/apps/Thaw/src/thaw/plugins/QueueWatcher.java  2007-04-02 11:33:12 UTC 
(rev 12522)
@@ -37,7 +37,7 @@

        private JSplitPane split;

-       private final static int DIVIDER_LOCATION = 310; /* about the details 
panel */
+       public final static int DIVIDER_LOCATION = 250; /* about the details 
panel */
        private long lastChange = 0;
        private boolean folded = false;


Modified: trunk/apps/Thaw/src/thaw/plugins/index/IndexManagementHelper.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/IndexManagementHelper.java   
2007-04-02 00:53:44 UTC (rev 12521)
+++ trunk/apps/Thaw/src/thaw/plugins/index/IndexManagementHelper.java   
2007-04-02 11:33:12 UTC (rev 12522)
@@ -54,6 +54,7 @@
                return JOptionPane.showInputDialog(parent, prompt, defVal);
        }

+
        /**
         * Class implementing IndexAction will automatically do an 
addActionListener if necessary
         */
@@ -191,7 +192,7 @@
                                                                                
 " publicKey, privateKey, author, "+
                                                                                
 " positionInTree, revision, "+
                                                                                
 " newRev, parent) "+
-                                                                               
 "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)");
+                                                                               
 "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");

                                        /* TODO : Author */

@@ -214,7 +215,7 @@
                                        if (getTarget().getId() >= 0)
                                                st.setInt(10, 
getTarget().getId());
                                        else
-                                               st.setNull(11, Types.INTEGER);
+                                               st.setNull(10, Types.INTEGER);

                                        st.execute();

@@ -318,7 +319,7 @@
                        publishPrivateKeyBox = new 
JCheckBox(I18n.getMessage("thaw.plugin.index.publishPrivateKey"),
                                                             
defaultPublishPrivateKey);
                        
publishPrivateKeyBox.setEnabled(enablePublishPrivateKeyChoice);
-                       final JPanel subPanelA = new JPanel(); /* left => 
labels */
+                       final JPanel subPanelA = new JPanel(); /* left  => 
labels */
                        final JPanel subPanelB = new JPanel(); /* right => 
textfield */

                        subPanelA.setLayout(new GridLayout(askPrivateKey ? 2 : 
1, 1));

Modified: trunk/apps/Thaw/src/thaw/plugins/peerMonitor/PeerHelper.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/peerMonitor/PeerHelper.java        
2007-04-02 00:53:44 UTC (rev 12521)
+++ trunk/apps/Thaw/src/thaw/plugins/peerMonitor/PeerHelper.java        
2007-04-02 11:33:12 UTC (rev 12522)
@@ -1,9 +1,120 @@
 package thaw.plugins.peerMonitor;

+import javax.swing.JDialog;
+import javax.swing.JPanel;

+import javax.swing.JLabel;
+import java.awt.BorderLayout;
+import java.awt.GridLayout;
+import javax.swing.JTextArea;
+import javax.swing.JButton;
+
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractButton;
+
+
+import thaw.fcp.*; /* I'm lazy */
+import thaw.core.MainWindow;
+import thaw.core.I18n;
+
 public class PeerHelper {

+       public interface PeerAction extends ActionListener {
+               public void setTarget(Peer peer);
+       }


+       public static class PeerAdder implements PeerAction {
+               private FCPQueueManager queueManager;
+               private AbstractButton src;
+               private MainWindow mainWindow;
+
+               private JDialog dialog;
+               private JButton okButton;
+               private JButton cancelButton;
+               private JTextArea refArea;
+
+               public PeerAdder(FCPQueueManager queueManager, MainWindow 
mainWindow, AbstractButton actionSource) {
+                       this.queueManager = queueManager;
+                       this.src = actionSource;
+                       this.mainWindow = mainWindow;
+
+                       if (actionSource != null)
+                               actionSource.addActionListener(this);
+               }
+
+               public void setTarget(Peer peer) {
+                       /* we ignore */
+               }
+
+               public void actionPerformed(ActionEvent e) {
+                       if (e.getSource() == src) {
+                               dialog = new JDialog(mainWindow.getMainFrame(),
+                                                    
I18n.getMessage("thaw.plugin.peerMonitor.addPeer"));
+
+                               dialog.setLayout(new BorderLayout());
+
+                               JPanel buttonPanel = new JPanel(new 
GridLayout(1, 2));
+
+                               okButton = new 
JButton(I18n.getMessage("thaw.common.ok"));
+                               okButton.addActionListener(this);
+                               buttonPanel.add(okButton);
+
+                               cancelButton = new 
JButton(I18n.getMessage("thaw.common.cancel"));
+                               cancelButton.addActionListener(this);
+                               buttonPanel.add(cancelButton);
+
+                               refArea = new JTextArea("");
+
+                               JLabel label = new 
JLabel(I18n.getMessage("thaw.plugin.peerMonitor.enterRef"));
+
+                               dialog.getContentPane().add(label, 
BorderLayout.NORTH);
+                               dialog.getContentPane().add(refArea, 
BorderLayout.CENTER);
+                               dialog.getContentPane().add(buttonPanel, 
BorderLayout.SOUTH);
+
+                               dialog.setSize(700, 300);
+                               dialog.setVisible(true);
+
+                               return;
+                       }
+
+
+                       if (e.getSource() == okButton) {
+                               /* TODO */
+                               dialog.setVisible(false);
+                       }
+
+                       if (e.getSource() == cancelButton) {
+                               dialog.setVisible(false);
+                       }
+               }
+       }
+
+
+       public static class PeerRemover implements PeerAction {
+               private FCPQueueManager queueManager;
+               private AbstractButton src;
+
+               public PeerRemover(FCPQueueManager queueManager, AbstractButton 
actionSource) {
+                       this.queueManager = queueManager;
+                       this.src = actionSource;
+
+                       if (actionSource != null)
+                               actionSource.addActionListener(this);
+               }
+
+               public void setTarget(Peer peer) {
+                       if (src != null) {
+                               src.setEnabled(peer != null);
+                       }
+               }
+
+               public void actionPerformed(ActionEvent e) {
+                       /* TODO */
+               }
+       }
+
 }


Modified: trunk/apps/Thaw/src/thaw/plugins/peerMonitor/PeerMonitorPanel.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/peerMonitor/PeerMonitorPanel.java  
2007-04-02 00:53:44 UTC (rev 12521)
+++ trunk/apps/Thaw/src/thaw/plugins/peerMonitor/PeerMonitorPanel.java  
2007-04-02 11:33:12 UTC (rev 12522)
@@ -10,8 +10,14 @@
 import javax.swing.ListCellRenderer;
 import javax.swing.BorderFactory;

+import javax.swing.JMenu;
+import javax.swing.JPopupMenu;
+import javax.swing.JMenuItem;
+
 import javax.swing.event.ListSelectionListener;
 import javax.swing.event.ListSelectionEvent;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;

 import java.awt.event.ActionListener;
 import java.awt.event.ActionEvent;
@@ -33,13 +39,15 @@
 import thaw.core.I18n;
 import thaw.core.Logger;

+import thaw.fcp.FCPQueueManager;
+
 import thaw.gui.IconBox;

 /**
  * In fact, here is two panels : A panel with the peer list
  * and a panel with various details (ref, etc)
  */
-public class PeerMonitorPanel extends Observable implements ActionListener, 
ListSelectionListener
+public class PeerMonitorPanel extends Observable implements ActionListener, 
MouseListener
 {
        public final static String[] STR_STATUS = {
                "CONNECTED",
@@ -87,10 +95,15 @@
        private JLabel detailsLabel;
        private JPanel detailsPanel;

+
+       private JPopupMenu rightClickMenu;
+       private Vector rightClickActions;
+
+
        private boolean advanced;


-       public PeerMonitorPanel(Config config) {
+       public PeerMonitorPanel(FCPQueueManager queueManager, Config config, 
thaw.core.MainWindow mainWindow) {

                advanced = 
Boolean.valueOf(config.getValue("advancedMode")).booleanValue();

@@ -101,7 +114,7 @@
                peerList = new JList();

                peerList.setCellRenderer(new PeerCellRenderer());
-               peerList.addListSelectionListener(this);
+               //peerList.addListSelectionListener(this);

                Vector v = new Vector();

@@ -174,6 +187,25 @@
                mainPanel.add(refPanel);

                tabPanel.add(mainPanel, BorderLayout.CENTER);
+
+
+               rightClickMenu = new JPopupMenu();
+               rightClickActions = new Vector();
+
+               JMenuItem item;
+
+               item = new 
JMenuItem(I18n.getMessage("thaw.plugin.peerMonitor.addPeer"),
+                                                    IconBox.minAdd);
+               rightClickActions.add(new PeerHelper.PeerAdder(queueManager, 
mainWindow, item));
+               rightClickMenu.add(item);
+
+
+               item = new 
JMenuItem(I18n.getMessage("thaw.plugin.peerMonitor.removePeer"),
+                                                    IconBox.minDelete);
+               rightClickActions.add(new PeerHelper.PeerRemover(queueManager, 
item));
+               rightClickMenu.add(item);
+
+               peerList.addMouseListener(this);
        }


@@ -217,9 +249,9 @@

        public void setNmbThreads(int nmbNodeThreads) {
                
nodeThreads.setText(I18n.getMessage("thaw.plugin.peerMonitor.infos.nodeThreads")
-                                   + ": "+ Integer.toString(nmbNodeThreads));
+                                   + " : "+ Integer.toString(nmbNodeThreads));
                
thawThreads.setText(I18n.getMessage("thaw.plugin.peerMonitor.infos.thawThreads")
-                                   + ": "+ 
Integer.toString(Thread.activeCount()));
+                                   + " : "+ 
Integer.toString(Thread.activeCount()));
        }


@@ -277,7 +309,7 @@
        private Hashtable nodeInfos = null;

        /**
-        * \param peers : Vectors containing Hashmap containing the parameter 
list
+        * \param peers : Hashtable containing Hashtable containing the 
parameter list
         */
        public synchronized void setPeerList(Hashtable pL)
        {
@@ -406,6 +438,13 @@
                        };
                }

+               if (result == null && 
"volatile.runningThreadCount".equals(key)) {
+                       result = new String[] {
+                               
I18n.getMessage("thaw.plugin.peerMonitor.infos.node.runningThreads"),
+                               value
+                       };
+               }
+
                if (result == null && "myName".equals(key)) {
                        result = new String[] {
                                
I18n.getMessage("thaw.plugin.peerMonitor.infos.node.myName"),
@@ -413,12 +452,14 @@
                        };
                }

-               if (advanced) {
-                       if (result == null)
-                               result = new String[] { key, value };
-                       else
-                               result[0] = result[0] + " ("+key+")";
-               }
+               /*
+                 if (advanced) {
+                   if (result == null)
+                     result = new String[] { key, value };
+                   else
+                     result[0] = result[0] + " ("+key+")";
+                 }
+               */

                return result;
        }
@@ -469,8 +510,9 @@
        }


-       public void valueChanged(ListSelectionEvent e) {
-               if (e.getFirstIndex() == 0 && advanced) {
+       private void clicked() {
+               if (peerList.getSelectedValue() == null
+                   || !(peerList.getSelectedValue() instanceof Peer)) {
                        
displayInfos(I18n.getMessage("thaw.plugin.peerMonitor.nodeInfos"), nodeInfos);
                } else {
                        Peer peer;
@@ -487,4 +529,38 @@
                setChanged();
                notifyObservers();
        }
+
+
+       public void updateMenuState(Peer target) {
+               for (Iterator it = rightClickActions.iterator();
+                    it.hasNext();) {
+                       PeerHelper.PeerAction a = 
((PeerHelper.PeerAction)it.next());
+                       a.setTarget(target);
+               }
+       }
+
+
+       public void mouseClicked(final MouseEvent e) {
+               clicked();
+       }
+
+       public void mouseEntered(final MouseEvent e) { }
+       public void mouseExited(final MouseEvent e) { }
+
+       public void mousePressed(final MouseEvent e) {
+               showPopupMenu(e);
+       }
+
+       public void mouseReleased(final MouseEvent e) {
+               showPopupMenu(e);
+       }
+
+       protected void showPopupMenu(final MouseEvent e) {
+               if(e.isPopupTrigger()) {
+                       updateMenuState(((Peer)peerList.getSelectedValue()));
+                       rightClickMenu.show(e.getComponent(), e.getX(), 
e.getY());
+               }
+       }
+
+
 }

Modified: trunk/apps/Thaw/src/thaw/plugins/queueWatcher/DetailPanel.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/queueWatcher/DetailPanel.java      
2007-04-02 00:53:44 UTC (rev 12521)
+++ trunk/apps/Thaw/src/thaw/plugins/queueWatcher/DetailPanel.java      
2007-04-02 11:33:12 UTC (rev 12522)
@@ -24,21 +24,21 @@
        private JPanel subPanel;
        private JPanel panel;

-       private final JTextField file       = new JTextField();
-       private final JTextField size       = new JTextField();
-       private final JProgressBar progress = new JProgressBar(0, 100);
+       private final JTextField file                  = new JTextField();
+       private final JTextField size                  = new JTextField();
+       private final JProgressBar progress            = new JProgressBar(0, 
100);
        private final JProgressBar withTheNodeProgress = new JProgressBar(0, 
100);
-       private final JTextField status     = new JTextField();
-       private final JTextField key        = new JTextField();
-       private final JTextField path       = new JTextField();
-       private final JTextField priority   = new JTextField();
-       private final JTextField identifier = new JTextField();
-       private final JTextField globalQueue= new JTextField();
+       private final JTextField status                = new JTextField();
+       private final JTextField key                   = new JTextField();
+       private final JTextField path                  = new JTextField();
+       private final JTextField priority              = new JTextField();
+       private final JTextField identifier            = new JTextField();
+       private final JTextField globalQueue           = new JTextField();

        private FCPTransferQuery query = null;


-       private final static Dimension dim = new Dimension(300, 400);
+       private final static Dimension dim = new 
Dimension(thaw.plugins.QueueWatcher.DIVIDER_LOCATION-10, 400);


        public DetailPanel() {
@@ -46,15 +46,15 @@
                subPanel = new JPanel();

                final String[] fieldNames = { 
I18n.getMessage("thaw.common.file"),
-                                       I18n.getMessage("thaw.common.size"),
-                                       I18n.getMessage("thaw.common.progress"),
-                                       
I18n.getMessage("thaw.common.withTheNodeProgress"),
-                                       I18n.getMessage("thaw.common.status"),
-                                       I18n.getMessage("thaw.common.key"),
-                                       
I18n.getMessage("thaw.common.localPath"),
-                                       I18n.getMessage("thaw.common.priority"),
-                                       
I18n.getMessage("thaw.common.identifier"),
-                                       
I18n.getMessage("thaw.common.globalQueue")
+                                             
I18n.getMessage("thaw.common.size"),
+                                             
I18n.getMessage("thaw.common.progress"),
+                                             
I18n.getMessage("thaw.common.withTheNodeProgress"),
+                                             
I18n.getMessage("thaw.common.status"),
+                                             
I18n.getMessage("thaw.common.key"),
+                                             
I18n.getMessage("thaw.common.localPath"),
+                                             
I18n.getMessage("thaw.common.priority"),
+                                             
I18n.getMessage("thaw.common.identifier"),
+                                             
I18n.getMessage("thaw.common.globalQueue")
                };

                subPanel.setLayout(new GridLayout(fieldNames.length*2, 1));


Reply via email to