public class CatalogChooser
extends javax.swing.JPanel
A list of catalogs is kept in a ComboBox, and the user can choose from them and add new ones. When a catalog is chosen, its contents are displayed in a CatalogTreeView. As the datasets are browsed, the metadata is displayed in an HtmlBrowser widget.
When a new dataset is selected, a java.beans.PropertyChangeEvent is thrown, see addPropertyChangeListener.
Use Example:
// create widgets catalogChooser = new thredds.ui.CatalogChooser( prefs); catalogChooserDialog = catalogChooser.makeDialog(rootPaneContainer, "Open THREDDS dataset", true); // listen for selection catalogChooser.addPropertyChangeListener( new java.beans.PropertyChangeListener() { public void propertyChange( java.beans.PropertyChangeEvent e) { if (e.getPropertyName().equals("Dataset")) { .. } } }); // popup dialog catalogChooserDialog.show();You can use the CatalogChooser alone, wrap it into a JDialog for popping up, or use a ThreddsDatasetChooser instead, for a more complete interface.
ThreddsDatasetChooser
,
Serialized Formjavax.swing.JPanel.AccessibleJPanel
javax.swing.JComponent.AccessibleJComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
CatalogChooser(PreferencesExt prefs,
boolean showComboChooser,
boolean showOpenButton,
boolean showFileChooser)
Constructor, with control over whether a comboBox of previous catalogs is shown.
|
Modifier and Type | Method and Description |
---|---|
void |
addButton(javax.swing.JButton b)
Add this button to the button panel.
|
Catalog |
getCurrentCatalog()
Get the current catalog being shown.
|
java.lang.String |
getCurrentURL()
Get the current URL string.
|
DatasetNode |
getSelectedDataset() |
CatalogTreeView |
getTreeView()
Get the TreeView component.
|
javax.swing.JDialog |
makeDialog(javax.swing.RootPaneContainer parent,
java.lang.String title,
boolean modal)
Wrap this in a JDialog component.
|
void |
save()
Save persistent state.
|
void |
setAccessOnly(boolean accessOnly)
Whether to throw events only if dataset has an Access.
|
void |
setCatalog(Catalog catalog)
Set the current catalog.
|
void |
setCatalog(java.lang.String catalogURL)
Set the current catalog with a string URL.
|
void |
setCatrefEvents(boolean catrefEvents)
Whether to throw events if catref URL was chosen catref URL was chosen in HtmlViewer (default false).
|
void |
setDatasetEvents(boolean datasetEvents)
Whether to throw events if dataset URL was chosen in HtmlViewer (default true).
|
void |
setSelectedDataset(Dataset ds)
Set the currently selected InvDataset.
|
void |
setSelectedItem(java.lang.String item)
Use this to set the string value in the combo box
|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public CatalogChooser(PreferencesExt prefs, boolean showComboChooser, boolean showOpenButton, boolean showFileChooser)
prefs
- persistent storage, may be null.showComboChooser
- comboBox persists catalog URLsshowOpenButton
- show the "open" button.showFileChooser
- show a FileChooser (must have showComboChooser true)public void save()
public void addButton(javax.swing.JButton b)
b
- button to addpublic void setAccessOnly(boolean accessOnly)
accessOnly
- if true, throw events only if dataset has an Accesspublic void setCatrefEvents(boolean catrefEvents)
public void setDatasetEvents(boolean datasetEvents)
public void setSelectedItem(java.lang.String item)
item
- public void setSelectedDataset(Dataset ds)
ds
- select this InvDataset, must be already in the tree.public DatasetNode getSelectedDataset()
public Catalog getCurrentCatalog()
public CatalogTreeView getTreeView()
public java.lang.String getCurrentURL()
public void setCatalog(Catalog catalog)
public void setCatalog(java.lang.String catalogURL)
public javax.swing.JDialog makeDialog(javax.swing.RootPaneContainer parent, java.lang.String title, boolean modal)
parent
- JFrame (application) or JApplet (applet) or nulltitle
- dialog window titlemodal
- is modal