tag:robotlegs.tenderapp.com,2009-10-18:/discussions/questions/714-multiple-views-update-the-same-vo-in-modelRobotlegs: Discussion 2018-10-18T16:35:34Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/114311682011-11-15T16:51:42Z2011-11-15T16:51:43ZMultiple views update the same VO in Model<div><p>Hey,</p>
<p>First of, your views Mediators are listening to changes on the
model right and like you said: "views listening to changes to the
same VO" ?</p>
<p>Other things aside:<br>
If the new value of the VO is changed, you could put a bit of
view-logic to check if the value coming in is the same as the
current view-value, then do nothing...</p>
<p>Might be more of help if you posted some reference code.</p>
<p>/Pierre</p></div>Pierre Laveklinttag:robotlegs.tenderapp.com,2009-10-18:Comment/114311682011-11-15T16:53:12Z2011-11-15T16:53:13ZMultiple views update the same VO in Model<div><p>*"and not like you said..."</p></div>Pierre Laveklinttag:robotlegs.tenderapp.com,2009-10-18:Comment/114311682011-11-15T18:20:37Z2011-11-15T18:20:38ZMultiple views update the same VO in Model<div><p>Hi Pierre!</p>
<p>Yeah, so more explanations would be better. Ive ommited all the
RL logic view>mediator>command>model>mediator>view,
couse I dont want to complicate. But Im doing it like this.</p>
<p>More details to make it clear: I have an object which properties
are visualized in 4 different places: 2D, 3D, properties panel, and
quick menu. So if I change eg. x position in properties it should
change in 2D (if current). If 3D view is current one and I move the
object, it should update properties panel and when I switch to 2D
view it also should be updated.</p>
<p>And as I said before: When 1 view is edited I don't want the
value to go around through Model and back to this view. It should
dispatch to model and change internally.</p>
<p>ps</p></div>pstag:robotlegs.tenderapp.com,2009-10-18:Comment/114311682011-11-15T18:33:46Z2011-11-15T18:33:47ZMultiple views update the same VO in Model<div><p>Ok:<br>
( bare with me, written on my iPhone ) AView {</p>
<pre>
<code>changeSignal.dispatch( aPayload );</code>
</pre>
<p>}</p>
<p>AMediator {</p>
<pre>
<code>view.changeSignal.add( onChange );
eventMap.mapListener( ModelEvent.PROPS_CHANGED, onPropsChanged );
onChange( inPayload ):void
{
injectedModel.setProps( inPayload );
view.setReflectedProps( inPayload );
}
onPropsChanged( event:Event ):void
{
// nasty mediator logic
var pl:Payload = event.payLoad;
if( view.props != pl )
view.setReflectedProps( inPayload );
}</code>
</pre>
<p>}</p>
<p>Does that make sense or am I am I on the wrong track?</p></div>Pierre Laveklinttag:robotlegs.tenderapp.com,2009-10-18:Comment/114311682011-11-15T18:59:11Z2011-11-15T18:59:11ZMultiple views update the same VO in Model<div><p>Looks that it will work, I dont see any unnecessary actions.
That should do the trick! Thanks Pierre!</p></div>ps