diff options
Diffstat (limited to 'server/src/com/vaadin/ui/AbstractComponent.java')
-rw-r--r-- | server/src/com/vaadin/ui/AbstractComponent.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/server/src/com/vaadin/ui/AbstractComponent.java b/server/src/com/vaadin/ui/AbstractComponent.java index d980c27916..b6289e0b7d 100644 --- a/server/src/com/vaadin/ui/AbstractComponent.java +++ b/server/src/com/vaadin/ui/AbstractComponent.java @@ -991,4 +991,24 @@ public abstract class AbstractComponent extends AbstractClientConnector actionManager.removeAction(shortcut); } } + + /** + * Determine whether a <code>content</code> component is equal to, or the + * ancestor of this component. + * + * @param content + * the potential ancestor element + * @return <code>true</code> if the relationship holds + */ + protected boolean isOrHasAncestor(Component content) { + if (content instanceof HasComponents) { + for (Component parent = this; parent != null; parent = parent + .getParent()) { + if (parent == content) { + return true; + } + } + } + return false; + } } |