}
public void requestRepaintAll() {
- requestRepaint();
- for (Iterator<Component> childIterator = getComponentIterator(); childIterator
- .hasNext();) {
+ requestRepaintAll(this);
+ }
+
+ /**
+ * Helper that implements the logic needed by requestRepaintAll. Calls
+ * requestRepaintAll/requestRepaint for the component container and all its
+ * children recursively.
+ *
+ * @param container
+ */
+ public static void requestRepaintAll(HasComponents container) {
+ container.requestRepaint();
+ for (Iterator<Component> childIterator = container
+ .getComponentIterator(); childIterator.hasNext();) {
Component c = 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();
+ if (c instanceof HasComponents) {
+ requestRepaintAll((HasComponents) c);
} else {
c.requestRepaint();
}
*/
public int getComponentCount();
- /**
- * Causes a repaint of this component, and all components below it.
- *
- * This should only be used in special cases, e.g when the state of a
- * descendant depends on the state of a ancestor.
- *
- */
- public void requestRepaintAll();
-
/**
* Moves all components from an another container into this container. The
* components are removed from <code>source</code>.
*/
protected abstract Component initContent();
- private void requestContentRepaint() {
- if (getParent() == null) {
- // skip repaint - not yet attached
- return;
- }
- if (getContent() instanceof ComponentContainer) {
- ((ComponentContainer) getContent()).requestRepaintAll();
- } else {
- getContent().requestRepaint();
- }
- }
-
// Size related methods
// TODO might not be necessary to override but following the pattern from
// AbstractComponentContainer
@Override
public void setHeight(float height, Unit unit) {
super.setHeight(height, unit);
- requestContentRepaint();
+ requestRepaintAll();
}
@Override
public void setWidth(float height, Unit unit) {
super.setWidth(height, unit);
- requestContentRepaint();
+ requestRepaintAll();
}
// ComponentContainer methods
}
public void requestRepaintAll() {
- requestRepaint();
-
- requestContentRepaint();
+ AbstractComponentContainer.requestRepaintAll(this);
}
/**
return new ComponentIterator();
}
+ public void requestRepaintAll() {
+ AbstractComponentContainer.requestRepaintAll(this);
+ }
+
public int getComponentCount() {
int count = 0;
if (layout != null) {
* otherwise
*/
public boolean isComponentVisible(Component childComponent);
+
+ /**
+ * Causes a repaint of this component, and all components below it.
+ *
+ * This should only be used in special cases, e.g when the state of a
+ * descendant depends on the state of a ancestor.
+ */
+ public void requestRepaintAll();
+
}
}
}
- // Virtually identical to AbstractCompoenentContainer.setEnabled();
public void requestRepaintAll() {
- requestRepaint();
- if (visibleComponents != null) {
- for (Iterator<Component> childIterator = visibleComponents
- .iterator(); childIterator.hasNext();) {
- Component c = 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();
- }
- }
- }
+ AbstractComponentContainer.requestRepaintAll(this);
}
/**