Skip to content

Commit 97674f3

Browse files
author
Paul Verest 伟保罗
committed
JJS Examples Help pages (JJS-Examples not working yet)
1 parent 93cbff5 commit 97674f3

File tree

9 files changed

+189
-2
lines changed

9 files changed

+189
-2
lines changed

org.nodeclipse.help/HelpToc.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
<topic label="JavaScript" href="contents/.javascript.md.html"/>
1515
<topic label="CoffeeScript" href="contents/.coffeescript.md.html"/>
1616
<topic label="TypeScript" href="contents/.typescript.md.html"/>
17-
<topic label="Nashorn" href="contents/.nashorn.md.html"/>
1817
<topic label="node_redis" href="contents/.node_redis.md.html"/>
1918
<topic label="Plugins" href="contents/.plugins.md.html"/>
2019
<topic label="FAQ" href="contents/.FAQ.md.html"/>
2120
<topic label="PhantomJS" href="contents/.phantomjs.md.html"/>
2221
<topic label="Nashorn" href="contents/.nashorn.md.html"/>
22+
<anchor id="JJS-Examples"/>
2323
<!-- examples are below
2424
<topic label="Main Topic" href="html/maintopic.html"/>
2525
<link toc="LinkedToc.xml" />

org.nodeclipse.jjs/HelpToc.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<?NLS TYPE="org.eclipse.help.toc"?>
3+
4+
<toc label="Nodeclipse Help - JJS examples" link_to="JJS-Examples" topic="help/.index.md.html">
5+
<topic label="javaextend.js" href="help/javaextend.js"/>
6+
<topic label="fxinit.js" href="help/fxinit.js"/>
7+
<topic label="fxhelloworld.js" href="help/fxhelloworld.js"/>
8+
</toc>

org.nodeclipse.jjs/build.properties

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@ output.. = bin/
33
bin.includes = plugin.xml,\
44
META-INF/,\
55
.,\
6-
icons/
6+
icons/,\
7+
help/,\
8+
HelpToc.xml
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd">
2+
<html>
3+
<head>
4+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5+
<title>C:\Users\weibl\git\NTS\nodeclipse-1\org.nodeclipse.jjs\help\.index.md.html</title>
6+
7+
8+
<style type="text/css">
9+
10+
.markdown-body {
11+
border: 1px solid #CACACA;
12+
padding: 30px;
13+
font-size: 14px;
14+
line-height: 1.6;
15+
}
16+
17+
.markdown-body h2 {
18+
border-bottom: 1px solid #CCCCCC;
19+
}
20+
21+
.markdown-body code {
22+
white-space: nowrap;
23+
}
24+
25+
.markdown-body code, .markdown-body tt {
26+
background-color: #F8F8F8;
27+
border: 1px solid #EAEAEA;
28+
border-radius: 3px 3px 3px 3px;
29+
margin: 0 2px;
30+
padding: 0 5px;
31+
}
32+
33+
.markdown-body .highlight pre, .markdown-body pre {
34+
background-color: #F8F8F8;
35+
border: 1px solid #CCCCCC;
36+
border-radius: 3px 3px 3px 3px;
37+
font-size: 13px;
38+
line-height: 19px;
39+
overflow: auto;
40+
padding: 6px 10px;
41+
}
42+
43+
.markdown-body img {
44+
border: 0 none;
45+
}
46+
47+
pre, code, tt {
48+
font-family: Consolas,"Liberation Mono",Courier,monospace;
49+
font-size: 12px;
50+
}
51+
</style>
52+
53+
54+
<script type="text/javascript">
55+
56+
function getDocumentScrollTop()
57+
{
58+
var res = document.body.scrollTop || document.documentElement.scrollTop || window.pageYOffset || 0;
59+
// alert(res);
60+
return res;
61+
}
62+
63+
function setDocumentScrollTop(ypos)
64+
{
65+
window.scrollTo(0, ypos);
66+
}
67+
68+
</script>
69+
70+
71+
</head>
72+
<body class="markdown-body">
73+
<h2> <a name="jjs-examples-list" class="anchor" href="..md.html#jjs-examples-list"><span class="octicon octicon-link"></span></a>JJS Examples List</h2>
74+
<ul>
75+
<li><a href="javaextend.js">javaextend.js</a></li>
76+
<li><a href="fxinit.js">fxinit.js</a></li>
77+
<li><a href="fxhelloworld.js">fxhelloworld.js</a></li>
78+
</ul>
79+
</body>
80+
</html>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
function start(stage) {
3+
stage.title = "Hello World!";
4+
var button = new Button();
5+
button.text = "Say 'Hello World'";
6+
button.onAction = function() print("Hello World!");
7+
var root = new StackPane();
8+
root.children.add(button);
9+
stage.scene = new Scene(root, 300, 250);
10+
stage.show();
11+
}
12+
load("fxinit.js");

org.nodeclipse.jjs/help/fxinit.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
GLOBAL = this;
2+
javafx = Packages.javafx;
3+
com.sun.javafx.application.LauncherImpl.launchApplication(
4+
(Java.extend(javafx.application.Application, {
5+
init: function() {
6+
// FX packages and classes must be defined here because they may not be
7+
// viable until launch time.
8+
Stage = javafx.stage.Stage;
9+
scene = javafx.scene;
10+
Scene = scene.Scene;
11+
Group = scene.Group;
12+
chart = scene.chart;
13+
control = scene.control;
14+
Button = control.Button;
15+
StackPane = scene.layout.StackPane;
16+
FXCollections = javafx.collections.FXCollections;
17+
ObservableList = javafx.collections.ObservableList;
18+
Chart = chart.Chart;
19+
CategoryAxis = chart.CategoryAxis;
20+
NumberAxis = chart.NumberAxis;
21+
BarChart = chart.BarChart;
22+
XYChart = chart.XYChart;
23+
Series = chart.XYChart$Series;
24+
Data = chart.XYChart$Data;
25+
TreeView = control.TreeView;
26+
TreeItem = control.TreeItem;
27+
if (GLOBAL.init) {
28+
init();
29+
}
30+
},
31+
start: function(stage) {
32+
if (GLOBAL.start) {
33+
start(stage);
34+
}
35+
},
36+
stop: function() {
37+
if (GLOBAL.stop) {
38+
stop();
39+
}
40+
}
41+
})).class, new (Java.type("java.lang.String[]"))(0));

org.nodeclipse.jjs/help/index.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
3+
## JJS Examples List
4+
5+
- [javaextend.js](javaextend.js)
6+
- [fxinit.js](fxinit.js)
7+
- [fxhelloworld.js](fxhelloworld.js)
8+
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
//javaextend.js
2+
3+
// http://hg.openjdk.java.net/nashorn/jdk8/nashorn/raw-file/29b2b2ed954c/docs/JavaScriptingProgrammersGuide.html#jsextendconcrete
4+
5+
/**
6+
* Results:
7+
size invoked!
8+
add(i, e) invoked!
9+
10+
*/
11+
12+
var ArrayList = Java.type("java.util.ArrayList")
13+
var ArrayListExtender = Java.extend(ArrayList)
14+
var printSizeInvokedArrayList = new ArrayListExtender() {
15+
size: function() { print("size invoked!"); }
16+
}
17+
var printAddInvokedArrayList = new ArrayListExtender() {
18+
add: function(x, y) {
19+
if(typeof(y) === "undefined") {
20+
print("add(e) invoked!");
21+
} else {
22+
print("add(i, e) invoked!");
23+
}
24+
}
25+
};
26+
printSizeInvokedArrayList.size();
27+
printAddInvokedArrayList.add(33, 33);

org.nodeclipse.jjs/plugin.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,13 @@
6060
type= "org.nodeclipse.jjs.launch.LaunchConfigurationType" >
6161
</launchConfigurationTabGroup>
6262
</extension>
63+
64+
<extension
65+
point="org.eclipse.help.toc">
66+
<toc
67+
file="HelpToc.xml"
68+
primary="false">
69+
</toc>
70+
</extension>
71+
6372
</plugin>

0 commit comments

Comments
 (0)