New Posts New Posts RSS Feed: Adding to Root menu
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Forum LockedAdding to Root menu

 Post Reply Post Reply
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: Adding to Root menu
    Posted: 21-Mar-2008 at 12:53pm
I have added a button to the root menu. I added a button called Edit and under that Options.
 
In the FoundationModule I have a CommandHandler for that button that needs to open up an editor.
I have the call to the editor to display an EntityEditorController that I have created.
 
I get an error here: (From the inherited reference to PageController) 

protected void CreateDefaultEntityManager() {

Guard.ArgumentNotNullOrEmptyString(Id, "Id"); // Id is null for some reason

 

Any ideas would be great?

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: 26-Mar-2008 at 11:06am
It looks like your EntityEditorController has not been passed the workitem that it controls or its workitem does not have an Id assigned.
 
How are you creating your editor?  Are you using the EntityEditorService?
 
The EntityEditorService contains (amongst a lot of other code) this method:

/// <summary>

/// Make a new Editor instance (to edit existing or new entity)

/// given the type of an Editor to make

/// that is not mapped to another type.

/// </summary>

private IEntityEditorController MakeUnmappedEditor<TEditor>()

where TEditor : IEntityEditorController {

ControlledWorkItem<TEditor> editorWorkItem =

WorkItem.WorkItems.AddNew<ControlledWorkItem<TEditor>>();

IEntityEditorController editor = editorWorkItem.Controller;

EditorKeys.Add(new EditorKey(editor));

return editor;

}

If you're not using the EntityEditorService, your command handler will need to do something similar.
 
(The line adding the new EditorKey is of course only needed in the service implementation).
 
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: 26-Mar-2008 at 11:16am

From what I can tell that method is never used. So, I should create my instance of AddNew<> that calls the new method.

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: 26-Mar-2008 at 11:31am

For your editor to work, it must be created as the controller of a ControlledWorkItem.  You accomplish that with:

WorkItem.WorkItems.AddNew<ControlledWorkItem<TEditor>>();

IEntityEditorController editor = editorWorkItem.Controller;

If you want to encapsulate that inside of an AddNew<TEditor>() method, that's OK.
 
Bill J.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down