Re: Example DataChooser plugin source code?

Hi Eric-

Eric Davies wrote:
At 11:24 AM 31/07/2007, Don Murray wrote:
Hi Eric-

Eric Davies wrote:
I had a homebrew DataChooser working in an earlier version of IDL (pre plugin).

Does that no longer work?  If we broke something, let us know.

I used to subclass IdvChooser, which meant that my subclass had java.awt.Component as a ancestor. Currently IdvChooser is subclassed from ChooserPanel which is not subclassed from anything. There was another place in the code that needs a javax.swing.JComponent instead of a java.awt.Component.
Minor stuff, but enough to break my code of course.

Ugh! sorry about that.  We'll be more careful about changing these
chooser classes.

We went to a paradigm of ChooserPanel having a getContents that
is called instead of having it be the component itself.

Can you point out which class has the Component/JComponent issue?

Given I have to update the code anyhow, I might as well convert my code to be a plugin, which I regard as a much more elegant way of adding components (compared to subclassing the main class, ugghh).

That's what we think as well.

I'm now trying rewire the code to be a plug-in.
An example or two would be most appreciated.

If you make a JAR file with the choosers.xml and the
Java classes (with the the correct directory structure
mimicking the package), you should  be all set.  Then
with use the -plugin or -installplugin command line option
to us it.

Presumably, I get to throw out my class that extended IntegratedDataViewer?

You shouldn't have had to extend IntegratedDataViewer before to add
in a custom chooser.  You should have just needed to have the
choosers.xml in your .metapps/DefaultIdv directory and the
class file in your classpath.  What mods did you need to make to
IntegratedDataViewer?

Still, an example would be reassuring.

If you just want to add in a chooser, you should be able to
create the JAR file as I described above.  If you want to
remove all the system choosers and just have yours you could
add an idv.rbi which looks like:

<?xml version="1.0" encoding="ISO-8859-1"?>

<resourcebundle name="Default">

  <!-- Where the xml is that defines the data choosers -->
<resources name="idv.resource.choosers" loadmore="false" removeprevious="true">
    <resource location="/choosers.xml"/>
  </resources>
</resourcebundle>

The loadmore says not to load chooser resources from subsequent
plugins and the removeprevious says remove any system choosers
or choosers from previously loaded plugins.  I've attached a
sample plugin JAR file which has just the Files chooser in it.

We're about to do a developer's workshop and the docs are at:

http://www.unidata.ucar.edu/software/idv/release/nightly/docs/workshop/

which has a little more discussion of the architecture than past docs
and examples of creating custom choosers, data sources, and displays
under the Java Developer section.

I'm cc'ing the list since this information should be useful to
other developers.

Don
*************************************************************
Don Murray                               UCAR Unidata Program
dmurray@xxxxxxxxxxxxxxxx                        P.O. Box 3000
(303) 497-8628                              Boulder, CO 80307
http://www.unidata.ucar.edu/staff/donm
*************************************************************

  • 2007 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the idvdevelopers archives: