Various prototypes in Scriptographer act as lists: SegmentList, LayerList, CurveList, HierarchyList, PopupMenu, etc.
Automatic wrapping of the underlying Java classes gives these prototypes some of the behavior of normal JavaScript arrays. Lists can be enumerated just like arrays, and elements can be retrieved and set through the array operator:
There are three types of such lists:
In Scriptographer, all prototypes are in fact Java classes that can be used both in scripts (through the Rhino JavaScript Engine), and also directly from Java. For example the Scriptographer interface itself is written in Java, using the same classes that hide behind the JavaScript prototypes. This automatic wrapping in Bean Properties and List Prototypes allows faster development and only one code base for more than one language (Java and JavaScript, but theoretically also others, like JRuby, Jython, etc).
[Unhandled Macro: this.documentationColumn]
Automatic wrapping of the underlying Java classes gives these prototypes some of the behavior of normal JavaScript arrays. Lists can be enumerated just like arrays, and elements can be retrieved and set through the array operator:
for (var i in path.segments) {
path.segments[i].point.x += 10;
}
path.segment[0] = new Segment(new Point(10, 20));There are three types of such lists:
- Normal lists can set and retrieve values by integer indices.
- Read-only lists can only retrieve values by integere indices.
- String-Index lists are read-only lists that can be accessed both by an integer index or a string. They are used for LayerList, FontList and FontFamily.
In Scriptographer, all prototypes are in fact Java classes that can be used both in scripts (through the Rhino JavaScript Engine), and also directly from Java. For example the Scriptographer interface itself is written in Java, using the same classes that hide behind the JavaScript prototypes. This automatic wrapping in Bean Properties and List Prototypes allows faster development and only one code base for more than one language (Java and JavaScript, but theoretically also others, like JRuby, Jython, etc).
[Unhandled Macro: this.documentationColumn]
Scripts
03.10.08, 00:01
18.09.08, 20:43
16.09.08, 21:36
14.09.08, 18:50
21.08.08, 19:19
Posts
10.10.08, 21:20
10.10.08, 10:19
10.10.08, 01:33
07.10.08, 15:40
04.10.08, 20:50
Script of the Moment
Donation