Package adams.gui.tools
Class FindInFilesPanel
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- adams.gui.core.BasePanel
-
- adams.gui.tools.FindInFilesPanel
-
- All Implemented Interfaces:
CleanUpHandler
,Stoppable
,StoppableWithFeedback
,ImageObserver
,MenuContainer
,Serializable
,Accessible
public class FindInFilesPanel extends BasePanel implements StoppableWithFeedback, CleanUpHandler
Simple tool for finding text in .- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
-
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
Fields Modifier and Type Field Description static String
KEY_CASESENSITIVE
static String
KEY_DIR
static String
KEY_FILEREGEXP
static String
KEY_MATCHING
static String
KEY_RECURSIVE
static String
KEY_SEARCHTEXT
protected List<AbstractFindInFilesAction>
m_Actions
the actions.protected BaseButtonWithDropDownMenu
m_ButtonActions
the action button.protected BaseButton
m_ButtonStart
the button for starting the search.protected BaseButton
m_ButtonStop
the button for stopping the search.protected BaseCheckBox
m_CheckBoxCaseSensitive
whether to search case-sensitive.protected BaseCheckBox
m_CheckBoxRecursive
whether to search recursively.protected BaseComboBox<String>
m_ComboBoxMatching
the type of search to perform.protected FileSearchHandler
m_CurrentHandler
the current search handler.protected ExceptionHandler
m_ExceptionHandler
the exception handler.protected LocalDirectoryLister
m_Lister
the file lister to use.protected BaseListWithButtons
m_ListResults
for listing the files that matched.protected Logger
m_Logger
for logging.protected DefaultListModel<String>
m_ModelResults
the model for the results.protected DirectoryChooserPanel
m_PanelDir
the directory.protected ParameterPanel
m_PanelParameters
for the parameters.protected boolean
m_Running
whether search is currently running.protected BaseStatusBar
m_StatusBar
the status bar.protected boolean
m_Stopped
whether the search has been stopped.protected RegExpTextField
m_TextFileRegExp
the regexp for the files.protected BaseTextField
m_TextSearchText
the search expression.static String
SESSION_FILE
the file to store the recent parameters in.-
Fields inherited from class adams.gui.core.BasePanel
m_FileChooser
-
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
accessibleContext, 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
Constructors Constructor Description FindInFilesPanel()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cleanUp()
Cleans up data structures, frees up memory.protected void
finishInit()
Finishes the initialization.File
getSelectedFile()
Returns the currently selected file.File[]
getSelectedFiles()
Returns the currently selected files.protected void
initGUI()
Initializes the members.protected void
initialize()
Initializes the membersboolean
isRunning()
Returns whether the search is currently underway.boolean
isStopped()
Whether the execution has been stopped.protected void
loadSession()
Loads the parameters from an existing session file.protected void
saveSession()
Stores the current parameters in a session props file.void
startSearch()
Starts the search.void
stopExecution()
Stops the execution.protected void
updateButtons()
Updates the state of the buttons.-
Methods inherited from class adams.gui.core.BasePanel
afterHide, afterShow, beforeHide, beforeShow, closeParent, getParentChild, getParentDialog, getParentFrame, getParentInternalFrame, getParentTitle, initFileChooser, main, printErrorMessage, printException, saveComponent, setEnabledCascade, setEnabledCascade, setParentTitle, setVisible
-
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, 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, 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 Detail
-
SESSION_FILE
public static final String SESSION_FILE
the file to store the recent parameters in.- See Also:
- Constant Field Values
-
KEY_DIR
public static final String KEY_DIR
- See Also:
- Constant Field Values
-
KEY_RECURSIVE
public static final String KEY_RECURSIVE
- See Also:
- Constant Field Values
-
KEY_FILEREGEXP
public static final String KEY_FILEREGEXP
- See Also:
- Constant Field Values
-
KEY_MATCHING
public static final String KEY_MATCHING
- See Also:
- Constant Field Values
-
KEY_SEARCHTEXT
public static final String KEY_SEARCHTEXT
- See Also:
- Constant Field Values
-
KEY_CASESENSITIVE
public static final String KEY_CASESENSITIVE
- See Also:
- Constant Field Values
-
m_PanelParameters
protected ParameterPanel m_PanelParameters
for the parameters.
-
m_PanelDir
protected DirectoryChooserPanel m_PanelDir
the directory.
-
m_CheckBoxRecursive
protected BaseCheckBox m_CheckBoxRecursive
whether to search recursively.
-
m_TextFileRegExp
protected RegExpTextField m_TextFileRegExp
the regexp for the files.
-
m_ComboBoxMatching
protected BaseComboBox<String> m_ComboBoxMatching
the type of search to perform.
-
m_TextSearchText
protected BaseTextField m_TextSearchText
the search expression.
-
m_CheckBoxCaseSensitive
protected BaseCheckBox m_CheckBoxCaseSensitive
whether to search case-sensitive.
-
m_ButtonStart
protected BaseButton m_ButtonStart
the button for starting the search.
-
m_ButtonStop
protected BaseButton m_ButtonStop
the button for stopping the search.
-
m_ModelResults
protected DefaultListModel<String> m_ModelResults
the model for the results.
-
m_ListResults
protected BaseListWithButtons m_ListResults
for listing the files that matched.
-
m_Actions
protected List<AbstractFindInFilesAction> m_Actions
the actions.
-
m_ButtonActions
protected BaseButtonWithDropDownMenu m_ButtonActions
the action button.
-
m_StatusBar
protected BaseStatusBar m_StatusBar
the status bar.
-
m_Stopped
protected boolean m_Stopped
whether the search has been stopped.
-
m_Running
protected boolean m_Running
whether search is currently running.
-
m_Lister
protected LocalDirectoryLister m_Lister
the file lister to use.
-
m_ExceptionHandler
protected ExceptionHandler m_ExceptionHandler
the exception handler.
-
m_Logger
protected Logger m_Logger
for logging.
-
m_CurrentHandler
protected FileSearchHandler m_CurrentHandler
the current search handler.
-
-
Method Detail
-
initialize
protected void initialize()
Initializes the members- Overrides:
initialize
in classBasePanel
-
finishInit
protected void finishInit()
Finishes the initialization.- Overrides:
finishInit
in classBasePanel
-
updateButtons
protected void updateButtons()
Updates the state of the buttons.
-
startSearch
public void startSearch()
Starts the search.
-
stopExecution
public void stopExecution()
Stops the execution.- Specified by:
stopExecution
in interfaceStoppable
-
isStopped
public boolean isStopped()
Whether the execution has been stopped.- Specified by:
isStopped
in interfaceStoppableWithFeedback
- Returns:
- true if stopped
-
isRunning
public boolean isRunning()
Returns whether the search is currently underway.- Returns:
- true if currently running
-
getSelectedFile
public File getSelectedFile()
Returns the currently selected file.- Returns:
- the file, null if none or more than one selected
-
getSelectedFiles
public File[] getSelectedFiles()
Returns the currently selected files.- Returns:
- the files
-
loadSession
protected void loadSession()
Loads the parameters from an existing session file.
-
saveSession
protected void saveSession()
Stores the current parameters in a session props file.
-
cleanUp
public void cleanUp()
Cleans up data structures, frees up memory.- Specified by:
cleanUp
in interfaceCleanUpHandler
-
-