[kepler-dev] More usability improvements: display names

Edward A. Lee eal at eecs.berkeley.edu
Fri Aug 5 08:30:27 PDT 2005


I've made some changes so that the name of a parameter
displayed in the edit parameters box need not be the same
as the name of the parameter in the Ptolemy hierarchy.

This should be used with restraint, when for some reason
a stylized name is needed, such as beginning with an underscore,
or not having spaces, and the stylized name is not attractive
or informative to a user.

I've used it for the preferences. So now, the preference
name is _linkBendRadius, but what is displayed in the
dialog is "Link bend radius".  Note that the latter would
not work as a name in the expression language because
of the spaces, and the leading underscore is used to try
to prevent collisions with user-defined parameters.

The reason that this should be used with restraint is
that it is now invisible from the UI what the actual
name of the parameter is...  If you want to use it in
an expression, you have to look it up in the code or the
documentation.

To do this, I've added a method to the Settable interface:

   getDisplayName(): String

and a method to all the relevant implementing classes:

   setDisplayName(String)

To use this, when you create a parameter, call the latter
method.  E.g., in ptolemy.vergil.VergilPreferences there is:

         Parameter _linkBendRadius = new Parameter(this, "_linkBendRadius");
         _linkBendRadius.setTypeEquals(BaseType.DOUBLE);
         _linkBendRadius.setExpression("20.0");
         _linkBendRadius.setDisplayName("Link bend radius");

Edward


------------
Edward A. Lee
Professor, Chair of the EE Division, Associate Chair of EECS
231 Cory Hall, UC Berkeley, Berkeley, CA 94720
phone: 510-642-0253 or 510-642-0455, fax: 510-642-2845
eal at eecs.Berkeley.EDU, http://ptolemy.eecs.berkeley.edu/~eal  



More information about the Kepler-dev mailing list