Hi Curtis, Busy waiting for a data change didn't quite seem to work. I'm still seeing small.v5d loaded without any mappings at all. And you're right. I did have that other method in SpreadSheet.java called "myAutoDetect()" which I now removed since I wasn't using it. So your version of my SpreadSheet.java should be most up to date. Attached is my updated VisadAPI.java as well as SSCellListener since I had to import a couple packages in that class to have it compile. Do you know what could be causing this? Thanks, Michelle Michelle Kam (408) 742-2881 Lockheed Martin Space Systems Co. SSM/ATC/MSIS B/153 O/L922 1111 Lockheed Martin Way, Sunnyvale, CA 94089 -----Original Message----- From: Curtis Rueden [mailto:curtis@xxxxxxxxxxxxx] Sent: Thursday, June 12, 2003 5:12 PM To: Kam, Michelle C Subject: 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
Attachment:
SSCellListener.java
Description: Binary data
Attachment:
VisadAPI.java
Description: Binary data
visad
archives: