tag:robotlegs.tenderapp.com,2009-10-18:/discussions/resources/35-robotlegs-example-clock-appRobotlegs: Discussion 2012-02-29T11:54:20Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/28209122010-09-08T18:43:39Z2010-09-08T18:43:40ZRobotLegs Example – Clock App<div><p>Thanks for the example. I'm pretty new to this framework but it seems like you have a lot of view stuff being done weird places. I think this'll make it pretty hard to reuse with different views.</p>
<ul>
<li><p>AddClocks command -- A command shouldn't create views and add them to the display list directly. I'd have the parent view handle this, possibly in response to a call from its mediator.</p></li>
<li><p>AlignClocksOnStage command -- Why have a command for aligning the clocks? Seems like this is a view thing too. No need for this command IMO.</p></li>
<li><p>ClockAppMediator -- shouldn't set x/y positions. Layout is the also the views responsibility. I'd probably do something like, have the view expose a centerChildren() method.</p></li>
<li><p>SetupStage -- also a view thing. I'd just do this in creationComplete.</p></li>
</ul>
<p>If you want to explore the controller/commands a bit more, how about adding a UI for setting the time?<br />
</p></div>blockagetag:robotlegs.tenderapp.com,2009-10-18:Comment/28209122010-09-15T21:08:39Z2010-09-15T21:08:39ZRobotLegs Example – Clock App<div><p>Hi,</p>
<p>thanks for the reply, I'm going to think about your comments and change the app where appropriate.</p>
<p>I will post an update soon.</p>
<p>Simone</p></div>simonetag:robotlegs.tenderapp.com,2009-10-18:Comment/28209122010-09-16T19:12:39Z2010-09-16T19:12:39ZRobotLegs Example – Clock App<div><p>Hi,</p>
<p>I've pushed a new branch called blockageReview and here is the repo</p>
<p><a href="mailto:git@github.com">git@github.com</a>:vizio360/RobotLegs-Clock-App-Demo.git</p>
<p>where I think I fixed all the issues you raised in your review.</p>
<p>AddClocks command -- A command shouldn't create views and add them to the display list directly. I'd have the parent view handle this, possibly in response to a call from its mediator.<br />
--- Maybe I'm not getting it right, but somewhere in the code I will need to create the Views, and I don't really want to inject them into the mediator as I don't want to tightly couple the Main View Mediator with its children, but I agree with you that I shouldn't modify a view directly in a command.
What I've done is creating a command for each view creation, which dispatches an event which then the Main App view is listening to.</p>
<p>AlignClocksOnStage command -- Why have a command for aligning the clocks? Seems like this is a view thing too. No need for this command IMO.<br />
--- I made this decision because I found easier to locate where things are done by looking at the commands name, but I can see your point, and I agree so I moved this responsibility to the main app view.</p>
<p>ClockAppMediator -- shouldn't set x/y positions. Layout is the also the views responsibility. I'd probably do something like, have the view expose a centerChildren() method.<br />
--- as mentioned above I moved it into the main app view.</p>
<p>SetupStage -- also a view thing. I'd just do this in creationComplete.<br />
--- here I thought about treating the stage as a view so I've created a mediator specifically for the Stage. The stage can be seen as the DisplayObject at the top of the display list so why not treat it as a view?</p>
<p>about expanding it so to be able to change the time, I need to work on it but it won't be soon..</p>
<p>thanks for spending time looking at my code, and yet again there is always stuff to learn :)</p>
<p>cheers<br />
Simone<br />
</p></div>simonetag:robotlegs.tenderapp.com,2009-10-18:Comment/28209122010-09-17T10:58:20Z2010-09-17T10:58:20ZRobotLegs Example – Clock App<div><p>@Simone</p>
<p>Inspired by your pretty clock I started working on an analog clock for Flex & AIR, which I want to use in one of my projects.<br />
I used your script for the time and clock’s hands settings.<br />
In my example the time’s setting occurs in the view.<br />
The Clock is customizable.<br />
I use Models + Commands for setting the time-zone and the styles (colors, logo) of the clock.</p>
<p>My goal is to be able to add different Clocks to the application, each showing a different time and eventually having different looks.</p>
<p>Also it would be nice if I could add a starting time (for example: the moment I start working on a project).<br />
The clock’s Face would change, i.e. circular sectors in a different color would show the time elapsed. By the end of the day (or night) or whenever I stop working the elapsed time should be inserted into the DB table for that project. Hmmm, I wish I could explain it better.</p>
<p>Maybe we (and others) should try to collaborate and make 3 versions of the clock: Flash, Flex and AIR.</p>
<p>My Clock has several weak points at this stage:</p>
<ul>
<li><p>one of them is the positioning of the clock’s components, which is a real mess</p></li>
<li><p>there is no input validation for the form used to customize the clock</p></li>
<li><p>the time zone offset is just an array set in the Model - it should be a real list of time zones</p></li>
<li><p>I need a better solution for the drawing of circle sectors and the curved text</p></li>
</ul>
<p>Of course there are more things that should to be improved. It’s a work in progress.</p>
<p>I hope to hear everyone's opinion and/or suggestions :)</p>
<p><a href="http://ondina.github.com/clock/RobotlegsClock.html">http://ondina.github.com/clock/RobotlegsClock.html</a></p>
<p><a href="http://github.com/Ondina/robotlegsclock">http://github.com/Ondina/robotlegsclock</a></p>
<p>Ondina</p></div>Ondina D.F.