Revision: 3356
Author: [email protected]
Date: Thu Mar  4 14:42:47 2010
Log: NEW - bug 2721: Can't expand any database nodes in Copy Table Data dialogue
http://trillian.sqlpower.ca/bugzilla/show_bug.cgi?id=2721

The DBTreeModel is populating columns when accessing children instead of the DBTree doing it for the model. To prevent the DBTreeModel from going into an infinite loop between populating a SQLTable and updating itself from having children added the populate columns and indices on the SQLTable will exit early if it has already
been entered earlier on the same thread.
http://code.google.com/p/power-architect/source/detail?r=3356

Modified:
 /trunk/src/ca/sqlpower/architect/swingui/DBTree.java
 /trunk/src/ca/sqlpower/architect/swingui/dbtree/DBTreeModel.java

=======================================
--- /trunk/src/ca/sqlpower/architect/swingui/DBTree.java Fri Jan 15 15:02:04 2010 +++ /trunk/src/ca/sqlpower/architect/swingui/DBTree.java Thu Mar 4 14:42:47 2010
@@ -279,9 +279,6 @@
        public void expandPath(TreePath tp) {
                try {
                        session.getArchitectFrame().setCursor(new 
Cursor(Cursor.WAIT_CURSOR));
-                       if (tp.getLastPathComponent() instanceof SQLObject) {
-                           ((SQLObject) tp.getLastPathComponent()).populate();
-                       }
                        super.expandPath(tp);
                } catch (Exception ex) {
logger.warn("Unexpected exception while expanding path "+tp, ex); //$NON-NLS-1$
@@ -289,18 +286,6 @@
                        session.getArchitectFrame().setCursor(null);
                }
        }
-
-       @Override
-       public void expandRow(int row) {
-           if (getPathForRow(row).getLastPathComponent() instanceof SQLObject) 
{
-               try {
- ((SQLObject) getPathForRow(row).getLastPathComponent()).populate();
-            } catch (SQLObjectException e) {
-                throw new RuntimeException(e);
-            }
-           }
-           super.expandRow(row);
-       }

        // ---------- methods of DragSourceListener -----------
        public void dragEnter(DragSourceDragEvent dsde) {
=======================================
--- /trunk/src/ca/sqlpower/architect/swingui/dbtree/DBTreeModel.java Wed Feb 17 08:55:16 2010 +++ /trunk/src/ca/sqlpower/architect/swingui/dbtree/DBTreeModel.java Thu Mar 4 14:42:47 2010
@@ -55,7 +55,6 @@

 /**
* A tree model that displays {...@link SQLObject}s contained in a {...@link SQLObjectRoot}. - * Each object is displayed as is and will not cause the {...@link SQLObject}s to populate.
  */
 public class DBTreeModel implements TreeModel, java.io.Serializable {

@@ -91,7 +90,7 @@
         }

            public List<? extends SQLObject> getChildren() {
- return parentTable.getChildrenWithoutPopulating(containingChildType);
+               return parentTable.getChildren(containingChildType);
            }

            public Class<? extends SPObject> getContainingChildType() {
@@ -384,7 +383,7 @@
                SQLObject sqlParent = (SQLObject) parent;
                try {
if (logger.isDebugEnabled()) logger.debug("returning "+sqlParent.getChildrenWithoutPopulating().size()); //$NON-NLS-1$
-                       return sqlParent.getChildrenWithoutPopulating().size();
+                       return sqlParent.getChildren().size();
                } catch (Exception e) {
                    throw new RuntimeException(e);
                }

Reply via email to