]> source.dussan.org Git - vaadin-framework.git/commitdiff
setEnabled(false) disables visible sub-components; Fixes #677 (together with [5513])
authorMarc Englund <marc.englund@itmill.com>
Thu, 25 Sep 2008 12:24:48 +0000 (12:24 +0000)
committerMarc Englund <marc.englund@itmill.com>
Thu, 25 Sep 2008 12:24:48 +0000 (12:24 +0000)
svn changeset:5514/svn branch:trunk

src/com/itmill/toolkit/ui/Table.java

index adb78be2d2a6f1a61e1fdf4eb485fbdbbc1a5d6e..24f0437f3d4f356a780657ccd2ebc8e6af5a4553 100644 (file)
@@ -3007,4 +3007,35 @@ public class Table extends AbstractSelect implements Action.Container,
             requestRepaint();
         }
     }
+
+    // Identical to AbstractCompoenentContainer.setEnabled();
+    public void setEnabled(boolean enabled) {
+        super.setEnabled(enabled);
+        if (getParent() != null && !getParent().isEnabled()) {
+            // some ancestor still disabled, don't update children
+            return;
+        } else {
+            requestRepaintAll();
+        }
+    }
+
+    // Virtually identical to AbstractCompoenentContainer.setEnabled();
+    public void requestRepaintAll() {
+        requestRepaint();
+        for (Iterator childIterator = visibleComponents.iterator(); childIterator
+                .hasNext();) {
+            Component c = (Component) childIterator.next();
+            if (c instanceof Form) {
+                // Form has children in layout, but is not ComponentContainer
+                c.requestRepaint();
+                ((Form) c).getLayout().requestRepaintAll();
+            } else if (c instanceof Table) {
+                ((Table) c).requestRepaintAll();
+            } else if (c instanceof ComponentContainer) {
+                ((ComponentContainer) c).requestRepaintAll();
+            } else {
+                c.requestRepaint();
+            }
+        }
+    }
 }