[kepler-dev] [Bug 3471] - custom input boxes in actor configuration dialog

bugzilla-daemon at ecoinformatics.org bugzilla-daemon at ecoinformatics.org
Fri Sep 19 15:23:51 PDT 2008


cxh at eecs.berkeley.edu changed:

           What    |Removed                     |Added
         AssignedTo|berkley at nceas.ucsb.edu      |cxh at eecs.berkeley.edu
             Status|ASSIGNED                    |NEW

------- Comment #2 from cxh at eecs.berkeley.edu  2008-09-19 15:23 -------
There is more to the thread at

One issue is that data.expr.CustomQueryBoxParameter imports ptolemy.actor.gui
and thus means that data.expr depends on actor.gui.

On August 15, I folded changes in:

2008-08-15 18:40  cxh

        * [r50436] /trunk/ptolemy/actor/gui/PtolemyQuery.java,
          /trunk/ptolemy/data/expr/makefile, /trunk/ptolemy/gui/Query.java,
          /trunk/ptolemy/gui/makefile: Peter Reutemann: Custom query boxes
          in Kepler/Ptolemy. See 

On August 16, Edward pointed out:
> There is no need to modify the underlying framework to do this.
> Just put a subclass of ptolemy.actor.gui.ParameterEditorStyle
> (an attribute) inside the attribute that you want a custom input
> box for.  Your subclass can implement that custom input box,
> and it will automatically appear in the query box.  This is how
> the style preferences currently there are implemented. 

On August 16, Peter responded with
> Taking the FileChooserStyle as example: it calls the public
> addFileChooser method of the Query class in order to be able to add
> the JLabel and the QueryFileChooser box via the protected _addPair
> method. Unless I'm willing to modify the Query class (adding another
> public addXYZ method), I'm not able to add my own custom box outside
> the ptolemy.gui package, right? And wouldn't it be also necessary to
> add my own style class to the _parameterStyles member of the
> ptolemy.actor.gui.style.StyleConfigurer? 

On August 17, Peter wrote:
[Edward wrote:]
> I guess the right solution would be to add a public method like
> addPair(), which would use _addPair(), but this would be tricky
> to get right. In particular, _addPair() populates the _entries
> hashtable with objects, and I'm not sure what would be the right
> sort of object to provide for a completely custom entry...
> There might be other gotcha's as well.

> Unfortunately, I don't have bandwidth for this sort of thing
> right now, but if you want to take a stab at modifying the Query
> class, I would be happy to take a look...

I had another go at the ptolemy.qui.Query class and my previous
modifications, once again based on today's subversion repository. See
link at end of post for downloads.

This post is also in response to Christopher's feedback:

Here are the additional modifications:
- All inner classes of ptolemy.qui.Query are now public and static,
  in case one needs to use, e.g., a QueryActionListener in a package
  outside ptolemy.gui. They all contain a private member "_owner"
  of type ptolemy.gui.Query.

  --> ptolemy.gui.Query.diff

- An additional abstract superclass ptolemy.gui.QueryChooser
  (derived from javax.swing.Box) which enables derived classes to
  call _addPair and _notifyListeners of the ptolemy.gui.Query class,
  even if they're outside the ptolemy.gui package.
  (the QueryInputDialogChooser in the example below is now derived
  from this class)

  --> ptolemy-additional_classes.zip

- Updated example to demonstrate the changes. This time, there are
  no classes in the ptolemy... package hierarchy anymore. The example
  contains a simple actor with a parameter consisting of a text field
  and a button to pop up a dialog for entering a string (which is
  then displayed in the text field).

  --> examples.zip (example classes)
      examples.kar (Kepler archive)

Files mentioned above are available for download from this link:

Hopefully, this all makes sense to you... ;-)

Cheers, Peter 


I'm going to try to fold in Peter's second set of changes and see what happens.

More information about the Kepler-dev mailing list