Example #1
0
 /**
  * Valida Valor TolerĂ¢ncia
  *
  * @param valorBase - valor base a ser comparado com tolerancia
  * @param valorTol - valor a ser toleravel
  * @param tolerancia - valor para tolerancia sobre o valorTol
  * @param decimal - numero de casas decimais
  */
 public static boolean validaTolerancia(
     double valorBase, double valorTol, double tolerancia, int decimal) {
   if (valorBase != 0 && tolerancia != 0) {
     return (valorTol <= Valor.round(valorBase + tolerancia, JavaUtil.getValueDef(decimal, 2))
         && valorTol >= Valor.round(valorBase - tolerancia, JavaUtil.getValueDef(decimal, 2)));
   }
   return true;
 }
  /**
   * validates the Model.
   *
   * @return a list of ValidationErrors. Successful validation is signaled by an empty list.
   * @modified
   */
  public List validate(IMarkable markable) {
    getMarkers().clear();
    List errors = new ArrayList();

    if (namProperty == null || namProperty.length() == 0) {
      errors.add(new ValidationError(markable, "has property with empty name"));
    } else {
      if (!JavaUtil.isValidIdentifier(namProperty)) {
        errors.add(
            new ValidationError(
                markable, "name of property '" + namProperty + "' is not a valid java identifier"));
      }
      if (XMAComponentImpl.isReservedbyComponent(namProperty)) {
        errors.add(
            new ValidationError(
                markable, "name of property '" + namProperty + "' is reserved for the generator"));
      }
      if (getComponent().isEmbeddable()) {
        if (XMAComponentImpl.isReservedbyEmbeddableComponent(namProperty)) {
          errors.add(
              new ValidationError(
                  markable,
                  "name of property '"
                      + namProperty
                      + "' is reserved by the generator for embeddable components"));
        }
      }
    }
    if (txtDescription == null || txtDescription.length() == 0) {
      errors.add(new ValidationError(markable, "has property with empty description"));
    }

    return errors;
  }
 private MouseEvent createEvent(java.awt.event.MouseEvent e, boolean down) {
   return new MouseEvent(e.getButton(), down, e.getX(), e.getY(), JavaUtil.getEventMods(e));
 }