// Renderer file for the Orgchart demo with tiered layout gray = Color(110,110,110); medGray = Color(170,167,160); lightGray = Color(240,237,230); red = Color(200,60,60); darkBlue = Color(70,70,90); font12 = Font('Dialog', FontStyle.PLAIN, 12); font10 = Font('Dialog', FontStyle.PLAIN, 10); stroke1 = new java.awt.BasicStroke(1); stroke2 = new java.awt.BasicStroke(2); // Configuration function to set the node's outline based on whether // the element is selected. var setOutline = function(ren, selected) { if (selected) { ren.setStroke(stroke2); ren.setOutline(red); } else { ren.setStroke(stroke1); ren.setOutline(gray); } } // First pass for the links Pass({ content: Shape({ id: 'Link', shape: '@linkPath', position: ORIGIN, selection: Selection.NONE, outline: gray, fill: null, }), }) // Pass // Second pass for the nodes Pass({ content: List({ id:'Node', content: [ Bounds({ id: 'outline', referenceId: 'text', padding: 4, arcWidth: 10, arcHeight: 10, fill: lightGray, config: Script('setOutline(R, selected);'), }), List({ id: 'text', content: [ Text({ text: '@name', alignment: Alignment.NORTH_WEST, font: font12, fill: red, }), Text({ text: '@contactName', alignment: Alignment.NORTH_WEST, offset: Point(10, 16), font: font10, fill: darkBlue, }), Text({ text: '@contactInfo', alignment: Alignment.NORTH_WEST, offset: Point(10, 30), font: font10, fill: darkBlue, }), ] // List.content }), // List // Handle to expand or hide subtrees. // linkPosition is a property of TreeElement. The TreeLayout // listens for TagSelection events for tag 'state' // (enabled by the demo). Shape({ id: 'handle', shape: Rectangle(-4,0,8,6), position: '@linkPosition', fill: medGray, selectionTag: 'state', }), ]}) // List }) // Pass