SDK: remove duplicate code in AbstractSceneExplorer's constructor

One constructor with the shared logic, other constructor are just sugar
experimental
David Bernard 11 years ago
parent 846960c28c
commit f26b53fcb7
  1. 22
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/AbstractSceneExplorerNode.java
  2. 1
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeBone.java
  3. 1
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeSpatial.java

@ -65,34 +65,22 @@ public abstract class AbstractSceneExplorerNode extends AbstractNode implements
private final List<Property<?>> sceneProperties = Collections.synchronizedList(new LinkedList<Property<?>>());
public AbstractSceneExplorerNode() {
super(Children.LEAF, new DynamicLookup(new InstanceContent()));
lookupContents = ((DynamicLookup) getLookup()).getInstanceContent();
this(Children.LEAF, null);
}
public AbstractSceneExplorerNode(Children children, DataObject dataObject) {
super(children, new ProxyLookup(dataObject.getLookup(), new DynamicLookup(new InstanceContent())));
super(children, new ProxyLookup(dataObject != null ? dataObject.getLookup() : Lookup.EMPTY, new DynamicLookup(new InstanceContent())));
this.dataObject = dataObject;
this.jmeChildren = children;
lookupContents = getLookup().lookup(DynamicLookup.class).getInstanceContent();
}
public AbstractSceneExplorerNode(DataObject dataObject) {
super(Children.LEAF, new ProxyLookup(dataObject != null ? dataObject.getLookup() : Lookup.EMPTY, new DynamicLookup(new InstanceContent())));
this.dataObject = dataObject;
lookupContents = getLookup().lookup(DynamicLookup.class).getInstanceContent();
this(Children.LEAF, dataObject);
}
public AbstractSceneExplorerNode(Children children) {
//TODO: OMG!
super(children, children instanceof JmeSpatialChildren
? (((JmeSpatialChildren) children).getDataObject() != null
? new ProxyLookup(((JmeSpatialChildren) children).getDataObject().getLookup(), new DynamicLookup(new InstanceContent()))
: new DynamicLookup(new InstanceContent()))
: new DynamicLookup(new InstanceContent()));
this.jmeChildren = children;
lookupContents = getLookup().lookup(DynamicLookup.class).getInstanceContent();
if (children instanceof JmeSpatialChildren) {
this.dataObject = ((JmeSpatialChildren) children).getDataObject();
}
this(children, (children instanceof JmeSpatialChildren) ? ((JmeSpatialChildren) children).getDataObject() : null);
}
public InstanceContent getLookupContents() {

@ -63,7 +63,6 @@ public class JmeBone extends AbstractSceneExplorerNode {
public JmeBone(JmeSkeletonControl jmeSkeletonControl, Bone bone, JmeBoneChildren children) {
super(children);
this.jmeChildren = children;
this.jmeSkeletonControl = jmeSkeletonControl;
getLookupContents().add(bone);
getLookupContents().add(this);

@ -83,7 +83,6 @@ public class JmeSpatial extends AbstractSceneExplorerNode {
public JmeSpatial(Spatial spatial, JmeSpatialChildren factory) {
super(factory);
this.jmeChildren = factory;
this.spatial = spatial;
getLookupContents().add(spatial);
getLookupContents().add(this);

Loading…
Cancel
Save