// Renderer file for the Weekly Schedule demo white = java.awt.Color.white; bgSel = Gradient(Point(0,10), white, Point(0,90), Color(220,220,220), true, GradientUnits.PERCENT); pinkGrad = Gradient(Point(0,10), white, Point(0,90), Color(205,175,170), true, GradientUnits.PERCENT); greenGrad = Gradient(Point(0,10), white, Point(0,90), Color(170,190,170), true, GradientUnits.PERCENT); blueGrad = Gradient(Point(0,10), white, Point(0,90), Color(160,190,205), true, GradientUnits.PERCENT); tanGrad = Gradient(Point(0,10), white, Point(0,90), Color(200,170,140), true, GradientUnits.PERCENT); bgUnsel = Color(235,235,235); strokeUnsel = Color(140,140,160); strokeSel = Color(139,80,139); textUnsel = Color(80,90,120); textSel = Color(70,80,120); annoLine = Color(210,210,210); annoText = Color(105,105,110); dayFont = Font('dialog', FontStyle.BOLD_ITALIC, 13); hourFont = Font('dialog', FontStyle.ITALIC, 11); classFont = Font('dialog', FontStyle.BOLD_ITALIC, 13); profFont = Font('dialog', FontStyle.PLAIN, 11); // First pass for the chart annotations Pass({ content: List({ id: 'Annotation', content: [ // Hour (horizontal) lines Shape({ shape: '@intervalLine', position: ORIGIN, outline: annoLine, strokeWidth: 1, }), // Day (vertical) lines Shape({ shape: '@periodLine', position: ORIGIN, outline: annoLine, strokeWidth: 2, }), // Chart frame outline Shape({ shape: '@chartFrame', position: ORIGIN, outline: annoLine, strokeWidth: 2, fill: null, }), // Day labels Text({ text: '@periodLabel', font: dayFont, fill: annoText, offset: Point(0,-2), alignment: Alignment.SOUTH, }), // Hour labels left Text({ text: '@intervalLabel', position: '@pointLeft', font: hourFont, fill: annoText, offset: Point(-5,-4), alignment: Alignment.NORTH_EAST, }), // Hour labels right Text({ text: '@intervalLabel', position: '@pointRight', font: hourFont, fill: annoText, offset: Point(4,-4), alignment: Alignment.NORTH_WEST, }), ]}) // List }), // Pass // Second pass for the bookings Pass({ content: List({ id: 'Booking', content: [ // Rectangle for booking, only outlined when not selected Shape({ id: 'itemRectangle', shape: '@itemRectangle', fill: { selector: '@selected', 'true': bgSel, 'false': bgUnsel, }, outline: { selector: '@selected', 'false': strokeUnsel, }, }), // Arrow for booking Shape({ shape: '@arrow', fill: { selector: '@department', ECON: pinkGrad, MGMT: blueGrad, CPSC: greenGrad, 'default': tanGrad, }, }), // Position the booking text relative to the enclosing rectangle Text({ text: '@classID', position: BoundsPosition('itemRectangle', Alignment.NORTH), offset: Point(0, 3), alignment: Alignment.NORTH, font: classFont, fill: { selector: '@selected', 'true': textSel, 'false': textUnsel, } }), Text({ text: '@profName', position: BoundsPosition('itemRectangle', Alignment.NORTH), offset: Point(0, 15), alignment: Alignment.NORTH, font: profFont, fill: { selector: '@selected', 'true': textSel, 'false': textUnsel, } }), ]}) // List }), // Pass // Use a separate rendering pass for the selection outline to ensure // the neighboring booking doesn't cover the edge Pass({ content: Shape({ id: 'selectOutline', enabled: '@selected', shape: '@itemRectangle', fill: null, outline: strokeSel, strokeWidth: 2, }), }) // Pass