Examples of DateTimeFormat


Examples of com.google.gwt.i18n.client.DateTimeFormat

         */
        formatStr = formatMonthNames(date, formatStr);
        formatStr = formatDayNames(date, formatStr);

        // Format uses the browser locale
        DateTimeFormat format = DateTimeFormat.getFormat(formatStr);

        String result = format.format(date);

        return result;
    }
View Full Code Here

Examples of com.google.gwt.i18n.client.DateTimeFormat

     *
     */
    public Date parseDate(String dateString, String formatString,
            boolean lenient) throws IllegalArgumentException {
        /* DateTimeFormat uses the browser's locale */
        DateTimeFormat format = DateTimeFormat.getFormat(formatString);

        /*
         * Parse month names separately when locale for the DateTimeService is
         * not the same as the browser locale
         */
        dateString = parseMonthName(dateString, formatString);

        Date date;

        if (lenient) {
            date = format.parse(dateString);
        } else {
            date = format.parseStrict(dateString);
        }

        // Some version of Firefox sets the timestamp to 0 if parsing fails.
        if (date != null && date.getTime() == 0) {
            throw new IllegalArgumentException("Parsing of '" + dateString
View Full Code Here

Examples of com.google.gwt.i18n.client.DateTimeFormat

      DataTable data = DataTable.create();
      data.addColumn(DataTable.ColumnType.DATETIME, "start");
      data.addColumn(DataTable.ColumnType.DATETIME, "end");
      data.addColumn(DataTable.ColumnType.STRING, "content");

        DateTimeFormat dtf = DateTimeFormat.getFormat("yyyy-MM-dd");

        // fill the table with some data
        data.addRow();
        data.setValue(0, 0, dtf.parse("2010-08-23"));
        data.setValue(0, 1, dtf.parse("2010-08-30"));
        data.setValue(0, 2, "Project A");
        data.addRow();
        data.setValue(1, 0, dtf.parse("2010-08-28"));
        data.setValue(1, 2, "Meeting");
        data.addRow();
        data.setValue(2, 0, dtf.parse("2010-09-02"));
        data.setValue(2, 2, "Phone Call");
        data.addRow();
        data.setValue(3, 0, dtf.parse("2010-09-03"));
        data.setValue(3, 2, "Finished");

        // create options
        Timeline.Options options = Timeline.Options.create();
        options.setWidth("100%");
View Full Code Here

Examples of com.google.gwt.i18n.client.DateTimeFormat

        DataTable data = DataTable.create();
        data.addColumn(DataTable.ColumnType.DATETIME, "time");
        data.addColumn(DataTable.ColumnType.NUMBER, "Function A");
        data.addColumn(DataTable.ColumnType.NUMBER, "Function B");

        DateTimeFormat dtf = DateTimeFormat.getFormat("yyyy-MM-dd");

        // create data
        Date d = dtf.parse("2010-08-23");
        int n = 200; // number of datapoints
        for (int i = 0; i < n; i++) {
          data.addRow();
          data.setValue(i, 0, new Date(d.getTime()));
          data.setValue(i, 1, customFunctionA(i));
View Full Code Here

Examples of com.google.gwt.i18n.client.DateTimeFormat

    DataTable data = DataTable.create();
    data.addColumn(DataTable.ColumnType.DATETIME, "start");
    data.addColumn(DataTable.ColumnType.DATETIME, "end");
    data.addColumn(DataTable.ColumnType.STRING, "content");

    DateTimeFormat df = DateTimeFormat.getFormat("yyyy-MM-dd");
    DateTimeFormat dtf = DateTimeFormat.getFormat("yyyy-MM-dd HH:mm:ss");

    int n = 0;
   
    data.addRow();
    data.setValue(n, 0, df.parse("2010-08-23"));
    data.setValue(n, 2, "<div>Conversation</div><img src='img/comments-icon.png' style='width:32px; height:32px;'>");
    n++;

    data.addRow();
    data.setValue(n, 0, dtf.parse("2010-08-23 23:00:00"));
    data.setValue(n, 2, "<div>Mail from boss</div><img src='img/mail-icon.png' style='width:32px; height:32px;'>");
    n++;

    data.addRow();
    data.setValue(n, 0, dtf.parse("2010-08-24 16:00:00"));
    data.setValue(n, 2, "Report");
    n++;

    data.addRow();
    data.setValue(n, 0, df.parse("2010-08-26"));
    data.setValue(n, 1, df.parse("2010-09-02"));
    data.setValue(n, 2, "Traject A");
    n++;

    data.addRow();
    data.setValue(n, 0, df.parse("2010-08-28"));
    data.setValue(n, 2, "<div>Memo</div><img src='img/notes-edit-icon.png' style='width:48px; height:48px;'>");
    n++;

    data.addRow();
    data.setValue(n, 0, df.parse("2010-08-29"));
    data.setValue(n, 2, "<div>Phone call</div><img src='img/Hardware-Mobile-Phone-icon.png' style='width:32px; height:32px;'>");
    n++;

    data.addRow();
    data.setValue(n, 0, df.parse("2010-08-31"));
    data.setValue(n, 1, df.parse("2010-09-03"));
    data.setValue(n, 2, "Traject B");
    n++;

    data.addRow();
    data.setValue(n, 0, dtf.parse("2010-09-04 12:00:00"));
    data.setValue(n, 2, "<div>Report</div><img src='img/attachment-icon.png' style='width:32px; height:32px;'>");
    n++;
     
    return data;
  }
View Full Code Here

Examples of com.google.gwt.i18n.client.DateTimeFormat

  /**
   * Get the range from the timeline and put it in the textboxes on screen
   */
  private void getRange() {
    Timeline.DateRange range = timeline.getVisibleChartRange();
    DateTimeFormat dtf = DateTimeFormat.getFormat("yyyy-MM-dd HH:mm:ss");

    // set the new startdate and enddate
    txtStartDate.setText(dtf.format(range.getStart()));
    txtEndDate.setText(dtf.format(range.getEnd()));
  }
View Full Code Here

Examples of com.google.gwt.i18n.client.DateTimeFormat

  /**
   * Get the entered dates from the textboxes on screen, and apply them to
   * the timeline
   */ 
  private void setRange() {
    DateTimeFormat datetime = DateTimeFormat.getFormat("yyyy-MM-dd HH:mm:ss");
    DateTimeFormat date = DateTimeFormat.getFormat("yyyy-MM-dd");
   
    Date startDate;
    Date endDate;
   
    // Try to parse the startdate
    try {
      startDate = datetime.parse(txtStartDate.getText());
    } catch (IllegalArgumentException err) {
      try {
      startDate = date.parse(txtStartDate.getText());
      } catch (IllegalArgumentException err2) {
        Window.alert("I don't understand the startdate that you entered :(");
        return;
      }
    }

    // Try to parse the enddate
    try {
      endDate = datetime.parse(txtEndDate.getText());
    } catch (IllegalArgumentException err) {
      try {
        endDate = date.parse(txtEndDate.getText());
      } catch (IllegalArgumentException err2) {
        Window.alert("I cannot make sense of the enddate that you entered :(");
        return;
      }
    }
View Full Code Here

Examples of com.google.gwt.i18n.client.DateTimeFormat

        DataTable data = DataTable.create();
        data.addColumn(DataTable.ColumnType.DATETIME, "time");
        data.addColumn(DataTable.ColumnType.NUMBER, "Function A");
        data.addColumn(DataTable.ColumnType.NUMBER, "Function B");

        DateTimeFormat dtf = DateTimeFormat.getFormat("yyyy-MM-dd");

        // create data
        Date d = dtf.parse("2010-08-23");
        int n = 1000; // number of datapoints
        for (int i = 0; i < n; i++) {
          data.addRow();
          data.setValue(i, 0, new Date(d.getTime()));
          data.setValue(i, 1, customFunction(i) / 100);
          data.setValue(i, 2, customFunction2(i) / 100);
          d.setTime(d.getTime() + 1000 * 60); // steps of one minute
        }
       
        Graph.Options options = Graph.Options.create();
        options.setHeight("400px");
        options.setLegendCheckboxes(true);
        //options.setVerticalStep(10);
        //options.setScale(Graph.Options.SCALE.HOUR, 2);
        options.setLineStyle(Graph.Options.LINESTYLE.DOT, 0);
        options.setLineRadius(1.0, 0);
        options.setLineColor("#FFA500", 0);
        options.setLineVisibe(false, 1);
        options.setLineColor("#FF0000", 1);
        options.setLineStyle(Graph.Options.LINESTYLE.DOTLINE);
        options.setVerticalMin(-1);
        options.setVerticalMax(1);
        options.setMin(dtf.parse("2010-08-22"));
        options.setMax(dtf.parse("2010-08-24"));
        options.setZoomMin(1000L * 60L * 60L);
       
/*
        String json =      
          "[{ " +
View Full Code Here

Examples of com.google.gwt.i18n.client.DateTimeFormat

  /**
   * Get the range from the timeline and put it in the textboxes on screen
   */
  private void getRange() {
    Graph.DateRange range = graph.getVisibleChartRange();
    DateTimeFormat dtf = DateTimeFormat.getFormat("yyyy-MM-dd HH:mm:ss");

    // set the new startdate and enddate
    txtStartDate.setText(dtf.format(range.getStart()));
    txtEndDate.setText(dtf.format(range.getEnd()));
  }
View Full Code Here

Examples of com.google.gwt.i18n.client.DateTimeFormat

  /**
   * Get the entered dates from the textboxes on screen, and apply them to
   * the timeline
   */ 
  private void setRange() {
    DateTimeFormat datetime = DateTimeFormat.getFormat("yyyy-MM-dd HH:mm:ss");
    DateTimeFormat date = DateTimeFormat.getFormat("yyyy-MM-dd");
   
    Date startDate;
    Date endDate;
   
    // Try to parse the startdate
    try {
      startDate = datetime.parse(txtStartDate.getText());
    } catch (IllegalArgumentException err) {
      try {
      startDate = date.parse(txtStartDate.getText());
      } catch (IllegalArgumentException err2) {
        Window.alert("I don't understand the startdate that you entered :(");
        return;
      }
    }

    // Try to parse the enddate
    try {
      endDate = datetime.parse(txtEndDate.getText());
    } catch (IllegalArgumentException err) {
      try {
        endDate = date.parse(txtEndDate.getText());
      } catch (IllegalArgumentException err2) {
        Window.alert("I cannot make sense of the enddate that you entered :(");
        return;
      }
    }
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.