]> source.dussan.org Git - vaadin-framework.git/commitdiff
Remove paintableToId now that each VPaintable knows its own pid (#8323)
authorLeif Åstrand <leif@vaadin.com>
Thu, 9 Feb 2012 12:50:59 +0000 (14:50 +0200)
committerLeif Åstrand <leif@vaadin.com>
Thu, 9 Feb 2012 12:50:59 +0000 (14:50 +0200)
src/com/vaadin/terminal/gwt/client/VPaintableMap.java

index aa3e8e3cb86d67d3cb5f0b316d2992b4e7257f2d..a3b6f62174eca4258708847333afc2f1ea3aebdd 100644 (file)
@@ -22,7 +22,6 @@ import com.vaadin.terminal.gwt.client.RenderInformation.Size;
 public class VPaintableMap {
 
     private Map<String, VPaintable> idToPaintable = new HashMap<String, VPaintable>();
-    private Map<VPaintable, String> paintableToId = new HashMap<VPaintable, String>();
 
     public static VPaintableMap get(ApplicationConnection applicationConnection) {
         return applicationConnection.getPaintableMap();
@@ -81,7 +80,6 @@ public class VPaintableMap {
      */
     public void clear() {
         idToPaintable.clear();
-        paintableToId.clear();
         idToComponentDetail.clear();
     }
 
@@ -99,7 +97,6 @@ public class VPaintableMap {
         ComponentDetail componentDetail = GWT.create(ComponentDetail.class);
         idToComponentDetail.put(pid, componentDetail);
         idToPaintable.put(pid, paintable);
-        paintableToId.put(paintable, pid);
         if (paintable instanceof VPaintableWidget) {
             VPaintableWidget pw = (VPaintableWidget) paintable;
             setPid(pw.getWidgetForPaintable().getElement(), pid);
@@ -122,12 +119,14 @@ public class VPaintableMap {
      *            the paintable who's id is needed
      * @return the id for the given paintable or null if the paintable could not
      *         be found
+     * @deprecated use {@link VPaintable#getId()} instead
      */
+    @Deprecated
     public String getPid(VPaintable paintable) {
         if (paintable == null) {
             return null;
         }
-        return paintableToId.get(paintable);
+        return paintable.getId();
     }
 
     @Deprecated
@@ -235,7 +234,6 @@ public class VPaintableMap {
                     // clean reference to paintable
                     idToComponentDetail.remove(pid);
                     idToPaintable.remove(pid);
-                    paintableToId.remove(paintable);
                 }
                 /*
                  * else NOP : same component has been reattached to another
@@ -360,7 +358,7 @@ public class VPaintableMap {
     }
 
     public Collection<? extends VPaintable> getPaintables() {
-        return Collections.unmodifiableCollection(paintableToId.keySet());
+        return Collections.unmodifiableCollection(idToPaintable.values());
     }
 
     /**