New Posts New Posts RSS Feed: [COMPLETED] Widget View Template
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

[COMPLETED] Widget View Template

 Post Reply Post Reply Page  <1234>
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: [COMPLETED] Widget View Template
    Posted: 26-Sep-2007 at 2:04pm
I found this method:  AddToControlViewToolStrip() in the DotNetNavigatorControlViewToolStripAdapter (adapted from the DotNetGridViewToolStripAdapter).  It has the AddEditButton, AddAddNewButton and AddDeleteButton methods that I want, but how do I get them to fire?
 
This is quite odd.  The DotNetNavigatorControlViewToolStripAdapter inherits from ControlViewToolStripAdapter in which the following is declared:

///
<summary>Add to the ControlViewToolStrip <see cref="UIExtensionSite"/>.</summary>
protected virtual void AddToControlViewToolStrip() {
}
 
In that same class is the Configure() method which has as one of its calls, AddToControlViewToolStrip().  That method is defined (with the add button methods) in DotNetNavigatorControlViewToolStripAdapter, not in ControlViewToolStripAdapter.  Shouldn't these add button methods be in that class rather than the class that is inheriting from it?  In the event that I don't want them implemented, I could override in the class that is inheriting from it.  Well, I may not have this square in my head, but if someone else could look at this and let me know what to do or how to think about it, I would really appreciate it.  The same structure is found in Cabana with the DotNetNavigatorGridViewToolStripAdapter (IdeaBlade.Cab.UI) and the GridViewToolStripAdapter (IdeaBlade.Cab.Interface).
 
Thanks!!
Bill


Edited by Linguinut - 26-Sep-2007 at 2:17pm
Back to Top
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 Posted: 26-Sep-2007 at 1:14pm
Along the way, I found the DevExPageView.  I created a new ContactView2 and inherited from this control.  I passed it to the GeneralTabViewController and got the error that ContactView2 could not be converted to IBindingView.  Bummer.  That would have saved a lot of work...it has the add/edit/delete and alert messaging...sure would be nice.  Is there a way to do that, maybe?
Back to Top
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 Posted: 26-Sep-2007 at 11:05am

The culprit was in the new ControlViewWithToolbarPresenterBase.cs class.  I had the following:

/// <summary>ViewContext was set and is presumed ready with values.</summary>
protected override void OnViewContextSet() {
    base.OnViewContextSet();
    SetBindingManagerBindingSource();
    SetControlViewToolStripAdapter();
}
 
In the GridViewContextBase there was a slough of stuff that inaugurated the GridView.  Inside of one of the methods was a call like this:
 
GridViewToolStripAdapter.Configure();
 
Aha!!  I added the call to the OnViewContextSet() above.  Now, the data shows up properly with navigation to the additional entities.  Good stuff!!!
 
Alas!  There is always a cloud with every silver lining.  I assumed (ya, bad idea) that the add, delete and save buttons would appear in the toolbar, but they do not.  Another switch is hiding in there somewhere.  Now, where is that thing?
Back to Top
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 Posted: 25-Sep-2007 at 8:49pm
From the ContactsView class:
 
[InjectionMethod]
public void InjectPresenter([CreateNew] DotNetControlViewWithToolbarPresenter<IBindingView> pPresenter)
{
    SetPresenter(pPresenter, mNavigator, mControlBindingManager);
}
 
Is this the right way to do 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: 25-Sep-2007 at 6:23pm

As I mentioned earlier, ensure that the BindingSource for your ControlView is properly assigned to the BindingNavigator.

Back to Top
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 Posted: 25-Sep-2007 at 5:24pm
Ok.  The test was partially successful.  I was able to get past the casting problem.  Now, I am still trying to figure out how to get the toolbar to be enabled.  It has got to be related to SetControlViewToolStripAdapterCore() somehow.
Back to Top
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 Posted: 25-Sep-2007 at 5:18pm
It is very difficult to present to the forum all of the intricacies of this project.  As a result, I have obviously not provided enough information about what I am doing.  Sorry about that.
 
I didn't have any kind of support for the toolstrip in the BindingViewContext, so I created a new one--ControlViewContext.  I threw a few things in there to get the ball rolling.  It is possible that I didn't need to do that.  I am attempting to get this current casting issue resolved and it may include rewritting some of those classes.
 
As I was finishing this response up, I did notice that ControlViewContext was inheriting directly from BindingViewContextBase.  I changed that to ControlViewContextBase.  Building now.  Will test shortly.
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: 25-Sep-2007 at 5:01pm
So...
 
does IdeaBlade.Cab.ControlViewContext inherit from IdeaBlade.Cab.ControlViewContextBase?
 
Neither of these are defined in standard IdeaBlade.Cab.  The ControlView is built using BindingViewContext.
 
What are you adding in ControlViewContext (and CVCBase) that isn't present in BindingViewContext?
 
Bill J.
Back to Top
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 Posted: 25-Sep-2007 at 3:20pm

Unable to cast object of type 'IdeaBlade.Cab.UI.ControlViewContext' to type 'IdeaBlade.Cab.Interface.ControlViewContextBase'.

This is being thrown on:
/// <summary>Get the ControlView's ViewContext.</summary>
protected new ControlViewContextBase ViewContext {
    get { return (ControlViewContextBase) base.ViewContext; }
}
Back to Top
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 Posted: 25-Sep-2007 at 2:34pm
I found an override where one didn't need to be.  It was in the ControlViewWithToolbarPresenter class. 

///
<summary>get the view's bindingviewcontext</summary>
public new ibindingviewcontext viewcontext
{
    get { return (ibindingviewcontext)base.viewcontext; }
}
 
I commented this section out.  Now, I am past that error, but am now experiencing another.  A similar error so I will review all of the various pieces again and see what I overlooked.  It is not easy converting from the grid view to the control view.
Back to Top
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 Posted: 25-Sep-2007 at 2:13pm
The ViewContext is showing up as an IBindingViewContext type rather than the expected type of ControlViewContextBase.  The presenter base class has the following:

///
<summary>Get the ControlView's ViewContext.</summary>
protected new ControlViewContextBase ViewContext {
    get { return (ControlViewContextBase) base.ViewContext; }
}

/// <summary>Get the view's ViewContext.</summary>
IBindingViewContext IControlViewWithToolbarPresenter.ViewContext{ get { return ViewContext; } }

This is setup in the same way as the grid view presenter base class.  I tried to force the type by casting it; however, that did not work.
 
I am not sure if SetControlViewToolStripAdapterCore() is called after setting the context.  I will set some breakpoints to see if the calls are being made in the proper order.
 
 
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: 25-Sep-2007 at 2:03pm
I'd like to help, but I don't quite understand the problem.
 
What do you mean when you say you can't "get the ViewContext to behave"?  Do you get a compile error?  An exception at runtime?
 
Are you calling SetControlViewToolStripAdapterCore() after the context has been set in the presenter?
 
Bill J.
Back to Top
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 Posted: 25-Sep-2007 at 1:01pm

Ugh!  After all that work yesterday, I think I really screwed up the LIB source projects.  I added a ControlViewWithToolbarPresenterBase class in order to replicate what was done in the GridViewPresenterBase class. For the life of me, I cannot get the ViewContext to behave in the following method of the presenter class:

protected override ControlViewToolStripAdapter SetControlViewToolStripAdapterCore(object pToolStrip)
{
    return new DotNetNavigatorControlViewToolStripAdapter 
         (pToolStrip
 as BindingNavigator, BindingSource, ViewContext);
}
 
It is looking for the type ControlViewContextBase.  It is in the presenter base class.  That type is being returned as ViewContext.  And, it should be available to this presenter.  Yet, it ain't happenin'.
 
Time to take a walk.  Maybe it will all fall into place after I clear my head a little.
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: 25-Sep-2007 at 10:58am
Have you checked that the BindingSource for the ControView is properly assigned to the BindingSource property of the BindingNavigator.
 
Bill J.
Back to Top
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 Posted: 25-Sep-2007 at 9:45am

I cannot get the toolbar enabled.  I do not know where to throw the switch.  Data is showing up on the view in the tab control.  I can update the record that I am on (both customer and contact).  I just cannot see more than one contact because the navigation is disabled.  Where should I enable the toolbar?

Back to Top
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 Posted: 24-Sep-2007 at 5:39pm
Yup...the ugly VS cache was rearing up again.  Closing/reopening the solution did the trick.  I got to stop thinking it was my fault and try that first next time.
 
Anyway, now I have the data showing up (because I can now bind some controls); however, the toolbar is inactive.  I think there is a switch in there somewhere, but it is time to go home.  Maybe tomorrow I'll be able to wrap this up.
Back to Top
 Post Reply Post Reply Page  <1234>

Forum Jump Forum Permissions View Drop Down