Example usage for com.google.gwt.i18n.client DateTimeFormat getFullTimeFormat

List of usage examples for com.google.gwt.i18n.client DateTimeFormat getFullTimeFormat

Introduction

In this page you can find the example usage for com.google.gwt.i18n.client DateTimeFormat getFullTimeFormat.

Prototype

@Deprecated
public static DateTimeFormat getFullTimeFormat() 

Source Link

Document

Retrieve the DateTimeFormat object for full time format.

Usage

From source file:com.google.gwt.sample.i18n.client.DateTimeFormatExampleController.java

License:Apache License

@Override
protected String doGetPattern(String patternKey) {
    // Date + Time
    if ("fullDateTime".equals(patternKey)) {
        return DateTimeFormat.getFullDateTimeFormat().getPattern();
    }/*w  w  w.  j a  v  a2  s .  c  om*/

    if ("longDateTime".equals(patternKey)) {
        return DateTimeFormat.getLongDateTimeFormat().getPattern();
    }

    if ("mediumDateTime".equals(patternKey)) {
        return DateTimeFormat.getMediumDateTimeFormat().getPattern();
    }

    if ("shortDateTime".equals(patternKey)) {
        return DateTimeFormat.getShortDateTimeFormat().getPattern();
    }

    // Date only
    if ("fullDate".equals(patternKey)) {
        return DateTimeFormat.getFullDateFormat().getPattern();
    }

    if ("longDate".equals(patternKey)) {
        return DateTimeFormat.getLongDateFormat().getPattern();
    }

    if ("mediumDate".equals(patternKey)) {
        return DateTimeFormat.getMediumDateFormat().getPattern();
    }

    if ("shortDate".equals(patternKey)) {
        return DateTimeFormat.getShortDateFormat().getPattern();
    }

    // Time only
    if ("fullTime".equals(patternKey)) {
        return DateTimeFormat.getFullTimeFormat().getPattern();
    }

    if ("longTime".equals(patternKey)) {
        return DateTimeFormat.getLongTimeFormat().getPattern();
    }

    if ("mediumTime".equals(patternKey)) {
        return DateTimeFormat.getMediumTimeFormat().getPattern();
    }

    if ("shortTime".equals(patternKey)) {
        return DateTimeFormat.getShortTimeFormat().getPattern();
    }

    throw new IllegalArgumentException("Unknown pattern key '" + patternKey + "'");
}

From source file:java.text.DateFormat.java

License:Apache License

public final static DateFormat getTimeInstance(int style) {
    switch (style) {
    case FULL://w  w w . j av a  2 s .c  om
        return new SimpleDateFormat(DateTimeFormat.getFullTimeFormat());
    case LONG:
        return new SimpleDateFormat(DateTimeFormat.getLongTimeFormat());
    case SHORT:
        return new SimpleDateFormat(DateTimeFormat.getShortTimeFormat());
    default:
        return getTimeInstance();
    }
}

From source file:net.s17fabu.vip.gwt.showcase.client.content.i18n.CwDateTimeFormat.java

License:Apache License

/**
 * Update the selected pattern based on the pattern in the list.
 *//*  ww w .  j ava 2  s  .  c  om*/
private void updatePattern() {
    switch (patternList.getSelectedIndex()) {
    // Date + Time
    case 0:
        activeFormat = DateTimeFormat.getFullDateTimeFormat();
        patternBox.setText(activeFormat.getPattern());
        patternBox.setEnabled(false);
        break;

    case 1:
        activeFormat = DateTimeFormat.getLongDateTimeFormat();
        patternBox.setText(activeFormat.getPattern());
        patternBox.setEnabled(false);
        break;
    case 2:
        activeFormat = DateTimeFormat.getMediumDateTimeFormat();
        patternBox.setText(activeFormat.getPattern());
        patternBox.setEnabled(false);
        break;
    case 3:
        activeFormat = DateTimeFormat.getShortDateTimeFormat();
        patternBox.setText(activeFormat.getPattern());
        patternBox.setEnabled(false);
        break;

    // Date only
    case 4:
        activeFormat = DateTimeFormat.getFullDateFormat();
        patternBox.setText(activeFormat.getPattern());
        patternBox.setEnabled(false);
        break;

    case 5:
        activeFormat = DateTimeFormat.getLongDateFormat();
        patternBox.setText(activeFormat.getPattern());
        patternBox.setEnabled(false);
        break;
    case 6:
        activeFormat = DateTimeFormat.getMediumDateFormat();
        patternBox.setText(activeFormat.getPattern());
        patternBox.setEnabled(false);
        break;
    case 7:
        activeFormat = DateTimeFormat.getShortDateFormat();
        patternBox.setText(activeFormat.getPattern());
        patternBox.setEnabled(false);
        break;

    // Time only
    case 8:
        activeFormat = DateTimeFormat.getFullTimeFormat();
        patternBox.setText(activeFormat.getPattern());
        patternBox.setEnabled(false);
        break;

    case 9:
        activeFormat = DateTimeFormat.getLongTimeFormat();
        patternBox.setText(activeFormat.getPattern());
        patternBox.setEnabled(false);
        break;
    case 10:
        activeFormat = DateTimeFormat.getMediumTimeFormat();
        patternBox.setText(activeFormat.getPattern());
        patternBox.setEnabled(false);
        break;
    case 11:
        activeFormat = DateTimeFormat.getShortTimeFormat();
        patternBox.setText(activeFormat.getPattern());
        patternBox.setEnabled(false);
        break;

    // Custom
    case 12:
        patternBox.setEnabled(true);
        String pattern = patternBox.getText();
        try {
            activeFormat = DateTimeFormat.getFormat(pattern);
        } catch (IllegalArgumentException e) {
            showErrorMessage(constants.cwDateTimeFormatInvalidPattern());
            return;
        }
        break;
    }

    // Update the formatted value
    updateFormattedValue();
}