Dojo, XPages and Graphics, oh My....
OK, I've kind-of started working on placing entries on the day and week views of the XPages calendar. I've come across a feature of dojo called dojox.gfx. This is a vector graphics engine for placing shapes on the screen and is also used in the dojo charting side of things. Now, I'm not sure if this is the best thing to use but is what I've found so far that kind-of matches what I need to do. However, this library seems to be client side JavaScript driven, at least that's the only way I've found to get stuff to show up on the page.
With the gfx engine being client side JavaScript this poses a few problems:
- I can't get at the sessionScope, viewScope and requestScope variables
- I'm not sure how to get at the data I need unless we put it in a hidden field, which is of course doable
- You have to create a drawing surface to put shapes on and it is assigned a size, you then place a shape of a certain size onto the drawing surface. This is all controlled via x,y coordinates. While I could get the screen resolution of whatever browser is looking at the calendar, I would then have to accommodate all the different resolutions out there and figure out where to place a shape. This makes me shiver just thinking about it.
- In CSS when you define a size in pixels, it's not really that size and the size you define also includes the padding and margins. So if you say something is 75px tall with a 1px padding. It's actually 77px tall, at least the best I can tell, it may be different depending on the monitor. This makes figuring out how tall to make an entry kind-of difficult. I guess I could loop through the time span making only small shapes that are all jammed together to make one big shape.
On the plus side, this is very cool stuff to be working with and it's very easy. I was putting shapes on the screen in less than 5 minutes and with only 4 lines of code to put a movable rectangle on the screen, development should be pretty quick, theoretically at least. The dojox.gfx engine also allows you to do gradients and path type drawings, rotate shapes via a slider, resize shapes and I'm sure some other stuff. Very cool.
So, that's where I'm at. If someone has a better idea on how to put entries on a day/week view calendar and then show their duration I'm all ears (or eyes as the case may be).











Comments
Date: 03/04/2010 05:43:50 PM
Name: Steve Castledine
Website: http://www.stevecastledine.com
Try these client side and start to see possibilities :) Must be somwhere within xpage not script library
var tmp="#{serverScope.variable}";
var tmp="#{javascript:@DbName()}";
Date: 03/04/2010 09:23:38 PM
Name: Nathan T. Freeman
Website: http://nathan.lotus911.com
Or you could do what Medusa does and pass the information through in a meta tag. Or you could use Jeremy Hodge's technique for embedding contextual data. { Link }
Lots of ways to skin this cat.
Date: 03/05/2010 04:07:01 AM
Name: Paul Withers
Website: http://http:hermes.intec.co.uk/intec/blog.nsf
I seem to remember I found that IE and Firefox handle the padding slightly differently, that one includes the padding in the total figure and one excludes it. I may be wrong, but it's worth checking. If so, you should be able to use dojo.isIE.
dojox.gfx sounds a slick solution. The only alternative I could think of would be using a repeat control to create a table with x fixed-height rows, depending on the duration. But it sounds like dojox.gfx will be easier and look much better.