[kepler-dev] Re: Customizing

Edward A Lee eal at eecs.berkeley.edu
Wed Aug 25 05:07:04 PDT 2004


Oops, sorry... I guess I gave you the way to override Look Inside,
not the way to override Configure...

The following example (in the Python actor library) overrides
Configure:

   <entity name="PythonScript" class="ptolemy.actor.lib.python.PythonScript">
     <property name="_editorFactory" 
class="ptolemy.vergil.toolbox.TextEditorConfigureFactory">
       <property name="attributeName" value="script"/>
     </property>
   </entity>

The class ptolemy.vergil.toolbox.TextEditorConfigureFactory
extends ptolemy.actor.gui.EditorFactory, which is an attribute that
specifies what to do on Configure:

     /** Create an editor for configuring the specified object with the
      *  specified parent window.
      *  @param object The object to configure.
      *  @param parent The parent window, or null if there is none.
      */
     public abstract void createEditor(NamedObj object, Frame parent);

It is up to the subclass to save any changes to the actor's parameters,
preferably by creating a ptolemy.moml.MoMLChangeRequest and then
calling requestChange() on the actor.

Hope this helps...

Edward


At 02:51 PM 8/24/2004 -0500, Rod Spears wrote:
>Here is my actor:
>
>   <entity name="MyData" 
> class="org.ecoinformatics.seek.datasource.eml.eml2.Eml200DataSource">
>        <doc>Data Source.</doc>
>           <property name="script" 
> class="ptolemy.kernel.util.StringAttribute" value="Hello">
>          </property>
>          <property name="_tableauFactory" 
> class="org.ecoinformatics.seek.datasource.eml.eml2.QBTableauFactory">
>              <property name="attributeName" value="script"/>
>
></property> 
>
>
>        </entity>
>
>When I use "Configure" I get a one line text box with the value "Hello"
>When I use "Look Inside" I get my "new" UI and it is empty and if I give 
>it a value and close the UI it seems to work. Then when I open the UI 
>again the new value is there.
>
>If I save it, the "script" attribute has the value "Hello" and not the 
>value I typed in with the new UI.
>
>What am I doing wrong?
>
>I did experiment with the "style" but that changes the Configure dialog, 
>and it seems that I really want to use the "Look Inside" approach.
>
>Thanks,
>Rod

------------
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