Added 3 events to the InteractiveActionThread class
This commit is contained in:
parent
038f8a8626
commit
085ca90a94
|
@ -53,6 +53,9 @@ public class BatchAutorouterThread extends InteractiveActionThread
|
|||
|
||||
protected void thread_action()
|
||||
{
|
||||
for (ThreadActionListener hl : this.listeners)
|
||||
hl.autorouterStarted();
|
||||
|
||||
FRLogger.traceEntry("BatchAutorouterThread.thread_action()");
|
||||
|
||||
try
|
||||
|
@ -133,6 +136,16 @@ public class BatchAutorouterThread extends InteractiveActionThread
|
|||
}
|
||||
|
||||
FRLogger.traceExit("BatchAutorouterThread.thread_action()");
|
||||
|
||||
for (ThreadActionListener hl : this.listeners)
|
||||
{
|
||||
if (this.is_stop_requested()) {
|
||||
hl.autorouterAborted();
|
||||
}
|
||||
else {
|
||||
hl.autorouterFinished();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void draw(java.awt.Graphics p_graphics)
|
||||
|
|
|
@ -23,6 +23,10 @@
|
|||
*/
|
||||
package eu.mihosoft.freerouting.interactive;
|
||||
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Used for running an eu.mihosoft.freerouting.interactive action in a seperate Thread,
|
||||
* that can be stopped by the user.
|
||||
|
@ -31,6 +35,11 @@ package eu.mihosoft.freerouting.interactive;
|
|||
*/
|
||||
public abstract class InteractiveActionThread extends Thread implements eu.mihosoft.freerouting.datastructures.Stoppable
|
||||
{
|
||||
protected List<ThreadActionListener> listeners = new ArrayList<ThreadActionListener>();
|
||||
|
||||
public void addListener(ThreadActionListener toAdd) {
|
||||
listeners.add(toAdd);
|
||||
}
|
||||
|
||||
public static InteractiveActionThread get_autoroute_instance(BoardHandling p_board_handling)
|
||||
{
|
||||
|
@ -234,3 +243,4 @@ public abstract class InteractiveActionThread extends Thread implements eu.mihos
|
|||
private final java.io.InputStream input_stream;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
package eu.mihosoft.freerouting.interactive;
|
||||
|
||||
public interface ThreadActionListener {
|
||||
void autorouterStarted();
|
||||
void autorouterAborted();
|
||||
void autorouterFinished();
|
||||
}
|
Loading…
Reference in New Issue