forked from BasicPrimitives/javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCaseShowFrame.html
More file actions
123 lines (110 loc) · 3.76 KB
/
CaseShowFrame.html
File metadata and controls
123 lines (110 loc) · 3.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Selected Items Frame</title>
<script type="text/javascript" src="../../primitives.js"></script>
<link href="../../css/primitives.css" media="screen" rel="stylesheet" type="text/css" />
<script type="text/javascript">
var control,
minimizedItemShapeTypes = [
primitives.ShapeType.Rectangle,
primitives.ShapeType.Oval,
primitives.ShapeType.Triangle,
primitives.ShapeType.CrossOut,
primitives.ShapeType.Circle,
primitives.ShapeType.Rhombus,
primitives.ShapeType.Wedge,
primitives.ShapeType.FramedOval,
primitives.ShapeType.FramedTriangle,
primitives.ShapeType.FramedWedge,
primitives.ShapeType.FramedRhombus
],
shapeIndex = 0,
itemTitleColors = [
primitives.Colors.Red,
primitives.Colors.Green,
primitives.Colors.Navy,
primitives.Colors.Cyan
],
colorIndex = 0;
function getNextShapeType() {
var result = minimizedItemShapeTypes[shapeIndex];
shapeIndex += 1;
if (shapeIndex == minimizedItemShapeTypes.length) {
shapeIndex = 0;
}
return result;
}
function getNextColor() {
var result = itemTitleColors[colorIndex];
colorIndex += 1;
if (colorIndex == itemTitleColors.length) {
colorIndex = 0;
}
return result;
}
function getMarkerTemplate() {
var result = new primitives.TemplateConfig();
result.name = "MarkerTemplate";
result.minimizedItemSize = new primitives.Size(8, 8);
result.highlightPadding = new primitives.Thickness(4, 4, 4, 4);
return result;
}
document.addEventListener('DOMContentLoaded', function () {
var options = new primitives.OrgConfig();
var rootItem = {
id: 0,
parent: null,
title: "Title 0",
description: "Description",
image: "../images/photos/a.png",
minimizedItemShapeType: (getNextShapeType()),
itemTitleColor: (getNextColor())
};
var levelItems = [rootItem];
var items = [rootItem];
var id = 1;
for (var levelIndex = 0; levelIndex < 4; levelIndex += 1) {
var newLevelItems = [];
for (var index = 0; index < levelItems.length; index += 1) {
var parent = levelItems[index];
for (var index2 = 0; index2 < 2; index2++) {
var newItem = {
id: ++id,
parent: parent.id,
title: id.toString() + " Title",
description: id.toString() + " Description",
image: "../images/photos/b.png",
minimizedItemShapeType: (getNextShapeType()),
itemTitleColor: (getNextColor())
};
items.push(newItem);
newLevelItems.push(newItem);
}
}
levelItems = newLevelItems;
}
/* collect all ids */
var selectedItems = [];
for (var index = 0; index < items.length; index += 1) {
selectedItems.push(items[index].id);
}
options.items = items;
options.cursorItem = 0;
options.showFrame = true;
options.frameInnerPadding = 4;
options.frameOuterPadding = 4;
options.templates = [getMarkerTemplate()];
options.defaultTemplateName = "MarkerTemplate";
options.hasSelectorCheckbox = primitives.Enabled.True;
options.pageFitMode = primitives.PageFitMode.None;
options.selectedItems = selectedItems;
control = primitives.OrgDiagram(document.getElementById("basicdiagram"), options);
});
</script>
</head>
<body>
<div id="basicdiagram" style="width: 640px; height: 480px; border-style: dotted; border-width: 1px;"></div>
</body>
</html>