Revision: 14692
          http://gate.svn.sourceforge.net/gate/?rev=14692&view=rev
Author:   markagreenwood
Date:     2011-12-07 19:13:25 +0000 (Wed, 07 Dec 2011)
Log Message:
-----------
make sure we don't get into horrible loops trying to call update when we are 
already updating

Modified Paths:
--------------
    gate/trunk/src/gate/gui/creole/manager/AvailablePlugins.java

Modified: gate/trunk/src/gate/gui/creole/manager/AvailablePlugins.java
===================================================================
--- gate/trunk/src/gate/gui/creole/manager/AvailablePlugins.java        
2011-12-07 19:11:08 UTC (rev 14691)
+++ gate/trunk/src/gate/gui/creole/manager/AvailablePlugins.java        
2011-12-07 19:13:25 UTC (rev 14692)
@@ -805,14 +805,18 @@
     };
 
     private int column;
+    
+    private boolean updating = false;
 
     public void update() {
       
-      //TODO return if we are already in the process of updating
+      if (updating) return;
       
+      updating = true;
+            
       TableColumn col = 
table.getColumnModel().getColumn(table.convertColumnIndexToView((column)));
 
-      int selected = 0, deselected = 0;
+      int selected = 0;
       TableModel m = table.getModel();
       for(int i = 0; i < m.getRowCount(); i++) {
         if(Boolean.TRUE.equals(m.getValueAt(i, column))) {
@@ -829,6 +833,8 @@
       }
 
       table.getTableHeader().repaint();
+      
+      updating = false;
 
     }
 
@@ -836,10 +842,10 @@
       super();
       this.column = column;
       this.table = table;
-      
-      //force the text to be to the right of the icon
+
+      // force the text to be to the right of the icon
       this.setHorizontalTextPosition(TRAILING);
-      
+
       setOpaque(true);
 
       table.getTableHeader().addMouseListener(new MouseAdapter() {
@@ -848,25 +854,25 @@
 
           JTableHeader header = (JTableHeader)e.getSource();
 
-            TableColumnModel columnModel = table.getColumnModel();
-            int vci = columnModel.getColumnIndexAtX(e.getX());
-            int mci = table.convertColumnIndexToModel(vci);
-            if(mci == column) {
-              if(e.getX() <= header.getHeaderRect(vci).x + 
icon.getIconWidth()) {
+          TableColumnModel columnModel = table.getColumnModel();
+          int vci = columnModel.getColumnIndexAtX(e.getX());
+          int mci = table.convertColumnIndexToModel(vci);
+          if(mci == column) {
+            if(e.getX() <= header.getHeaderRect(vci).x + icon.getIconWidth()) {
               TableColumn column = columnModel.getColumn(vci);
               Object v = column.getHeaderValue();
               boolean b = Status.DESELECTED.equals(v) ? true : false;
-              if (!b) {
-              TableModel m = table.getModel();
-              for(int i = 0; i < m.getRowCount(); i++)
-                m.setValueAt(b, i, mci);
-              column.setHeaderValue(b ? Status.SELECTED : Status.DESELECTED);
+              if(!b) {
+                TableModel m = table.getModel();
+                for(int i = 0; i < m.getRowCount(); i++)
+                  m.setValueAt(b, i, mci);
+                column.setHeaderValue(b ? Status.SELECTED : Status.DESELECTED);
               }
               header.repaint();
-              }
             }
           }
-        });
+        }
+      });
 
       table.getModel().addTableModelListener(new TableModelListener() {
         @Override

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Cloud Services Checklist: Pricing and Packaging Optimization
This white paper is intended to serve as a reference, checklist and point of 
discussion for anyone considering optimizing the pricing and packaging model 
of a cloud services business. Read Now!
http://www.accelacomm.com/jaw/sfnl/114/51491232/
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs

Reply via email to