[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


http://bugzilla.ecoinformatics.org/show_bug.cgi?id=3471


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
http://groups.google.com/group/comp.soft-sys.ptolemy/browse_thread/thread/27600a8a04d9deeb#

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/CustomQueryBoxParameter.java,
          /trunk/ptolemy/data/expr/makefile, /trunk/ptolemy/gui/Query.java,
          /trunk/ptolemy/gui/QueryChooserHelper.java,
          /trunk/ptolemy/gui/SettableQueryChooser.java,
          /trunk/ptolemy/gui/makefile: Peter Reutemann: Custom query boxes
          in Kepler/Ptolemy. See 
http://www.scms.waikato.ac.nz/~fracpete/downloads/ptolemy/custom_query_boxes/

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:
--start--
[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:
  http://mercury.nceas.ucsb.edu/ecoinformatics/pipermail/kepler-dev/200...

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:
  http://www.scms.waikato.ac.nz/~fracpete/downloads/ptolemy/custom_quer...

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

Cheers, Peter 

--end--

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