question about BookmarkableView

Jay Shaughnessy jshaughn at redhat.com
Tue Mar 13 12:53:41 UTC 2012


These methods are hard to get right sometimes, sometimes you need to see 
it in action.  I guess my question would be, what would happen in the 
"else"?  Just looking it almost seems like it should be:

     if (content != null) {
         if (content instanceof BookmarkableView) {
             ((BookmarkableView) 
content).renderView(viewPath.next().next());
         }  else {
             setContent(content);
         }
     }

Why do we setContent and then potentially call renderView? Seems like we 
should set content only f we're not going to hand off rendering to 
another view.



On 3/12/2012 9:48 PM, John Sanda wrote:
> I am trying to resolve a navigation issue and found myself looking at 
> the AbstractSectionedLeftNavigationView.renderContentView. The end of 
> the method is as follows:
>
> ViewFactory viewFactory = item.getViewFactory();
> if (viewFactory != null) {
>     destroyCurrentContent();
>     Canvas content = viewFactory.createView();
>     if (content != null) {
>         setContent(content);
>         if (content instanceof BookmarkableView) {
>             ((BookmarkableView) 
> content).renderView(viewPath.next().next());
>         }
>     }
> }
>
> So here is my question. What if content is not an instance of 
> BookmarkableView? I have traced some calls of renderView back to 
> AbstractTableSection and I see that there is logic for determining 
> whether to display the details or table view. It just seems that there 
> should either be an else block there to handle cases where content is 
> not a BookmarkableView or it should be assumed that content is always 
> a BookmarkableView.
>
> - John
> _______________________________________________
> rhq-devel mailing list
> rhq-devel at lists.fedorahosted.org
> https://fedorahosted.org/mailman/listinfo/rhq-devel



More information about the rhq-devel mailing list