Hello All,
I was hoping someone out there had some experience implementing the
ThreddsDatasetChooser component and would be willing to help me out a
bit. I've made a very simple test class to get the
ThreddsDatasetChooser up and running. The class is at the end of this
email. I'm able to display the dialog without much trouble, but I am
unable to make it connect to a catalog. When I enter a catalog URL into
the combobox and click "Connect", a progress dialog comes up after a few
seconds and tells me that it's "opening the catalog"...but after about
20 seconds or so, the dialog goes away and nothing else happens. I also
get the following exception in the output pane of my IDE:
Exception in thread "Thread-2" java.lang.NullPointerException
at
thredds.catalog.ui.CatalogFactoryCancellable$OpenCatalogTask.run(Catalog
FactoryCancellable.java:158)
at java.lang.Thread.run(Thread.java:613)
Can anyone help me out and let me know what I'm not doing or doing
wrong??
Thanks in advance,
Chris
import java.io.IOException;
import javax.swing.*;
import thredds.catalog.ui.ThreddsDatasetChooser;
import ucar.util.prefs.PreferencesExt;
import ucar.util.prefs.XMLStore;
/**
*
* @author asamac
*/
public class Browse {
/**
* Creates a new instance of Browse
*/
public Browse() {
}
private static void createAndShowGUI(){
JFrame frame = new JFrame("Thredds Catalog Browser");
frame.setSize(800, 600);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JTabbedPane tabPane = new JTabbedPane();
System.err.println("before");
XMLStore store = null;
try {
store = XMLStore.createFromFile("xmlStore.xml", null);
} catch (IOException ex) {
ex.printStackTrace();
}
PreferencesExt prefs = store.getPreferences();
System.err.println("prefs instantiated");
ThreddsDatasetChooser datasetChooser = new
ThreddsDatasetChooser(prefs, tabPane, frame, true, true);
System.err.println("tdc instantiated");
datasetChooser.addPropertyChangeListener( new
java.beans.PropertyChangeListener() {
public void propertyChange( java.beans.PropertyChangeEvent e)
{
if (e.getPropertyName().equals("Dataset")) {
System.err.println("single dataset");
}else if (e.getPropertyName().equals("Datasets")){
System.err.println("multiple datasets");
}else if (e.getPropertyName().equals("InvAccess")){
System.err.println("invAccess");
}
}
});
frame.add(tabPane);
frame.setVisible(true);
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
}
});
}
}
Christopher Mueller | Scientist
Applied Science Associates
70 Dean Knauss Drive | Narragansett, RI 02882 USA
p: +1 401-789-6224 | f: +1 401-789-1932
e: cmueller@xxxxxxxxxxxxxx <mailto:ehowlett@xxxxxxxxxxxxxx> |
www.asascience.com <http://www.asascience.com/>
ASA | Science. Services. Solutions.