1515 < link href ="../../min/primitives.latest.css?5100 " media ="screen " rel ="stylesheet " type ="text/css " />
1616
1717 < script type ='text/javascript '>
18+ var minimizedItemShapeTypes = [
19+ primitives . common . ShapeType . Rectangle ,
20+ primitives . common . ShapeType . Oval ,
21+ primitives . common . ShapeType . Triangle ,
22+ primitives . common . ShapeType . CrossOut ,
23+ primitives . common . ShapeType . Circle ,
24+ primitives . common . ShapeType . Rhombus ,
25+ primitives . common . ShapeType . Wedge ,
26+ primitives . common . ShapeType . FramedOval ,
27+ primitives . common . ShapeType . FramedTriangle ,
28+ primitives . common . ShapeType . FramedWedge ,
29+ primitives . common . ShapeType . FramedRhombus
30+ ] ,
31+ shapeIndex = 0 ,
32+ itemTitleColors = [
33+ primitives . common . Colors . Red ,
34+ primitives . common . Colors . Green ,
35+ primitives . common . Colors . Navy ,
36+ primitives . common . Colors . Cyan
37+ ] ,
38+ colorIndex = 0 ;
39+
40+ function getNextShapeType ( ) {
41+ var result = minimizedItemShapeTypes [ shapeIndex ] ;
42+ shapeIndex += 1 ;
43+ if ( shapeIndex == minimizedItemShapeTypes . length ) {
44+ shapeIndex = 0 ;
45+ }
46+ return result ;
47+ }
48+
49+ function getNextColor ( ) {
50+ var result = itemTitleColors [ colorIndex ] ;
51+ colorIndex += 1 ;
52+ if ( colorIndex == itemTitleColors . length ) {
53+ colorIndex = 0 ;
54+ }
55+ return result ;
56+ }
57+
58+ function getMarkerTemplate ( ) {
59+ var result = new primitives . orgdiagram . TemplateConfig ( ) ;
60+ result . name = "MarkerTemplate" ;
61+ result . minimizedItemSize = new primitives . common . Size ( 8 , 8 ) ;
62+ result . highlightPadding = new primitives . common . Thickness ( 4 , 4 , 4 , 4 ) ;
63+ return result ;
64+ }
65+
1866 $ ( document ) . ready ( function ( ) {
19- var options = new primitives . orgdiagram . Config ( ) ;
67+ var options = new primitives . orgdiagram . Config ( ) ;
2068
21- var rootItem = new primitives . orgdiagram . ItemConfig ( {
22- id : 0 ,
23- parent : null ,
24- title : "Title 0" ,
25- description : "Description" ,
26- image : "../images/photos/a.png"
27- } ) ;
28- var levelItems = [ rootItem ] ;
29- var items = [ rootItem ] ;
30- var id = 1 ;
31- for ( var levelIndex = 0 ; levelIndex < 4 ; levelIndex += 1 ) {
32- var newLevelItems = [ ] ;
33- for ( var index = 0 ; index < levelItems . length ; index += 1 ) {
34- var parent = levelItems [ index ] ;
35- for ( var index2 = 0 ; index2 < 2 ; index2 ++ ) {
36- var newItem = new primitives . orgdiagram . ItemConfig ( {
37- id : ++ id ,
38- parent : parent . id ,
39- title : id . toString ( ) + " Title" ,
40- description : id . toString ( ) + " Description" ,
41- image : "../images/photos/b.png"
42- } ) ;
43- items . push ( newItem ) ;
44- newLevelItems . push ( newItem ) ;
45- }
69+ var rootItem = {
70+ id : 0 ,
71+ parent : null ,
72+ title : "Title 0" ,
73+ description : "Description" ,
74+ image : "../images/photos/a.png" ,
75+ minimizedItemShapeType : ( getNextShapeType ( ) ) ,
76+ itemTitleColor : ( getNextColor ( ) )
77+ } ;
78+ var levelItems = [ rootItem ] ;
79+ var items = [ rootItem ] ;
80+ var id = 1 ;
81+ for ( var levelIndex = 0 ; levelIndex < 4 ; levelIndex += 1 ) {
82+ var newLevelItems = [ ] ;
83+ for ( var index = 0 ; index < levelItems . length ; index += 1 ) {
84+ var parent = levelItems [ index ] ;
85+ for ( var index2 = 0 ; index2 < 2 ; index2 ++ ) {
86+ var newItem = {
87+ id : ++ id ,
88+ parent : parent . id ,
89+ title : id . toString ( ) + " Title" ,
90+ description : id . toString ( ) + " Description" ,
91+ image : "../images/photos/b.png" ,
92+ minimizedItemShapeType : ( getNextShapeType ( ) ) ,
93+ itemTitleColor : ( getNextColor ( ) )
94+ } ;
95+ items . push ( newItem ) ;
96+ newLevelItems . push ( newItem ) ;
4697 }
47- levelItems = newLevelItems ;
4898 }
99+ levelItems = newLevelItems ;
100+ }
49101
50- /* collect all ids */
51- var selectedItems = [ ] ;
52- for ( var index = 0 ; index < items . length ; index += 1 ) {
53- selectedItems . push ( items [ index ] . id ) ;
54- }
102+ /* collect all ids */
103+ var selectedItems = [ ] ;
104+ for ( var index = 0 ; index < items . length ; index += 1 ) {
105+ selectedItems . push ( items [ index ] . id ) ;
106+ }
55107
56- options . items = items ;
57- options . cursorItem = 0 ;
58- options . showFrame = true ;
59- options . hasSelectorCheckbox = primitives . common . Enabled . True ;
60- options . pageFitMode = primitives . common . PageFitMode . None ;
61- options . selectedItems = selectedItems ;
108+ options . items = items ;
109+ options . cursorItem = 0 ;
110+ options . showFrame = true ;
111+ options . frameInnerPadding = 4 ;
112+ options . frameOuterPadding = 4 ;
113+ options . templates = [ getMarkerTemplate ( ) ] ;
114+ options . defaultTemplateName = "MarkerTemplate" ;
115+ options . hasSelectorCheckbox = primitives . common . Enabled . True ;
116+ options . pageFitMode = primitives . common . PageFitMode . None ;
117+ options . selectedItems = selectedItems ;
62118
63- jQuery ( "#basicdiagram" ) . orgDiagram ( options ) ;
119+ jQuery ( "#basicdiagram" ) . orgDiagram ( options ) ;
64120 } ) ;
65121
66122 </ script >
67123</ head >
68124
69125< body >
70- < div id ="basicdiagram " style ="width: 640px; height: 480px; border-style: dotted; border-width: 1px; " />
126+ < div id ="basicdiagram " style ="width: 640px; height: 480px; border-style: dotted; border-width: 1px; " />
71127</ body >
72128
73129</ html >
0 commit comments