[kepler-dev] Adding actors to the workflow programmatically
Christopher Brooks
cxh at eecs.berkeley.edu
Tue Jan 29 18:07:52 PST 2008
Hi R.P,
Sorry for the delay, I'm just going through old email.
ptolemy/kernel/CompositeEntity.java contains connect() methods that
can be used to connect ports.
For a simple example of a model defined in Java, see
http://ptolemy.eecs.berkeley.edu/ptolemyII/ptIIlatest/ptII/ptolemy/domains/sdf/demo/Butterfly/Butterfly.java
The kernel chapter of Volume 2 of the Ptolemy II design doc discusses
how to connect actors
http://www.eecs.berkeley.edu/Pubs/TechRpts/2007/EECS-2007-8.pdf
Using change requests is somewhat better than calling connect()
The bottom of ptII/ptolemy/moml/demo/modulation.xml defines a relation
and then calls link:
<relation name="r3" class="ptolemy.actor.TypedIORelation">
</relation>
...
<link port="mult.output" relation="r3"/>
...
<link port="display.input" relation="r3"/>
You could do something similar in a ChangeRequest.
_Christopher
--------
Thanks for the help guys, think I get the gist of it now.
One further question relating to this - in a similar way, what is the
functionality that actually connects two actors together? Does this
work through the LinkModel class, I'm guessing it's a similar
situation to dropping the actor into a model in that a change request
is used?
Thanks again,
Russell
Quoting Christopher Brooks <cxh at eecs.berkeley.edu>:
> Hi R.P.,
>
> If you have a model, then you can instantiate the actor into
> the model with the constructor for the actor that takes a container.
> However, you need to handle actor name duplication issues yourself.
>
> The biggest problem is that undo/redo will not work, since undo/redo
> uses ChangeRequests.
>
> This also gets into configurations, effigies and tableaux. See
> the following classes ptolemy.actor.gui: Configuration, Effigy,
> Tableau.
>
> Ptolemy models can be described in MoML, Java and Tcl. For examples
> of models in Java, see the .java classes in ptolemy/domains/*/demo/*,
> for example
> sdf/demo/Butterfly/Butterfly.java
> or
> ct/demo/Helicopter/Helicopter.java
>
> _Christopher
>
> Edward writes:
> --------
>
>
> When you drag an actor in, the outline of what happens is:
>
> actor = the selected actor in the library;
> String xml = actor.exportMoML();
> model = the composite actor being edited.
> MoMLChangeRequest request = new MoMLChangeRequest(..., xml, ...);
> model.requestChange(request);
>
> I.e., a MoML description of the actor to drop in is obtained,
> and a change request is used to insert that MoML into the model.
>
> Edward
>
>
> At 04:05 AM 1/10/2008, R.P.Mciver at cs.cardiff.ac.uk wrote:
> >Hi,
> >
> >I've been playing about with trying to add Actors to a workflow in a
> >manner different to dragging them from the tree of those available,
> >however I've not been having much luck!
> >
> >I was wondering if anyone could tell me what code is actually execut
ed
> >when the user drags an entity from the tree onto the workflow? And i
s
> >there a simple "addEntity" command that could be used to add an acto
r
> >to an existing workflow?
> >
> >Thanks in advance to anyone who can help!
> >
> >Russell
> >
> >----------------------------------------------------------------
> >This message was sent using IMP, the Internet Messaging Program.
> >
> >
> >_______________________________________________
> >Kepler-dev mailing list
> >Kepler-dev at ecoinformatics.org
> >http://mercury.nceas.ucsb.edu/ecoinformatics/mailman/listinfo/kepler
-dev
>
> ------------
> Edward A. Lee
> Chair of EECS and Robert S. Pepper Distinguished Professor
> 231 Cory Hall, UC Berkeley, Berkeley, CA 94720-1770
> phone: 510-642-0253, fax: 510-642-2845
> eal at eecs.Berkeley.EDU,
> http://www.eecs.berkeley.edu/Faculty/Homepages/lee.h
> tml
>
> _______________________________________________
> Kepler-dev mailing list
> Kepler-dev at ecoinformatics.org
> http://mercury.nceas.ucsb.edu/ecoinformatics/mailman/listinfo/kepler-
dev
> --------
> _______________________________________________
> Kepler-dev mailing list
> Kepler-dev at ecoinformatics.org
> http://mercury.nceas.ucsb.edu/ecoinformatics/mailman/listinfo/kepler-dev
>
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
--------
More information about the Kepler-dev
mailing list