Package edu.wisc.ssec.mcidasv.chooser
Class TLEFileChooser
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JFileChooser
edu.wisc.ssec.mcidasv.chooser.TLEFileChooser
- All Implemented Interfaces:
ImageObserver
,MenuContainer
,PropertyChangeListener
,Serializable
,EventListener
,Accessible
,AncestorListener
public class TLEFileChooser
extends JFileChooser
implements AncestorListener, PropertyChangeListener
An extension of JFileChooser to handle Two-Line Element (TLE)
files, for plotting satellite orbit tracks.
- Author:
- Gail Dengel and Tommy Jasmin
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JFileChooser
JFileChooser.AccessibleJFileChooser
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String
private static final org.slf4j.Logger
private PolarOrbitTrackChooser
private static final long
auto-generated default valueprivate boolean
Value is controlled viaancestorAdded(AncestorEvent)
andancestorRemoved(AncestorEvent)
protected OnFileChangeListener
This is mostly used to preemptively null-out the listener.Fields inherited from class javax.swing.JFileChooser
ACCEPT_ALL_FILE_FILTER_USED_CHANGED_PROPERTY, accessibleContext, ACCESSORY_CHANGED_PROPERTY, APPROVE_BUTTON_MNEMONIC_CHANGED_PROPERTY, APPROVE_BUTTON_TEXT_CHANGED_PROPERTY, APPROVE_BUTTON_TOOL_TIP_TEXT_CHANGED_PROPERTY, APPROVE_OPTION, APPROVE_SELECTION, CANCEL_OPTION, CANCEL_SELECTION, CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY, CONTROL_BUTTONS_ARE_SHOWN_CHANGED_PROPERTY, CUSTOM_DIALOG, DIALOG_TITLE_CHANGED_PROPERTY, DIALOG_TYPE_CHANGED_PROPERTY, DIRECTORIES_ONLY, DIRECTORY_CHANGED_PROPERTY, ERROR_OPTION, FILE_FILTER_CHANGED_PROPERTY, FILE_HIDING_CHANGED_PROPERTY, FILE_SELECTION_MODE_CHANGED_PROPERTY, FILE_SYSTEM_VIEW_CHANGED_PROPERTY, FILE_VIEW_CHANGED_PROPERTY, FILES_AND_DIRECTORIES, FILES_ONLY, MULTI_SELECTION_ENABLED_CHANGED_PROPERTY, OPEN_DIALOG, SAVE_DIALOG, SELECTED_FILE_CHANGED_PROPERTY, SELECTED_FILES_CHANGED_PROPERTY
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
Constructor Summary
ConstructorsConstructorDescriptionTLEFileChooser
(PolarOrbitTrackChooser chooser, String directory, String filename) Create the file chooser -
Method Summary
Modifier and TypeMethodDescriptionvoid
ancestorAdded
(AncestorEvent ancestorEvent) void
ancestorMoved
(AncestorEvent ancestorEvent) Not implemented.void
ancestorRemoved
(AncestorEvent ancestorEvent) void
Approve the selectionprivate OnFileChangeListener
Creates a directory monitoringservice
.getPath()
See the javadoc forgetPath(String)
.Get the path theJFileChooser
should be using.getPotc()
void
handleChangeWatchService
(String newPath) Respond to path changes in theJFileChooser
.protected void
void
handleStartWatchService
(String topic, Object reason) Begin monitoring the directory returned bygetPath()
for changes.void
handleStopWatchService
(String topic, Object reason) Disable directory monitoring (if it was enabled in the first place).boolean
Determine if this file chooser is actually visible to the user.void
private void
refreshIfNeeded
(String filePath) Used to handle theOnFileChangeListener.onFileDelete(String)
andOnFileChangeListener.onWatchInvalidation(String)
events.void
Change the path that the file chooser is presenting to the user.void
void
setSelectedFile
(File file) private void
setTrulyVisible
(boolean value) Set whether or not this file chooser is actually visible to the user.Methods inherited from class javax.swing.JFileChooser
accept, addActionListener, addChoosableFileFilter, cancelSelection, changeToParentDirectory, createDialog, ensureFileIsVisible, fireActionPerformed, getAcceptAllFileFilter, getAccessibleContext, getAccessory, getActionListeners, getApproveButtonMnemonic, getApproveButtonText, getApproveButtonToolTipText, getChoosableFileFilters, getControlButtonsAreShown, getCurrentDirectory, getDescription, getDialogTitle, getDialogType, getDragEnabled, getFileFilter, getFileSelectionMode, getFileSystemView, getFileView, getIcon, getName, getSelectedFile, getSelectedFiles, getTypeDescription, getUI, getUIClassID, isAcceptAllFileFilterUsed, isDirectorySelectionEnabled, isFileHidingEnabled, isFileSelectionEnabled, isMultiSelectionEnabled, isTraversable, paramString, removeActionListener, removeChoosableFileFilter, rescanCurrentDirectory, resetChoosableFileFilters, setAcceptAllFileFilterUsed, setAccessory, setApproveButtonMnemonic, setApproveButtonMnemonic, setApproveButtonText, setApproveButtonToolTipText, setControlButtonsAreShown, setCurrentDirectory, setDialogTitle, setDialogType, setDragEnabled, setFileFilter, setFileHidingEnabled, setFileSelectionMode, setFileSystemView, setFileView, setMultiSelectionEnabled, setSelectedFiles, setup, showDialog, showOpenDialog, showSaveDialog, updateUI
Methods inherited from class javax.swing.JComponent
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
Methods inherited from class java.awt.Container
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
Methods inherited from class java.awt.Component
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, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
ID
- See Also:
-
serialVersionUID
auto-generated default value- See Also:
-
logger
-
potc
-
watchListener
This is mostly used to preemptively null-out the listener. -
trulyVisible
Value is controlled viaancestorAdded(AncestorEvent)
andancestorRemoved(AncestorEvent)
-
-
Constructor Details
-
TLEFileChooser
Create the file chooser- Parameters:
chooser
-PolarOrbitTrackChooser
to which thisTLEFileChooser
belongs.directory
- Initial directory.filename
- Initial filename withindirectory
.
-
-
Method Details
-
setSelectedFile
- Overrides:
setSelectedFile
in classJFileChooser
-
approveSelection
Approve the selection- Overrides:
approveSelection
in classJFileChooser
-
setPotc
-
getPotc
-
propertyChange
- Specified by:
propertyChange
in interfacePropertyChangeListener
-
handleFileChanged
-
setPath
Change the path that the file chooser is presenting to the user.This value will be written to the user's preferences so that the user can pick up where they left off after restarting McIDAS-V.
- Parameters:
newPath
- Path to set.
-
getPath
See the javadoc forgetPath(String)
.The difference between the two is that this method passes the value of
System.getProperty("user.home")
togetPath(String)
as the default value.- Returns:
- Path to use for the chooser.
-
getPath
Get the path theJFileChooser
should be using.If the path in the user's preferences is
null
(or does not exist),defaultValue
will be returned.If there is a nonexistent path in the preferences file,
FileChooser.findValidParent(String)
will be used.- Parameters:
defaultValue
- Default path to use if there is a "bad" path in the user's preferences. Cannot benull
.- Returns:
- Path to use for the chooser.
- Throws:
NullPointerException
- ifdefaultValue
isnull
.
-
handleChangeWatchService
Respond to path changes in theJFileChooser
.This method will disable monitoring of the previous path and then enable monitoring of
newPath
.- Parameters:
newPath
- New path to begin watching.
-
handleStartWatchService
Begin monitoring the directory returned bygetPath()
for changes.- Parameters:
topic
- Artifact fromEventBus
annotation. Not used.reason
- Optional "Reason" for starting. Helpful for logging.
-
handleStopWatchService
Disable directory monitoring (if it was enabled in the first place).- Parameters:
topic
- Artifact fromEventBus
annotation. Not used.reason
- Optional "Reason" for starting. Helpful for logging.
-
createWatcher
Creates a directory monitoringservice
.- Returns:
- Directory monitor that will respond to changes.
-
refreshIfNeeded
Used to handle theOnFileChangeListener.onFileDelete(String)
andOnFileChangeListener.onWatchInvalidation(String)
events.- Parameters:
filePath
- Path of interest. Cannot benull
.
-
ancestorAdded
- Specified by:
ancestorAdded
in interfaceAncestorListener
-
ancestorRemoved
- Specified by:
ancestorRemoved
in interfaceAncestorListener
-
ancestorMoved
Not implemented.- Specified by:
ancestorMoved
in interfaceAncestorListener
- Parameters:
ancestorEvent
- Ignored.
-
isTrulyVisible
Determine if this file chooser is actually visible to the user.- Returns:
- Whether or not this component has been made visible.
-
setTrulyVisible
Set whether or not this file chooser is actually visible to the user.- Parameters:
value
-true
means visible.
-