Ejemplo n.º 1
0
 @UiHandler("importButton")
 public void onImportClicked(SelectionEvent<Item> event) {
   if (deviceCombo.getValue() == null) {
     new AlertMessageBox(i18n.error(), i18n.errFillFields()).show();
   } else {
     new ImportDialog(deviceCombo.getValue()).show();
   }
 }
Ejemplo n.º 2
0
 @Override
 public void onAnything() {
   Device oldDevice = deviceCombo.getValue();
   if (oldDevice != null) {
     deviceCombo.setValue(deviceStore.findModel(oldDevice));
   } else if (deviceStore.size() == 1) {
     deviceCombo.setValue(deviceStore.get(0));
   }
 }
Ejemplo n.º 3
0
 @UiHandler("loadButton")
 public void onLoadClicked(SelectEvent event) {
   archiveHandler.onLoad(
       deviceCombo.getValue(),
       getCombineDate(fromDate, fromTime),
       getCombineDate(toDate, toTime),
       !disableFilter.getValue(),
       snapToRoads.getValue(),
       new ArchiveStyle(style));
 }
  /**
   * Creates combobox used to select molecular viewer.
   *
   * @return viewer selector
   */
  private ComboBox<String> createViewerTypeCombobox() {
    ListStore<String> store =
        new ListStore<String>(
            new ModelKeyProvider<String>() {
              @Override
              public String getKey(String item) {
                return item;
              }
            });

    store.add(AppPropertiesManager.CONSTANTS.viewer_local());
    store.add(AppPropertiesManager.CONSTANTS.viewer_jmol());
    store.add(AppPropertiesManager.CONSTANTS.viewer_pse());

    final ComboBox<String> viewerTypeComboBox =
        new ComboBox<String>(
            store,
            new LabelProvider<String>() {
              @Override
              public String getLabel(String item) {
                return item;
              }
            });

    viewerTypeComboBox.setId("viewercombo");
    viewerTypeComboBox.setTriggerAction(TriggerAction.ALL);
    viewerTypeComboBox.setEditable(false);
    viewerTypeComboBox.setWidth(100);

    viewerTypeComboBox.setToolTipConfig(createViewerTypeComboBoxToolTipConfig());

    String viewerCookie = Cookies.getCookie("crkviewer");
    if (viewerCookie != null) {
      viewerTypeComboBox.setValue(viewerCookie);
    } else {
      viewerTypeComboBox.setValue(AppPropertiesManager.CONSTANTS.viewer_jmol());
    }

    ApplicationContext.setSelectedViewer(viewerTypeComboBox.getValue());

    viewerTypeComboBox.addSelectionHandler(
        new SelectionHandler<String>() {
          @Override
          public void onSelection(SelectionEvent<String> event) {
            Cookies.setCookie("crkviewer", event.getSelectedItem());
            ApplicationContext.setSelectedViewer(event.getSelectedItem());
          }
        });

    return viewerTypeComboBox;
  }
Ejemplo n.º 5
0
  @UiHandler("gpxButton")
  public void onGPXClicked(SelectionEvent<Item> event) {
    if (deviceCombo.getValue() == null) {
      new AlertMessageBox(i18n.error(), i18n.errFillFields()).show();
    } else {
      DateTimeFormat jsonTimeFormat =
          ApplicationContext.getInstance().getFormatterUtil().getRequestTimeFormat();

      Window.open(
          "/traccar/export/gpx"
              + "?deviceId="
              + (deviceCombo.getValue() == null ? null : deviceCombo.getValue().getId())
              + "&from="
              + jsonTimeFormat.format(getCombineDate(fromDate, fromTime)).replaceFirst("\\+", "%2B")
              + "&to="
              + jsonTimeFormat.format(getCombineDate(toDate, toTime)).replaceFirst("\\+", "%2B")
              + "&filter="
              + !disableFilter.getValue()
              + "&snapToRoads="
              + snapToRoads.getValue(),
          "_blank",
          null);
    }
  }