Package com.extjs.gxt.ui.client.util

Examples of com.extjs.gxt.ui.client.util.DateWrapper


   * Creates a new time instance.
   *
   * @param date any date, hours and minutes will be used
   */
  public Time(Date date) {
    setHour(new DateWrapper(date).getHours());
    setMinutes(new DateWrapper(date).getMinutes());
  }
View Full Code Here


   *
   * @param date any date, hours and minutes will be used
   * @param text the display text
   */
  public Time(Date date, String text) {
    setHour(new DateWrapper(date).getHours());
    setMinutes(new DateWrapper(date).getMinutes());
    setText(text);
  }
View Full Code Here

   * Returns a new date instance form the time information.
   *
   * @return the new date instance
   */
  public Date getDate() {
    DateWrapper w = new DateWrapper();
    w = w.clearTime();
    w = w.addHours(getHour());
    w = w.addMinutes(getMinutes());
    return w.asDate();
  }
View Full Code Here

  public Stock(String name, String symbol, double open, double last) {
    set("name", name);
    set("symbol", symbol);
    set("open", open);
    set("last", last);
    set("date", new DateWrapper().addDays(-(int)(Math.random() * 100)).asDate());
    set("change", last - open);
    set("split", new Boolean(Math.random() > .5));
    set("type", getType());
  }
View Full Code Here

  protected Plant createPlant() {
    Plant plant = new Plant();
    plant.setName("New Plant 1");
    plant.setLight("Mostly Shady");
    plant.setPrice(0);
    plant.setAvailable(new DateWrapper().clearTime().asDate());
    plant.setIndoor(false);
    return plant;
  }
View Full Code Here

        BasePagingLoadResult<Post> r = le.<BasePagingLoadResult<Post>> getData();
        for (Post p : r.getData()) {
          if (p.getSubject().equals("")) {
            p.setSubject(null);
          }
          p.setDate(new DateWrapper(p.getDate()).clearTime().asDate());
        }
      }

    });
View Full Code Here

    setLayout(new FlowLayout(10));

    List<Stock> stocks = TestData.getStocks();
    for (Stock s : stocks) {
      DateWrapper w = new DateWrapper();
      w = w.clearTime();
      w = w.addDays((int) (Math.random() * 1000));
      s.set("date", w.asDate());
    }

    List<ColumnConfig> configs = new ArrayList<ColumnConfig>();

    ColumnConfig column = new ColumnConfig();
    column.setId("name");
    column.setHeader("Common Name");
    column.setWidth(220);

    TextField<String> text = new TextField<String>();
    text.setAllowBlank(false);
    column.setEditor(new CellEditor(text));
    configs.add(column);

    final SimpleComboBox<String> combo = new SimpleComboBox<String>();
    combo.setForceSelection(true);
    combo.setTriggerAction(TriggerAction.ALL);
    combo.add("Shade");
    combo.add("Mostly Shady");
    combo.add("Sun or Shade");
    combo.add("Mostly Sunny");
    combo.add("Sunny");

    CellEditor editor = new CellEditor(combo) {
      @Override
      public Object preProcessValue(Object value) {
        if (value == null) {
          return value;
        }
        return combo.findModel(value.toString());
      }

      @Override
      public Object postProcessValue(Object value) {
        if (value == null) {
          return value;
        }
        return ((ModelData) value).get("value");
      }
    };

    column = new ColumnConfig();
    column.setId("light");
    column.setHeader("Light");
    column.setWidth(130);
    column.setEditor(editor);
    configs.add(column);

    column = new ColumnConfig();
    column.setId("price");
    column.setHeader("Price");
    column.setAlignment(HorizontalAlignment.RIGHT);
    column.setWidth(70);
    column.setNumberFormat(NumberFormat.getCurrencyFormat());
    column.setEditor(new CellEditor(new NumberField()));

    configs.add(column);

    DateField dateField = new DateField();
    dateField.getPropertyEditor().setFormat(DateTimeFormat.getFormat("MM/dd/y"));

    column = new ColumnConfig();
    column.setId("available");
    column.setHeader("Available");
    column.setWidth(95);
    column.setEditor(new CellEditor(dateField));
    column.setDateTimeFormat(DateTimeFormat.getFormat("yyyy MMM dd"));
    configs.add(column);

    CheckColumnConfig checkColumn = new CheckColumnConfig("indoor", "Indoor?", 55);
    CellEditor checkBoxEditor = new CellEditor(new CheckBox());
    checkColumn.setEditor(checkBoxEditor);
    configs.add(checkColumn);

    final ListStore<Plant> store = new ListStore<Plant>();
    store.add(TestData.getPlants());

    ColumnModel cm = new ColumnModel(configs);

    ContentPanel cp = new ContentPanel();
    cp.setHeading("Edit Plants");
    cp.setFrame(true);
    cp.setIcon(Resources.ICONS.table());
    cp.setSize(600, 300);
    cp.setLayout(new FitLayout());

    final EditorGrid<Plant> grid = new EditorGrid<Plant>(store, cm);
    grid.setAutoExpandColumn("name");
    grid.setBorders(true);
    grid.addPlugin(checkColumn);
    cp.add(grid);

    ToolBar toolBar = new ToolBar();
    Button add = new Button("Add Plant");
    add.addSelectionListener(new SelectionListener<ButtonEvent>() {

      @Override
      public void componentSelected(ButtonEvent ce) {
        Plant plant = new Plant();
        plant.setName("New Plant 1");
        plant.setLight("Mostly Shady");
        plant.setPrice(0);
        plant.setAvailable(new DateWrapper().clearTime().asDate());
        plant.setIndoor(false);

        grid.stopEditing();
        store.insert(plant, 0);
        grid.startEditing(store.indexOf(plant), 0);
View Full Code Here

      public void componentSelected(ButtonEvent ce) {
        Plant plant = new Plant();
        plant.setName("New Plant 1");
        plant.setLight("Mostly Shady");
        plant.setPrice(0);
        plant.setAvailable(new DateWrapper().clearTime().asDate());
        plant.setIndoor(false);

        re.stopEditing(false);
        store.insert(plant, 0);
        re.startEditing(store.indexOf(plant), true);
View Full Code Here

    }

    final Person person = new Person("Darrell Meyer", "Sencha Inc", "Ext GWT", "Washington, DC", 1000000000d);

    List<Kid> kids = new ArrayList<Kid>();
    kids.add(new Kid("Alec", 4, new DateWrapper(2004, 1, 1).asDate()));
    kids.add(new Kid("Lia", 2, new DateWrapper(2005, 1, 1).asDate()));
    kids.add(new Kid("Andrew", 1, new DateWrapper(2007, 1, 1).asDate()));

    person.setKids(kids);

    VerticalPanel vp = new VerticalPanel();
    vp.setSpacing(10);
View Full Code Here

     *
     * @param maxValue the max value
     */
    public void setMaxValue(Date maxValue) {
        if (maxValue != null) {
            maxValue = new DateWrapper(maxValue).clearTime().asDate();
        }
        this.maxValue = maxValue;
    }
View Full Code Here

TOP

Related Classes of com.extjs.gxt.ui.client.util.DateWrapper

Copyright © 2018 www.massapicom. 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.