jadrake75
22 May 2009, 12:09 PM
My application has a series of MVC controllers and views for the main "structure" of the application's viewport (typical split pane, border like layout components...). I have a series of dialogs which you can think of as a windows which "show up" on top of the viewport to do some more detailed editing of some of my models.
I have a RestfulModelController which is hooked up to recieve "Submit" or "Remove" events and hands all the AJAX request stuff to save (or update) or delete a model. This emits a persistentEvent of Created, Updated or Deleted which will be captured by the controllers that have stores (or other constructs) that can get updated based on the result of changes made within the ModelController. This all works fine.
My conundrum is this. Does my dialog/panel need to be controlled by a view?
If I have three launch points (right-click on an item, a top-level menu and a toolbar somewhere) all can have an onClick listener to call:
AlbumActions.create( )
or
Dispatcher.dispatchEvent( new AppEvent( StampEvents.Create, Album.class ) );
My point is.... what would be the benefit of creating a View for the my dialog (ie. I would have a view, that upon receiving a Create event, would initialize the dialog and show it) rather than simply having a helper actions class call "show( )" after constructing the window?
In a JSP application where the View is a JSP, and it is tied to the action this makes a little more sense, but in this case it almost seems like a level of indirection without a lot of benefit. The only benefit I see, is that because my view was provided a controller when created (in this case the RestfulModelController), upon clicking "Ok" I can call that controller with the Events.Submit event type occurred rather than bubble it up to the EventDispatcher and have it bubble down through the controller heirachy to the controller who knows how to handle that model type. For the show/hide case I don't see a lot of value here.
What are people's thoughts on this?
-Jason
I have a RestfulModelController which is hooked up to recieve "Submit" or "Remove" events and hands all the AJAX request stuff to save (or update) or delete a model. This emits a persistentEvent of Created, Updated or Deleted which will be captured by the controllers that have stores (or other constructs) that can get updated based on the result of changes made within the ModelController. This all works fine.
My conundrum is this. Does my dialog/panel need to be controlled by a view?
If I have three launch points (right-click on an item, a top-level menu and a toolbar somewhere) all can have an onClick listener to call:
AlbumActions.create( )
or
Dispatcher.dispatchEvent( new AppEvent( StampEvents.Create, Album.class ) );
My point is.... what would be the benefit of creating a View for the my dialog (ie. I would have a view, that upon receiving a Create event, would initialize the dialog and show it) rather than simply having a helper actions class call "show( )" after constructing the window?
In a JSP application where the View is a JSP, and it is tied to the action this makes a little more sense, but in this case it almost seems like a level of indirection without a lot of benefit. The only benefit I see, is that because my view was provided a controller when created (in this case the RestfulModelController), upon clicking "Ok" I can call that controller with the Events.Submit event type occurred rather than bubble it up to the EventDispatcher and have it bubble down through the controller heirachy to the controller who knows how to handle that model type. For the show/hide case I don't see a lot of value here.
What are people's thoughts on this?
-Jason