Hi Peter,

Thanks for your report.  I've added your feature request to our bug list for
kepler 1.1.0, and will try to get someone to review your code changes and
fold them into svn.




On Thu, Aug 14, 2008 at 1:54 PM, Peter Reutemann <[EMAIL PROTECTED]>wrote:

> Hi there
> I've encountered a similar problem as mentioned in the following thread:
> http://groups.google.com/group/comp.soft-sys.ptolemy/browse_thread/thread/dc4c136eb6870d10/75e79a2afd7cc9ab
> Though using Kepler, I needed to modify the underlying Ptolemy
> framework in order to allow custom input boxes in actor dialogs. But
> instead of hacking the ptolemy.gui.Query and
> ptolemy.actor.gui.PtolemyQuery classes whenever I'd need another
> custom query box, I modified those two classes (and added
> classes/interfaces) to make it a bit more flexible.
> In order to get a new query box into Ptolemy, you need to modify the
> following places:
> - ptolemy.gui.Query
>  ~ set(String,String)
>  ~ getStringValue(String)
>  in those two methods the type of custom query chooser, e.g.,
>  QueryColorChooser is used to determine how to obtain/set the
>  string representation.
> - ptolemy.actor.gui.PtolemyQuery
>  ~ addStyledEntry(Settable)
>  here the type of Parameter defines what query chooser is added
>  for the attribute, e.g., a QueryColorChooser in case of a
>  ColorAttribute.
> To decouple this a bit, I've come up with an interface called
> "CustomQueryBoxParameter", to be implemented by types derived from
> Parameter that need a custom query box. The interface consists of only
> one method:
>  javax.swing.Box createQueryBox(PtolemyQuery query, Settable att)
> This method returns a custom query box (fully configured), based on
> the current query and attribute this query belongs to. This swing
> element contains all the necessary logic to manipulate the data, e.g.,
> a button for popping up another dialog, etc. The addStyledEntry method
> of the PtolemyQuery class obtains a box from an attribute implementing
> CustomQueryBoxParameter and attaches it (via the _addPair method).
> The query box being returned, is a custom class derived from
> javax.swing.Box, which implements another interface called
> "SettableQueryChooser". This interface is used in the
> set/getStringValue methods of ptolemy.gui.Query to set/get the current
> string value. The actual query chooser class turns that into whatever
> internal representation it uses. This interface avoids having to add
> new logic to the Query class, whenever a new custom QueryChooser is
> implemented.
> Since I'm apparently not the only user who encountered this problem,
> I'd like to contribute my code (which will hopefully trickle down to
> Kepler at one stage, in case it gets accepted). Not exactly sure how
> contributions work around here.
> Note: my original post *with* attachments didn't come through
> apparently (never showed up in the Google group), you can find my
> original post including the attachments on my homepage:
> http://www.scms.waikato.ac.nz/~fracpete/downloads/ptolemy/custom_query_boxes/<http://www.scms.waikato.ac.nz/%7Efracpete/downloads/ptolemy/custom_query_boxes/>
> There are several files available for download from this web page:
> - ptolemy-patch.zip
>  contains patches for the Query/PtolemyQuery classes
>  (run against subversion repository August 14, 2008)
> - ptolemy-additional_classes.zip
>  additional classes/interfaces necessary for my proposed changes
> - examples-classes.zip
>  contains a simple actor that uses a custom query box with a button
>  that pops up a JOptionPane for the user to enter some text; this is
>  just to demonstrate how the slightly modified framework would work
> - examples.kar
>  a kepler archive - I know, this is not exactly the right place, but
>  I thought some Kepler people/developers read this mailing list as well
>  and might be interested in this
> Hopefully, my ramblings made some sense, otherwise the code hopefully
> speaks for itself. ;-)
> Cheers, Peter
> --
> Peter Reutemann, Dept. of Computer Science, University of Waikato, NZ
> http://www.cs.waikato.ac.nz/~fracpete/<http://www.cs.waikato.ac.nz/%7Efracpete/>Ph.
>  +64 (7) 858-5174
> ----------------------------------------------------------------------------
> Posted to the ptolemy-hackers mailing list.  Please send administrative
> mail for this list to: [EMAIL PROTECTED]

Matthew B. Jones
Director of Informatics Research and Development
National Center for Ecological Analysis and Synthesis (NCEAS)
UC Santa Barbara
[EMAIL PROTECTED] Ph: 1-907-523-1960

Reply via email to