Browse Source

Added some more Javadocs and did some small fixes

MeFisto94 9 years ago
parent
commit
338df068f6

+ 1 - 3
jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeControl.java

@@ -51,8 +51,6 @@ import org.openide.util.actions.SystemAction;
  * The JmeControl implements the Base Behavior of each Control-Node
  * @author MeFisto94
  */
-
-
 public abstract class JmeControl extends AbstractSceneExplorerNode {
 
     protected Control control;
@@ -93,7 +91,7 @@ public abstract class JmeControl extends AbstractSceneExplorerNode {
     public void destroy() throws IOException {
         super.destroy();
         
-        if (control == null)
+        if (control == null || getParentNode() == null)
             return;
         
         final Spatial spat = getParentNode().getLookup().lookup(Spatial.class);

+ 0 - 1
jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeGenericControl.java

@@ -49,7 +49,6 @@ public class JmeGenericControl extends JmeControl {
     public JmeGenericControl(Control control, DataObject dataObject) {
         //TODO: lookup content! (control etc)
         super(dataObject);
-        this.control = control;
         addToLookup(this);
         addToLookup(control);
         this.control = control;

+ 7 - 0
jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeSpatialChildren.java

@@ -91,10 +91,17 @@ public class JmeSpatialChildren extends Children.Keys<Object> {
         setKeys(createKeys());
     }
 
+    /**
+     * CreateKey finds all the Elements in our SceneGraph and returns them as "Keys".
+     * Those Keys will then be processed by {@link #createNodes(java.lang.Object) } into SceneExplorer Nodes.
+     * That means the add-Actions just have to add elements to the SceneGraph for their AbstractSceneExplorerNode to be created
+     * @return The List of Keys
+     */
     protected List<Object> createKeys() {
         try {
             return SceneApplication.getApplication().enqueue(new Callable<List<Object>>() {
 
+                @Override
                 public List<Object> call() throws Exception {
                     List<Object> keys = new LinkedList<Object>();
                     if (spatial != null && spatial instanceof com.jme3.scene.Node) {

+ 11 - 1
jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/NewSpatialPopup.java

@@ -70,9 +70,11 @@ public class NewSpatialPopup extends AbstractAction implements Presenter.Popup {
         this.dataObject = node.getLookup().lookup(DataObject.class);
     }
 
+    @Override
     public void actionPerformed(ActionEvent e) {
     }
 
+    @Override
     public JMenuItem getPopupPresenter() {
         JMenu result = new JMenu("Add Spatial..");
         result.add(new JMenuItem(new AddNodeAction()));
@@ -110,7 +112,7 @@ public class NewSpatialPopup extends AbstractAction implements Presenter.Popup {
             });
         }
     }
-
+  
     private class AddEmitterAction extends AbstractAction {
 
         public AddEmitterAction() {
@@ -160,6 +162,11 @@ public class NewSpatialPopup extends AbstractAction implements Presenter.Popup {
         }
     }
 
+    /**
+     * AddSpatialUndo automatically handles the removal of the Spatial from the its parent (depending on undo/redo)
+     * @param undoParent The Parental Node
+     * @param undoSpatial  The Spatial to handle
+     */
     private void addSpatialUndo(final Node undoParent, final Spatial undoSpatial) {
         //add undo
         if (undoParent != null && undoSpatial != null) {
@@ -190,6 +197,9 @@ public class NewSpatialPopup extends AbstractAction implements Presenter.Popup {
         }
     }
 
+    /**
+     * Sets this (parent) node as modified/dirty/to be saved.
+     */
     private void setModified() {
         java.awt.EventQueue.invokeLater(new Runnable() {