tag:robotlegs.tenderapp.com,2009-10-18:/discussions/problems/315-navigation-question-buttonsRobotlegs: Discussion 2018-10-18T16:35:26Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/72809042011-05-17T11:11:24Z2011-05-17T11:11:25ZNavigation Question : Buttons<div><p>I been thinking about the best practice for navigation elements
in RL.</p>
<p>One Idea I have, and forgive me if this is a very simple
question, is to have a separate NavView class mediated by
NavViewMediator. When a button is clicked in NavView the mediator
updates the Model with the new state and Model dispatches a
SystemEvent that ContentViewMediator catches and updates
ContentView. So far so good ?</p>
<p>My question now is what about the Navigation buttons themselwes.
Should they be compartmentalized as in : the code for a Button put
inside the view.components package as a new package below
components? This will most likely only be one class that could for
example extend SimpleButton ?</p>
<p>So my question is what is the best strategy for where to put
Navigation buttons ?</p>
<p>Thanks on beforehand</p>
<p>Thomas</p></div>thomas.thorstenssontag:robotlegs.tenderapp.com,2009-10-18:Comment/72809042011-05-17T11:19:22Z2011-05-17T11:19:22ZNavigation Question : Buttons<div><p>Maybe it is not necessary to create a class for every button. So
the idea with NavView + NavViewMediator is good, but I don't think
that updating the model from the mediator is the best practice.
Usually I'm dispatching an event from the mediator to the event bus
and there is a command which is mapped to this event. Actually the
command updates the model or directly changes the content.</p></div>krasimirtag:robotlegs.tenderapp.com,2009-10-18:Comment/72809042011-05-17T12:13:34Z2011-05-17T12:13:34ZNavigation Question : Buttons<div><p>Yes I forgot that I actually also update Model via Commands
only.</p>
<p>But then to the main question. If I have ony class only (for all
buttons) for things like hoover,roll out and whatnot.</p>
<p>Should I compartmentalize it, as in create a package named
button inside view.components package ?</p>
<p>Remember NavView and NavViewMediator goes where they should so
Im clear over that.</p>
<p>But what about the button class itself for the buttons that
NavView contain. Should I compartmentalize it so that NavView
compoes/instantiates the button using the new keyword? Lol</p>
<p>Thanks</p>
<p>Thomas</p></div>thomas.thorstenssontag:robotlegs.tenderapp.com,2009-10-18:Comment/72809042011-05-17T12:23:25Z2011-05-17T12:23:25ZNavigation Question : Buttons<div><p>To be honest in 80% of the cases I'm using one class to manage a
navigation component like yours. I mean if I have a simple menu
with few buttons. In the rest 20% I have more complex logic like
drop-down menus or some animations of the buttons. In such kind of
cases it is good to have a specific class for the buttons. I guess
it depends of the type of your navigation.</p></div>krasimirtag:robotlegs.tenderapp.com,2009-10-18:Comment/72809042011-05-17T12:40:20Z2011-05-17T12:40:20ZNavigation Question : Buttons<div><p>I see , but in those more complex cases you would seal that off
from the rest of the application yes ? For example (good point !)
in the case of a Menu with Sub Menu.</p>
<p>Thanks for the speedy replies</p>
<p>Thomas</p></div>thomas.thorstensson