03.08.2013 Views

PTOLEMY II - CiteSeerX

PTOLEMY II - CiteSeerX

PTOLEMY II - CiteSeerX

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CompositeActor<br />

ptolemy.gui.BasicJApplet<br />

«Interface»<br />

ExecutionListener<br />

+executionError(m : Manager, ex : Exception)<br />

+executionFinished(m : Manager)<br />

+managerStateChanged(m : Manager)<br />

MoMLParser<br />

+parse(base : URL, in : InputStream)<br />

1..1<br />

creates<br />

uses<br />

PtolemyApplet<br />

+background : applet parameter<br />

+controls : applet parameter<br />

+modelClass : applet parameter<br />

+orientation : applet parameter<br />

#_manager : Manager<br />

#_setupOK : boolean<br />

#_toplevel : NamedObj<br />

#_workspace : Workspace<br />

+PtolemyApplet()<br />

#_createModel(workspace : Workspace) : NamedObj<br />

#_createView()<br />

#_go()<br />

#_stop()<br />

MoMLApplet<br />

+modelURL : applet parameter<br />

+MoMLApplet()<br />

+_createModel(w : Workspace, filterGraphicalClasses : boolean) creates<br />

Custom Applets<br />

FIGURE 8.1. UML static structure diagram for PtolemyApplet, a convenience class for constructing applets.<br />

PtolemyApplet is in the ptolemy.actor.gui package.<br />

it is "vertical", then the controls are placed above the visual elements of the Placeable actors. This<br />

is the default. If it is "horizontal", then the controls are placed to the left of the visual elements. If<br />

it is "controls_only" then no visual elements are placed.<br />

The use of these applet parameters is explained in more detail below.<br />

8.2 HTML Files Containing Applets<br />

An applet is a Java class that can be referenced by an HTML file and accessed either locally or<br />

over the web and run in a secure manner on the local machine in a web browser. Unfortunately, many<br />

browsers available today are shipped with an earlier version of Java that does not provide features that<br />

Ptolemy <strong>II</strong> requires. The work around is to use Sun’s Java Plug-In, which invokes the 1.4 version of<br />

the Java Runtime Environment (JRE), instead of the default Java runtime that is shipped with the<br />

browser. The Java Plug-in is installed when the JRE or the Java Development Kit (JDK) is installed.<br />

Unfortunately, using the Java Plug-in makes the applet HTML more complex. There are two choices:<br />

1. Use fairly complex JavaScript to determine which browser is running and then to properly select<br />

one of three different ways to invoke the Java Plug-in. This method works on the most different<br />

types of platforms and browsers. The JavaScript is so complex, that rather than reproduce it here,<br />

please see one of the demonstration html files such as $PT<strong>II</strong>/ptolemy/domains/sdf/demo/Butterfly/<br />

Butterfly.htm. Sun provides a free tool called HTMLConverter that will automatically generate the<br />

234 Ptolemy <strong>II</strong><br />

JPanel<br />

ModelPane

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!