Hi Markus,
You are right. The script you gave has a flavor of being ad-hoc and prone to being
complex.
The script we gave you was intended to be used as an illustration of RTCalendarBuilder.
Wrapping and shaping the script into a builder is the natural following step.
There is a chapter about that topic on:
The first question you need to ask yourself is what is your domain? Are these simple
dates? Or something else (e.g., abstract event for which a date is an event's
attribute).
The builder should then takes as input your domain. Let us know if you need further help
:-)
Cheers,
Alexandre
On May 1, 2017, at 6:28 AM, Markus Böhm
<markus.boehm(a)gmail.com> wrote:
Hi Milton, tx once again. It's really tempting to experiment with
Pharo's/Roassal's live coding. May I ask concerning OO model (I'm not an
expert, but want to learn):
I modified Your snippet slightly, to mark e.g. easter or a birthday. The code block [:d |
... ], handed over to "RTEllipse new color:" is executed for every day in a
year; so for every day (365 times) it is checked if that day is easter (or a birthday
...). Would it be not more efficient to have an OO model that allows to receive such
messages and execute them only >once<, similar to "mark: #easter with: Color
red." or "mark collection of dates with Color red". Beyond that it seems to
be necessary to construct the easter Date object 365 times as well, because year can only
be derived from d within code block? But I guess there might be a workaround?
BR Markus
Week startDay: #Monday.
b := RTCalendarBuilder new.
b dateShape composite: [ :com |
com add: (RTEllipse new color: [ :d |
(d = Date today) | (d = (Date easterDateFor: d year)) | (d = (Date newDay: 12 month:
#August year: d year))
ifTrue: [ Color blue trans ]
ifFalse: [Color transparent]]; size: 18).
com add: (RTLabel new text: [:d| d dayOfMonth];
color: [:d | (d dayOfWeek = 1)
ifTrue: [Color red]
ifFalse: [ Color black] ]) ].
b showDayNames.
b yearShape composite: [ :comp |
comp add: (RTLabel new text: [ :d | d year ]; height: 20 ).
comp add: (RTBox new color: [ Color blue alpha: 0.1 ]). ] .
b dates: Year current.
b build.
^ b view
On Fri, Apr 28, 2017 at 3:49 PM, Markus Böhm <markus.boehm(a)gmail.com> wrote:
Hi Milton, Alexandre
tx for remembering, implementing and providing. I installed it and the calendar view
looks really great. BR Markus
On Fri, Apr 28, 2017 at 11:40 AM, Alexandre Bergel <alexandre.bergel(a)me.com>
wrote:
Hi Markus,
Milton worked on the issue. With the last version of Roassal, can you try the following
code?
-=-=-=-=-=-=
| b |
Week startDay: #Monday.
b := RTCalendarBuilder new.
b dateShape composite: [ :com |
com add: (RTEllipse new color: [ :d |
d = Date today
ifTrue: [ Color blue trans ]
ifFalse: [Color transparent] ]; size: 18).
com add: (RTLabel new text: [:d| d dayOfMonth];
color: [:d | (d dayOfWeek = 1)
ifTrue: [Color red]
ifFalse: [ Color black ] ]) ].
b showDayNames.
b yearShape composite: [ :comp |
comp add: (RTLabel new text: [ :d | d year ]; height: 20 ).
comp add: (RTBox new color: [ Color blue alpha: 0.1 ]). ] .
b dates: Year current.
b build.
^ b view
-=-=-=-=-=-=
It produces:
<33871758-2bcb-11e7-8fbf-ff1284fc607b.png>
Let us know how it goes
Cheers,
Milton & Alexandre
On Apr 21, 2017, at 1:58 PM, Markus Böhm
<markus.boehm(a)gmail.com> wrote:
May I ask:
Roassal and Pharo are really fantastic. I’m trying to get a grip on it and use it. What
makes me think:
In the introduction of the superb “Agile Visualization” book it is stated, that the
Roassal OO approach allows for visualizations that are “easily extensible”. I guess
compared to hand-crafted, imperative visualizations.
Let’s take an example: RTCalendarBuilder
I noticed that present visualization of week days start with Sunday as first day of week.
E.g. in Europe/Germany weeks start on Monday (according ISO8601). We are visually so used
to it, that other schemes make us think (not intuitive).
How could I modify this?
P.S.: Especially in calendrical visualizations there will be many (local) variations. So
maybe it’s a good example to understand how to easily extend Roassal in above and similar
topics as an interested user.
BR Mike
_______________________________________________
Moose-dev mailing list
Moose-dev(a)list.inf.unibe.ch
https://www.list.inf.unibe.ch/listinfo/moose-dev
_______________________________________________
Moose-dev mailing list
Moose-dev(a)list.inf.unibe.ch
https://www.list.inf.unibe.ch/listinfo/moose-dev
_______________________________________________
Moose-dev mailing list
Moose-dev(a)list.inf.unibe.ch
https://www.list.inf.unibe.ch/listinfo/moose-dev