66 lines
1.3 KiB
Java
Executable File
66 lines
1.3 KiB
Java
Executable File
package org.gcube.portlets.user.dataminermanagertester.client.application.monitor;
|
|
|
|
import org.gcube.portlets.user.dataminermanagertester.client.application.monitor.MonitorRequestEvent.MonitorRequestEventHandler;
|
|
***REMOVED***
|
|
|
|
import com.google.gwt.user.client.Timer;
|
|
|
|
/**
|
|
*
|
|
* @author Giancarlo Panichi
|
|
*
|
|
*
|
|
*/
|
|
public class MonitorRequest {
|
|
|
|
private Timer monitor = null;
|
|
|
|
private MonitorRequestEventHandler handler;
|
|
|
|
public MonitorRequest() {
|
|
monitor = new Timer() {
|
|
public void run() {
|
|
executeCommand();
|
|
***REMOVED***
|
|
***REMOVED***;
|
|
|
|
***REMOVED***
|
|
|
|
private void stopMonitor() {
|
|
if (monitor.isRunning()) {
|
|
monitor.cancel();
|
|
***REMOVED***
|
|
|
|
***REMOVED***
|
|
|
|
private void executeCommand() {
|
|
MonitorRequestEvent event = new MonitorRequestEvent();
|
|
handler.onMonitor(event);
|
|
|
|
***REMOVED***
|
|
|
|
public void addHandler(MonitorRequestEventHandler handler) {
|
|
this.handler = handler;
|
|
***REMOVED***
|
|
|
|
public void start() {
|
|
startSchedule();
|
|
***REMOVED***
|
|
|
|
private void startSchedule() {
|
|
// Execute the timer to expire 2 seconds in the future
|
|
monitor.schedule(Constants.CLIENT_MONITOR_PERIODMILLIS);
|
|
|
|
***REMOVED***
|
|
|
|
public void repeat() {
|
|
monitor.schedule(Constants.CLIENT_MONITOR_PERIODMILLIS);
|
|
***REMOVED***
|
|
|
|
public void stop() {
|
|
stopMonitor();
|
|
***REMOVED***
|
|
|
|
|
|
|
|
***REMOVED*** |