Package com.google.gwt.i18n.client

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


            canvas.setStrokeStyle(gridColor);
            canvas.setLineWidth(0.8);
            canvas.beginPath();
        }

        DateTimeFormat formatter = DateTimeFormat.getFormat("MMM d y");
        while (monday.before(currentEndDate)) {
            Label lbl = new Label();
            lbl.setWidth(width + "px");
            lbl.setStyleName(CLASSNAME_SCALEDATE);
            lbl.setText(formatter.format(monday));
            timeFromStart = monday.getTime() - currentStartDate.getTime();
            float x = timeFromStart * xUnit + paddingLeft;

            canvas.moveTo(x, 0);
            canvas.lineTo(x, canvas.getHeight());
View Full Code Here


            canvas.setStrokeStyle(gridColor);
            canvas.setLineWidth(0.8);
            canvas.beginPath();
        }

        DateTimeFormat formatter = DateTimeFormat.getFormat("MMM y");
        int currentMonth = currentStartDate.getMonth();
        int currentYear = currentStartDate.getYear();
        Float width = VTimelineWidget.getDaysInMonth(currentMonth, currentYear)
        * DAY * xUnit;
        while (first.before(currentEndDate)) {
            Label lbl = new Label();
            lbl.setStyleName(CLASSNAME_SCALEDATE);
            lbl.setWidth(width + "px");
            lbl.setText(formatter.format(first));

            timeFromStart = first.getTime() - currentStartDate.getTime();
            float x = timeFromStart * xUnit + paddingLeft;

            if (gridColor != null) {
View Full Code Here

            canvas.setStrokeStyle(gridColor);
            canvas.setLineWidth(0.8);
            canvas.beginPath();
        }

        DateTimeFormat formatter = DateTimeFormat.getFormat("yyyy");
        while (first.before(currentEndDate)) {
            Label lbl = new Label();
            lbl.setWidth(width + "px");
            lbl.setText(formatter.format(first));
            lbl.setStyleName(CLASSNAME_SCALEDATE);

            timeFromStart = first.getTime() - currentStartDate.getTime();
            float x = timeFromStart * xUnit + paddingLeft;

View Full Code Here

            displayComponentPanel.add(lbl);
            displayComponentPanel.setWidgetPosition(lbl, (int)x-lbl.getOffsetWidth()/2, (int)y-lbl.getOffsetHeight());

            markerMap.put(markString, lbl);

            DateTimeFormat formatter = DateTimeFormat.getFormat("MMM d, ''yy");

            FlexTable tooltip = new FlexTable();
            tooltip.setVisible(true);
            tooltip.setStyleName(CLASSNAME_MARKERTOOLTIP);
            tooltip.setBorderWidth(0);
            tooltip.setCellSpacing(0);
            tooltip.setCellPadding(0);

            tooltip.getRowFormatter().setStyleName(0, "top");
            tooltip.getCellFormatter().setStyleName(0, 0, "topLeft");
            tooltip.getCellFormatter().setStyleName(0, 1, "topMiddle");
            tooltip.getCellFormatter().setStyleName(0, 2, "topRight");

            tooltip.getRowFormatter().setStyleName(1, "middle");
            tooltip.getCellFormatter().setStyleName(1, 0, "middleLeft");
            tooltip.getCellFormatter().setStyleName(1, 1, "content");
            tooltip.getCellFormatter().setStyleName(1, 2, "middleRight");

            tooltip.getRowFormatter().setStyleName(2, "bottom");
            tooltip.getCellFormatter().setStyleName(2, 0, "bottomLeft");
            tooltip.getCellFormatter().setStyleName(2, 1, "bottomMiddle");
            tooltip.getCellFormatter().setStyleName(2, 2, "bottomRight");

            HTML content = new HTML(
                    "<span class=date>"+formatter.format(new Date(time))+"</span> <br/>"+
                    "<span class=text>"+description+"</span>"
            );

            tooltip.setWidget(1, 1, content);
View Full Code Here

         * not the same as the browser locale
         */
        formatStr = formatMonthNames(date, formatStr);

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

        String result = format.format(date);

        return result;
    }
View Full Code Here

     *
     */
    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

  }
 
  @SuppressWarnings("rawtypes")
  private List getGridConfig() {
    List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
    DateTimeFormat dtf = DateTimeFormat.getFormat("dd-MM-yyyy");
   
    // Se agrega esta columna para mantener el identificador de las tareas
    ColumnConfig clmncnfgId = new ColumnConfig(ParamsConst.ID, ParamsConst.ID, 1);
    clmncnfgId.setHidden(Boolean.TRUE);
    configs.add(clmncnfgId);
View Full Code Here

 
 
  @SuppressWarnings("rawtypes")
  private List getGridConfig() {
    List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
    DateTimeFormat dtf = DateTimeFormat.getFormat("dd-MM-yyyy");
   
    // Se agrega esta columna para mantener el identificador de las objetivos
    ColumnConfig clmncnfgId = new ColumnConfig(ParamsConst.ID, ParamsConst.ID, 1);
    clmncnfgId.setHidden(Boolean.TRUE);
    configs.add(clmncnfgId);
View Full Code Here

          } else if (type.equals(Date.class)) {
            if ("timestamp".equals(field.getFormat())) {
              Date d = new Date(Long.parseLong(v) * 1000);
              model.set(name, d);
            } else {
              DateTimeFormat format = DateTimeFormat.getFormat(field.getFormat());
              Date d = format.parse(v);
              model.set(name, d);
            }
          }
        } else {
          model.set(field.getName(), v);
View Full Code Here

    if (value.length() < 1) { // if it's blank and textfield didn't flag it then
      // it's valid
      return true;
    }

    DateTimeFormat format = getPropertyEditor().getFormat();

    Date date = null;

    try {
      date = getPropertyEditor().convertStringValue(value);
    } catch (Exception e) {

    }

    if (date == null) {
      String error = null;
      if (getMessages().getInvalidText() != null) {
        error = Format.substitute(getMessages().getInvalidText(), value, format.getPattern().toUpperCase());
      } else {
        error = GXT.MESSAGES.dateField_invalidText(value, format.getPattern().toUpperCase());
      }
      markInvalid(error);
      return false;
    }
   
    date = new DateWrapper(date).resetTime().asDate();

    if (minValue != null && date.before(minValue)) {
      String error = null;
      if (getMessages().getMinText() != null) {
        error = Format.substitute(getMessages().getMinText(), format.format(minValue));
      } else {
        error = GXT.MESSAGES.dateField_minText(format.format(minValue));
      }
      markInvalid(error);
      return false;
    }
    if (maxValue != null && date.after(maxValue)) {
      String error = null;
      if (getMessages().getMaxText() != null) {
        error = Format.substitute(getMessages().getMaxText(), format.format(maxValue));
      } else {
        error = GXT.MESSAGES.dateField_maxText(format.format(maxValue));
      }
      markInvalid(error);
      return false;
    }
View Full Code Here

TOP

Related Classes of com.google.gwt.i18n.client.DateTimeFormat

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.