RE: setMaps()?

Hi Michelle,

>and making the appropriate modifications in VisadAPI.java. It still compiles
>and runs. But I'm stuck in the same spot as before. When I run java -mx512m
>visad.ss.SpreadSheet and a spreadsheet appears. I click on my "GO" button
>and the small.v5d does not have my specified mappings. There are no mappings
>at all under "Current Maps".
>
>Is there a problem with setMaps?

First, you still have a line that calls "mySS.myAutoDetect(false)" which
fails to compile on my machine.  I changed this line to
"mySS.setAutoDetect(false)" and proceeded to investigate.

The reason what you are doing doesn't work is that the SpreadSheet loads the
data in the background (in a separate thread).  You are calling setMaps
immediately after instructing the SpreadSheet to load some data, and thus the
load is not yet complete when you call setMaps.

I apologize for my bad advice of putting setMaps in the same method as
addDataSource.  It turns out that won't work.  But I believe you can solve the
problem by registering your VisadAPI as an SSCellListener, then listening for
DATA_CHANGE events and setting the maps at that point.

Just have your VisadAPI class implement SSCellListener, add a method:
    "public void ssCellChanged(SSCellChangeEvent e)"
and in that method, if "e.getChangeType() == SSCellChangeEvent.DATA_CHANGE",
then call your setCurrentMaps method at that point.  You may also want to
perform some additional checks, to ensure that it is your small.v5d data
source that was added, rather than some other data, or a data clear operation.

I also want to emphasize what Bill said earlier--if you are sure you want this
functionality within the context of the SpreadSheet, then you can continue
along the path I described above, but if you don't need the SpreadSheet, then
it would be easier to write a stand-alone VisAD application.

>On another note, after reading Ugo's tutorial, I'm wondering if maybe I need
>to add a Data Reference object after I created the mappings. Would that be
>necessary to get the mappings to show up on the display? 

No, the SpreadSheet logic takes care of all that.  You'd only need to create
DataReferences if you used the core VisAD API without SpreadSheet.

-Curtis


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