Skip to content

Commit 7d7916e

Browse files
committed
Add Widgets example script
1 parent 6a3a923 commit 7d7916e

File tree

1 file changed

+67
-0
lines changed
  • src/main/resources/script-templates/JavaScript

1 file changed

+67
-0
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
// @boolean(label = "boolean") pBoolean
2+
// @byte(label = "byte") pByte
3+
// @char(label = "char") pChar
4+
// @double(label = "double") pDouble
5+
// @float(label = "float") pFloat
6+
// @int(label = "int") pInt
7+
// @long(label = "long") pLong
8+
// @short(label = "short") pShort
9+
// @Boolean(label = "Boolean") oBoolean
10+
// @Byte(label = "Byte") oByte
11+
// @Character(label = "Character") oCharacter
12+
// @Double(label = "Double") oDouble
13+
// @Float(label = "Float") oFloat
14+
// @Integer(label = "Integer") oInteger
15+
// @Long(label = "Long") oLong
16+
// @Short(label = "Short") oShort
17+
// @int(min = 0, max = 1000) boundedInteger
18+
// @double(min = 0.2, max = 1000.7, stepSize = 12.34) boundedDouble
19+
// @BigInteger bigInteger
20+
// @BigDecimal bigDecimal
21+
// @String string
22+
// @File file
23+
// @ColorRGB color
24+
// @OUTPUT String result
25+
26+
// A JavaScript script exercising various parameter types.
27+
// It is the duty of the scripting framework to harvest
28+
// the parameter values from the user, and then display
29+
// the 'result' output parameter, based on its type.
30+
31+
var sb = new java.lang.StringBuilder();
32+
33+
sb.append("Widgets JavaScript results:\n");
34+
35+
sb.append("\n");
36+
sb.append("\tboolean = " + pBoolean + "\n");
37+
sb.append("\tbyte = " + pByte + "\n");
38+
sb.append("\tchar = " + "'" + pChar + "' [" + pChar.charCodeAt(0) + "]\n");
39+
sb.append("\tdouble = " + pDouble + "\n");
40+
sb.append("\tfloat = " + pFloat + "\n");
41+
sb.append("\tint = " + pInt + "\n");
42+
sb.append("\tlong = " + pLong + "\n");
43+
sb.append("\tshort = " + pShort + "\n");
44+
45+
sb.append("\n");
46+
sb.append("\tBoolean = " + oBoolean + "\n");
47+
sb.append("\tByte = " + oByte + "\n");
48+
oCharValue = oCharacter == null ? "null" : "" + oCharacter.charCodeAt(0);
49+
sb.append("\tCharacter = " + "'" + oCharacter + "' [" + oCharValue + "]\n");
50+
sb.append("\tDouble = " + oDouble + "\n");
51+
sb.append("\tFloat = " + oFloat + "\n");
52+
sb.append("\tInteger = " + oInteger + "\n");
53+
sb.append("\tLong = " + oLong + "\n");
54+
sb.append("\tShort = " + oShort + "\n");
55+
56+
sb.append("\n");
57+
sb.append("\tbounded integer = " + boundedInteger + "\n");
58+
sb.append("\tbounded double = " + boundedDouble + "\n");
59+
60+
sb.append("\n");
61+
sb.append("\tBigInteger = " + bigInteger + "\n");
62+
sb.append("\tBigDecimal = " + bigDecimal + "\n");
63+
sb.append("\tString = " + string + "\n");
64+
sb.append("\tFile = " + file + "\n");
65+
sb.append("\tcolor = " + color + "\n");
66+
67+
result = sb.toString();

0 commit comments

Comments
 (0)