Hi,
It's me again! ;) I'm building a calendar visualization inspired by http://www.xconomy.com/wordpress/wp-content/images/2012/11/skeuo-calendar.pn....
Each node of visualization will be a month that contains: - An header (with (a) the name of the month and (b) the headers for the columns containing 'Mon' 'Tue' 'Wed' etc.) - Inner nodes for the days
I created such visualization without the headers and now I'm wondering which is the clearer solution to add them.
As I wrote in the previous mail, I'm using nodes:forEach: to generate the visualization with inner nodes.
The first solution that came to my mind is to nest another nodes:forEach to draw the headers. Let me explain:
view nodes: months forEach: [ :month | … headers := OrderedCollection with: month name . headers addAll: #('Sun' 'Mon' 'Tue' 'Wed' 'Thu' 'Fri' 'Sat' ).
view nodes: headers forFirst: [ :header | 'The first header is an instance of the Month class, which is used as a key in the Dictionary that represents my data.' 'Thus I use that to recover the days for the current month from the dictionary'
days := myData at: header. view nodes: days. ] ]
Notice that nodes:forFirst: is a message I implemented that works like nodes:forEach: but only considers the first node of nodes and attaches the inner nodes only to that element.
I feel this solution is a bit of a hack. How would you do it in a cleaner way?
____
Another question concerns drag & drop. I set my inner nodes (i.e, days) to be not draggable since I do not want the user to drag them, but I want the user to be able to drag the entire shape representing a month (i.e., outer node). As an effect to drag the month you should explicitly start the dragging from the outer node but this is counter intuitive. I'd like to be able to drag the month also from its inner nodes (days).
Is there a way to propagate the interaction and from the inner nodes I can drag the container shape? ____
Thanks in advance, Roberto