|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jidesoft.swing.Searchable com.jidesoft.editor.CodeEditorSearchable
public class CodeEditorSearchable
CodeEditorSearchable
is an concrete implementation of Searchable
that enables the search
function in CodeEditor.
It's very simple to use it. Assuming you have a CodeEditor, all you need to do is to call
Now the CodeEditor will have the search function.
CodeEditor editor = ....;
CodeEditorSearchable searchable = new CodeEditorSearchable(editor);
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.jidesoft.swing.Searchable |
---|
Searchable.SearchField, Searchable.SearchPopup |
Field Summary |
---|
Fields inherited from class com.jidesoft.swing.Searchable |
---|
_component, _componentListener, _focusListener, _keyListener, _matchCount, CLIENT_PROPERTY_SEARCHABLE, listenerList, PROPERTY_SEARCH_TEXT |
Constructor Summary | |
---|---|
CodeEditorSearchable(CodeEditor editor)
|
Method Summary | |
---|---|
protected void |
cancelHighlightAll()
Cancel highlight all. |
void |
changedUpdate(DocumentEvent e)
|
protected String |
convertElementToString(Object object)
Converts the element in CodeEditor to string. |
int |
findFirst(String s)
Finds the first element that matches the searching text. |
int |
findFromCursor(String s)
Finds the next matching index from the cursor. |
int |
findLast(String s)
Finds the last element that matches the searching text. |
int |
findNext(String s)
Finds the next matching index from the cursor. |
int |
findPrevious(String s)
Finds the previous matching index from the cursor. |
void |
firePropertyChangeEvent(String searchingText)
|
protected Object |
getElementAt(int index)
Gets the element at the specified index. |
protected int |
getElementCount()
Gets the total element count in the component. |
Color |
getHighlightColor()
Gets the highlight color. |
protected int |
getSelectedIndex()
Gets the selected index in the component. |
protected void |
highlightAll()
Highlight all matching cases in the target. |
void |
insertUpdate(DocumentEvent e)
|
boolean |
isActivateKey(KeyEvent e)
Checks if the key in KeyEvent should activate the search popup. |
boolean |
isWholeWords()
Gets the wholeWords property. |
void |
propertyChange(PropertyChangeEvent evt)
|
void |
removeUpdate(DocumentEvent e)
|
protected void |
searchingTextEmpty()
Actions to take on searching text empty scenario |
void |
setHighlightColor(Color highlightColor)
Changes the highlight color. |
protected void |
setSelectedIndex(int index,
boolean incremental)
Sets the selected index. |
void |
setWholeWords(boolean wholeWords)
Sets the wholeWords property. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CodeEditorSearchable(CodeEditor editor)
Method Detail |
---|
public Color getHighlightColor()
public void setHighlightColor(Color highlightColor)
highlightColor
- the hightlight colorgetHighlightColor()
public void firePropertyChangeEvent(String searchingText)
firePropertyChangeEvent
in class Searchable
public void propertyChange(PropertyChangeEvent evt)
propertyChange
in interface PropertyChangeListener
protected void highlightAll()
Searchable
highlightAll
in class Searchable
protected void cancelHighlightAll()
Searchable
Searchable.highlightAll()
, you may want to override
this method to notify your Searchable that the highlightAll button is to be released.
cancelHighlightAll
in class Searchable
protected void setSelectedIndex(int index, boolean incremental)
Searchable
setSelectedIndex
in class Searchable
index
- the index to be selectedincremental
- a flag to enable multiple selection. If the flag is true, the element at the index should be
added to current selection. If false, you should clear previous selection and then select the
element.protected int getSelectedIndex()
Searchable
Here are some examples. In the case of JList, the index is the row index. In the case of JTree, the index is the row index too. In the case of JTable, depending on the selection mode, the index could be row index (in row selection mode), could be column index (in column selection mode) or could the cell index (in cell selection mode).
getSelectedIndex
in class Searchable
protected Object getElementAt(int index)
Searchable
getElementAt
in class Searchable
index
- the index
protected int getElementCount()
Searchable
getElementCount
in class Searchable
protected String convertElementToString(Object object)
toString()
of whatever
element that returned from list.getModel().getElementAt(i)
.
convertElementToString
in class Searchable
object
- the object to be converted to string
public void insertUpdate(DocumentEvent e)
insertUpdate
in interface DocumentListener
public void removeUpdate(DocumentEvent e)
removeUpdate
in interface DocumentListener
public void changedUpdate(DocumentEvent e)
changedUpdate
in interface DocumentListener
public boolean isActivateKey(KeyEvent e)
Searchable
isActivateKey
in class Searchable
e
- the key event
public int findLast(String s)
Searchable
findLast
in class Searchable
s
- the searching text
public int findFirst(String s)
Searchable
findFirst
in class Searchable
s
- the searching text
public int findFromCursor(String s)
Searchable
findFromCursor
in class Searchable
s
- the searching text
public int findNext(String s)
Searchable
findNext
in class Searchable
s
- the searching text
public int findPrevious(String s)
Searchable
findPrevious
in class Searchable
s
- the searching text
public boolean isWholeWords()
isWholeWords
in interface WholeWordsSupport
public void setWholeWords(boolean wholeWords)
setWholeWords
in interface WholeWordsSupport
wholeWords
- true if the comparison matches exactly the word only. Otherwise false.protected void searchingTextEmpty()
Searchable
searchingTextEmpty
in class Searchable
|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |