New Posts New Posts RSS Feed: [Resolved] TabShellLayout
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

[Resolved] TabShellLayout

 Post Reply Post Reply Page  <12
Author
Linguinut View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14-Jun-2007
Location: United States
Posts: 394
Post Options Post Options   Quote Linguinut Quote  Post ReplyReply Direct Link To This Post Topic: [Resolved] TabShellLayout
    Posted: 26-Oct-2007 at 2:47pm
Dan,
 
For what it's worth, I really wish I could help.  I have been tracking with you.  As I keep up with you, if anything comes to mind, I will certainly let you know.  Keep at it.  The solution is waiting for you to find.
 
Bill
Back to Top
orcities View Drop Down
Senior Member
Senior Member
Avatar

Joined: 28-Aug-2007
Location: United States
Posts: 454
Post Options Post Options   Quote orcities Quote  Post ReplyReply Direct Link To This Post Posted: 26-Oct-2007 at 3:49pm
I am going to alter the ShellService and the Nave service to do what I want. I will let you know how it goes.
Back to Top
orcities View Drop Down
Senior Member
Senior Member
Avatar

Joined: 28-Aug-2007
Location: United States
Posts: 454
Post Options Post Options   Quote orcities Quote  Post ReplyReply Direct Link To This Post Posted: 29-Oct-2007 at 12:20pm
Ok, I know what I want to do. But I have no idea on how to do it.
 
The following is built into the page controllers ShowPage:

if ( controller == null ) {

        controller = MakeNewPage<T>(pParentWorkItem, pPageWorkItemId);

        ShowPage(controller, pPageWorkspace);

      } else {

        controller.MainWorkspace.Activate(controller.MainView);

      }

Meaning that if the controller doesn't exist then add one. This will do the refresh of the content.
 
Now, in the TabbedShellLayout I can hide a page. I can also get the ActiveSmartPart and the current IPageView, to keep it generic.
 
I want to dispose of that PageView, that way when the user clicks on the nav item again it will create the page again, but I have no idea how to do that.
 
So far, I have been successful in hiding the tab, remove it from the WorkItem. But, the page will not load again when the user clicks on the nav item.
 
HELP
Back to Top
Bill Jensen View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 31-Jul-2007
Location: United States
Posts: 229
Post Options Post Options   Quote Bill Jensen Quote  Post ReplyReply Direct Link To This Post Posted: 29-Oct-2007 at 2:22pm

The concept of destroying and recreating a view each time it becomes visible is rather foreign to CAB and Cabana.

Since you've succeeded in hiding and revealing a view, I'm still not understanding why you can't merely refresh the data source of a view when it becomes visible.
 
Bill J.
Back to Top
orcities View Drop Down
Senior Member
Senior Member
Avatar

Joined: 28-Aug-2007
Location: United States
Posts: 454
Post Options Post Options   Quote orcities Quote  Post ReplyReply Direct Link To This Post Posted: 29-Oct-2007 at 2:34pm

Because I am an idiot and can't figure out how to do it.

I know I want to "Re-execute the original query and assign the result as the data source for the binding source." but I can't figure it out.
 
ShowPage is static. This method runs when you click on the link in the NavBar. Therefore, I do not have the same access to the variables. The MainBindingSource is not static.
 
The main reason I was trying to remove the page from the WorkItem is because ShowPage either adds a new page, if the current page hasn't been created, or makes it the active page. I thought it would be simpler to remove it. This would only require me to add code to the TabShellLayout presenter and view.
 
 
 
 
Back to Top
Bill Jensen View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 31-Jul-2007
Location: United States
Posts: 229
Post Options Post Options   Quote Bill Jensen Quote  Post ReplyReply Direct Link To This Post Posted: 29-Oct-2007 at 3:33pm

The static ShowPage() method of the page controller (mine is named Page1) calls the generic base class method:

ShowPage<Page1PageController>(pParentWorkItem, pPageWorkItemId, pPageWorkspace);

Examining this method, we find:

protected static void ShowPage<T>(WorkItem pParentWorkItem, string pPageWorkItemId, IWorkspace pPageWorkspace)

where T : PageController<TRootObj> {

T controller = GetPageController<T>(pParentWorkItem, pPageWorkItemId);

We note that GetPageController<>() is protected static, so it's available in our page controller's static ShowPage method.  So, in your page controller's static ShowPage() method try:
 

public static void ShowPage(WorkItem pParentWorkItem, string pPageWorkItemId, IWorkspace pPageWorkspace)

{

// Refresh entities before displaying

Page1PageController controller = GetPageController<Page1PageController>(pParentWorkItem, pPageWorkItemId);

controller.RefreshEntities();

// Base ShowPage method will call back to overridden methods in this class

ShowPage<Page1PageController>(pParentWorkItem, pPageWorkItemId, pPageWorkspace);

}

Then write a RefreshEntities() method (perhaps similar to what you do in GetInitialEntities() to re-query the data.
 
Full disclosure:  I haven't tested this code.
 
Bill J.
Back to Top
orcities View Drop Down
Senior Member
Senior Member
Avatar

Joined: 28-Aug-2007
Location: United States
Posts: 454
Post Options Post Options   Quote orcities Quote  Post ReplyReply Direct Link To This Post Posted: 30-Oct-2007 at 12:55pm
This is my solution, atleast until refactoring.
 
I created a TabService. This service adds each tab to a collection, built with a helper class that add the tab with an allowclose flag. If the page is to not ever be closed then the flag is false. When a new page is selected I see if the page exists in the collection if not I add it.
 
Then in the ShowPage static method of each page I make the page visible by pulling the Tab from the service and changing the visibility. Then I refresh the page, as noted above by Bill, if necessary.
 
 
 
 
Back to Top
Bill Jensen View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 31-Jul-2007
Location: United States
Posts: 229
Post Options Post Options   Quote Bill Jensen Quote  Post ReplyReply Direct Link To This Post Posted: 30-Oct-2007 at 2:37pm
Sounds like a good solution to me.  Keeping the knowledge of the tabs in a TabService avoids having any other components depend on the particular shell layout type.
 
This could be generalized slightly into a "PageVisibilityService" with a MakeVisible(pageViewId) method.   If the page isn't part of a TabShellLyaout, the service does nothing.  That way, page's don't care at all about where they're displayed.
 
Bill J.
Back to Top
 Post Reply Post Reply Page  <12

Forum Jump Forum Permissions View Drop Down