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 StringKEY_CASESENSITIVEstatic StringKEY_DIRstatic StringKEY_FILEREGEXPstatic StringKEY_MATCHINGstatic StringKEY_RECURSIVEstatic StringKEY_SEARCHTEXTprotected List<AbstractFindInFilesAction>m_Actionsthe actions.protected BaseButtonWithDropDownMenum_ButtonActionsthe action button.protected BaseButtonm_ButtonStartthe button for starting the search.protected BaseButtonm_ButtonStopthe button for stopping the search.protected BaseCheckBoxm_CheckBoxCaseSensitivewhether to search case-sensitive.protected BaseCheckBoxm_CheckBoxRecursivewhether to search recursively.protected BaseComboBox<String>m_ComboBoxMatchingthe type of search to perform.protected FileSearchHandlerm_CurrentHandlerthe current search handler.protected ExceptionHandlerm_ExceptionHandlerthe exception handler.protected LocalDirectoryListerm_Listerthe file lister to use.protected BaseListWithButtonsm_ListResultsfor listing the files that matched.protected Loggerm_Loggerfor logging.protected DefaultListModel<String>m_ModelResultsthe model for the results.protected DirectoryChooserPanelm_PanelDirthe directory.protected ParameterPanelm_PanelParametersfor the parameters.protected booleanm_Runningwhether search is currently running.protected BaseStatusBarm_StatusBarthe status bar.protected booleanm_Stoppedwhether the search has been stopped.protected RegExpTextFieldm_TextFileRegExpthe regexp for the files.protected BaseTextFieldm_TextSearchTextthe search expression.static StringSESSION_FILEthe 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 voidcleanUp()Cleans up data structures, frees up memory.protected voidfinishInit()Finishes the initialization.FilegetSelectedFile()Returns the currently selected file.File[]getSelectedFiles()Returns the currently selected files.protected voidinitGUI()Initializes the members.protected voidinitialize()Initializes the membersbooleanisRunning()Returns whether the search is currently underway.booleanisStopped()Whether the execution has been stopped.protected voidloadSession()Loads the parameters from an existing session file.protected voidsaveSession()Stores the current parameters in a session props file.voidstartSearch()Starts the search.voidstopExecution()Stops the execution.protected voidupdateButtons()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:
initializein classBasePanel
-
finishInit
protected void finishInit()
Finishes the initialization.- Overrides:
finishInitin 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:
stopExecutionin interfaceStoppable
-
isStopped
public boolean isStopped()
Whether the execution has been stopped.- Specified by:
isStoppedin 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:
cleanUpin interfaceCleanUpHandler
-
-