New Posts New Posts RSS Feed: Process for creating new Base View?
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Process for creating new Base View?

 Post Reply Post Reply Page  <12
Author
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 Topic: Process for creating new Base View?
    Posted: 21-Sep-2007 at 1:44pm
I believe, but I am not sure, that I get the context of the grid ok. But I can not reference any of the grids properties. LIke the selected rows.
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: 21-Sep-2007 at 9:31am
Excellent example. Thanks.
The only question I have now is:
 
How do I know what is selected by the Roles Grid in the ActionView?
 
I have tried to look at other examples, like the SimpleSearch Widget, but can't find an example that works.
 
You mentioned passing an object through the Context. I assume you can do that with the parameters value of the ViewFactory.Add method.
 
But how do you get the value back out?


Edited by orcities - 21-Sep-2007 at 10:27am
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: 21-Sep-2007 at 7:10am
Bill, I really appreciate it. The modules provided with the Cabana project were very simply and it was hard to see how to extend to a new view.
 
I am looking through the code now. I might have some questions later but right now I am ok.
 
 
I really appreciate all your help on this.
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: 20-Sep-2007 at 8:13pm
Hi Dan and Bill (and anyone else reading this thread),
 
In order to offer better guidance, I needed to get some experience with what you're trying to do myself.  My earlier advice to start with the MasterDetail view and tab view controller was a bit bogus...it's much easier to start with a simple view and work up.
 
After a conversation with Ward, I constructed a three-panel layout like the one you're trying to create and made a specialized version populated with grids and a button control.
 
The results are available at:
 
 
Note:  Ward has promised to put it up in the Friends area tonight.  If it's not there by tomorrow morning, ask.
 
It's a standard wizard-generated Cabana project that should build and run.  (You may need to adjust the connection string in IdeaBlade.ibconfig.)  If you run it, be sure to navigate through the various users--only some of them have UserSecurityCodes configured.  Also, my grid builders are very primitive--displaying the Name property only.
 
My earlier advice to start with the MasterDetail view and tab view controller was a bit bogus...it's much easier to start with a simple view and work up.
 
You're on exactly the right track in creating the ThreePanel view and adding names to WorkspaceNames and ViewNames. 
 
As you can see, the only logic in my ThreePanelView layout view is to get the sub view ids from the context (which it gets from the presenter)  and assign them to the SmartPartPlaceHolders.  (These are unique ids for the instances of the grid and action views.)
 
The ThreePanelView presenter has no special purpose logic at all.
 
The only complexity is in the ThreePanelViewTabViewController.  I simply inherit from the base TabViewController and override a few methods.
 
It creates a context for the layout view, but delegates its configuration to the child class in ConfigureThreePanelViewContextCore().  There are also three properties that supply unique ids for the child views.
 
My child class is UserRolesTabViewController, added to the page's TabViewControllers collection at the usual place in the PageController.  It simply creates a context for each sub view and adds it to the workitem, then uses the ViewFactoryService to add the view to the workitem.   (I added registration of the views with the ViewFactoryService to the ModuleController.)
 
I provided some very basic data sources for the two grids.
 
The ActionView is just a placeholder with two buttons.  I could field the click events in the view, invoke methods on the presenter, and either do the updates there or invoke methods on the ActionViewContext (or some object passed in the context) to update the entities.
 
This process clarified for me the process of creating a layout view and adding child views to it.  It's all done by adding contexts and views to the workitem, then supplying the unique view ids to the SmartPartPlaceholders.
 
Let me know if this helps get you back on the air.
 
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: 20-Sep-2007 at 1:22pm
Available: will be all roles in the database (Role Grid)
Action: Buttons to add and delete user roles
Assigned: all the users currently assigned roles (Role Grid) of UserRole
 
Users - UserId ...
UserRole - UserId, RoleId
Role - RoleId ...
 
I do wish for them to be in sync.
 
That is exactly what I am trying to do.
 
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: 20-Sep-2007 at 1:18pm

You're definitely on the right track.  I'm actually working on your problem myself as well.

The tab controller for your ThreePanel view composes and manages the display of sub views (the easy part), but also must handle synchronization of the data sources for the sub views (the tricky part).  This requires a clear understanding of the sub views' binding sources and their relation to the main binding source of the layout view.
I need to understand the entity relationships involved.
 
1.  The ThreePanel view will be displayed in a tab in the detail portion of a Summary/Detail or Search/Summary/Detail page whose root entity is "User".  Correct.
 
2.  What entity type will be displayed in each of the three sub views (Available, Assigned, and Action)?   Role?
 
3.  What is the relationship between the entities displayed in each sub view?  A child relation of User?
 
4.  You want the subviews to stay "in sync" with each other and with the main summary view as you navigate between users, right?
 
What is the application functionality you're trying to achieve?  Are you trying to manage the roles assigned to users (a many-to-many relationship) by displaying two lists and using buttons to move items from the available to the assigned list?
 
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: 20-Sep-2007 at 11:01am
Is this correct?
Below is the process I used to create a new base view and add views/controls to that view.
 
Goal View: Has Three SmartPartPlaceholders on it.
TopPlaceHolder -> will hold grid view
MiddlePlaceHolder -> will hold action buttons
BottomPlaceHolder -> will hold current values
 
1. Create View Class and add to <Business>.<App>.Foundation.Views
   ThreePaneView.cs
2. Add SmartPartPlaceholders
3. In View Constructor add method call: SetSmartPartPlaceHolderNames();
4. Build SetSmartPartPlaceHolderNames(); method:
private void SetSmartPartPlaceHolderNames() {
// Critical! Must set SmartPartPlaceHolder name immediately or mysterious exception during create.
mAvailableSmartPartPlaceholder.SmartPartName = WorkspaceNames.AvailableSmartPartPlaceholder;
mActionSmartPartPlaceHolder.SmartPartName =
WorkspaceNames.ActionSmartPartPlaceholder;
mAvailableSmartPartPlaceholder.SmartPartName = WorkspaceNames.AssignedSmartPartPlaceholder;
}
5. Add reference to Placeholders in  <Business>.<App>.Interface.Constants.Workspaces
6.
public const string AvailableSmartPartPlaceholder = "AvailableSmartPartPlaceholder";
public const string AssignedSmartPartPlaceholder = "AssignedSmartPartPlaceholder";
public const string ActionSmartPartPlaceholder = "ActionSmartPartPlaceholder";
7. Create Grid View to place in "AssignedSmartPartPlaceholder";
8. Create UserRolesGridView displays Roles that are assigned to User in the UserRoles Entity.
9. Create TabController - ManageUserRolesTabControl
10. Add/Modify CreateView() method to get data and show control
public override void CreateView(){
mBindingSource =new EntityBindingSource(typeof(Role), EntityManager, mEmptyList, String.Empty);
ViewId = "UserRolesGridView";
//Choose DetailRoleGrid
IGridBuilderService pGridBuilderService = this.WorkItem.Services.Get<IGridBuilderService>();
GridBuilderBase pGridBulderProtoType = pGridBuilderService.Get("DetailRole"); 

GridViewContext detailRoles = GridViewContext.AddNew(WorkItem, ViewId, mBindingSource);

detailRoles.GridBuilderPrototype = pGridBulderProtoType;
//CreateView<UserRolesGridView>(); //Just adds the grid to page

UserRolesGridView mAssignedView = WorkItem.SmartParts.AddNew<UserRolesGridView>();

AssignedWorkspace.Show(mAssignedView);
}
11. Get the ThreePanelView Control's SmartPart Placeholder
private IWorkspace ActionWorkspace{
get{ return WorkItem.Workspaces[WorkspaceNames.ActionSmartPartPlaceholder];
}

}

 

I either run into a problem with binding.

The item type of the BindingSource that you selected [LOC.CEMS.Model.User] does not match  the BoundType of this BindingManager [LOC.CEMS.Model.Role].
 
Or if I try to add a control with user type just to see if it works I get:
Value cannot be null.
Parameter name: id
 
In the GridViewPresenterBase class. Funny thing is I am not trying to bind any grid.
Altered CreateView() as such. ActionButtonView just has 2 buttons on it. And to get it to run to this point I changed the boundtype to be User.

public override void CreateView(){

ActionButtonsView mActionButtonView = WorkItem.SmartParts.AddNew<ActionButtonsView>();

ActionWorkspace.Show(mActionButtonView);
}


Edited by orcities - 20-Sep-2007 at 11:04am
Back to Top
 Post Reply Post Reply Page  <12

Forum Jump Forum Permissions View Drop Down