public class FileSearchRunnable extends Object implements Runnable, VetoableChangeListener, GenericListener<FileSearchListener>, Measurable, DescriptionProvider, Stoppable, Comparator<int[]>, FileSearchListener
T-Plan Robot Enterprise, (C) 2009-2022 T-Plan Limited. All rights reserved.
Constructor and Description |
---|
FileSearchRunnable(File[] files,
String pattern,
boolean ignoreCase) |
Modifier and Type | Method and Description |
---|---|
void |
addPostTask(Runnable r,
String name,
float progressAmount) |
void |
addSearchListener(FileSearchListener listener) |
int |
compare(int[] o1,
int[] o2) |
boolean |
equals(File[] files,
String pattern,
boolean ignoreCase) |
void |
fileSearchStarting(Object source,
File file) |
void |
genericEvent(FileSearchListener listener,
EventObject event,
Object customObject)
Call the listener method on a particular listener.
|
float |
getProgress()
Get the task progress where 0 means "0% done" and 1 means "100% done".
|
String |
getProgressDescription()
Get description.
|
boolean |
isStopped()
Find out whether the task has been already stopped.
|
void |
matchFound(Object source,
File file,
String line,
int lineNumber,
int column,
String searchedString) |
void |
matchReplaced(Object source,
File file,
String line,
int lineNumber,
int column,
String searchedString) |
void |
processFinished(Object source) |
void |
processStarting(Object source) |
void |
progressUpdated(Object source,
String progressDesc,
float progress) |
void |
removeSearchListener(FileSearchListener listener) |
void |
run() |
void |
searchFinished(Object source) |
void |
stop()
Call this method to request the implementing object to stop the current
task or activity.
|
void |
taskFinished(Object source,
Runnable r,
String name) |
void |
taskStarting(Object source,
Runnable r,
String name) |
void |
vetoableChange(PropertyChangeEvent evt) |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
public void genericEvent(FileSearchListener listener, EventObject event, Object customObject)
GenericListener
ChangeListener
the method should call
listener.stateChanged((ChangeEvent)event)
. This method will
be called by the GenericListenerSupport.fireEvent(com.tplan.robot.util.GenericListener, java.util.EventObject, java.lang.Object)
method for each registered listener.genericEvent
in interface GenericListener<FileSearchListener>
listener
- the registered listener.event
- an event to fire to the listener. The implementing class should
check whether it is an appropriate event matching the listener type and
throw an IllegalArgumentException
if not. For example, if the listener
is a ChangeListener
the event must be a ChangeEvent
.customObject
- an optional object allowing the implementing class to transfer
data between individual call of this method. For example, the argument may be a
List where the method will store all exceptions thrown by the listener to.public void addSearchListener(FileSearchListener listener)
public void removeSearchListener(FileSearchListener listener)
public void vetoableChange(PropertyChangeEvent evt) throws PropertyVetoException
vetoableChange
in interface VetoableChangeListener
PropertyVetoException
public float getProgress()
Measurable
getProgress
in interface Measurable
public String getProgressDescription()
DescriptionProvider
getProgressDescription
in interface DescriptionProvider
public void stop()
Stoppable
public boolean isStopped()
Stoppable
public int compare(int[] o1, int[] o2)
compare
in interface Comparator<int[]>
public void processStarting(Object source)
processStarting
in interface FileSearchListener
public void fileSearchStarting(Object source, File file)
fileSearchStarting
in interface FileSearchListener
public void matchFound(Object source, File file, String line, int lineNumber, int column, String searchedString)
matchFound
in interface FileSearchListener
public void matchReplaced(Object source, File file, String line, int lineNumber, int column, String searchedString)
matchReplaced
in interface FileSearchListener
public void searchFinished(Object source)
searchFinished
in interface FileSearchListener
public void taskStarting(Object source, Runnable r, String name)
taskStarting
in interface FileSearchListener
public void taskFinished(Object source, Runnable r, String name)
taskFinished
in interface FileSearchListener
public void progressUpdated(Object source, String progressDesc, float progress)
progressUpdated
in interface FileSearchListener
public void processFinished(Object source)
processFinished
in interface FileSearchListener