Package com.google.gwt.i18n.client

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


    if (val != null && val instanceof Number && c.getNumberFormat() != null) {
      Number n = (Number) val;
      val = c.getNumberFormat().format(n.doubleValue());
    } else if (val != null && val instanceof Date && c.getDateTimeFormat() != null) {
      DateTimeFormat dtf = c.getDateTimeFormat();
      val = dtf.format((Date) val);
    }

    String text = null;
    if (val != null) {
      text = val.toString();
View Full Code Here


    if (val != null && c.getNumberFormat() != null) {
      Number n = (Number) val;
      NumberFormat nf = cm.getColumn(colIndex).getNumberFormat();
      val = nf.format(n.doubleValue());
    } else if (val != null && c.getDateTimeFormat() != null) {
      DateTimeFormat dtf = c.getDateTimeFormat();
      val = dtf.format((Date) val);
    }

    String text = null;
    if (val != null) {
      text = val.toString();
View Full Code Here

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

    }

    public String getDateString() {
        String t = textWidget.getText();
        Date date = this.visualFormatFormatter.parse( t );
        DateTimeFormat formatter = DateTimeFormat.getFormat( defaultFormat );
        return formatter.format( date );
    }
View Full Code Here

   * @param patternString
   * @return
   */
  public static DateTimeFormat getDateTimeFormat(String patternString)
  {
    DateTimeFormat result;
   
    if (FULL_DATE_PATTERN.equals(patternString))
    {
      result = DateTimeFormat.getFormat(PredefinedFormat.DATE_FULL);
    }
View Full Code Here

            }
        } );

        // Check if there is a valid date set. If not, set this date.
        try {
            DateTimeFormat formatter = DateTimeFormat.getFormat( defaultFormat );
            Date date = formatter.parse( selectedDate );
            selectedDate = visualFormatFormatter.format( date );
        } catch ( Exception e ) {
            selectedDate = visualFormatFormatter.format( new Date() );
        }
View Full Code Here

   
    ProgressDto progressDto = null;
    String process = "";
    String totalsituation = "";
    //Grid 1
    DateTimeFormat dateTimeFormat = DateTimeFormat.getFormat(Constants.DATE_FORMAT);
    NumberFormat numberFormat = NumberFormat.getFormat(Constants.NUMBER_FORMAT);
    String process_date = "";
    //String [] arrMois = mois.split(Constants.SEPRATE);
    for (int j = 0; j < list.size(); j++) {   
      progressDto = list.get(j);
      process_date = progressDto.getDate() != null ? dateTimeFormat.format(progressDto.getDate()) : "";
      process += (j+1) + Constants.SEPRATE + progressDto.getLabel() + Constants.SEPRATE +
      process_date + Constants.SEPRATE + numberFormat.format(progressDto.getCumule()) + Constants.SEPRATE + numberFormat.format(progressDto.getMois()) +
      Constants.SEPRATE + numberFormat.format(progressDto.getCumule2()) + Constants.SEPRATE + numberFormat.format(progressDto.getMois2()) + Constants.SEPRATE;
    }
View Full Code Here

    add(panel);
  }

  public static List<Stock> getCompanies() {
    DateTimeFormat f = DateTimeFormat.getFormat("M/d h:mma");
    List<Stock> stocks = new ArrayList<Stock>();
    stocks.add(new Stock("3m Co", 71.72, 0.02, 0.03, f.parse("4/2 12:00am"), "Manufacturing"));
    stocks.add(new Stock("Alcoa Inc", 29.01, 0.42, 1.47, f.parse("4/1 12:00am"), "Manufacturing"));
    stocks.add(new Stock("Altria Group Inc", 83.81, 0.28, 0.34, f.parse("4/3 12:00am"), "Manufacturing"));
    stocks.add(new Stock("American Express Company", 52.55, 0.01, 0.02, f.parse("4/8 12:00am"), "Finance"));
    stocks.add(new Stock("American International Group, Inc.", 64.13, 0.31, 0.49, f.parse("4/1 12:00am"), "Services"));
    stocks.add(new Stock("AT&T Inc.", 31.61, -0.48, -1.54, f.parse("4/8 12:00am"), "Services"));
    stocks.add(new Stock("Boeing Co.", 75.43, 0.53, 0.71, f.parse("4/8 12:00am"), "Manufacturing"));
    stocks.add(new Stock("Caterpillar Inc.", 67.27, 0.92, 1.39, f.parse("4/1 12:00am"), "Services"));
    stocks.add(new Stock("Citigroup, Inc.", 49.37, 0.02, 0.04, f.parse("4/4 12:00am"), "Finance"));
    stocks.add(new Stock(
        "E.I. du Pont de Nemours and Company", 40.48, 0.51, 1.28, f.parse("4/1 12:00am"), "Manufacturing"));
    stocks.add(new Stock("Exxon Mobil Corp", 68.1, -0.43, -0.64, f.parse("4/3 12:00am"), "Manufacturing"));
    stocks.add(new Stock("General Electric Company", 34.14, -0.08, -0.23, f.parse("4/3 12:00am"), "Manufacturing"));
    stocks.add(new Stock("General Motors Corporation", 30.27, 1.09, 3.74, f.parse("4/3 12:00am"), "Automotive"));
    stocks.add(new Stock("Hewlett-Packard Co.", 36.53, -0.03, -0.08, f.parse("4/3 12:00am"), "Computer"));
    stocks.add(new Stock("Honeywell Intl Inc", 38.77, 0.05, 0.13, f.parse("4/3 12:00am"), "Manufacturing"));
    stocks.add(new Stock("Intel Corporation", 19.88, 0.31, 1.58, f.parse("4/2 12:00am"), "Computer"));
    stocks.add(new Stock("International Business Machines", 81.41, 0.44, 0.54, f.parse("4/1 12:00am"), "Computer"));
    stocks.add(new Stock("Johnson & Johnson", 64.72, 0.06, 0.09, f.parse("4/2 12:00am"), "Medical"));
    stocks.add(new Stock("JP Morgan & Chase & Co", 45.73, 0.07, 0.15, f.parse("4/2 12:00am"), "Finance"));
    stocks.add(new Stock("McDonald\"s Corporation", 36.76, 0.86, 2.40, f.parse("4/2 12:00am"), "Food"));
    stocks.add(new Stock("Merck & Co., Inc.", 40.96, 0.41, 1.01, f.parse("4/2 12:00am"), "Medical"));
    stocks.add(new Stock("Microsoft Corporation", 25.84, 0.14, 0.54, f.parse("4/2 12:00am"), "Computer"));
    stocks.add(new Stock("Pfizer Inc", 27.96, 0.4, 1.45, f.parse("4/8 12:00am"), "Services"));
    stocks.add(new Stock("The Coca-Cola Company", 45.07, 0.26, 0.58, f.parse("4/1 12:00am"), "Food"));
    stocks.add(new Stock("The Home Depot, Inc.", 34.64, 0.35, 1.02, f.parse("4/8 12:00am"), "Retail"));
    stocks.add(new Stock("The Procter & Gamble Company", 61.91, 0.01, 0.02, f.parse("4/1 12:00am"), "Manufacturing"));
    stocks.add(new Stock("United Technologies Corporation", 63.26, 0.55, 0.88, f.parse("4/1 12:00am"), "Computer"));
    stocks.add(new Stock("Verizon Communications", 35.57, 0.39, 1.11, f.parse("4/3 12:00am"), "Services"));
    stocks.add(new Stock("Wal-Mart Stores, Inc.", 45.45, 0.73, 1.63, f.parse("4/3 12:00am"), "Retail"));
    stocks.add(new Stock(
        "Walt Disney Company (The) (Holding Company)", 29.89, 0.24, 0.81, f.parse("4/1 12:00am"), "Services"));
    return stocks;
  }
View Full Code Here

    plants.add(new Plant("Cardinal Flower", "Shade", 7.81, "05/18/2006", false));
    return plants;
  }

  public static List<Stock> getCompanies() {
    DateTimeFormat f = DateTimeFormat.getFormat("M/d h:mma");
    List<Stock> stocks = new ArrayList<Stock>();
    stocks.add(new Stock("3m Co", 71.72, 0.02, 0.03, f.parse("4/2 12:00am"),
        "Manufacturing"));
    stocks.add(new Stock("Alcoa Inc", 29.01, 0.42, 1.47, f.parse("4/1 12:00am"),
        "Manufacturing"));
    stocks.add(new Stock("Altria Group Inc", 83.81, 0.28, 0.34, f.parse("4/3 12:00am"),
        "Manufacturing"));
    stocks.add(new Stock("American Express Company", 52.55, 0.01, 0.02,
        f.parse("4/8 12:00am"), "Finance"));
    stocks.add(new Stock("American International Group, Inc.", 64.13, 0.31, 0.49,
        f.parse("4/1 12:00am"), "Services"));
    stocks.add(new Stock("AT&T Inc.", 31.61, -0.48, -1.54, f.parse("4/8 12:00am"),
        "Services"));
    stocks.add(new Stock("Boeing Co.", 75.43, 0.53, 0.71, f.parse("4/8 12:00am"),
        "Manufacturing"));
    stocks.add(new Stock("Caterpillar Inc.", 67.27, 0.92, 1.39, f.parse("4/1 12:00am"),
        "Services"));
    stocks.add(new Stock("Citigroup, Inc.", 49.37, 0.02, 0.04, f.parse("4/4 12:00am"),
        "Finance"));
    stocks.add(new Stock("E.I. du Pont de Nemours and Company", 40.48, 0.51, 1.28,
        f.parse("4/1 12:00am"), "Manufacturing"));
    stocks.add(new Stock("Exxon Mobil Corp", 68.1, -0.43, -0.64, f.parse("4/3 12:00am"),
        "Manufacturing"));
    stocks.add(new Stock("General Electric Company", 34.14, -0.08, -0.23,
        f.parse("4/3 12:00am"), "Manufacturing"));
    stocks.add(new Stock("General Motors Corporation", 30.27, 1.09, 3.74,
        f.parse("4/3 12:00am"), "Automotive"));
    stocks.add(new Stock("Hewlett-Packard Co.", 36.53, -0.03, -0.08,
        f.parse("4/3 12:00am"), "Computer"));
    stocks.add(new Stock("Honeywell Intl Inc", 38.77, 0.05, 0.13, f.parse("4/3 12:00am"),
        "Manufacturing"));
    stocks.add(new Stock("Intel Corporation", 19.88, 0.31, 1.58, f.parse("4/2 12:00am"),
        "Computer"));
    stocks.add(new Stock("International Business Machines", 81.41, 0.44, 0.54,
        f.parse("4/1 12:00am"), "Computer"));
    stocks.add(new Stock("Johnson & Johnson", 64.72, 0.06, 0.09, f.parse("4/2 12:00am"),
        "Medical"));
    stocks.add(new Stock("JP Morgan & Chase & Co", 45.73, 0.07, 0.15,
        f.parse("4/2 12:00am"), "Finance"));
    stocks.add(new Stock("McDonald\"s Corporation", 36.76, 0.86, 2.40,
        f.parse("4/2 12:00am"), "Food"));
    stocks.add(new Stock("Merck & Co., Inc.", 40.96, 0.41, 1.01, f.parse("4/2 12:00am"),
        "Medical"));
    stocks.add(new Stock("Microsoft Corporation", 25.84, 0.14, 0.54,
        f.parse("4/2 12:00am"), "Computer"));
    stocks.add(new Stock("Pfizer Inc", 27.96, 0.4, 1.45, f.parse("4/8 12:00am"),
        "Services"));
    stocks.add(new Stock("The Coca-Cola Company", 45.07, 0.26, 0.58,
        f.parse("4/1 12:00am"), "Food"));
    stocks.add(new Stock("The Home Depot, Inc.", 34.64, 0.35, 1.02,
        f.parse("4/8 12:00am"), "Retail"));
    stocks.add(new Stock("The Procter & Gamble Company", 61.91, 0.01, 0.02,
        f.parse("4/1 12:00am"), "Manufacturing"));
    stocks.add(new Stock("United Technologies Corporation", 63.26, 0.55, 0.88,
        f.parse("4/1 12:00am"), "Computer"));
    stocks.add(new Stock("Verizon Communications", 35.57, 0.39, 1.11,
        f.parse("4/3 12:00am"), "Services"));
    stocks.add(new Stock("Wal-Mart Stores, Inc.", 45.45, 0.73, 1.63,
        f.parse("4/3 12:00am"), "Retail"));
    stocks.add(new Stock("Walt Disney Company (The) (Holding Company)", 29.89, 0.24,
        0.81, f.parse("4/1 12:00am"), "Services"));
    return stocks;
  }
View Full Code Here

   * @param params
   * @return
   */
  protected String append(Object... params) {
    NumberFormat numberFormat = NumberFormat.getFormat(Constants.NUMBER_FORMAT);
    DateTimeFormat dateTimeFormat = DateTimeFormat.getFormat(Constants.DATE_FORMAT);
    String srcParam = "";
    for( Object param : params ) {
      if( param != null ) {
        if( param instanceof String ) {
          srcParam += param;
        }
        if( param instanceof Integer ) {
          srcParam += numberFormat.format(((Integer) param).intValue());
        }
        if( param instanceof Double ) {
          srcParam += numberFormat.format(((Double) param).doubleValue());
        }
        if( param instanceof Float ) {
          srcParam += numberFormat.format(((Float) param).floatValue());
        }
        if( param instanceof Date ) {
          srcParam += dateTimeFormat.format((Date) param);
        }
      }
      else {
        srcParam += "null";
      }
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.