Beispiel #1
0
  public void eventNotify(WebEvent ev) {
    if (ev.getName().equals(Name.REPLOT)) {
      ReplotDetails details = (ReplotDetails) ev.getData();
      ReplotDetails.Reason reason = details.getReplotReason();
      // todo: not to remove and turn off distance tool if expanding plot.
      /*disableSelection();
      changeMode(Mode.OFF);*/
    }

    //        if (ev.getName().equals(Name.FITS_VIEWER_CHANGE)) {
    //            LineSelection sel=
    // (LineSelection)getPlotView().getAttribute(WebPlot.ACTIVE_DISTANCE);
    //            changeMode(sel==null ? Mode.OFF : Mode.EDIT);
    //        }
  }
Beispiel #2
0
  public static void onMessage(String msg) {
    try {
      GwtUtil.getClientLogger().log(Level.INFO, "onMessage: " + msg);

      ServerEvent sEvent = parseJsonEvent(msg);
      Name name = sEvent == null ? null : sEvent.getName();
      Serializable data = sEvent.getData();

      if (name == null) {
        GwtUtil.getClientLogger().log(Level.INFO, "Failed to evaluate: " + msg);
      }
      if (name.equals(Name.EVT_CONN_EST)) {
        JSONObject dataJ = JSONParser.parseStrict(sEvent.getData().toString()).isObject();
        String sEventInfo =
            dataJ.get("connID").isString().stringValue()
                + "_"
                + dataJ.get("channel").isString().stringValue();
        Cookies.setCookie("seinfo", sEventInfo);
        GwtUtil.getClientLogger()
            .log(Level.INFO, "Websocket connection established: " + sEventInfo);
      } else if (data instanceof BackgroundStatus) {
        WebEvent<String> ev =
            new WebEvent<String>(
                ClientEventQueue.class, name, ((BackgroundStatus) data).serialize());
        WebEventManager.getAppEvManager().fireEvent(ev);
        GwtUtil.getClientLogger()
            .log(Level.INFO, "Event: Name:" + name.getName() + ", Data: " + ev.getData());
      } else {
        WebEvent<String> ev =
            new WebEvent<String>(ClientEventQueue.class, name, String.valueOf(data));
        WebEventManager.getAppEvManager().fireEvent(ev);
        GwtUtil.getClientLogger()
            .log(Level.INFO, "Event: Name:" + name.getName() + ", Data: " + sEvent.getData());
      }
    } catch (Exception e) {
      GwtUtil.getClientLogger()
          .log(Level.WARNING, "Exception interpreting incoming message: " + msg, e);
    }
  }