[MOBY-guts] biomoby commit

Dmitry Repchevski drepchevski at dev.open-bio.org
Tue Aug 31 16:15:45 UTC 2010


drepchevski
Tue Aug 31 12:15:45 EDT 2010
Update of /home/repository/moby/moby-live/Java/src/main/org/inb/biomoby/generator/gui
In directory dev.open-bio.org:/tmp/cvs-serv28356/biomoby/generator/gui

Modified Files:
	AbstractServiceModelPanel.java DatatypesGeneratorPanel.java 
Log Message:

moby-live/Java/src/main/org/inb/biomoby/generator/gui AbstractServiceModelPanel.java,1.1,1.2 DatatypesGeneratorPanel.java,1.1,1.2
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/inb/biomoby/generator/gui/AbstractServiceModelPanel.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/Java/src/main/org/inb/biomoby/generator/gui/AbstractServiceModelPanel.java	2009/12/17 14:06:03	1.1
+++ /home/repository/moby/moby-live/Java/src/main/org/inb/biomoby/generator/gui/AbstractServiceModelPanel.java	2010/08/31 16:15:44	1.2
@@ -19,6 +19,7 @@
 import javax.swing.ImageIcon;
 import javax.swing.JFileChooser;
 import javax.swing.SwingWorker;
+import javax.swing.event.TreeModelEvent;
 import javax.swing.event.TreeSelectionEvent;
 import javax.swing.event.TreeSelectionListener;
 import javax.swing.tree.TreePath;
@@ -26,7 +27,6 @@
 import org.inb.biomoby.central.model.MobyCentralModel;
 import org.inb.biomoby.central.model.ServicesModel;
 import org.inb.biomoby.central.gui.AbstractMobyServicesTreePanel;
-import org.inb.biomoby.central.gui.renderer.EntityTreeCellRenderer;
 import org.inb.biomoby.shared.registry.Service;
 import org.inb.swing.ImageLoader;
 import org.inb.swing.LabelButton;
@@ -45,7 +45,6 @@
 
     public AbstractServiceModelPanel()
     {
-        tree.setCellRenderer(new EntityTreeCellRenderer());
         tree.addTreeSelectionListener(this);
 
         reloadButton = new LabelButton(new ImageIcon(ImageLoader.read("images/reload.png")));
@@ -120,6 +119,42 @@
     }
 
     @Override
+    public void treeNodesInserted(TreeModelEvent e)
+    {
+        super.treeNodesInserted(e);
+
+        if (!reloadButton.isEnabled())
+        {
+           reloadButton.setEnabled(true);
+        }
+    }
+
+    @Override
+    public void treeNodesRemoved(TreeModelEvent e)
+    {
+        super.treeStructureChanged(e);
+
+        if (reloadButton != null &&
+            generateButton != null &&
+            tree.getRowCount() < 1)
+        {
+            reloadButton.setEnabled(false);
+            generateButton.setEnabled(false);
+        }
+    }
+
+    @Override
+    public void treeStructureChanged(TreeModelEvent e)
+    {
+        super.treeStructureChanged(e);
+
+        if (reloadButton != null && reloadButton.isEnabled() != (tree.getRowCount() > 0))
+        {
+            reloadButton.setEnabled(!reloadButton.isEnabled());
+        }
+    }
+
+    @Override
     public void propertyChange(PropertyChangeEvent evt)
     {
         Object value = evt.getNewValue();

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/inb/biomoby/generator/gui/DatatypesGeneratorPanel.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/Java/src/main/org/inb/biomoby/generator/gui/DatatypesGeneratorPanel.java	2009/12/17 14:06:03	1.1
+++ /home/repository/moby/moby-live/Java/src/main/org/inb/biomoby/generator/gui/DatatypesGeneratorPanel.java	2010/08/31 16:15:44	1.2
@@ -19,6 +19,7 @@
 import javax.swing.ImageIcon;
 import javax.swing.JFileChooser;
 import javax.swing.SwingWorker;
+import javax.swing.event.TreeModelEvent;
 import javax.swing.filechooser.FileNameExtensionFilter;
 import org.inb.biomoby.central.model.DatatypesModel;
 import org.inb.biomoby.central.gui.AbstractMobyDatatypesTreePanel;
@@ -124,6 +125,45 @@
     }
 
     @Override
+    public void treeNodesInserted(TreeModelEvent e)
+    {
+        super.treeNodesInserted(e);
+
+        if (!reloadButton.isEnabled())
+        {
+           reloadButton.setEnabled(true);
+        }
+
+        if (!generateButton.isEnabled())
+        {
+           generateButton.setEnabled(true);
+        }
+    }
+
+    @Override
+    public void treeNodesRemoved(TreeModelEvent e)
+    {
+        super.treeStructureChanged(e);
+
+        if (tree.getRowCount() < 1)
+        {
+            reloadButton.setEnabled(false);
+            generateButton.setEnabled(false);
+        }
+    }
+
+    @Override
+    public void treeStructureChanged(TreeModelEvent e)
+    {
+        super.treeStructureChanged(e);
+
+        if (reloadButton.isEnabled() != (tree.getRowCount() > 0))
+        {
+            reloadButton.setEnabled(!reloadButton.isEnabled());
+        }
+    }
+
+    @Override
     public void propertyChange(PropertyChangeEvent evt)
     {
         Object value = evt.getNewValue();




More information about the MOBY-guts mailing list