Revision: 3744
Author: [email protected]
Date: Fri Jul 16 07:18:35 2010
Log: Since AbstractSPObject implements allowsChildren() and isAlllowedChildType(Class<? extends SPObject>), there is no need for extending classes to implement these methods unless it is case specific.
http://code.google.com/p/power-architect/source/detail?r=3744

Modified:
 /trunk/src/main/java/ca/sqlpower/architect/ArchitectProject.java
 /trunk/src/main/java/ca/sqlpower/architect/ProjectSettings.java
 /trunk/src/main/java/ca/sqlpower/architect/ddl/DDLStatement.java
/trunk/src/main/java/ca/sqlpower/architect/ddl/critic/CriticAndSettings.java
 /trunk/src/main/java/ca/sqlpower/architect/ddl/critic/CriticGrouping.java
 /trunk/src/main/java/ca/sqlpower/architect/ddl/critic/CriticManager.java
/trunk/src/main/java/ca/sqlpower/architect/enterprise/BusinessDefinition.java
 /trunk/src/main/java/ca/sqlpower/architect/enterprise/DomainCategory.java
 /trunk/src/main/java/ca/sqlpower/architect/etl/kettle/KettleSettings.java
 /trunk/src/main/java/ca/sqlpower/architect/olap/OLAPRootObject.java
 /trunk/src/main/java/ca/sqlpower/architect/olap/OLAPSession.java
 /trunk/src/main/java/ca/sqlpower/architect/profile/ColumnProfileResult.java
 /trunk/src/main/java/ca/sqlpower/architect/profile/ColumnValueCount.java
 /trunk/src/main/java/ca/sqlpower/architect/profile/ProfileManagerImpl.java
 /trunk/src/main/java/ca/sqlpower/architect/profile/ProfileSettings.java
 /trunk/src/main/java/ca/sqlpower/architect/profile/TableProfileResult.java
/trunk/src/main/java/ca/sqlpower/architect/swingui/ArchitectSwingProject.java
 /trunk/src/main/java/ca/sqlpower/architect/swingui/PlayPenComponent.java
 /trunk/src/main/java/ca/sqlpower/architect/swingui/PlayPenContentPane.java
 /trunk/src/main/java/ca/sqlpower/architect/swingui/Relationship.java
 /trunk/src/main/java/ca/sqlpower/architect/swingui/TablePane.java
 /trunk/src/main/java/ca/sqlpower/architect/swingui/olap/CubePane.java
 /trunk/src/main/java/ca/sqlpower/architect/swingui/olap/DimensionPane.java
 /trunk/src/main/java/ca/sqlpower/architect/swingui/olap/UsageComponent.java
/trunk/src/main/java/ca/sqlpower/architect/swingui/olap/VirtualCubePane.java

=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/ArchitectProject.java Thu Jul 15 11:56:19 2010 +++ /trunk/src/main/java/ca/sqlpower/architect/ArchitectProject.java Fri Jul 16 07:18:35 2010
@@ -131,8 +131,8 @@
      */
     @Constructor
     public ArchitectProject(
- @ConstructorParameter(isProperty=ParameterType.CHILD, propertyName="rootObject") SQLObjectRoot rootObject, - @ConstructorParameter(isProperty=ParameterType.CHILD, propertyName="profileManager") ProfileManager profileManager) + @ConstructorParameter(parameterType=ParameterType.CHILD, propertyName="rootObject") SQLObjectRoot rootObject, + @ConstructorParameter(parameterType=ParameterType.CHILD, propertyName="profileManager") ProfileManager profileManager)
             throws SQLObjectException {
         this.rootObject = rootObject;
         rootObject.setParent(this);
@@ -297,22 +297,6 @@
     public RunnableDispatcher getRunnableDispatcher() {
         return getSession();
     }
-
-    public boolean allowsChildren() {
-        return true;
-    }
-
-    public int childPositionOffset(Class<? extends SPObject> childType) {
-        int offset = 0;
-        for (Class<? extends SPObject> type : allowedChildTypes) {
-            if (type.isAssignableFrom(childType)) {
-                return offset;
-            } else {
-                offset += getChildren(type).size();
-            }
-        }
-        throw new IllegalArgumentException();
-    }

     @Transient @Accessor
     public List<Class<? extends SPObject>> getAllowedChildTypes() {
=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/ProjectSettings.java Mon Apr 19 15:21:01 2010 +++ /trunk/src/main/java/ca/sqlpower/architect/ProjectSettings.java Fri Jul 16 07:18:35 2010
@@ -40,6 +40,11 @@

 public class ProjectSettings extends AbstractSPObject {

+    /**
+     * Defines an absolute ordering of the child types of this class.
+     *
+ * IMPORTANT!: When changing this, ensure you maintain the order specified by {...@link #getChildren()}
+     */
public static final List<Class<? extends SPObject>> allowedChildTypes = Collections.emptyList();

     private boolean savingEntireSource = false;
@@ -170,17 +175,9 @@
     protected boolean removeChildImpl(SPObject child) {
         return false;
     }
-
-    public boolean allowsChildren() {
-        return false;
-    }
-
-    public int childPositionOffset(Class<? extends SPObject> childType) {
- throw new IllegalArgumentException("This object does not contain children");
-    }

     public List<Class<? extends SPObject>> getAllowedChildTypes() {
-        return null;
+        return allowedChildTypes;
     }

     public List<? extends SPObject> getChildren() {
=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/ddl/DDLStatement.java Fri Feb 19 13:16:46 2010 +++ /trunk/src/main/java/ca/sqlpower/architect/ddl/DDLStatement.java Fri Jul 16 07:18:35 2010
@@ -35,6 +35,13 @@
  * text of that statement for a particular database.
  */
 public class DDLStatement extends AbstractSPObject {
+
+    /**
+     * Defines an absolute ordering of the child types of this class.
+     *
+ * IMPORTANT!: When changing this, ensure you maintain the order specified by {...@link #getChildren()}
+     */
+ public static final List<Class<? extends SPObject>> allowedChildTypes = Collections.emptyList();

        public static class StatementType {

@@ -208,17 +215,9 @@
     protected boolean removeChildImpl(SPObject child) {
         return false;
     }
-
-    public boolean allowsChildren() {
-        return false;
-    }
-
-    public int childPositionOffset(Class<? extends SPObject> childType) {
-        return 0;
-    }

     public List<Class<? extends SPObject>> getAllowedChildTypes() {
-        return Collections.emptyList();
+        return allowedChildTypes;
     }

     public List<? extends SPObject> getChildren() {
=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/ddl/critic/CriticAndSettings.java Wed Jul 14 08:59:53 2010 +++ /trunk/src/main/java/ca/sqlpower/architect/ddl/critic/CriticAndSettings.java Fri Jul 16 07:18:35 2010
@@ -49,6 +49,8 @@

     /**
      * Defines an absolute ordering of the child types of this class.
+     *
+ * IMPORTANT!: When changing this, ensure you maintain the order specified by {...@link #getChildren()}
      */
public static final List<Class<? extends SPObject>> allowedChildTypes = Collections.emptyList();

@@ -205,14 +207,6 @@
     protected boolean removeChildImpl(SPObject child) {
         return false;
     }
-
-    public boolean allowsChildren() {
-        return false;
-    }
-
-    public int childPositionOffset(Class<? extends SPObject> childType) {
-        return 0;
-    }

     public List<Class<? extends SPObject>> getAllowedChildTypes() {
         return allowedChildTypes;
=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/ddl/critic/CriticGrouping.java Thu Jul 8 14:01:17 2010 +++ /trunk/src/main/java/ca/sqlpower/architect/ddl/critic/CriticGrouping.java Fri Jul 16 07:18:35 2010
@@ -42,10 +42,11 @@

     /**
      * Defines an absolute ordering of the child types of this class.
+     *
+ * IMPORTANT!: When changing this, ensure you maintain the order specified by {...@link #getChildren()}
      */
     public static final List<Class<? extends SPObject>> allowedChildTypes =
- Collections.unmodifiableList(new ArrayList<Class<? extends SPObject>>(
-                Collections.singletonList(CriticAndSettings.class)));
+ Collections.<Class<? extends SPObject>>singletonList(CriticAndSettings.class);

     /**
* Contains all of the settings for each critic known to the group. Each
@@ -105,14 +106,6 @@
         }
         return removed;
     }
-
-    public boolean allowsChildren() {
-        return true;
-    }
-
-    public int childPositionOffset(Class<? extends SPObject> childType) {
-        return 0;
-    }

     @Transient @Accessor
     public List<Class<? extends SPObject>> getAllowedChildTypes() {
=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/ddl/critic/CriticManager.java Wed Jul 14 08:59:53 2010 +++ /trunk/src/main/java/ca/sqlpower/architect/ddl/critic/CriticManager.java Fri Jul 16 07:18:35 2010
@@ -71,10 +71,11 @@

     /**
      * Defines an absolute ordering of the child types of this class.
+     *
+ * IMPORTANT!: When changing this, ensure you maintain the order specified by {...@link #getChildren()}
      */
     public static final List<Class<? extends SPObject>> allowedChildTypes =
- Collections.unmodifiableList(new ArrayList<Class<? extends SPObject>>(
-                Collections.singletonList(CriticGrouping.class)));
+ Collections.<Class<? extends SPObject>>singletonList(CriticGrouping.class);

     /**
* These are the critics that the critic manager will start with when it is
@@ -256,14 +257,6 @@
         }
         return removed;
     }
-
-    public boolean allowsChildren() {
-        return true;
-    }
-
-    public int childPositionOffset(Class<? extends SPObject> childType) {
-        return 0;
-    }

     @Transient @Accessor
     public List<Class<? extends SPObject>> getAllowedChildTypes() {
=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/enterprise/BusinessDefinition.java Thu Jul 15 11:56:19 2010 +++ /trunk/src/main/java/ca/sqlpower/architect/enterprise/BusinessDefinition.java Fri Jul 16 07:18:35 2010
@@ -40,6 +40,11 @@
  */
 public class BusinessDefinition extends AbstractSPObject {

+    /**
+     * Defines an absolute ordering of the child types of this class.
+     *
+ * IMPORTANT!: When changing this, ensure you maintain the order specified by {...@link #getChildren()}
+     */
     public static final List<Class<? extends SPObject>> allowedChildTypes =
         Collections.emptyList();

@@ -83,14 +88,6 @@
     public List<? extends SPObject> getChildren() {
         return Collections.emptyList();
     }
-
-    public boolean allowsChildren() {
-        return false;
-    }
-
-    public int childPositionOffset(Class<? extends SPObject> childType) {
-        return 0;
-    }

     public void removeDependency(SPObject dependency) {
         // No operation.
=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/enterprise/DomainCategory.java Fri May 14 11:58:04 2010 +++ /trunk/src/main/java/ca/sqlpower/architect/enterprise/DomainCategory.java Fri Jul 16 07:18:35 2010
@@ -36,6 +36,11 @@
  */
 public class DomainCategory extends AbstractSPObject {

+    /**
+     * Defines an absolute ordering of the child types of this class.
+     *
+ * IMPORTANT!: When changing this, ensure you maintain the order specified by {...@link #getChildren()}
+     */
     public static final List<Class<? extends SPObject>> allowedChildTypes =
Collections.<Class<? extends SPObject>>singletonList(UserDefinedSQLType.class);

@@ -55,18 +60,6 @@
         setName(name);
     }

-    public boolean allowsChildren() {
-        return true;
-    }
-
-    public int childPositionOffset(Class<? extends SPObject> childType) {
-        if (childType == UserDefinedSQLType.class) {
-            return 0;
-        } else {
- throw new IllegalArgumentException("DomainCategory cannot have children of type " + childType);
-        }
-    }
-
     public List<Class<? extends SPObject>> getAllowedChildTypes() {
         return allowedChildTypes;
     }
=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/etl/kettle/KettleSettings.java Fri Apr 30 14:27:46 2010 +++ /trunk/src/main/java/ca/sqlpower/architect/etl/kettle/KettleSettings.java Fri Jul 16 07:18:35 2010
@@ -31,6 +31,11 @@

 public class KettleSettings extends AbstractSPObject {

+    /**
+     * Defines an absolute ordering of the child types of this class.
+     *
+ * IMPORTANT!: When changing this, ensure you maintain the order specified by {...@link #getChildren()}
+     */
public static final List <Class<? extends SPObject>> allowedChildTypes = Collections.emptyList();

     /**
@@ -145,14 +150,6 @@
     protected boolean removeChildImpl(SPObject child) {
         return false;
     }
-
-    public boolean allowsChildren() {
-        return false;
-    }
-
-    public int childPositionOffset(Class<? extends SPObject> childType) {
-        return 0;
-    }

     public List<Class<? extends SPObject>> getAllowedChildTypes() {
         return Collections.emptyList();
=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/olap/OLAPRootObject.java Mon Apr 19 14:18:19 2010 +++ /trunk/src/main/java/ca/sqlpower/architect/olap/OLAPRootObject.java Fri Jul 16 07:18:35 2010
@@ -20,7 +20,6 @@
 package ca.sqlpower.architect.olap;

 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;

@@ -37,11 +36,11 @@

     /**
      * Defines an absolute ordering of the child types of this class.
+     *
+ * IMPORTANT!: When changing this, ensure you maintain the order specified by {...@link #getChildren()}
      */
-    @SuppressWarnings("unchecked")
     public static final List<Class<? extends SPObject>> allowedChildTypes =
- Collections.unmodifiableList(new ArrayList<Class<? extends SPObject>>(
-                Arrays.asList(OLAPSession.class)));
+ Collections.<Class<? extends SPObject>>singletonList(OLAPSession.class);


private final List<OLAPSession> olapSessions = new ArrayList<OLAPSession>();
=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/olap/OLAPSession.java Mon Apr 19 14:18:19 2010 +++ /trunk/src/main/java/ca/sqlpower/architect/olap/OLAPSession.java Fri Jul 16 07:18:35 2010
@@ -19,8 +19,6 @@

 package ca.sqlpower.architect.olap;

-import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;

@@ -29,10 +27,10 @@
 import ca.sqlpower.object.annotation.Accessor;
 import ca.sqlpower.object.annotation.Constructor;
 import ca.sqlpower.object.annotation.ConstructorParameter;
+import ca.sqlpower.object.annotation.ConstructorParameter.ParameterType;
 import ca.sqlpower.object.annotation.Mutator;
 import ca.sqlpower.object.annotation.NonProperty;
 import ca.sqlpower.object.annotation.Transient;
-import ca.sqlpower.object.annotation.ConstructorParameter.ParameterType;
 import ca.sqlpower.sqlobject.SQLDatabase;

 /**
@@ -43,11 +41,11 @@

     /**
      * Defines an absolute ordering of the child types of this class.
+     *
+ * IMPORTANT!: When changing this, ensure you maintain the order specified by {...@link #getChildren()}
      */
-    @SuppressWarnings("unchecked")
     public static final List<Class<? extends SPObject>> allowedChildTypes =
- Collections.unmodifiableList(new ArrayList<Class<? extends SPObject>>(
-                Arrays.asList(Schema.class)));
+        Collections.<Class<? extends SPObject>>singletonList(Schema.class);

     /**
      * The database this session's schema uses.
@@ -74,7 +72,7 @@
      */
     @Constructor
     public OLAPSession(
- @ConstructorParameter(isProperty=ParameterType.CHILD, propertyName="schema") Schema schema) { + @ConstructorParameter(parameterType=ParameterType.CHILD, propertyName="schema") Schema schema) {
         setName("New Session");
         if (schema.getParent() != null) {
             throw new IllegalStateException(
=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/profile/ColumnProfileResult.java Mon Jun 28 11:21:31 2010 +++ /trunk/src/main/java/ca/sqlpower/architect/profile/ColumnProfileResult.java Fri Jul 16 07:18:35 2010
@@ -19,7 +19,6 @@
 package ca.sqlpower.architect.profile;

 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;

@@ -37,11 +36,11 @@

     /**
      * Defines an absolute ordering of the child types of this class.
+     *
+ * IMPORTANT!: When changing this, ensure you maintain the order specified by {...@link #getChildren()}
      */
-    @SuppressWarnings("unchecked")
     public static final List<Class<? extends SPObject>> allowedChildTypes =
- Collections.unmodifiableList(new ArrayList<Class<? extends SPObject>>(
-                Arrays.asList(ColumnValueCount.class)));
+ Collections.<Class<? extends SPObject>>singletonList(ColumnValueCount.class);

private static final Logger logger = Logger.getLogger(ColumnProfileResult.class);

@@ -265,18 +264,6 @@
         }
         return false;
     }
-
-    public boolean allowsChildren() {
-        return true;
-    }
-
-    public int childPositionOffset(Class<? extends SPObject> childType) {
-        if (childType.isAssignableFrom(ColumnValueCount.class)) {
-            return 0;
-        } else {
-            throw new IllegalArgumentException();
-        }
-    }

     public List<Class<? extends SPObject>> getAllowedChildTypes() {
         return allowedChildTypes;
=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/profile/ColumnValueCount.java Mon Jun 28 11:21:31 2010 +++ /trunk/src/main/java/ca/sqlpower/architect/profile/ColumnValueCount.java Fri Jul 16 07:18:35 2010
@@ -38,6 +38,8 @@

     /**
      * Defines an absolute ordering of the child types of this class.
+     *
+ * IMPORTANT!: When changing this, ensure you maintain the order specified by {...@link #getChildren()}
      */
public static final List<Class<? extends SPObject>> allowedChildTypes = Collections.emptyList();

@@ -167,14 +169,6 @@
     protected boolean removeChildImpl(SPObject child) {
         return false;
     }
-
-    public boolean allowsChildren() {
-        return false;
-    }
-
-    public int childPositionOffset(Class<? extends SPObject> childType) {
-        return 0;
-    }

     public List<Class<? extends SPObject>> getAllowedChildTypes() {
         return Collections.emptyList();
=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/profile/ProfileManagerImpl.java Wed Jun 30 13:40:21 2010 +++ /trunk/src/main/java/ca/sqlpower/architect/profile/ProfileManagerImpl.java Fri Jul 16 07:18:35 2010
@@ -71,6 +71,8 @@

     /**
      * Defines an absolute ordering of the child types of this class.
+     *
+ * IMPORTANT!: When changing this, ensure you maintain the order specified by {...@link #getChildren()}
      */
     @SuppressWarnings("unchecked")
     public static final List<Class<? extends SPObject>> allowedChildTypes =
=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/profile/ProfileSettings.java Mon Apr 19 14:18:19 2010 +++ /trunk/src/main/java/ca/sqlpower/architect/profile/ProfileSettings.java Fri Jul 16 07:18:35 2010
@@ -40,6 +40,8 @@

     /**
      * Defines an absolute ordering of the child types of this class.
+     *
+ * IMPORTANT!: When changing this, ensure you maintain the order specified by {...@link #getChildren()}
      */
public static final List<Class<? extends SPObject>> allowedChildTypes = Collections.emptyList();

@@ -196,18 +198,10 @@
     protected boolean removeChildImpl(SPObject child) {
         return false;
     }
-
-    public boolean allowsChildren() {
-        return false;
-    }
-
-    public int childPositionOffset(Class<? extends SPObject> childType) {
-        return 0;
-    }

     @Transient @Accessor
     public List<Class<? extends SPObject>> getAllowedChildTypes() {
-        return Collections.emptyList();
+        return allowedChildTypes;
     }

     @NonProperty
=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/profile/TableProfileResult.java Wed Jun 23 11:55:57 2010 +++ /trunk/src/main/java/ca/sqlpower/architect/profile/TableProfileResult.java Fri Jul 16 07:18:35 2010
@@ -20,7 +20,6 @@

 import java.text.DateFormat;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Date;
@@ -54,13 +53,12 @@

     /**
      * Defines an absolute ordering of the child types of this class.
+     *
+ * IMPORTANT!: When changing this, ensure you maintain the order specified by {...@link #getChildren()}
      */
-    @SuppressWarnings("unchecked")
     public static final List<Class<? extends SPObject>> allowedChildTypes =
- Collections.unmodifiableList(new ArrayList<Class<? extends SPObject>>(
-                Arrays.asList(ColumnProfileResult.class)));
-
-    @SuppressWarnings("unused")
+ Collections.<Class<? extends SPObject>>singletonList(ColumnProfileResult.class);
+
private static final Logger logger = Logger.getLogger(TableProfileResult.class);

     private int rowCount;
@@ -289,18 +287,6 @@
         }
         return false;
     }
-
-    public boolean allowsChildren() {
-        return true;
-    }
-
-    public int childPositionOffset(Class<? extends SPObject> childType) {
-        if (childType.isAssignableFrom(ColumnProfileResult.class)) {
-            return 0;
-        } else {
-            throw new IllegalArgumentException();
-        }
-    }

     @NonBound
     public List<Class<? extends SPObject>> getAllowedChildTypes() {
=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/swingui/ArchitectSwingProject.java Thu Jul 15 11:56:19 2010 +++ /trunk/src/main/java/ca/sqlpower/architect/swingui/ArchitectSwingProject.java Fri Jul 16 07:18:35 2010
@@ -191,11 +191,11 @@
      */
     @Constructor
     public ArchitectSwingProject(
- @ConstructorParameter(isProperty=ParameterType.CHILD, propertyName="rootObject") SQLObjectRoot rootObject, - @ConstructorParameter(isProperty=ParameterType.CHILD, propertyName="olapRootObject") OLAPRootObject olapRootObject, - @ConstructorParameter(isProperty=ParameterType.CHILD, propertyName="kettleSettings") KettleSettings kettleSettings, - @ConstructorParameter(isProperty=ParameterType.CHILD, propertyName="profileManager") ProfileManager profileManager, - @ConstructorParameter(isProperty=ParameterType.CHILD, propertyName="criticManager") CriticManager criticManager + @ConstructorParameter(parameterType=ParameterType.CHILD, propertyName="rootObject") SQLObjectRoot rootObject, + @ConstructorParameter(parameterType=ParameterType.CHILD, propertyName="olapRootObject") OLAPRootObject olapRootObject, + @ConstructorParameter(parameterType=ParameterType.CHILD, propertyName="kettleSettings") KettleSettings kettleSettings, + @ConstructorParameter(parameterType=ParameterType.CHILD, propertyName="profileManager") ProfileManager profileManager, + @ConstructorParameter(parameterType=ParameterType.CHILD, propertyName="criticManager") CriticManager criticManager
             ) throws SQLObjectException {
         super(rootObject, profileManager);
         this.olapRootObject = olapRootObject;
@@ -230,22 +230,6 @@
         return getSession();
     }

-    public boolean allowsChildren() {
-        return true;
-    }
-
-    public int childPositionOffset(Class<? extends SPObject> childType) {
-        int offset = 0;
-        for (Class<? extends SPObject> type : allowedChildTypes) {
-            if (type.isAssignableFrom(childType)) {
-                return offset;
-            } else {
-                offset += getChildren(type).size();
-            }
-        }
-        throw new IllegalArgumentException();
-    }
-
     @Transient @Accessor
     public List<Class<? extends SPObject>> getAllowedChildTypes() {
         return allowedChildTypes;
=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/swingui/PlayPenComponent.java Mon Jul 5 12:39:21 2010 +++ /trunk/src/main/java/ca/sqlpower/architect/swingui/PlayPenComponent.java Fri Jul 16 07:18:35 2010
@@ -62,6 +62,11 @@

private static final Logger logger = Logger.getLogger(PlayPenComponent.class);

+    /**
+     * Defines an absolute ordering of the child types of this class.
+     *
+ * IMPORTANT!: When changing this, ensure you maintain the order specified by {...@link #getChildren()}
+     */
public static final List<Class<? extends SPObject>> allowedChildTypes = Collections.emptyList();

     private Rectangle bounds = new Rectangle();
@@ -669,17 +674,9 @@
         }
     }

-    public boolean allowsChildren() {
-        return (allowedChildTypes.size() > 0);
-    }
-
     public List<Class<? extends SPObject>> getAllowedChildTypes() {
         return allowedChildTypes;
     }
-
-    public int childPositionOffset(Class<? extends SPObject> childType) {
- throw new IllegalArgumentException("This class does not allow children");
-    }

     @Override
     @Accessor
=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/swingui/PlayPenContentPane.java Mon Jul 5 12:48:58 2010 +++ /trunk/src/main/java/ca/sqlpower/architect/swingui/PlayPenContentPane.java Fri Jul 16 07:18:35 2010
@@ -52,9 +52,13 @@
 public class PlayPenContentPane extends AbstractSPObject {
private static final Logger logger = Logger.getLogger(PlayPenContentPane.class);

-    @SuppressWarnings("unchecked")
- public static final List<Class<? extends SPObject>> allowedChildTypes = Collections - .unmodifiableList(new ArrayList<Class<? extends SPObject>>(Arrays.asList(PlayPenComponent.class)));
+    /**
+     * Defines an absolute ordering of the child types of this class.
+     *
+ * IMPORTANT!: When changing this, ensure you maintain the order specified by {...@link #getChildren()}
+     */
+    public static final List<Class<? extends SPObject>> allowedChildTypes =
+ Collections.<Class<? extends SPObject>>singletonList(PlayPenComponent.class);

     /**
* A list of component types that are dependent on other components (see
@@ -309,18 +313,6 @@
         }
         return true;
     }
-
-    public int childPositionOffset(Class<? extends SPObject> childType) {
-        int offset = 0;
-        for (Class<? extends SPObject> type : allowedChildTypes) {
-            if (type.isAssignableFrom(childType)) {
-                return offset;
-            } else {
-                offset += getChildren(type).size();
-            }
-        }
-        throw new IllegalArgumentException();
-    }

     public List<Class<? extends SPObject>> getAllowedChildTypes() {
         return allowedChildTypes;
@@ -360,10 +352,6 @@
                     parent.getClass().getSimpleName());
         }
     }
-
-    public boolean allowsChildren() {
-        return true;
-    }

     @NonBound
     public List<? extends SPObject> getDependencies() {
=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/swingui/Relationship.java Wed May 26 14:48:19 2010 +++ /trunk/src/main/java/ca/sqlpower/architect/swingui/Relationship.java Fri Jul 16 07:18:35 2010
@@ -69,6 +69,11 @@
public class Relationship extends PlayPenComponent implements SPListener, LayoutEdge {
        private static final Logger logger = 
Logger.getLogger(Relationship.class);

+    /**
+     * Defines an absolute ordering of the child types of this class.
+     *
+ * IMPORTANT!: When changing this, ensure you maintain the order specified by {...@link #getChildren()}
+     */
public static final List<Class<? extends SPObject>> allowedChildTypes = PlayPenComponent.allowedChildTypes;

        public static final String PARENT_TO_CHILD = "receives";
=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/swingui/TablePane.java Mon Jul 12 08:21:11 2010 +++ /trunk/src/main/java/ca/sqlpower/architect/swingui/TablePane.java Fri Jul 16 07:18:35 2010
@@ -94,6 +94,11 @@

        private static final Logger logger = Logger.getLogger(TablePane.class);

+    /**
+     * Defines an absolute ordering of the child types of this class.
+     *
+ * IMPORTANT!: When changing this, ensure you maintain the order specified by {...@link #getChildren()}
+     */
public static final List<Class<? extends SPObject>> allowedChildTypes = PlayPenComponent.allowedChildTypes;

        /**
=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/swingui/olap/CubePane.java Thu Apr 8 07:59:33 2010 +++ /trunk/src/main/java/ca/sqlpower/architect/swingui/olap/CubePane.java Fri Jul 16 07:18:35 2010
@@ -47,9 +47,13 @@

 public class CubePane extends OLAPPane<Cube, OLAPObject> {

-    @SuppressWarnings("unused")
     private static final Logger logger = Logger.getLogger(CubePane.class);

+    /**
+     * Defines an absolute ordering of the child types of this class.
+     *
+ * IMPORTANT!: When changing this, ensure you maintain the order specified by {...@link #getChildren()}
+     */
public static final List<Class<? extends SPObject>> allowedChildTypes = PlayPenComponent.allowedChildTypes;

     public CubePane(Cube model) {
=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/swingui/olap/DimensionPane.java Thu Apr 8 07:59:33 2010 +++ /trunk/src/main/java/ca/sqlpower/architect/swingui/olap/DimensionPane.java Fri Jul 16 07:18:35 2010
@@ -53,6 +53,11 @@

private static final Logger logger = Logger.getLogger(DimensionPane.class);

+    /**
+     * Defines an absolute ordering of the child types of this class.
+     *
+ * IMPORTANT!: When changing this, ensure you maintain the order specified by {...@link #getChildren()}
+     */
public static final List<Class<? extends SPObject>> allowedChildTypes = PlayPenComponent.allowedChildTypes;

     private class HierarchyWatcher implements SPListener {
=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/swingui/olap/UsageComponent.java Fri Apr 9 11:56:35 2010 +++ /trunk/src/main/java/ca/sqlpower/architect/swingui/olap/UsageComponent.java Fri Jul 16 07:18:35 2010
@@ -54,6 +54,11 @@
  */
public class UsageComponent extends PlayPenComponent implements LayoutEdge {

+    /**
+     * Defines an absolute ordering of the child types of this class.
+     *
+ * IMPORTANT!: When changing this, ensure you maintain the order specified by {...@link #getChildren()}
+     */
public static final List<Class<? extends SPObject>> allowedChildTypes = PlayPenComponent.allowedChildTypes;

     private final OLAPObject model;
=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/swingui/olap/VirtualCubePane.java Thu Apr 8 07:59:33 2010 +++ /trunk/src/main/java/ca/sqlpower/architect/swingui/olap/VirtualCubePane.java Fri Jul 16 07:18:35 2010
@@ -45,6 +45,11 @@

 public class VirtualCubePane extends OLAPPane<VirtualCube, OLAPObject> {

+    /**
+     * Defines an absolute ordering of the child types of this class.
+     *
+ * IMPORTANT!: When changing this, ensure you maintain the order specified by {...@link #getChildren()}
+     */
public static final List<Class<? extends SPObject>> allowedChildTypes = PlayPenComponent.allowedChildTypes;

public VirtualCubePane(VirtualCubePane copyMe, PlayPenContentPane parent) {

Reply via email to