Skip to content

Commit 07cf917

Browse files
Added polyline offset tests
1 parent df74c85 commit 07cf917

File tree

6 files changed

+698
-325
lines changed

6 files changed

+698
-325
lines changed
Lines changed: 213 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,213 @@
1+
<!DOCTYPE html>
2+
<html>
3+
4+
<head>
5+
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
6+
<title>Inactive items in family chart layout</title>
7+
8+
<!-- # include file="../../src.primitives/src.primitives.html"-->
9+
<script type="text/javascript" src="../../min/primitives.min.js?5100"></script>
10+
<link href="../../min/primitives.latest.css?5100" media="screen" rel="stylesheet" type="text/css" />
11+
12+
<script type='text/javascript'>
13+
var control;
14+
15+
document.addEventListener('DOMContentLoaded', function () {
16+
var options = new primitives.famdiagram.Config();
17+
var items = [
18+
new primitives.famdiagram.ItemConfig({
19+
id: 2000,
20+
parents: null,
21+
title: "Scott Aasrud",
22+
description: "Co-CEO",
23+
image: "../images/photos/a.png"
24+
}),
25+
new primitives.famdiagram.ItemConfig({
26+
id: 2100,
27+
parents: null,
28+
title: "Scott Aasrud 2",
29+
description: "Co-CEO",
30+
image: "../images/photos/a.png"
31+
}),
32+
new primitives.famdiagram.ItemConfig({ id: 2001, parents: [2000, 2100], hasSelectorCheckbox: false, templateName: "DepartmentTitleTemplate", title: "Finance", itemTitleColor: "Green" }),
33+
34+
new primitives.famdiagram.ItemConfig({
35+
id: 1000,
36+
parents: null,
37+
title: "Scott Aasrud",
38+
description: "Co-CEO",
39+
image: "../images/photos/a.png"
40+
}),
41+
new primitives.famdiagram.ItemConfig({
42+
id: 1100,
43+
parents: null,
44+
title: "Scott Aasrud 2",
45+
description: "Co-CEO",
46+
image: "../images/photos/a.png"
47+
}),
48+
new primitives.famdiagram.ItemConfig({ id: 1001, parents: [1000, 1100], hasSelectorCheckbox: false, templateName: "DepartmentTitleTemplate", title: "Finance", itemTitleColor: "Green" }),
49+
50+
new primitives.famdiagram.ItemConfig({
51+
id: 0,
52+
parents: null,
53+
title: "Scott Aasrud",
54+
description: "Co-CEO",
55+
image: "../images/photos/a.png"
56+
}),
57+
new primitives.famdiagram.ItemConfig({
58+
id: 100,
59+
parents: null,
60+
title: "Scott Aasrud 2",
61+
description: "Co-CEO",
62+
image: "../images/photos/a.png"
63+
}),
64+
new primitives.famdiagram.ItemConfig({ id: 1, parents: [0, 100], hasSelectorCheckbox: false, templateName: "DepartmentTitleTemplate", title: "Finance", itemTitleColor: "Green" }),
65+
new primitives.famdiagram.ItemConfig({
66+
id: 2,
67+
parents: [1],
68+
title: "Ted Lucas",
69+
description: "VP, Human Resources",
70+
image: "../images/photos/b.png"
71+
}),
72+
new primitives.famdiagram.ItemConfig({ id: 3, parents: [0, 100], hasSelectorCheckbox: false, templateName: "DepartmentTitleTemplate", title: "Sales", itemTitleColor: "Navy" }),
73+
new primitives.famdiagram.ItemConfig({
74+
id: 4,
75+
parents: [3],
76+
title: "Fritz Stuger",
77+
description: "VP, Human Resources",
78+
image: "../images/photos/b.png"
79+
}),
80+
new primitives.famdiagram.ItemConfig({ id: 5, parents: [0, 100], hasSelectorCheckbox: false, templateName: "DepartmentTitleTemplate", title: "Operations", itemTitleColor: "Magenta" }),
81+
new primitives.famdiagram.ItemConfig({
82+
id: 6,
83+
parents: [5],
84+
title: "Brad Whitt",
85+
description: "VP, Human Resources",
86+
image: "../images/photos/b.png"
87+
}),
88+
new primitives.famdiagram.ItemConfig({ id: 7, parents: [0, 100], hasSelectorCheckbox: false, templateName: "DepartmentTitleTemplate", title: "IT", itemTitleColor: "Orange" }),
89+
new primitives.famdiagram.ItemConfig({
90+
id: 8,
91+
parents: [7],
92+
title: "Ted Whitt",
93+
description: "VP, Human Resources",
94+
image: "../images/photos/b.png"
95+
}),
96+
new primitives.famdiagram.ItemConfig({
97+
id: 18,
98+
parents: [7],
99+
title: "Ted Whitt 2",
100+
description: "VP, Human Resources",
101+
image: "../images/photos/b.png"
102+
}),
103+
{ id: 19, parents: [2], isVisible: true, description: "VP, Security Technology Unit (STU)", email: "robemorg@name.com", groupTitleColor: "#4169e1", image: "../images/photos/y.png", itemTitleColor: "#4b0082", phone: "308-532-6548", title: "Robert Morgan" },
104+
{ id: 20, parents: [2], isVisible: true, description: "GM, Software Serviceability", email: "idabene@name.com", groupTitleColor: "#4169e1", image: "../images/photos/a.png", itemTitleColor: "#4b0082", phone: "765-723-1327", title: "Ida Benefield" },
105+
{ id: 21, parents: [4], isVisible: true, description: "GM, Core Operating System Test", email: "vadaduho@name.com", groupTitleColor: "#4169e1", image: "../images/photos/d.png", itemTitleColor: "#4b0082", phone: "303-333-9215", title: "Vada Duhon" },
106+
{ id: 22, parents: [4], isVisible: true, description: "GM, Global Platform Technologies and Services", email: "willloyd@name.com", groupTitleColor: "#4169e1", image: "../images/photos/f.png", itemTitleColor: "#4b0082", phone: "585-309-6253", title: "William Loyd" },
107+
{ id: 23, parents: [6], isVisible: true, description: "Sr. VP, NAME & Personal Services Division", email: "craiblue@name.com", groupTitleColor: "#4169e1", image: "../images/photos/g.png", itemTitleColor: "#4b0082", phone: "915-355-4705", title: "Craig Blue" },
108+
{ id: 24, parents: [6], isVisible: true, description: "VP, NAME Communications Services and Member Platform", email: "joelcraw@name.com", groupTitleColor: "#4169e1", image: "../images/photos/h.png", itemTitleColor: "#4b0082", phone: "650-623-3302", title: "Joel Crawford" },
109+
{ id: 25, parents: [8], isVisible: true, description: "VP & CFO, NAME", email: "barblang@name.com", groupTitleColor: "#4169e1", image: "../images/photos/o.png", itemTitleColor: "#4b0082", phone: "618-822-7345", title: "Barbara Lang" },
110+
{ id: 26, parents: [8], isVisible: true, description: "VP, NAME Operations", email: "barbfaul@name.com", groupTitleColor: "#4169e1", image: "../images/photos/d.png", itemTitleColor: "#4b0082", phone: "641-678-7646", title: "Barbara Faulk" },
111+
{ id: 27, parents: [18], isVisible: true, description: "VP, NAME Global Sales & Marketing", email: "stewwill@name.com", groupTitleColor: "#4169e1", image: "../images/photos/z.png", itemTitleColor: "#4b0082", phone: "803-746-8733", title: "Stewart Williams" },
112+
{ id: 28, parents: [18], isVisible: true, description: "Sr. VP, NAME Information Services & Merchant Platform", email: "robelemi@name.com", groupTitleColor: "#4169e1", image: "../images/photos/y.png", itemTitleColor: "#4b0082", phone: "425-590-4308", title: "Robert Lemieux" }
113+
];
114+
115+
options.items = items;
116+
options.cursorItem = 0;
117+
options.selectionPathMode = primitives.common.SelectionPathMode.FullStack;
118+
options.neighboursSelectionMode = primitives.common.NeighboursSelectionMode.ParentsChildrenSiblingsAndSpouses;
119+
options.templates = [getDepartmentTitleTemplate()];
120+
options.onItemRender = onTemplateRender;
121+
options.hasSelectorCheckbox = primitives.common.Enabled.True;
122+
options.normalLevelShift = 20;
123+
options.dotLevelShift = 20;
124+
options.lineLevelShift = 10;
125+
options.normalItemsInterval = 10;
126+
options.dotItemsInterval = 10;
127+
options.lineItemsInterval = 4;
128+
129+
130+
control = primitives.famdiagram.Control(document.getElementById("basicdiagram"), options);
131+
});
132+
133+
134+
function onTemplateRender(event, data) {
135+
switch (data.renderingMode) {
136+
case primitives.common.RenderingMode.Create:
137+
/* Initialize widgets here */
138+
break;
139+
case primitives.common.RenderingMode.Update:
140+
/* Update widgets here */
141+
break;
142+
}
143+
144+
var itemConfig = data.context;
145+
var element = data.element;
146+
147+
if (data.templateName == "DepartmentTitleTemplate") {
148+
element.firstChild.style.backgroundColor = itemConfig.itemTitleColor || primitives.common.Colors.RoyalBlue;
149+
element.firstChild.firstChild.textContent = itemConfig.title;
150+
}
151+
}
152+
153+
function getDepartmentTitleTemplate() {
154+
var result = new primitives.famdiagram.TemplateConfig();
155+
result.name = "DepartmentTitleTemplate";
156+
result.isActive = false;
157+
158+
var buttons = [];
159+
buttons.push(new primitives.famdiagram.ButtonConfig("delete", "ui-icon-close", "Delete"));
160+
buttons.push(new primitives.famdiagram.ButtonConfig("properties", "ui-icon-gear", "Info"));
161+
buttons.push(new primitives.famdiagram.ButtonConfig("add", "ui-icon-person", "Add"));
162+
buttons.push(new primitives.famdiagram.ButtonConfig("notice", "ui-icon-notice", "Notice"));
163+
result.buttons = buttons;
164+
165+
result.itemSize = new primitives.common.Size(200, 30);
166+
result.minimizedItemSize = new primitives.common.Size(3, 3);
167+
168+
/* the following example demonstrates JSONML template see http://http://www.jsonml.org/ for details: */
169+
result.itemTemplate = ["div",
170+
{
171+
"style": {
172+
width: result.itemSize.width + "px",
173+
height: result.itemSize.height + "px"
174+
},
175+
"class": ["bp-item", "bp-corner-all", "bt-item-frame"]
176+
},
177+
["div",
178+
{
179+
"name": "titleBackground",
180+
"style": {
181+
top: "2px",
182+
left: "2px",
183+
width: "196px",
184+
height: "25px"
185+
},
186+
"class": ["bp-item", "bp-corner-all", "bt-title-frame"]
187+
},
188+
["div",
189+
{
190+
name: "title",
191+
"class": ["bp-item", "bp-title"],
192+
style: {
193+
top: "3px",
194+
left: "6px",
195+
width: "188px",
196+
height: "23px",
197+
textAlign: "center"
198+
}
199+
}
200+
]
201+
]
202+
];
203+
204+
return result;
205+
}
206+
</script>
207+
</head>
208+
209+
<body>
210+
<div id="basicdiagram" style="width: 640px; height: 480px; border-style: dotted; border-width: 1px;" />
211+
</body>
212+
213+
</html>

0 commit comments

Comments
 (0)