All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.extjs.gxt.ui.client.data.DataField Maven / Gradle / Ivy

There is a newer version: 2.3.1-gwt22
Show newest version
/*
 * Sencha GXT 2.3.1a - Sencha for GWT
 * Copyright(c) 2007-2013, Sencha, Inc.
 * [email protected]
 * 
 * http://www.sencha.com/products/gxt/license/
 */
 package com.extjs.gxt.ui.client.data;

import com.google.gwt.i18n.client.DateTimeFormat;

/**
 * Describes a field in a Model. Used when mapping raw data to a
 * model's properties.
 */
public class DataField {

  /**
   * Field type constant for dates.
   */
  public static final String DATE_TYPE = "date";

  private String format;
  private String map;
  private String name;
  private Class type;

  /**
   * Creates a new field.
   * 
   * @param name the name
   */
  public DataField(String name) {
    this.name = name;
  }

  /**
   * Creates a new field instance.
   * 
   * @param name the field name
   * @param map the map name
   */
  public DataField(String name, String map) {
    this.name = name;
    this.map = map;
  }

  /**
   * Returns the format used when the type has been set to java.util.Date.
   * 
   * @return the format
   */
  public String getFormat() {
    return format;
  }

  /**
   * Returns the map.
   * 
   * @return the map
   */
  public String getMap() {
    return map;
  }

  /**
   * Returns the name.
   * 
   * @return the name
   */
  public String getName() {
    return name;
  }

  /**
   * Returns the type.
   * 
   * @return the type
   */
  public Class getType() {
    return type;
  }

  /**
   * Format is used when converting raw data to object instances. Format only
   * applies when #setType is used with java.util.Date. The value is a date time
   * format as defined by @link {@link DateTimeFormat}. If the raw data is a
   * timestamp, the format should be set to "timestamp".
   * 
   * @param format the format
   */
  public void setFormat(String format) {
    this.format = format;
  }

  /**
   * An optional field used when the property name of the model is different
   * than the property name of the raw data. When used with a
   * XmlReader the map value is treated as a xpath selector.
   * 
   * @param map the map
   */
  public void setMap(String map) {
    this.map = map;
  }

  /**
   * Sets the name of the field.
   * 
   * @param name the field
   */
  public void setName(String name) {
    this.name = name;
  }

  /**
   * The data type of the field used when converting the raw value.
   * 
   * 

* Valid values: *

    *
  • Integer.class
  • *
  • Long.class
  • *
  • Float.class
  • *
  • Double.class
  • *
  • Date.class
  • *
* * @param type */ public void setType(Class type) { this.type = type; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy