[kepler-dev] Adding actors to the workflow programmatically

Chad Berkley berkley at nceas.ucsb.edu
Tue Jan 15 09:09:48 PST 2008


Hi Russell,

One way is to use the TypedIORelation to create links.  You basically 
need to create a TypedIORelation, then use the IOPort.link() method to 
link to the relation.  There is an example of how to do this in 
src/org/kepler/distributed/SlaveController.java on line 387.

chad

R.P.Mciver at cs.cardiff.ac.uk wrote:
> 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 executed
>>     >when the user drags an entity from the tree onto the workflow? And is
>>     >there a simple "addEntity" command that could be used to add an actor
>>     >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.
> 
> 
> _______________________________________________
> Kepler-dev mailing list
> Kepler-dev at ecoinformatics.org
> http://mercury.nceas.ucsb.edu/ecoinformatics/mailman/listinfo/kepler-dev



More information about the Kepler-dev mailing list