public class SearchReplacePane extends JPanel implements ActionListener
JPanel.AccessibleJPanel
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
Modifier and Type | Field and Description |
---|---|
protected DocumentView |
docView |
protected boolean |
done |
protected TextIcon[] |
functionKeyIcons |
protected static String[] |
HIT_HIGHLIGHT_PREFIXES |
protected Matcher |
matcher |
protected JButton |
replaceAllButton |
protected JButton |
replaceButton |
protected SearchReplaceForm |
searchReplaceForm |
protected SearchReplaceForm.Info |
searchReplaceInfo |
protected SearchReplaceText |
searchReplaceText |
protected TextOffset |
selectionDot |
protected TextOffset |
selectionMark |
protected JButton |
skipButton |
protected JButton |
skipElementButton |
protected JButton |
startButton |
protected int |
textSelectionMaxLength |
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
SearchReplacePane(boolean twoColumns)
Constructs a panel.
|
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(ActionEvent e) |
void |
cancel()
Cancels current operation, if any.
|
protected void |
configureButton(JButton button) |
protected void |
createFunctionKeyIcons() |
protected SearchReplaceForm.Info |
defaultInfo() |
boolean |
findAgain(boolean backwards)
Search last searched string at caret position.
|
protected TextOffset[] |
findNext(SearchReplaceText searchReplaceText,
SearchReplaceForm.Info searchReplaceInfo,
Matcher matcher) |
DocumentView |
getDocumentView()
Returns the DocumentView on which this panel operates.
|
JTextField |
getSearchedField()
Returns the "Search" field.
|
protected Object[] |
getSearchReplaceInfo() |
int |
getUseTextSelection()
Returns the maximum length allowed for a text selection
which can be used to specify the searched text.
|
protected void |
highlightAll() |
protected void |
registerKeyBoardActions() |
protected void |
replace() |
protected void |
replaceAll() |
void |
search(boolean backwards)
Starts a text search at caret position.
|
protected void |
searchFailed() |
void |
searchReplace(boolean backwards)
Starts a text search/replace at caret position.
|
protected void |
searchSuccessful(TextOffset[] found) |
void |
setDocumentView(DocumentView docView)
Specifies the DocumentView on which this panel will operate.
|
protected void |
setDone(boolean done) |
void |
setUseTextSelection(int maxLength)
Specifies whether the text selection should be used to
specify the searched text.
|
protected void |
skip() |
protected void |
skipElement() |
protected boolean |
start() |
protected void |
stop() |
protected void |
unhighlightAll() |
protected boolean |
useTextSelection() |
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
protected int textSelectionMaxLength
protected TextIcon[] functionKeyIcons
protected SearchReplaceForm searchReplaceForm
protected JButton startButton
protected JButton skipButton
protected JButton skipElementButton
protected JButton replaceButton
protected JButton replaceAllButton
protected boolean done
protected SearchReplaceForm.Info searchReplaceInfo
protected Matcher matcher
protected SearchReplaceText searchReplaceText
protected TextOffset selectionMark
protected TextOffset selectionDot
protected DocumentView docView
protected static final String[] HIT_HIGHLIGHT_PREFIXES
public SearchReplacePane(boolean twoColumns)
twoColumns
- if true
, the panel is layout with the
form at the left and the command buttons at the right. If
false
, the panel is layout with the command buttons below
the form.protected void registerKeyBoardActions()
protected void createFunctionKeyIcons()
protected SearchReplaceForm.Info defaultInfo()
protected void configureButton(JButton button)
protected void setDone(boolean done)
public void setUseTextSelection(int maxLength)
maxLength
- maximum length allowed for a text selection
which can be used to specify the searched text. Initial value: 0
(means text selection cannot be used to specify the searched text).getUseTextSelection()
public int getUseTextSelection()
setUseTextSelection(int)
protected boolean useTextSelection()
public JTextField getSearchedField()
public void setDocumentView(DocumentView docView)
null
to disable this panel.public DocumentView getDocumentView()
null
if this panel has been disabled.public void search(boolean backwards)
backwards
- if true
, search is performed from caret
position to the beginning of the document.public void searchReplace(boolean backwards)
backwards
- if true
, search/replace is performed from
caret position to the beginning of the document.public boolean findAgain(boolean backwards)
backwards
- if true
, search is performed from caret
position to the beginning of the document.protected TextOffset[] findNext(SearchReplaceText searchReplaceText, SearchReplaceForm.Info searchReplaceInfo, Matcher matcher)
public void cancel()
protected Object[] getSearchReplaceInfo()
public void actionPerformed(ActionEvent e)
actionPerformed
in interface ActionListener
protected boolean start()
protected void searchFailed()
protected void searchSuccessful(TextOffset[] found)
protected void highlightAll()
protected void unhighlightAll()
protected void stop()
protected void skip()
protected void skipElement()
protected void replace()
protected void replaceAll()