diff options
author | Shawn O. Pearce <sop@google.com> | 2009-05-21 16:15:47 -0700 |
---|---|---|
committer | Shawn O. Pearce <sop@google.com> | 2009-05-21 16:15:47 -0700 |
commit | 5a6dc0fd74797d83b4d4ae70872302767c6bf964 (patch) | |
tree | 1b9ee8c70d399fbd37b2906a4a851f9a901329e2 | |
parent | 6657e694d911c6e6cf94b56626d980ef9cccabda (diff) | |
download | gwtexpui-5a6dc0fd74797d83b4d4ae70872302767c6bf964.tar.gz |
Fix View.isCurrentView to account for wrapping
ViewSite wraps View objects inside of other panels before it
displays them, so we really need to consider unwrapping the
parent a couple of levels in order to find the parent ViewSite
and test for our instance.
Signed-off-by: Shawn O. Pearce <sop@google.com>
-rw-r--r-- | src/main/java/com/google/gwtexpui/user/client/View.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/main/java/com/google/gwtexpui/user/client/View.java b/src/main/java/com/google/gwtexpui/user/client/View.java index eed4333..87668a7 100644 --- a/src/main/java/com/google/gwtexpui/user/client/View.java +++ b/src/main/java/com/google/gwtexpui/user/client/View.java @@ -38,8 +38,14 @@ public abstract class View extends Composite { /** true if this is the current view of its parent view site */ public final boolean isCurrentView() { - final Widget p = getParent(); - return p instanceof ViewSite && ((ViewSite<?>) p).getView() == this; + Widget p = getParent(); + while (p != null) { + if (p instanceof ViewSite) { + return ((ViewSite<?>) p).getView() == this; + } + p = p.getParent(); + } + return false; } /** Replace the current view in the parent ViewSite with this view. */ |