[kepler-dev] Reordering actor attributes and dynamically added parameters

Edward A Lee eal at eecs.berkeley.edu
Mon Jul 26 06:42:01 PDT 2004


I've checked in a mechanism for changing the order of attributes
(and ports, relations, and entities).  NamedObj now implements
an interface called Moveable with five methods:

    moveDown()
    moveToFirst()
    moveToIndex(int)
    moveToLast()
    moveUp()

To use this as (I think) Efrat needs, in an extended actor you
can do:

    public Foo(CompositeEntity container, String name) {
       Parameter newParameter = new Parameter(this, "newParameter");
       newParameter.moveToFirst();
    }

The new parameter will appear first in the list when you edit
parameters.

I also applied this to the icon editor, so you can now right click
on icon element and move it forward or backwards.  Unfortunately,
the names are a bit confusing, since "move to first" actually
moves an object to the back.  I don't have a good workaround here,
since sometimes you want to affect the drawing order and sometimes
you want to affect the visibility order of parameters...

You can also now right click on a port in a composite actor
and move it.

Currently, there is still a bug in that if you move the port
order that is defined in a class, the move is not persistent.
I need to disable that move...

Edward


At 07:06 AM 7/25/2004 -0700, Edward A Lee wrote:

>I've been looking for a mechanism for doing this also because it
>is needed for editing icons... Turns out an icon's visual components
>are represented by attributes and are rendered in attribute order.
>If you want to move an object to the foreground or background, you
>need to be able to affect this order.
>
>I will do this... But again, it will require better synchronizing
>the cvs trees for kepler and Ptolemy II...
>
>Edward
>
>
>At 03:43 PM 7/23/2004 -0700, Efrat Jaeger wrote:
>>Hi all,
>>
>>I have an actor that extends another actor thus its inherited parameters 
>>appear first. I was wondering if it was possible to reorder an actors' 
>>parameters, e.g. by accessing the attributeList (but at what stage?). I 
>>tried to override these parameters in the constructor, but I get a name 
>>duplication exception, as the parent class' constructor must be called 
>>first. I could write the actor from scratch, but it's not object 
>>oriented.. Anybody has any suggestions?
>>
>>Another thing I was messing with is I created an actor which dynamically 
>>adds/removes its output port according to a parameter value. I declare 
>>this port within the constructor and set it's type to be a 'string' (as 
>>shown below). When I drag this actor from the library its output type is 
>>initially set to unknown. I have to change the dependent parameter back 
>>and forth to get the correct output type. The same happens after saving 
>>and reloading the workflow (thus I get a type mismatch when executing and 
>>have to update it first). Please let me know what I should do in this 
>>case to get the desired port type as a default.
>>
>>//constructor
>>output = new TypedIOPort(this, "output", false, true);
>>output.setTypeEquals(BaseType.STRING);
>>output.setContainer(this);
>>xPar.setExpression(true);
>>
>>//attributeChanged
>>if (x) {
>>     try {
>>         output.setContainer(this);
>>         output.setTypeEquals(BaseType.STRING);
>>        ...
>>} else {
>>....
>>     if (p.getName().equals("output")) {
>>         p.setContainer(null);
>>     }
>>...
>>}
>>
>>Thanks,
>>
>>Efrat
>
>------------
>Edward A. Lee, Professor
>518 Cory Hall, UC Berkeley, Berkeley, CA 94720
>phone: 510-642-0455, fax: 510-642-2739
>eal at eecs.Berkeley.EDU, http://ptolemy.eecs.berkeley.edu/~eal
>
>_______________________________________________
>kepler-dev mailing list
>kepler-dev at ecoinformatics.org
>http://www.ecoinformatics.org/mailman/listinfo/kepler-dev

------------
Edward A. Lee, Professor
518 Cory Hall, UC Berkeley, Berkeley, CA 94720
phone: 510-642-0455, fax: 510-642-2739
eal at eecs.Berkeley.EDU, http://ptolemy.eecs.berkeley.edu/~eal




More information about the Kepler-dev mailing list