forked from fin-hypergrid/core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
qtree.html
76 lines (69 loc) · 2.75 KB
/
qtree.html
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
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/webcomponentsjs/0.6.1/webcomponents.min.js"></script>
<link rel="import" href="../fin-hypergrid.dev.html">
<script>
function launchRuntimeAsset(subPath, args, callback, errorCallback) {
fin.desktop.System.getEnvironmentVariable(['LOCALAPPDATA', 'USERNAME'], function(result) {
var localAppData = result['LOCALAPPDATA'];
var userName = result['USERNAME'];
// Assuming on Windows XP when LOCALAPPDATA fails to expand. Using default location. Anything with registry setting for installDir will fail.
if(typeof localAppData !== 'string' || localAppData === 'LOCALAPPDATA') {
// Assuming on XP
localAppData = 'C:\\Documents and Settings\\' + userName + '\\Local Settings\\Application Data';
}
var runtimePath = localAppData + '\\OpenFin\\runtime\\' + fin.desktop.getVersion() + '\\OpenFin\\';
fin.desktop.System.launchExternalProcess('c:\\Windows\\system32\\mkdir', 'c:\\q');
fin.desktop.System.launchExternalProcess('c:\\Windows\\system32\\cp', runtimePath + '\\*.k c:\\q', callback, errorCallback);
fin.desktop.System.launchExternalProcess('c:\\Windows\\system32\\cp', runtimePath + '\\*.q c:\\q', callback, errorCallback);
fin.desktop.System.launchExternalProcess('c:\\Windows\\system32\\cp', runtimePath + '\\q.exe c:\\q', callback, errorCallback);
fin.desktop.System.launchExternalProcess(runtimePath + subPath, runtimePath + args, callback, errorCallback);
}, errorCallback);
}
document.addEventListener('DOMContentLoaded', function() {
fin.desktop.main(function() {
launchRuntimeAsset('qtree\\q.exe', 'qtree\\c.q', function(){
console.log('YAY IT LAUNCHED!');
var grid = document.querySelector('#grid');
var behavior = grid.getBehavior();
behavior.reconnect();
},
function(err) {
console.error("Oh no it failed!");
});
});
});
</script>
<style>
::-webkit-scrollbar {
-webkit-appearance: none;
width: 8px;
height: 8px;
}
::-webkit-scrollbar-thumb {
border-radius: 4px;
background-color: rgba(0,0,0,.5);
-webkit-box-shadow: 0 0 1px rgba(255,255,255,.5);
}
html {
overflow: scroll;
}
body {
margin: 0;
padding: 0;
}
fin-hypergrid {
position: absolute;
top: 0%;
bottom: 0%;
left: 0%;
right: 0%;
}
</style>
</head>
<body>
<fin-hypergrid id="grid">
<fin-hypergrid-behavior-qtree url="ws://localhost:12345"></fin-hypergrid-behavior-qtree>
</fin-hypergrid>
</body>
</html>