[MOBY-guts] biomoby commit

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


drepchevski
Tue Aug 31 11:22:46 EDT 2010
Update of /home/repository/moby/moby-live/Java/src/main/org/inb/biomoby/central/gui
In directory dev.open-bio.org:/tmp/cvs-serv27447/gui

Modified Files:
	AbstractEntityTreePanel.java 
Log Message:
minor visual fix in MobyGenerator
moby-live/Java/src/main/org/inb/biomoby/central/gui AbstractEntityTreePanel.java,1.2,1.3
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/inb/biomoby/central/gui/AbstractEntityTreePanel.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- /home/repository/moby/moby-live/Java/src/main/org/inb/biomoby/central/gui/AbstractEntityTreePanel.java	2010/05/27 12:17:58	1.2
+++ /home/repository/moby/moby-live/Java/src/main/org/inb/biomoby/central/gui/AbstractEntityTreePanel.java	2010/08/31 15:22:46	1.3
@@ -10,8 +10,6 @@
 
 package org.inb.biomoby.central.gui;
 
-import java.awt.Component;
-import java.awt.Container;
 import java.awt.Dimension;
 import java.awt.Point;
 import java.awt.image.BufferedImage;
@@ -22,10 +20,11 @@
 import javax.swing.ToolTipManager;
 import javax.swing.event.ChangeEvent;
 import javax.swing.event.ChangeListener;
+import javax.swing.event.TreeModelEvent;
+import javax.swing.event.TreeModelListener;
 import javax.swing.tree.DefaultMutableTreeNode;
 import javax.swing.tree.TreePath;
 import org.inb.biomoby.central.MobyCentral;
-import org.inb.biomoby.central.model.MobyCentralModel;
 import org.inb.biomoby.central.model.ModelListener;
 import org.inb.biomoby.central.gui.renderer.EntityTreeCellRenderer;
 import org.inb.swing.DecoratedJScrollPane;
@@ -38,7 +37,7 @@
  */
 
 public abstract class AbstractEntityTreePanel extends JLayeredPane
-        implements ChangeListener, ModelListener<MobyCentral>
+        implements TreeModelListener, ChangeListener, ModelListener<MobyCentral>
 {
     protected final JTree tree;
     protected final JPanel control;
@@ -64,7 +63,7 @@
         add(scroll, JLayeredPane.DEFAULT_LAYER);
         add(control, JLayeredPane.PALETTE_LAYER);
 
-        MobyCentralModel.instance().addListener(this);
+        tree.getModel().addTreeModelListener(this);
     }
 
     protected void setBackgroundImage(BufferedImage logo)
@@ -117,30 +116,26 @@
         control.setBounds(Math.max(3, width - bPaneSize.width - 3), Math.max(3, 3), bPaneSize.width, bPaneSize.height);
     }
 
-    private void setEnabled(Container parent, boolean isEnabled)
-    {
-        parent.setEnabled(isEnabled);
+    public void treeNodesChanged(TreeModelEvent e) {}
+    public void treeNodesRemoved(TreeModelEvent e) {}
 
-        for (Component child : parent.getComponents())
+    public void treeNodesInserted(TreeModelEvent e)
+    {
+        if (!tree.isExpanded(0))
         {
-            if (child instanceof Container)
-            {
-                setEnabled((Container)child,isEnabled);
-            }
-            else
-            {
-                child.setEnabled(isEnabled);
-            }
+            tree.expandRow(0);
         }
     }
 
-    @Override
-    public void modelCleared()
-    {   
-        MobyCentral central = MobyCentralModel.instance().getSelectedCentral();
-        setEnabled(this, central != null);
+    public void treeStructureChanged(TreeModelEvent e)
+    {
+        if (!tree.isExpanded(0))
+        {
+            tree.expandRow(0);
+        }
     }
 
+    @Override public void modelCleared() {}
     @Override public void modelObjectInserted(MobyCentral central) {}
     @Override public void modelObjectRemoved(MobyCentral central) {}
     @Override public void modelObjectChanged(MobyCentral central1, MobyCentral central2) {}




More information about the MOBY-guts mailing list