[kepler-dev] Setting parameter style as password

Edward A Lee eal at eecs.berkeley.edu
Thu Sep 9 08:14:12 PDT 2004


At 01:56 AM 9/9/2004 -0700, altintas at sdsc.edu wrote:
>Hi,
>
>How can I set the style of a parameter to be Password style
>in the java code for the actor? And, once I set the style, what
>is the best way to process the password?
>
>I can set it up from the GUI but it only changes it in the MOML
>file. It also sometimes throws exceptions that the password cannot
>be handled as a string.
>
>It would be enough if you could point me to an example. I looked
>for examples on this but couldn't find one.
>
>Thanks on advance,
>Ilkay

Coincidentally, Yang and I worked on this on Tuesday morning,
and checked in to the tree a ptolemy.actor.gui.PasswordAttribute
that basically works, although it too is incomplete.

Put this in an actor, double click on the actor, and enter
the password.  Currently, the password is not persistent (it is
not stored in the MoML).  We are looking at how to store it
in the MoML encrypted as an option.

The way it works is that it has getPassword() and setPassword()
methods.   If you call getPassword() without having set the
password, it opens the edit parameters window for the actor
that contains it, thus prompting you to enter the password.
So if a model has such an actor, and you don't set the
password before running the model, you will be prompted for
the password when you run the model.

There is still a big unknown with this: Opening the dialog
to edit parameters is something that should only be done in the
Swing thread (the Java UI is not multithreaded). But a model
is not run in the swing thread.  I think we have to do a
SwingUtilities.invokeAndWait(), which is an extremely dangerous
thing to do.  Every time I've tried to use this, I've gotten
deadlock...  Ideas for alternative approaches would be welcome...

Edward



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