Examples of FormItem


Examples of com.smartgwt.client.widgets.form.fields.FormItem

    super(vectorLayer);
  }

  @Override
  protected FormItem createItem(AttributeInfo info) {
    FormItem formItem = super.createItem(info);
    formItem.setWidth("*");
    if ("dateAttr".equals(info.getName())) {
      // The data attribute will span all 4 columns:
      formItem.setColSpan(4);
    }
    return formItem;
  }
View Full Code Here

Examples of com.smartgwt.client.widgets.form.fields.FormItem

    this.disabled = disabled;

    // Don't set disabled on the form, but on the individual items. This way it's easier to overwrite when creating
    // custom form items.
    for (AttributeInfo info : featureInfo.getAttributes()) {
      FormItem formItem = formWidget.getItem(info.getName());
      if (formItem != null) {
        if (info.isEditable()) {
          formItem.setDisabled(disabled);
        } else {
          formItem.setDisabled(true);
        }
      }
    }
  }
View Full Code Here

Examples of com.smartgwt.client.widgets.form.fields.FormItem

  public void toForm(String name, Attribute<?> attribute) {
    AttributeInfo info = attributeInfoMap.get(name);
    if (info == null || !isIncluded(info)) {
      return;
    }
    FormItem item = formWidget.getField(info.getName());
    if (item != null) {
      if (info instanceof PrimitiveAttributeInfo) {
        PrimitiveAttribute<?> primitive = (PrimitiveAttribute<?>) attribute;
        if (attribute == null) {
          item.setDisabled(true);
        } else {
          switch (primitive.getType()) {
            case BOOLEAN:
              setValue(info.getName(), (BooleanAttribute) primitive); // NOSONAR valid cast
              break;
            case SHORT:
              setValue(info.getName(), (ShortAttribute) primitive); // NOSONAR valid cast
              break;
            case INTEGER:
              setValue(info.getName(), (IntegerAttribute) primitive); // NOSONAR valid cast
              break;
            case LONG:
              setValue(info.getName(), (LongAttribute) primitive); // NOSONAR valid cast
              break;
            case FLOAT:
              setValue(info.getName(), (FloatAttribute) primitive); // NOSONAR valid cast
              break;
            case DOUBLE:
              setValue(info.getName(), (DoubleAttribute) primitive); // NOSONAR valid cast
              break;
            case CURRENCY:
              setValue(info.getName(), (CurrencyAttribute) primitive); // NOSONAR valid cast
              break;
            case STRING:
              setValue(info.getName(), (StringAttribute) primitive); // NOSONAR valid cast
              break;
            case URL:
              setValue(info.getName(), (UrlAttribute) primitive); // NOSONAR valid cast
              break;
            case IMGURL:
              setValue(info.getName(), (ImageUrlAttribute) primitive); // NOSONAR valid cast
              break;
            case DATE:
              setValue(info.getName(), (DateAttribute) primitive); // NOSONAR valid cast
              break;
            default:
              throw new IllegalStateException("Unhandled primitive attribute type " +
                  primitive.getType());
          }
        }
      } else if (info instanceof AssociationAttributeInfo) {
        Object associationItem = item.getAttributeAsObject(AssociationItem.ASSOCIATION_ITEM_ATTRIBUTE_KEY);
        AssociationAttributeInfo associationInfo = (AssociationAttributeInfo) info;
        if (associationItem != null) {
          switch (associationInfo.getType()) {
            case MANY_TO_ONE:
              ((ManyToOneItem<?>) associationItem).toItem((ManyToOneAttribute) attribute)// NOSONAR
              break;
            case ONE_TO_MANY:
              ((OneToManyItem<?>) associationItem).toItem((OneToManyAttribute) attribute); // NOSONAR
              break;
            default:
              throw new IllegalStateException("Unhandled association attribute type " +
                  associationInfo.getType());
          }
        }
      }
      item.fireEvent(new ChangedEvent(item.getJsObj()));
    }
  }
View Full Code Here

Examples of com.smartgwt.client.widgets.form.fields.FormItem

          throw new IllegalStateException("Unhandled primitive attribute type " +
              primitive.getType());
      }
    } else {
      AssociationAttribute<?> association = (AssociationAttribute<?>) attribute;
      FormItem item = formWidget.getItem(name);
      Object associationItem = item.getAttributeAsObject(AssociationItem.ASSOCIATION_ITEM_ATTRIBUTE_KEY);
      switch (association.getType()) {
        case MANY_TO_ONE:
          ((ManyToOneItem<?>) associationItem).fromItem((ManyToOneAttribute) attribute); // NOSONAR valid cast
          break;
        case ONE_TO_MANY:
View Full Code Here

Examples of com.smartgwt.client.widgets.form.fields.FormItem

   */
  public void clear() {
    formWidget.clearValues();
    // the above does not call clearValue() on every item ?!! so do it explicitly
    for (AttributeInfo info : featureInfo.getAttributes()) {
      FormItem formItem = formWidget.getItem(info.getName());
      if (formItem != null) {
        if (info instanceof AssociationAttributeInfo) {
          Object associationItem = formItem
              .getAttributeAsObject(AssociationItem.ASSOCIATION_ITEM_ATTRIBUTE_KEY);
          AssociationAttributeInfo associationInfo = (AssociationAttributeInfo) info;
          if (associationItem != null) {
            switch (associationInfo.getType()) {
              case MANY_TO_ONE:
                ((ManyToOneItem<?>) associationItem).clearValue(); // NOSONAR valid cast
                break;
              case ONE_TO_MANY:
                ((OneToManyItem<?>) associationItem).clearValue(); // NOSONAR valid cast
                break;
              default:
                throw new IllegalStateException("Unhandled association attribute type " +
                    associationInfo.getType());
            }
          }
        } else {
          formItem.clearValue();

        }
      }
    }
  }
View Full Code Here

Examples of com.smartgwt.client.widgets.form.fields.FormItem

   * @param name attribute name
   * @param attribute attribute value
   */
  protected void setValue(String name, BooleanAttribute attribute) {
    // formWidget.setValue(name, attribute.getValue());
    FormItem item = formWidget.getField(name);
    if (item != null) {
      item.setValue(attribute.getValue());
    }
  }
View Full Code Here

Examples of com.smartgwt.client.widgets.form.fields.FormItem

   *
   * @param name attribute name
   * @param attribute attribute value
   */
  protected void setValue(String name, IntegerAttribute attribute) {
    FormItem item = formWidget.getField(name);
    if (item != null) {
      item.setValue(attribute.getValue());
    }
  }
View Full Code Here

Examples of com.smartgwt.client.widgets.form.fields.FormItem

   *
   * @param name attribute name
   * @param attribute attribute value
   */
  protected void setValue(String name, LongAttribute attribute) {
    FormItem item = formWidget.getField(name);
    if (item != null) {
      item.setValue(attribute.getValue());
    }
  }
View Full Code Here

Examples of com.smartgwt.client.widgets.form.fields.FormItem

   *
   * @param name attribute name
   * @param attribute attribute value
   */
  protected void setValue(String name, FloatAttribute attribute) {
    FormItem item = formWidget.getField(name);
    if (item != null) {
      item.setValue(attribute.getValue());
    }
  }
View Full Code Here

Examples of com.smartgwt.client.widgets.form.fields.FormItem

   *
   * @param name attribute name
   * @param attribute attribute value
   */
  protected void setValue(String name, DoubleAttribute attribute) {
    FormItem item = formWidget.getField(name);
    if (item != null) {
      item.setValue(attribute.getValue());
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.