private void plot() {
    if (dygraphs != null) {
      if (panel.remove(dygraphs)) ;
    }

    String eq = textArea.getValue();

    double x1 = Double.parseDouble(fromTb.getValue());
    double x2 = Double.parseDouble(toTb.getValue());
    double xs = 1.0 * (x2 - x1) / width;

    JsArray<JsArrayMixed> data = JsArray.createArray().cast();
    for (int i = 0; i < width; i++) {
      double x = x1 + i * xs;
      JsArrayNumber y = evalFn(eq, x);
      JsArrayMixed row = JsArrayMixed.createArray().cast();
      row.push(x);
      for (int j = 0; j < y.length(); j++) {
        row.push(y.get(j));
      }
      data.push(row);
    }
    dygraphs = new Dygraphs(data, null);
    dygraphs.setPixelSize(width, height);
    panel.add(dygraphs);
  }
Beispiel #2
0
  /** Called whenever any filter value changes. */
  protected void onFilterValueChange() {
    TaskInboxFilterBean newState = new TaskInboxFilterBean();
    int priorityVal = -1;
    if (priority.getValue().trim().length() > 0) {
      try {
        priorityVal = Integer.parseInt(priority.getValue());
      } catch (NumberFormatException nfe) {
      }
    }
    newState
        .setOwner(
            TaskOwnerEnum.valueOf(
                ownerAny.getValue(),
                ownerMine.getValue(),
                ownerActive.getValue(),
                ownerGroup.getValue()))
        .setPriority(priorityVal)
        .setDateDueFrom(dateDueFrom.getDateValue())
        .setDateDueTo(dateDueTo.getDateValue());

    TaskInboxFilterBean oldState = this.currentState;
    this.currentState = newState;
    // Only fire a change event if something actually changed.
    ValueChangeEvent.fireIfNotEqual(this, oldState, currentState);
  }
 @Override
 public String getNameValue() {
   if ((name.getValue().equals(defaultValue)) || (name.getValue().equals(""))) {
     return null;
   } else {
     return name.getValue();
   }
 }
 public String getValue() {
   // TODO use getValue() insted of getText() since getText return blaml stirng if nothing is
   // entered
   if (textbox.getValue() != null && !textbox.getValue().equals(moreInfoText)) {
     return textbox.getValue().trim();
   } else {
     return null;
   }
 }
Beispiel #5
0
  @Override
  public Number getValue() {

    String value = textBox.getValue().equals("") ? "0" : textBox.getValue();
    try {
      return Integer.valueOf(value);
    } catch (NumberFormatException e) {
      return -1;
    }
  }
 @Override
 public VariableDto getVariableDto(String script) {
   VariableDto variableDto = VariableDto.create();
   variableDto.setName(variableName.getValue());
   variableDto.setIsRepeatable(repeatableCheckbox.getValue());
   if (repeatableCheckbox.getValue()) variableDto.setOccurrenceGroup(occurrenceGroup.getValue());
   variableDto.setValueType(valueType.getValue(valueType.getSelectedIndex()));
   variableDto.setEntityType(entityType);
   variableDto.setMimeType(mimeType.getValue());
   variableDto.setUnit(unit.getValue());
   VariableDtos.setScript(variableDto, script);
   return variableDto;
 }
Beispiel #7
0
 public String getPostData() {
   StringBuffer postData = new StringBuffer();
   postData.append("&superusername="******"&superpassword="******"&superpasswordconfirm=");
   postData.append(URL.encodeQueryString(passwordConfirmTextBox.getValue()));
   postData.append("&superemail=");
   postData.append(URL.encodeQueryString(emailTextBox.getValue()));
   postData.append("&idprovider=");
   postData.append(URL.encodeQueryString(idProvider.getValue(idProvider.getSelectedIndex())));
   return postData.toString();
 }
  @UiHandler("projectName")
  void onProjectNameChanged(KeyUpEvent event) {
    String projectNameValue = projectName.getValue();

    if (projectNameValue != null && projectNameValue.contains(" ")) {
      projectNameValue = projectNameValue.replace(" ", "-");
      projectName.setValue(projectNameValue);
    }

    if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
      return;
    }

    delegate.projectNameChanged(projectName.getValue());
  }
Beispiel #9
0
  /** @see com.alkacon.geranium.client.ui.input.I_FormWidget#getApparentValue() */
  public String getApparentValue() {

    String result = m_textbox.getValue();
    if (ClientStringUtil.isEmpty(result)) {
      result = null;
    }
    return result;
  }
 @Override
 public void onFocus(FocusEvent event) {
   if (name.getValue().equals(defaultValue)) {
     name.setValue("");
     name.removeStyleName(style.nameDefaultText());
   } else {
     name.removeStyleName(style.nameDefaultText());
   }
 }
 @Override
 public void onBlur(BlurEvent event) {
   if (name.getValue().equals("")) {
     name.setValue(defaultValue);
     name.addStyleName(style.nameDefaultText());
   } else {
     name.removeStyleName(style.nameDefaultText());
   }
 }
Beispiel #12
0
 protected void hideEditor(boolean updateValue) {
   myOuterPanel.remove(myTextEditor);
   if (allowHtml) {
     myOuterPanel.add(myHtmlView);
   } else {
     myOuterPanel.add(myTextView);
   }
   if (updateValue) {
     setValue(myTextEditor.getValue(), true);
   }
 }
Beispiel #13
0
  @Override
  public boolean validate(Number value) {

    boolean outcome = true;
    boolean isEmpty = textBox.getValue().equals("");

    if (expressionValue != null || isExpressionScheme(textBox.getValue())) {
      outcome = true;
    } else if (isRequired() && isEmpty) {
      outcome = false;
    } else if (!isEmpty) {
      try {
        long i = Long.parseLong(textBox.getValue());
        outcome = (i >= 0) || allowNegativeNumber;
      } catch (NumberFormatException e) {
        outcome = false;
      }
    }

    return outcome;
  }
Beispiel #14
0
  /** Run the query and load the map */
  public void runQuery() {
    String query = queryTextBox.getValue();
    if (isValidQuery(query)) {
      LatLng latlng = parseLatLng(query);
      if (latlng == null) {
        queryTextBox.setValue("");
      } else {
        Geocoder geocoder = new Geocoder();
        latlng = parseLatLng(latlng.toUrlValue(6));
        if (latlng != null) initMap(map.getElement(), latlng);
        else initMap(map.getElement(), LatLng.newInstance(0.0, 0.0));
        geocoder.getLocations(
            query,
            new LocationCallback() {
              @Override
              public void onFailure(int statusCode) {
                // Window.alert("failed");
                Document.get().getElementById("responseCount").getStyle().setDisplay(Display.NONE);
                Document.get().getElementById("matches").getStyle().setDisplay(Display.NONE);
              }

              @Override
              public void onSuccess(JsArray<Placemark> locations) {
                responseGeocode(locations, true);
              }
            });
      }
    } else {
      initMap(map.getElement(), LatLng.newInstance(0.0, 0.0));
      Geocoder geocoder = new Geocoder();
      // map.setUIToDefault();
      geocoder.getLocations(
          query,
          new LocationCallback() {
            @Override
            public void onFailure(int statusCode) {
              // Window.alert("failed");
              Document.get().getElementById("responseCount").getStyle().setDisplay(Display.NONE);
              Document.get().getElementById("matches").getStyle().setDisplay(Display.NONE);
            }

            @Override
            public void onSuccess(JsArray<Placemark> locations) {
              responseGeocode(locations, false);
            }
          });
    }
  }
  // Commit the change
  @Override
  protected void commit() {

    // Update value
    String text = textBox.getValue();
    Byte number = null;
    if (text.length() > 0) {
      try {
        number = new Byte(text);
      } catch (NumberFormatException e) {
        number = new Byte("0");
      }
    }
    setValue(lastContext, lastParent, number);
    if (valueUpdater != null) {
      valueUpdater.update(number);
    }
    panel.hide();
  }
  public void savePlateSearchAsSpot() {
    GWT.log("showSpot factual");
    SpotHolder spotHolder = new SpotHolder();
    spotHolder.setName(plateNameTextBox.getValue());
    spotHolder.setCountryCode(countryTextBox.getValue());
    spotHolder.setState(stateTextBox.getValue());
    String color = getValue(colorsListBox);
    spotHolder.setColor(color);
    Long manufacturerId = getManufacturerId();
    spotHolder.getManufacturerHolder().setId(manufacturerId);
    String vehicleType = getValue(vehicleTypeListBox);
    spotHolder.setVehicleType(vehicleType);
    spotHolder.setDescription(keywordsTextBox.getValue());
    spotHolder.setSpotType(2);
    SaveSpotRequest saveSpotRequest = new SaveSpotRequest();
    saveSpotRequest.setIgnoreUploads(true);
    saveSpotRequest.setSpotHolder(spotHolder);
    ApiServiceAsync myService = mywebapp.getApiServiceAsync();
    myService.saveSpot(
        saveSpotRequest,
        new AsyncCallback() {
          public void onFailure(Throwable caught) {
            // callback.onFailure(caught);
            getMessagePanel().displayError("Could not save plate:" + caught.toString());
          }

          public void onSuccess(Object result) {
            // callback.onSuccess(result);
            MobileResponse mobileResponse = (MobileResponse) result;
            if (mobileResponse.getStatus() == 1) {
              SpotHolder spotHolder1 = mobileResponse.getSpotHolder();
              String token = MyWebApp.LEAVE_SPOT_MARK + spotHolder1.getId();
              History.newItem(token);
            } else {
              getMessagePanel().displayErrors(mobileResponse.getErrorMessages());
            }
          }
        });
  }
Beispiel #17
0
 @Override
 public String asExpressionValue() {
   return textBox.getValue();
 }
 public static String getValue(TextBox tb) {
   return tb.getValue().trim();
 }
 @UiHandler("projectUrl")
 void onProjectUrlChanged(KeyUpEvent event) {
   delegate.projectUrlChanged(projectUrl.getValue());
 }
  @Override
  public List<FilterCriteria> getFilterCriteria() {

    String locale = NLS.constants().locale();

    List<FilterCriteria> criteria = new ArrayList<FilterCriteria>();

    FilterCriteria castb_patient_identifiantCrit = new FilterCriteria();
    castb_patient_identifiantCrit.setField("casTb.patient.identifiant");
    castb_patient_identifiantCrit.setFieldDisplayName(NLS.constants().patient_field_identifiant());
    castb_patient_identifiantCrit.setOperation(CriteriaConstants.STRING_OPERATOR_CONTAINS);
    castb_patient_identifiantCrit.setValue(castb_patient_identifiantBox.getValue());
    castb_patient_identifiantCrit.setValueDisplayName(castb_patient_identifiantBox.getValue());
    criteria.add(castb_patient_identifiantCrit);
    FilterCriteria castb_patient_nomCrit = new FilterCriteria();
    castb_patient_nomCrit.setField("casTb.patient.nom");
    castb_patient_nomCrit.setFieldDisplayName(NLS.constants().patient_field_nom());
    castb_patient_nomCrit.setOperation(CriteriaConstants.STRING_OPERATOR_CONTAINS);
    castb_patient_nomCrit.setValue(castb_patient_nomBox.getValue());
    castb_patient_nomCrit.setValueDisplayName(castb_patient_nomBox.getValue());
    criteria.add(castb_patient_nomCrit);

    if (dateExamenBeforeBox.getValue() != null) {
      FilterCriteria dateExamenBeforeCrit = new FilterCriteria();
      dateExamenBeforeCrit.setField("dateExamen");
      dateExamenBeforeCrit.setFieldDisplayName(
          NLS.constants().examenATB_field_dateExamen()
              + BaseNLS.constants().search_operator_inferior());
      dateExamenBeforeCrit.setOperation(CriteriaConstants.DATE_OPERATOR_BEFORE);
      dateExamenBeforeCrit.setValue(DateUtil.getDate(dateExamenBeforeBox.getValue()));
      dateExamenBeforeCrit.setValueDisplayName(DateUtil.getDate(dateExamenBeforeBox.getValue()));
      criteria.add(dateExamenBeforeCrit);
    }

    if (dateExamenAfterBox.getValue() != null) {
      FilterCriteria dateExamenAfterCrit = new FilterCriteria();
      dateExamenAfterCrit.setField("dateExamen");
      dateExamenAfterCrit.setFieldDisplayName(
          NLS.constants().examenATB_field_dateExamen()
              + BaseNLS.constants().search_operator_superior());
      dateExamenAfterCrit.setOperation(CriteriaConstants.DATE_OPERATOR_AFTER);
      dateExamenAfterCrit.setValue(DateUtil.getDate(dateExamenAfterBox.getValue()));
      dateExamenAfterCrit.setValueDisplayName(DateUtil.getDate(dateExamenAfterBox.getValue()));
      criteria.add(dateExamenAfterCrit);
    }

    FilterCriteria raisonDepistageCrit = new FilterCriteria();
    raisonDepistageCrit.setField("raisonDepistage");
    raisonDepistageCrit.setFieldDisplayName(NLS.constants().examenATB_field_raisonDepistage());
    raisonDepistageCrit.setOperation(CriteriaConstants.STRING_OPERATOR_EQUAL);
    raisonDepistageCrit.setValue(
        raisonDepistageBox.getValue(raisonDepistageBox.getSelectedIndex()));
    raisonDepistageCrit.setValueDisplayName(
        EpicamRenderer.get()
            .getEnumDisplayValue(
                ExamenATBProxy.class,
                "raisonDepistage",
                raisonDepistageBox.getValue(raisonDepistageBox.getSelectedIndex())));
    criteria.add(raisonDepistageCrit);

    FilterCriteria resultatCrit = new FilterCriteria();
    resultatCrit.setField("resultat");
    resultatCrit.setFieldDisplayName(NLS.constants().examenATB_field_resultat());
    resultatCrit.setOperation(CriteriaConstants.STRING_OPERATOR_CONTAINS);
    resultatCrit.setValue(resultatBox.getValue());
    resultatCrit.setValueDisplayName(resultatBox.getValue());
    criteria.add(resultatCrit);

    FilterCriteria deletedEntityCrit = new FilterCriteria();
    deletedEntityCrit.setField("deleted");
    deletedEntityCrit.setFieldDisplayName(BaseNLS.constants().entity_field_deleted());
    if (deletedEntityBox.getValue()) {
      deletedEntityCrit.setOperation(CriteriaConstants.OPERATOR_ISNOTNULL);
      deletedEntityCrit.setValue("true");
      deletedEntityCrit.setValueDisplayName(BaseNLS.constants().boolean_true());
    } else {
      deletedEntityCrit.setOperation(CriteriaConstants.OPERATOR_ISNULL);
      deletedEntityCrit.setValue("false");
      deletedEntityCrit.setValueDisplayName(BaseNLS.constants().boolean_false());
    }
    criteria.add(deletedEntityCrit);

    return criteria;
  }
 @NotNull
 @Override
 public String getProjectName() {
   return projectName.getValue();
 }
Beispiel #22
0
 /**
  * To get Name.
  *
  * @return String
  */
 public String getName() {
   return name.getValue();
 }
Beispiel #23
0
 /**
  * To get Description.
  *
  * @return String
  */
 public String getDescription() {
   return description.getValue();
 }
  public void performPlateSearch() {
    getMessagePanel().clear();
    if (isEmpty(plateNameTextBox)) {
      getMessagePanel().displayError("Plate is required.");
    }
    if (isEmpty(countryTextBox.getTextBox())) {
      getMessagePanel().displayError("Country is required.");
    }
    if (isEmpty(stateTextBox.getTextBox())) {
      getMessagePanel().displayError("State is required.");
    }
    if (isEmpty(colorsListBox)) {
      getMessagePanel().displayError("Color is required.");
    } else {
      // getMessagePanel().displayError("Color is " + colorsListBox.getSelectedIndex());
    }
    if (isEmpty(manufacturersListBox)) {
      getMessagePanel().displayError("Manufacturer is required.");
    }
    if (isEmpty(vehicleTypeListBox)) {
      getMessagePanel().displayError("Vehicle Type is required.");
    }
    if (getMessagePanel().isHaveMessages()) {
      return;
    }
    SearchParameters searchParameters = new SearchParameters();
    searchParameters.setLicensePlate(true);
    searchParameters.setSpots(true);
    searchParameters.setPlateName(plateNameTextBox.getValue());
    searchParameters.setKeywords(keywordsTextBox.getValue());
    searchParameters.setCountryShortNameCode(countryTextBox.getValue());
    searchParameters.setState(stateTextBox.getValue());
    {
      String val = getValue(colorsListBox);
      searchParameters.setColor(val);
    }
    Long manufacturerId = getManufacturerId();
    searchParameters.setManufacturerId(manufacturerId);
    {
      String val = getValue(vehicleTypeListBox);
      searchParameters.setVehicleType(val);
    }
    searchParameters.setMax(20);
    ApiServiceAsync myService = mywebapp.getApiServiceAsync();
    myService.search(
        searchParameters,
        new AsyncCallback() {
          DataOperationDialog fetchLocalSpotsDialog = new DataOperationDialog("Searching Plates.");

          public void onFailure(Throwable caught) {
            fetchLocalSpotsDialog.hide();
            getMessagePanel().displayError(caught.getMessage());
          }

          public void onSuccess(Object result) {
            fetchLocalSpotsDialog.hide();
            MobileResponse mobileResponse = (MobileResponse) result;
            if (mobileResponse.getStatus() == 1) {
              // if no plates were found, let's just go to the new plate form
              if (mobileResponse.getLocationResults().isEmpty()) {
                savePlateSearchAsSpot();
              } else {
                displayLicensePlates(mobileResponse.getLocationResults(), 1);
              }
            } else {
              getMessagePanel().displayErrors(mobileResponse.getErrorMessages());
            }
          }
        });
  }
 public String getValue() {
   return textBox.getValue();
 }
Beispiel #26
0
 /* (non-Javadoc)
  * @see net.cbtltd.client.HasValue#noValue()
  */
 public boolean noValue() {
   return field == null || field.getValue() == null || field.getValue().isEmpty();
 }