List of usage examples for com.google.gwt.i18n.client DateTimeFormat getLongDateTimeFormat
@Deprecated public static DateTimeFormat getLongDateTimeFormat()
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(); }//from w w w. j a va2 s. c o m 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 getDateTimeInstance(int dateStyle, int timeStyle) { if (dateStyle != timeStyle) { throw new IllegalArgumentException( "Unsupported combinaison of dateStyle & timeStyle : " + dateStyle + "-" + timeStyle); }/*w w w .j ava2s.c o m*/ switch (dateStyle) { case FULL: return new SimpleDateFormat(DateTimeFormat.getFullDateTimeFormat()); case LONG: return new SimpleDateFormat(DateTimeFormat.getLongDateTimeFormat()); case SHORT: return new SimpleDateFormat(DateTimeFormat.getShortDateTimeFormat()); default: return getDateTimeInstance(); } }
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. *//*from w ww . j a va 2 s. com*/ 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(); }