[kepler-dev] Using PortParameter and ParameterPort

Jianting Zhang jzhang at lternet.edu
Mon Dec 12 07:49:38 PST 2005


Just found an easy solution: adding <property name="_stringMode"/> to the
property/entity (see ptolemy.data.expr.Variable for more details). 

Below is an example:  

 

        <property name="units"
class="ptolemy.actor.parameters.PortParameter" value="meters">

            <property name="_stringMode"/>

            <property name="style"
class="ptolemy.actor.gui.style.ChoiceStyle">

                        <property name="C0"
class="ptolemy.kernel.util.StringAttribute" value="meters"/>

                        <property name="C1"
class="ptolemy.kernel.util.StringAttribute" value="kilometers"/>

                        <property name="C2"
class="ptolemy.kernel.util.StringAttribute" value="feet"/>

                        <property name="C3"
class="ptolemy.kernel.util.StringAttribute" value="miles"/>

                        <property name="C4"
class="ptolemy.kernel.util.StringAttribute" value="nautmiles"/>

            </property>

        </property>

 

  _____  

From: kepler-dev-bounces at ecoinformatics.org
[mailto:kepler-dev-bounces at ecoinformatics.org] On Behalf Of Jianting Zhang
Sent: Friday, December 09, 2005 11:13 AM
To: 'Kepler-Dev'
Subject: [kepler-dev] Using PortParameter and ParameterPort

 

Hi, 

 

I was trying to use PortParameter/ParameterPort to specify the data type and
initial value of a port representing a parameter of a command line module.
When I use 

"<property name="units" class="ptolemy.actor.parameters.PortParameter"
value="meters"/>",

 there is an error saying "The ID meters is undefined.". It is ok if I
change "meters" to a number like "10". 

 It seems that the value was getting parsed. Is there any way to use string
instead of numbers when combined with PortParameter? Just like 

"<property name="comments" class="ptolemy.data.expr.StringParameter"
value="... ">. 

 

Thanks 

 

Jianting

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mercury.nceas.ucsb.edu/ecoinformatics/pipermail/kepler-dev/attachments/20051212/d8a2d964/attachment.htm


More information about the Kepler-dev mailing list