Пример #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();
   }
 }
Пример #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));
   }
 }
Пример #3
0
  /** This method should be called when after okButton is clicked. */
  ArgumentValidator getArgumentValidator() {
    Splittable params = StringQuoter.createIndexed();

    switch (validatorTypeCB.getCurrentValue()) {
      case Regex:
        String regex = regexField.getCurrentValue();
        StringQuoter.create(regex).assign(params, 0);
        break;
      case CharacterLimit:
        int charLimit = charLimitField.getCurrentValue();
        StringQuoter.create(charLimit).assign(params, 0);
        break;

      case IntAbove:
        int intAbove = intAboveField.getCurrentValue();
        StringQuoter.create(intAbove).assign(params, 0);
        break;

      case IntBelow:
        int intBelow = intBelowField.getCurrentValue();
        StringQuoter.create(intBelow).assign(params, 0);
        break;
      case IntRange:
        int intRangeAbove = intRangeAboveField.getCurrentValue();
        int intRangeBelow = intRangeBelowField.getCurrentValue();
        StringQuoter.create(intRangeAbove).assign(params, 0);
        StringQuoter.create(intRangeBelow).assign(params, 1);
        break;

      case DoubleAbove:
        double dblAbove = dblAboveField.getCurrentValue();
        StringQuoter.create(dblAbove).assign(params, 0);
        break;
      case DoubleBelow:
        double dblBelow = dblBelowField.getCurrentValue();
        StringQuoter.create(dblBelow).assign(params, 0);
        break;

      case DoubleRange:
        double dblRangeAbove = dblRangeAboveField.getCurrentValue();
        double dblRangeBelow = dblRangeBelowField.getCurrentValue();
        StringQuoter.create(dblRangeAbove).assign(params, 0);
        StringQuoter.create(dblRangeBelow).assign(params, 1);
        break;
      default:
        break;
    }
    AutoBean<ArgumentValidator> avAutobean = factory.argumentValidator();
    avAutobean.as().setType(validatorTypeCB.getCurrentValue());
    avAutobean.as().setParams(params);

    // JDS Get the actual validator, and add it as metadata to the autobean.
    AbstractArgumentEditor.createAndAttachValidator(avAutobean.as());

    return avAutobean.as();
  }
  /**
   * 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;
  }
Пример #5
0
  private void updateStatusInfo() {
    if (vectorLayers != null) {
      List<VectorLayerInfo> vectors = new ArrayList<VectorLayerInfo>();

      for (Layer layer : vectorLayers) {
        vectors.add(new VectorLayerInfo((Vector) layer));
      }

      layerStore.clear();
      layerStore.addAll(vectors);
      layerCombo.redraw();
    }

    if (selectedLayer != null) {
      layerCombo.setValue(new VectorLayerInfo(selectedLayer));
    }
  }
Пример #6
0
  /** @param supportedValidatorTypes use these to construct content of the combo box */
  AddValidatorDialog(
      Set<ArgumentValidatorType> supportedValidatorTypes, ArgumentValidatorMessages avMessages) {
    this.avMessages = avMessages;

    setHeadingText(avMessages.validatorDialogHeading());
    setAutoHide(false);
    setSize("400", "250");
    // Initialize the ComboBox list store with the given Set<..>
    ListStore<ArgumentValidatorType> validatorTypes = new ListStore<>(new AVTLabelKeyProvider());
    validatorTypes.addAll(supportedValidatorTypes);

    // Initialize the ComboBox
    validatorTypeCB = new ComboBox<>(validatorTypes, new AVTLabelKeyProvider());
    validatorTypeCB.setForceSelection(true);
    validatorTypeCB.setAllowBlank(false);
    validatorTypeCB.setTriggerAction(TriggerAction.ALL);

    // Construct all "provided" fields.
    constructDoubleSpinnerFields();
    constructIntegerSpinnerFields();
    charLimitField = new NumberField<>(new NumberPropertyEditor.IntegerPropertyEditor());
    charLimitField.setAllowBlank(false);
    charLimitField.addValidHandler(this);
    charLimitField.addInvalidHandler(this);

    add(BINDER.createAndBindUi(this));

    // Initialize validatorTypeToCardMap
    validatorTypeToCardMap = Maps.newHashMap();
    validatorTypeToCardMap.put(ArgumentValidatorType.DoubleAbove, dblAboveValidatorCon);
    validatorTypeToCardMap.put(ArgumentValidatorType.DoubleBelow, dblBelowValidatorCon);
    validatorTypeToCardMap.put(ArgumentValidatorType.DoubleRange, dblRangeValidatorCon);

    validatorTypeToCardMap.put(ArgumentValidatorType.IntAbove, intAboveValidatorCon);
    validatorTypeToCardMap.put(ArgumentValidatorType.IntBelow, intBelowValidatorCon);
    validatorTypeToCardMap.put(ArgumentValidatorType.IntRange, intRangeValidatorCon);

    validatorTypeToCardMap.put(ArgumentValidatorType.Regex, regexValidatorCon);
    validatorTypeToCardMap.put(ArgumentValidatorType.CharacterLimit, characterLimitValidatorCon);

    // Set default values.
    ArgumentValidatorType next = supportedValidatorTypes.iterator().next();
    validatorTypeCB.setValue(next, true);
    cardLC.setActiveWidget(validatorTypeToCardMap.get(next));
  }
Пример #7
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));
 }
Пример #8
0
 @Override
 public void onRemoveLayer(List<Layer> allVectorLayers) {
   setVectorLayers(allVectorLayers);
   /*
    * Puesto que al eliminar una capa, ninguna de las restantes queda
    * seleccionada en el LayerManager, se limpia la capa seleccionada de la
    * combo de capas
    */
   layerCombo.setValue(null);
 }
Пример #9
0
  /** This method is used to update this widget to reflect the given argument validator */
  void setArgumentValidator(final ArgumentValidator av) {
    // Set the comboBox item and corresponding card.
    validatorTypeCB.setValue(av.getType(), true);
    cardLC.setActiveWidget(validatorTypeToCardMap.get(av.getType()));
    Splittable params = av.getParams();
    switch (av.getType()) {
      case Regex:
        String regex = params.get(0).asString();
        regexField.setValue(regex);
        break;
      case CharacterLimit:
        int charLimit = Double.valueOf(params.get(0).asNumber()).intValue();
        charLimitField.setValue(charLimit);
        break;

      case IntAbove:
        int intAbove = Double.valueOf(params.get(0).asNumber()).intValue();
        intAboveField.setValue(intAbove);
        break;

      case IntBelow:
        int intBelow = Double.valueOf(params.get(0).asNumber()).intValue();
        intBelowField.setValue(intBelow);
        break;
      case IntRange:
        int intRangeAbove = Double.valueOf(params.get(0).asNumber()).intValue();
        int intRangeBelow = Double.valueOf(params.get(1).asNumber()).intValue();
        intRangeAboveField.setValue(intRangeAbove);
        intRangeBelowField.setValue(intRangeBelow);
        break;

      case DoubleAbove:
        double dblAbove = params.get(0).asNumber();
        dblAboveField.setValue(dblAbove);
        break;
      case DoubleBelow:
        double dblBelow = params.get(0).asNumber();
        dblBelowField.setValue(dblBelow);
        break;

      case DoubleRange:
        double dblRangeAbove = params.get(0).asNumber();
        double dblRangeBelow = params.get(1).asNumber();
        dblRangeAboveField.setValue(dblRangeAbove);
        dblRangeBelowField.setValue(dblRangeBelow);
        break;

      default:
        break;
    }
  }
  /**
   * Creates panel storing selector used to select type of the molecular viewer.
   *
   * @return panel with viewer selector
   */
  private VBoxLayoutContainer createViewerTypePanelLocation() {
    VBoxLayoutContainer viewerTypePanelLocation = new VBoxLayoutContainer();
    viewerTypePanelLocation.setBorders(false);

    VBoxLayoutContainer vBoxLayout = new VBoxLayoutContainer();
    vBoxLayout.setVBoxLayoutAlign(VBoxLayoutAlign.LEFT);

    FormPanel viewerTypePanel = new FormPanel();
    viewerTypePanel.setBorders(false);
    viewerTypePanel.setWidth(100);
    viewerTypePanel.getElement().setPadding(new Padding(0));

    ComboBox<String> viewerTypeComboBox = createViewerTypeCombobox();
    FieldLabel viewerTypeComboBoxLabel =
        new FieldLabel(
            viewerTypeComboBox, AppPropertiesManager.CONSTANTS.results_grid_viewer_combo_label());
    viewerTypeComboBox.setStyleName("eppic-default-label");
    viewerTypePanel.add(viewerTypeComboBoxLabel);

    viewerTypePanelLocation.add(viewerTypePanel);

    return viewerTypePanelLocation;
  }
Пример #11
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);
    }
  }
Пример #12
0
  private void initializeLayerCombo(String width) {
    VectorLayerProperties properties = GWT.create(VectorLayerProperties.class);

    layerStore = new ListStore<VectorLayerInfo>(properties.key());

    layerCombo = new ComboBox<VectorLayerInfo>(layerStore, properties.name());
    layerCombo.setEmptyText((UIMessages.INSTANCE.sbLayerComboEmptyText()));
    layerCombo.setTypeAhead(true);
    layerCombo.setTriggerAction(TriggerAction.ALL);
    layerCombo.setForceSelection(true);
    layerCombo.setEditable(false);
    layerCombo.enableEvents();
    layerCombo.setWidth(width);

    layerCombo.addSelectionHandler(
        new SelectionHandler<VectorLayerInfo>() {
          @Override
          public void onSelection(SelectionEvent<VectorLayerInfo> event) {
            layerCombo.setValue(event.getSelectedItem(), true);
          }
        });

    layerCombo.addValueChangeHandler(
        new ValueChangeHandler<VectorLayerInfo>() {
          @Override
          public void onValueChange(ValueChangeEvent<VectorLayerInfo> event) {
            VectorLayer layer =
                (VectorLayer) layerManagerWidget.getSelectedLayer(LayerManagerWidget.VECTOR_TAB);
            if (layer == null) {
              layer = (VectorLayer) event.getValue().getLayer();
            }
            new SelectFeature(layer).unselectAll(null);
            layerManagerWidget.setSelectedLayer(
                LayerManagerWidget.VECTOR_TAB, layerCombo.getValue().getLayer());
          }
        });
  }
  private void initGUI() {
    mainContainer = new BorderLayoutContainer();
    refresButton = new TextButton("", ELearningController.ICONS.refresh());
    removeFromLectureButton =
        new TextButton("Remove form lecture", ELearningController.ICONS.delete());
    ListStore<Lecture> lectureListStore = new ListStore<Lecture>(lectureDataProperties.key());
    lectureComboBox =
        new ComboBox<Lecture>(
            lectureListStore,
            new LabelProvider<Lecture>() {
              public String getLabel(Lecture item) {
                return item.getLectureName();
              }
            });
    ListStore<Professor> professorListStore = new ListStore<Professor>(professorProperties.key());
    professorComboBox =
        new ComboBox<Professor>(
            professorListStore,
            new LabelProvider<Professor>() {
              public String getLabel(Professor item) {
                return item.getUsername();
              }
            });
    userGrid = createGrid();
    ToolBar toolBar = new ToolBar();

    lectureComboBox.setTriggerAction(ComboBoxCell.TriggerAction.ALL);
    lectureComboBox.setEditable(false);
    lectureComboBox.setAllowBlank(false);
    professorComboBox.setTriggerAction(ComboBoxCell.TriggerAction.ALL);
    professorComboBox.setEditable(false);
    professorComboBox.setAllowBlank(false);

    toolBar.setHorizontalSpacing(5);
    toolBar.add(refresButton);
    toolBar.add(new SeparatorToolItem());
    toolBar.add(new Label("Professor: "));
    toolBar.add(professorComboBox);
    toolBar.add(new Label("Lecture: "));
    toolBar.add(lectureComboBox);
    toolBar.add(new SeparatorToolItem());
    toolBar.add(removeFromLectureButton);

    mainContainer.setNorthWidget(toolBar, new BorderLayoutContainer.BorderLayoutData(30));
    mainContainer.setCenterWidget(userGrid);
    setState(ManageEnrolledStudentsController.IManageEnrolledStudentsState.NONE);
  }
Пример #14
0
 public void selectDevice(Device device) {
   deviceCombo.setValue(device, false);
 }