Example usage for com.google.gwt.user.client Timer Timer

List of usage examples for com.google.gwt.user.client Timer Timer

Introduction

In this page you can find the example usage for com.google.gwt.user.client Timer Timer.

Prototype

Timer

Source Link

Usage

From source file:com.dimdim.conference.ui.json.client.JSONEventsReader.java

License:Open Source License

/**
 * This method triggers the reader. It also starts a timer that will
 * repeast the reading every given amount of time.
 *///from  ww  w.ja v a 2s .c  om
//   private   boolean   firstEvent = true;
public void start() {
    //      super.doReadURL();
    //      
    timer = new Timer() {
        public void run() {
            //            if (!isBusy())
            //            {
            //            Window.alert("Calling event poll: ");
            urlReader.doReadURL();
            /*
            if (firstEvent) doReadURL();
            else
            {
               UIServerResponse resp = new UIServerResponse();
                       
             resp.isSuccess();
             resp.setFeatureId("feature.chat");
             resp.setEventId("chat.message");
             UIChatEntry msg = new UIChatEntry();
             msg.setChatId("none");
             msg.setMessageText("Hi hi hi");
             msg.setPrivateMessage("false");
             msg.setSenderId("Jack&abc.com");
             msg.setSystemMessage("false");
                     
               callback.urlReadingComplete(resp);
            }
            firstEvent = false;
            */
            //            }
            //            else
            //            {
            //               Window.alert("The http coneection busy");
            //            }
            //            this.schedule(timeMillis);
        }
    };
    //      timer.schedule(timeMillis);
    timer.scheduleRepeating((int) timeMillis);
}

From source file:com.dimdim.conference.ui.json.client.JSONurlReadingTimer.java

License:Open Source License

public JSONurlReadingTimer(String url, String confKey, int interval,
        GetEventResponseTextHandler responseHandler) {
    this.urlReader = new JSONurlReader(url, confKey, responseHandler);
    this.interval = interval;
    this.responsehandler = responseHandler;
    this.timer = new Timer() {
        public void run() {
            try {
                //               Window.alert("JSONurlReadingTimer:timer - Calling Event Poll");
                urlReader.doReadURL();//from  w  w  w  . j ava  2s  . c  o  m
            } catch (Exception e) {

            }
        }
    };
    responseHandler.setEventsReadingTimer(this.timer);
}

From source file:com.dimdim.conference.ui.json.client.ServerAvailabilityChecker.java

License:Open Source License

public ServerAvailabilityChecker(String url, int maxFailures, int waitTimeMillis,
        ServerAvailabilityListener listener) {
    this.url = url;
    this.maxFailures = maxFailures;
    this.listener = listener;
    this.waitTimeMillis = waitTimeMillis;
    this.handler = new ServerCheckerResponseTextHandler(this);

    timer = new Timer() {
        public void run() {
            runCheck();//from w w  w. j a  v  a2s.c  o m
        }
    };
}

From source file:com.dimdim.conference.ui.managers.client.resource.ResourceSharingController.java

License:Open Source License

/**
 * This method returns when the actual share or selection process is
 * kicked off. The sharing may involve multiple steps and each step has
 * to be considered as sharing active because the console must consider
 * it as a single unit of operation./*from   www  .j a v a  2 s  .c o m*/
 * 
 * @param shareKey
 */
private void startShare(String newShareKey, String currentShareKey, final UIResourceObject res) {
    //Window.alert("inside startshare of res sharing controller... res ="+res);
    if (newShareKey.equals(ResourceSharingController.DESKTOP)) {
        if (this.isShareDesktopActive()) {
            this.showWaitingForPubResponse(
                    ConferenceGlobals.getDisplayString("stopping.desktop.header", "Stopping Desktop Sharing"));
            this.dtpSharingProcessFlag = 2;
            stopDTPAppShare();
        } else {
            CommonUserInformationDialog cuid = CommonUserInformationDialog.getCommonUserInformationDialog(
                    UIStrings.getConfirmDesktopShareDialogHeader(),
                    UIStrings.getConfirmDesktopShareDialogComment1() + " "
                            + UIStrings.getConfirmDesktopShareDialogComment2());
            ClickListener okListener = new ClickListener() {
                public void onClick(Widget sender) {
                    onOK();
                }
            };
            ClickListener cancelListener = new ClickListener() {
                public void onClick(Widget sender) {
                    CommonUserInformationDialog.hideCommonUserInformationDialog();
                }
            };
            cuid.drawDialog();
            cuid.addOKClickListener(okListener);
            cuid.addCancelClickListener(cancelListener);
            cuid.setButtonLabels(UIStrings.getOKLabel(), UIStrings.getCancelLabel());

            //                desktopShareMessageDialog = new ConfirmationDialog(
            //                  UIStrings.getConfirmDesktopShareDialogHeader(),
            //                  UIStrings.getConfirmDesktopShareDialogComment1()+" "+
            //                  UIStrings.getConfirmDesktopShareDialogComment2(),
            //                  "default-message",this);
            //                desktopShareMessageDialog.setHideOnOK(false);
            //                desktopShareMessageDialog.drawDialog();
            //                desktopShareMessageDialog.setButtonLabels(UIStrings.getOKLabel(),UIStrings.getCancelLabel());
        }
    } else if (newShareKey.equals(ResourceSharingController.COBROWSE)) {
        boolean startNow = true;
        if (currentShareKey.equals(ResourceSharingController.SHARE_PPT_PRESENTATION)) {
            stopPPTPresentation();
        } else if (currentShareKey.equals(ResourceSharingController.COBROWSE)) {
            stopCobrowse(this.currentSharedResource);
        } else if (currentShareKey.equals(ResourceSharingController.WHITEBOARD)) {
            stopWhiteboardShare();
        }

        if (isShareDesktopActive()) {
            //stop desktop share
            appShareTimer = new Timer() {
                public void run() {
                    startCobrowse(res);
                }
            };
            startNow = false;
            this.dtpSharingProcessFlag = 2;
            stopDTPAppShare();
            PublisherInterfaceManager.getManager().setDesktopSharingActive(false);
        }

        if (startNow) {
            startCobrowse(res);
        }

    } else if (newShareKey.equals(ResourceSharingController.WHITEBOARD)) {
        boolean startNow = true;
        if (currentShareKey.equals(ResourceSharingController.SHARE_PPT_PRESENTATION)) {
            stopPPTPresentation();
        }
        if (currentShareKey.equals(ResourceSharingController.COBROWSE)) {
            stopCobrowse(res);
        }
        if (isShareDesktopActive()) {
            appShareTimer = new Timer() {
                public void run() {
                    startWhiteboardShare(res);
                }
            };
            startNow = false;
            this.dtpSharingProcessFlag = 2;
            stopDTPAppShare();
            PublisherInterfaceManager.getManager().setDesktopSharingActive(false);
        }

        if (startNow) {
            this.startWhiteboardShare(res);
        }

    } else if (newShareKey.equals(ResourceSharingController.SHARE_PPT_PRESENTATION)) {
        boolean startNow = true;

        if (currentShareKey.equals(ResourceSharingController.SHARE_PPT_PRESENTATION)) {
            //Window.alert("stop presentation...");
            stopPPTPresentation();
        }
        if (currentShareKey.equals(ResourceSharingController.COBROWSE)) {
            stopCobrowse(res);
        }
        if (currentShareKey.equals(ResourceSharingController.WHITEBOARD)) {
            stopWhiteboardShare();
        }

        if (isShareDesktopActive()) {
            appShareTimer = new Timer() {
                public void run() {
                    startPPTSharing(res);
                }
            };
            startNow = false;
            this.dtpSharingProcessFlag = 2;
            stopDTPAppShare();
            PublisherInterfaceManager.getManager().setDesktopSharingActive(false);
        }
        if (startNow) {
            //Window.alert("starting the share...");
            //Window.alert("ConferenceGlobals.getCurrentSharedResource() = "+ConferenceGlobals.getCurrentSharedResource());
            startPPTSharing(res);
        }

    } else {
    }
}

From source file:com.dimdim.conference.ui.managers.client.resource.ResourceSharingController.java

License:Open Source License

private void startPendingShare() {
    if (this.appShareTimer != null) {
        this.appShareTimer.schedule(2);
        Timer t = new Timer() {
            public void run() {
                appShareTimer = null;/*from  w  ww. jav a  2 s .  c  o m*/
            }
        };
        t.schedule(10);
    }
}

From source file:com.dimdim.conference.ui.model.client.helper.CobrowseCallInterface.java

License:Open Source License

public void startResponseChecker(final String code, FlashXmlCallListener listener, final int waitMillis) {
    if (listener != null) {
        this.addUrlListener(code, listener);
    }// w  w  w .  j  a  v a2s  . c  om

    stopResponseChecker();
    //Window.alert("inside start responce checker urlListeners = "+urlListeners);
    //Window.alert("created response checker..."+urlListeners.get(code));
    //DebugPanel.getDebugPanel().addDebugMessage("created response checker..."+urlListeners.get(code));
    this.responseChecker = new Timer() {
        public void run() {
            FlashXmlCallListener listener = (FlashXmlCallListener) urlListeners.get(code);
            //Window.alert("inside checker......"+listener);
            //DebugPanel.getDebugPanel().addDebugMessage("inside checker... "+listener);
            if (listener != null) {
                listener.onCompletion("timeout", "No response from server. Please contact support@dimdim.com");
            }
        }
    };
    responseChecker.schedule(waitMillis);
}

From source file:com.dimdim.conference.ui.model.client.helper.FlashXmlCallInterface.java

License:Open Source License

public void startResponseChecker(final String code, FlashXmlCallListener listener, final int waitMillis) {
    if (listener != null) {
        this.addUrlListener(code, listener);
    }/*from  w w w.  j  av  a 2s  .c  om*/

    stopResponseChecker();

    this.responseChecker = new Timer() {
        public void run() {
            FlashXmlCallListener listener = (FlashXmlCallListener) urlListeners.get(code);
            if (listener != null) {
                listener.onCompletion("timeout", "No response from server. Please contact support@dimdim.com");
            }
        }
    };
    responseChecker.schedule(waitMillis);
}

From source file:com.dimdim.conference.ui.model.client.helper.ProgressCheckUrlReader.java

License:Open Source License

public ProgressCheckUrlReader(final String checkUrl, int checkInterval,
        ProgressCheckListener progressCheckListener) {
    this.checkInterval = checkInterval;
    this.checkUrl = checkUrl;
    this.progressCheckListener = progressCheckListener;
    FlashXmlCallInterface.getInterface().addUrlListener(PROGRESS_CHECK, this);

    //      this.urlReader = new JSONurlReader(checkUrl,this);
    this.timer = new Timer() {
        public void run() {
            try {
                //               Window.alert("JSONurlReader reading url:"+urlReader.toString());
                //               urlReader.doReadURL();
                FlashXmlCallInterface.getInterface().callXmlUrlInFlash(PROGRESS_CHECK, checkUrl, 20000);
            } catch (Exception e) {
                Window.alert(e.toString());
            }/*  w w w  . j  av a  2s . com*/
        }
    };
}

From source file:com.dimdim.conference.ui.model.client.JSInterface.java

License:Open Source License

public static void callGWT(String callerId, final String data) {
    //      Window.alert("JSInterface:callGWT: caller:"+callerId+", data:"+data);
    JSInterface.init();/*from   w  w  w.ja  va2 s  . c  om*/
    if (JSInterface.s_initialized) {
        final JSCallbackListener listener = (JSCallbackListener) jsCallbackListeners.get(callerId);
        if (listener != null) {
            Timer timer = new Timer() {
                public void run() {
                    listener.handleCallFromJS(data);
                }
            };
            timer.schedule(1);
        } else {
            //            Window.alert("No Listener available");
        }
    } else {
        //         Window.alert("JSInterface not initialized");
    }
}

From source file:com.dimdim.conference.ui.model.client.JSInterface.java

License:Open Source License

public static void callGWT2(String callerId, final String data1, final String data2) {
    JSInterface.init();//w  w  w. ja  v a 2  s  .c o m
    //Window.alert("JSInterface:callGWT: caller:"+callerId+", data1:"+data1+", data2:"+data2);
    if (JSInterface.s_initialized) {
        final JSCallbackListener listener = (JSCallbackListener) jsCallbackListeners.get(callerId);
        if (listener != null) {
            Timer timer = new Timer() {
                public void run() {
                    listener.handleCallFromJS2(data1, data2);
                }
            };
            timer.schedule(1);
        } else {
            //Window.alert("No Listener available");
        }
    } else {
        //Window.alert("JSInterface not initialized");
    }
}