JSONObject hierarchyInfo = new JSONObject();
for (Paintable p : hierarchyPendingQueue) {
if (p instanceof HasComponents) {
- HasComponents cc = (HasComponents) p;
- String connectorId = paintableIdMap.get(cc);
+ HasComponents parent = (HasComponents) p;
+ String parentConnectorId = paintableIdMap.get(parent);
JSONArray children = new JSONArray();
- for (Component child : getChildComponents(cc)) {
- if (child.getState().isVisible()) {
+ for (Component child : getChildComponents(parent)) {
+ if (child.getState().isVisible()
+ && parent.isComponentVisible(child)) {
String childConnectorId = getPaintableId(child);
children.put(childConnectorId);
}
}
try {
- hierarchyInfo.put(connectorId, children);
+ hierarchyInfo.put(parentConnectorId, children);
} catch (JSONException e) {
throw new PaintException(
"Failed to send hierarchy information about "
- + connectorId + " to the client: "
+ + parentConnectorId + " to the client: "
+ e.getMessage());
}
}
public Iterator<Component> iterator() {
return getComponentIterator();
}
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.vaadin.ui.HasComponents#isComponentVisible(com.vaadin.ui.Component)
+ */
+ public boolean isComponentVisible(Component childComponent) {
+ return true;
+ }
}
\ No newline at end of file
// content never detached
}
+ public boolean isComponentVisible(Component childComponent) {
+ return true;
+ }
}
return count;
}
+
+ public boolean isComponentVisible(Component childComponent) {
+ return true;
+ };
}
*/
public Iterator<Component> getComponentIterator();
+ /**
+ * Checks if the child component is visible. This method allows hiding a
+ * child component from updates and communication to and from the client.
+ * This is useful for components that show only a limited number of its
+ * children at any given time and want to allow updates only for the
+ * children that are visible (e.g. TabSheet has one tab open at a time).
+ * <p>
+ * Note that this will prevent updates from reaching the child even though
+ * the child itself is set to visible. Also if a child is set to invisible
+ * this will not force it to be visible.
+ * </p>
+ *
+ * @param childComponent
+ * The child component to check
+ * @return true if the child component is visible to the user, false
+ * otherwise
+ */
+ public boolean isComponentVisible(Component childComponent);
}
removeListener(FocusEvent.EVENT_ID, FocusEvent.class, listener);
}
+
+ @Override
+ public boolean isComponentVisible(Component childComponent) {
+ return childComponent == getSelectedTab();
+ }
}