https://projects.ecoinformatics.org/ecoinfo/https://projects.ecoinformatics.org/ecoinfo/ecoinfo/favicon.ico?14691340362008-08-15T18:45:46ZEcoinformatics RedmineKepler - Bug #3471: custom input boxes in actor configuration dialoghttps://projects.ecoinformatics.org/ecoinfo/issues/3471?journal_id=118732008-08-15T18:45:46ZChristopher Brookscxh@eecs.berkeley.edu
<ul></ul><p>I folded the Ptolemy changes in to the Ptolemy Tree.<br />One issue is that one of the files in the example code from<br /><a class="external" href="http://www.scms.waikato.ac.nz/~fracpete/downloads/ptolemy/custom_query_boxes/examples-classes.zip">http://www.scms.waikato.ac.nz/~fracpete/downloads/ptolemy/custom_query_boxes/examples-classes.zip</a><br />need to be in ptolemy.actor.gui</p>
<p>I tried to put QueryInputDialogChooser into ptolemy/actor/gui/test,<br />but compilation fails because that class uses some package protected inner<br />classes in ptolemy.actor.gui.</p>
<p>CLASSPATH="../../../.." "/usr/bin/javac" -g -O InputDialogParameter.java<br />../../../../ptolemy/actor/gui/test/QueryInputDialogChooser.java:116: ptolemy.gui.Query.QueryActionListener is not public in ptolemy.gui.Query; cannot be accessed from outside package<br /> _entryBox.addActionListener(_owner.new QueryActionListener(name));<br /> ^<br />../../../../ptolemy/actor/gui/test/QueryInputDialogChooser.java:129: ptolemy.gui.Query.QueryFocusListener is not public in ptolemy.gui.Query; cannot be accessed from outside package<br /> _entryBox.addFocusListener(_owner.new QueryFocusListener(name));<br /> ^<br />../../../../ptolemy/actor/gui/test/QueryInputDialogChooser.java:139: _notifyListeners(java.lang.String) is not public in ptolemy.gui.Query; cannot be accessed from outside package<br /> _owner._notifyListeners(_name);</p>
<p>The obvious thing is to make the package protected code non-package protected.<br />There are probably other, more elegant solutions though.</p> Kepler - Bug #3471: custom input boxes in actor configuration dialoghttps://projects.ecoinformatics.org/ecoinfo/issues/3471?journal_id=118742008-09-19T22:23:51ZChristopher Brookscxh@eecs.berkeley.edu
<ul></ul><p>There is more to the thread at<br /><a class="external" href="http://groups.google.com/group/comp.soft-sys.ptolemy/browse_thread/thread/27600a8a04d9deeb">http://groups.google.com/group/comp.soft-sys.ptolemy/browse_thread/thread/27600a8a04d9deeb</a>#</p>
<p>One issue is that data.expr.CustomQueryBoxParameter imports ptolemy.actor.gui<br />and thus means that data.expr depends on actor.gui.</p>
<p>On August 15, I folded changes in:</p>
<p>2008-08-15 18:40 cxh</p>
<ul>
<li>[r50436] /trunk/ptolemy/actor/gui/PtolemyQuery.java,<br /> /trunk/ptolemy/data/expr/CustomQueryBoxParameter.java,<br /> /trunk/ptolemy/data/expr/makefile, /trunk/ptolemy/gui/Query.java,<br /> /trunk/ptolemy/gui/QueryChooserHelper.java,<br /> /trunk/ptolemy/gui/SettableQueryChooser.java,<br /> /trunk/ptolemy/gui/makefile: Peter Reutemann: Custom query boxes<br /> in Kepler/Ptolemy. See <a class="external" href="http://www.scms.waikato.ac.nz/~fracpete/downloads/ptolemy/custom_query_boxes/">http://www.scms.waikato.ac.nz/~fracpete/downloads/ptolemy/custom_query_boxes/</a></li>
</ul>
<p>On August 16, Edward pointed out:</p>
<blockquote>
<p>There is no need to modify the underlying framework to do this.<br />Just put a subclass of ptolemy.actor.gui.ParameterEditorStyle<br />(an attribute) inside the attribute that you want a custom input<br />box for. Your subclass can implement that custom input box,<br />and it will automatically appear in the query box. This is how<br />the style preferences currently there are implemented.</p>
</blockquote>
<p>On August 16, Peter responded with</p>
<blockquote>
<p>Taking the FileChooserStyle as example: it calls the public<br />addFileChooser method of the Query class in order to be able to add<br />the JLabel and the QueryFileChooser box via the protected _addPair<br />method. Unless I'm willing to modify the Query class (adding another<br />public addXYZ method), I'm not able to add my own custom box outside<br />the ptolemy.gui package, right? And wouldn't it be also necessary to<br />add my own style class to the _parameterStyles member of the<br />ptolemy.actor.gui.style.StyleConfigurer?</p>
</blockquote>
<p>On August 17, Peter wrote:<br />--start--<br />[Edward wrote:]</p>
<blockquote>
<p>I guess the right solution would be to add a public method like<br />addPair(), which would use _addPair(), but this would be tricky<br />to get right. In particular, _addPair() populates the _entries<br />hashtable with objects, and I'm not sure what would be the right<br />sort of object to provide for a completely custom entry...<br />There might be other gotcha's as well.</p>
</blockquote>
<blockquote>
<p>Unfortunately, I don't have bandwidth for this sort of thing<br />right now, but if you want to take a stab at modifying the Query<br />class, I would be happy to take a look...</p>
</blockquote>
<p>I had another go at the ptolemy.qui.Query class and my previous<br />modifications, once again based on today's subversion repository. See<br />link at end of post for downloads.</p>
<p>This post is also in response to Christopher's feedback:<br /> <a class="external" href="http://mercury.nceas.ucsb.edu/ecoinformatics/pipermail/kepler-dev/200">http://mercury.nceas.ucsb.edu/ecoinformatics/pipermail/kepler-dev/200</a>...</p>
<p>Here are the additional modifications:<br />- All inner classes of ptolemy.qui.Query are now public and static,<br /> in case one needs to use, e.g., a QueryActionListener in a package<br /> outside ptolemy.gui. They all contain a private member "_owner" <br /> of type ptolemy.gui.Query.</p>
<pre><code>--> ptolemy.gui.Query.diff</code></pre>
<p>- An additional abstract superclass ptolemy.gui.QueryChooser<br /> (derived from javax.swing.Box) which enables derived classes to<br /> call _addPair and _notifyListeners of the ptolemy.gui.Query class,<br /> even if they're outside the ptolemy.gui package.<br /> (the QueryInputDialogChooser in the example below is now derived<br /> from this class)</p>
<pre><code>--> ptolemy-additional_classes.zip</code></pre>
<p>- Updated example to demonstrate the changes. This time, there are<br /> no classes in the ptolemy... package hierarchy anymore. The example<br /> contains a simple actor with a parameter consisting of a text field<br /> and a button to pop up a dialog for entering a string (which is<br /> then displayed in the text field).</p>
<pre><code>--> examples.zip (example classes)<br /> examples.kar (Kepler archive)</code></pre>
<p>Files mentioned above are available for download from this link:<br /> <a class="external" href="http://www.scms.waikato.ac.nz/~fracpete/downloads/ptolemy/custom_quer">http://www.scms.waikato.ac.nz/~fracpete/downloads/ptolemy/custom_quer</a>...</p>
<p>Hopefully, this all makes sense to you... ;-)</p>
<p>Cheers, Peter</p>
<p>--end--</p>
<p>I'm going to try to fold in Peter's second set of changes and see what happens.</p> Kepler - Bug #3471: custom input boxes in actor configuration dialoghttps://projects.ecoinformatics.org/ecoinfo/issues/3471?journal_id=118752008-09-20T01:17:33ZChristopher Brookscxh@eecs.berkeley.edu
<ul></ul><p>I'm closing this one, I checked in Peter's latest code.<br />I moved CustomQueryBoxParameter from data.expr to actor.gui<br />I added actor/gui/CustomQueryExample.tar.gz which uses Peter's<br />example code of how to create a CustomQuery with classes outside of the ptII tree.</p> Kepler - Bug #3471: custom input boxes in actor configuration dialoghttps://projects.ecoinformatics.org/ecoinfo/issues/3471?journal_id=118762013-03-27T21:23:32ZRedmine Admin
<ul></ul><p>Original Bugzilla ID was 3471</p>