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>
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 @@ /** 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. */