You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@netbeans.apache.org by GitBox <gi...@apache.org> on 2017/12/01 08:22:35 UTC

[GitHub] JaroslavTulach commented on a change in pull request #308: Support for lazy object creation in Visual Library

JaroslavTulach commented on a change in pull request #308: Support for lazy object creation in Visual Library
URL: https://github.com/apache/incubator-netbeans/pull/308#discussion_r154286968
 
 

 ##########
 File path: api.visual/src/org/netbeans/api/visual/model/ObjectScene.java
 ##########
 @@ -86,16 +86,62 @@ public final void addObject (Object object, Widget... widgets) {
         objects.put (object, object);
         object2widget.put (object, mainWidget);
         object2widgets.put (object, mainWidget != null ? Arrays.asList (widgets) : EMPTY_WIDGETS_LIST);
-        objectStates.put (object, ObjectState.createNormal ());
-
+        ObjectState state = objectStates.computeIfAbsent(object, (o) -> ObjectState.createNormal());
         for (Widget widget : widgets) {
             widget2object.put (widget, object);
-            widget.setState (ObjectState.createNormal ());
+            widget.setState (state);
         }
 
         for (ObjectSceneListener listener : getListeners (ObjectSceneEventType.OBJECT_ADDED))
             listener.objectAdded (event, object);
     }
+    
+    /**
+     * Removes mapping for an object, including the object state. The caller is responsible for removing
+     * widgets from the scene before this call. If the is already removed or did not exist, the method
 
 Review comment:
   Missing "re" in "If the is".

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services