modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java | 43 +++++++--- 1 file changed, 32 insertions(+), 11 deletions(-)
New commits: commit ba09ae501b545b2a6452290584e7d5a9ea81b6ff Author: Joseph Marques joseph@redhat.com Date: Tue Sep 21 23:31:14 2010 -0400
fix master/details impl to allow detailsView navigation from /0 to /<id>
basically, since the detailsView is already showing when navigating from /0 to /<id>, the animationHide event was being suppressed, which meant that the subsequent callback wasn't invoked. this left the original detailsView canvas attached to the detailsHolder, instead of refreshing the holder with the latest view returned from the renderView method.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java index 0e3a899..c8ab12b 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java @@ -187,7 +187,6 @@ public abstract class TableSection extends Table implements BookmarkableView {
@Override public void renderView(ViewPath viewPath) { - basePath = viewPath.getPathToCurrent();
if (!viewPath.isEnd()) { @@ -224,20 +223,42 @@ public abstract class TableSection extends Table implements BookmarkableView { protected void switchToDetailsView() { Canvas contents = getTableContents(); if (contents != null) { - contents.animateHide(AnimationEffect.WIPE, new AnimationCallback() { - @Override - public void execute(boolean b) { - detailsView.setWidth100(); - detailsView.setHeight100(); - - detailsHolder.addMember(new BackButton(extendLocatorId("BackButton"), "Back to List", basePath)); - detailsHolder.addMember(detailsView); - detailsHolder.animateShow(AnimationEffect.WIPE); + if (contents.isVisible()) { + contents.animateHide(AnimationEffect.WIPE, new AnimationCallback() { + @Override + public void execute(boolean b) { + buildDetailsView(); + } + }); + } else { + /* + * if the programmer chooses to go directly from the detailView in create-mode to the + * detailsView in edit-mode, the content canvas will already be hidden, which means the + * animateHide would be a no-op (the event won't fire). this causes the detailsHolder + * to keep a reference to the previous detailsView (the one in create-mode) instead of the + * newly returned reference from getDetailsView(int) that was called when the renderView + * methods were called hierarchically down to render the new detailsView in edit-mode. + * therefore, we need to explicitly destroy what's already there (presumably the detailsView + * in create-mode), and then rebuild it (presumably the detailsView in edit-mode). + */ + for (Canvas child : detailsHolder.getMembers()) { + child.destroy(); } - }); + + buildDetailsView(); + } } }
+ private void buildDetailsView() { + detailsView.setWidth100(); + detailsView.setHeight100(); + + detailsHolder.addMember(new BackButton(extendLocatorId("BackButton"), "Back to List", basePath)); + detailsHolder.addMember(detailsView); + detailsHolder.animateShow(AnimationEffect.WIPE); + } + /** * Switches to viewing the table, hiding the details canvas. */
rhq-commits@lists.fedorahosted.org