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

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

Introduction

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

Prototype

@Deprecated
public static DateTimeFormat getFullDateFormat() 

Source Link

Document

Retrieve the DateTimeFormat object for full date format.

Usage

From source file:com.google.code.p.gwtcsample.client.GWTCSample.java

License:Apache License

public void testIntervalSelector(GWTCBox box) {
    box.setTitle("GWTCIntervalSelector");

    HashMap<String, String> strs = new HashMap<String, String>();
    strs.putAll(intervalStrs);/*from  w  w w .j a v a2  s.co m*/
    strs.putAll(pickerTitleStrs);

    for (int i : new int[] { 6, 5, 4, 3, 2, 1 }) {
        GWTCIntervalSelector interval = new GWTCIntervalSelector(i);
        interval.setI18nMessages(strs);
        box.add(createPanelWithDescription(interval, i18n.descr_interval_layout() + " " + i), DockPanel.SOUTH);
    }

    final GWTCWeekSelector weekInterval = new GWTCWeekSelector();
    weekInterval.setMinimalDate("-4y");
    weekInterval.setMaximalDate("-4y");
    strs.putAll(pickerStrs);
    strs.put("key.calendar.checkin.title", i18n.select_week_caption());
    strs.put("key.from", i18n.week_from());
    strs.put("key.to", i18n.week_to());
    strs.put("key.select.week", i18n.select_week());
    weekInterval.setI18nMessages(strs);
    box.add(createPanelWithDescription(weekInterval, i18n.descr_week_interval_custom()), DockPanel.NORTH);

    final GWTCIntervalSelector intervalCustomized = new CustomIntervalSelector();
    intervalCustomized.setDateFormat(DateTimeFormat.getShortDateFormat().getPattern().replace("yy", "yyyy"));
    intervalCustomized.setMaxdays(31);
    strs.putAll(pickerNavigationStrs);
    final Button customizedButton = new GWTCButton(i18n.click_button(), new ClickHandler() {
        public void onClick(ClickEvent event) {
            String ci = GWTCSimpleDatePicker.formatDate(DateTimeFormat.getFullDateFormat().getPattern(),
                    intervalCustomized.getInitDate());
            String co = GWTCSimpleDatePicker.formatDate(DateTimeFormat.getFullDateFormat().getPattern(),
                    intervalCustomized.getEndDate());
            alert.alert(ci + "\n" + co + "\n" + intervalCustomized.getNights());
        }

    });
    intervalCustomized.getGrid().setWidget(1, 3, customizedButton);
    customizedButton.setVisible(false);
    intervalCustomized.addValueChangeHandler(new ValueChangeHandler<GWTCIntervalSelector>() {
        public void onValueChange(ValueChangeEvent<GWTCIntervalSelector> event) {
            customizedButton.setVisible(true);
        }
    });
    intervalCustomized.setI18nMessages(strs);
    box.add(createPanelWithDescription(intervalCustomized, i18n.descr_interval_custom()), DockPanel.NORTH);

}

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  ww. ja va 2s .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:com.radoslavhusar.tapas.war.client.ui.NullableDatePickerCell.java

License:Apache License

/**
 * Constructs a new DatePickerCell that uses the date/time format given by
 * {@link DateTimeFormat#getFullDateFormat}.
 *///from  w ww  .ja va  2s  .com
@SuppressWarnings("deprecation")
public NullableDatePickerCell() {
    this(DateTimeFormat.getFullDateFormat(), SimpleSafeHtmlRenderer.getInstance());
}

From source file:eu.oobikwe.gwt.ui.FixedDatePickerCell.java

License:Apache License

/**
 * Constructs a new DatePickerCell that uses the date/time format given by
 * {@link DateTimeFormat#getFullDateFormat}.
 *//*  w ww.j ava  2s  .  com*/
@SuppressWarnings("deprecation")
public FixedDatePickerCell() {
    this(DateTimeFormat.getFullDateFormat(), SimpleSafeHtmlRenderer.getInstance());
}

From source file:java.text.DateFormat.java

License:Apache License

public final static DateFormat getDateInstance(int style) {
    switch (style) {
    case FULL:/*from ww w .j  a  va  2s  .  co m*/
        return new SimpleDateFormat(DateTimeFormat.getFullDateFormat());
    case LONG:
        return new SimpleDateFormat(DateTimeFormat.getLongDateFormat());
    case SHORT:
        return new SimpleDateFormat(DateTimeFormat.getShortDateFormat());
    default:
        return getDateInstance();
    }
}

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  av a  2 s.  c  o  m
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();
}

From source file:org.wannatrak.client.FilterWidget.java

License:Apache License

public FilterWidget(Mediator mediator) {
    this.mediator = mediator;
    mediator.setFilterWidget(this);

    setSpacing(7);//from   w ww . j a va  2  s.  co  m

    final StringConstants stringConstants = StringConstants.StringConstantsSingleton.getInstance();
    final Label label = new Label(stringConstants.timeInterval());
    label.setStylePrimaryName("filterHeader");

    final ChangeHandler changeHandler = new ChangeHandler() {
        public void onChange(ChangeEvent event) {

            FilterWidget.this.mediator.showSubjects();
        }
    };

    final Label from = new Label(stringConstants.fromTimeInterval());
    from.setStylePrimaryName("filterLabel");

    fromDayListBox = createDayListBox();
    fromDayListBox.setItemSelected(0, true);

    final DateBox fromDateBox = new DateBox();
    fromDateBox.addValueChangeHandler(new ListBoxValueChangeHandler(fromDateBox, fromDayListBox));
    fromDateBox.setWidth("15em");
    fromDateBox.setFormat(new DateBox.DefaultFormat(DateTimeFormat.getFullDateFormat()));
    fromDateBox.getDatePicker().setWidth("12.5em");
    fromDateBox.setValue(new Date());

    final ListBoxChangeHandler fromListBoxChangeHandler = new ListBoxChangeHandler(fromDateBox, fromDayListBox);
    fromDayListBox.addChangeHandler(fromListBoxChangeHandler);

    fromHourListBox = createHourListBox();
    fromHourListBox.addChangeHandler(changeHandler);
    fromHourListBox.setItemSelected(0, true);

    fromMinuteListBox = createMinuteListBox();
    fromMinuteListBox.addChangeHandler(changeHandler);
    fromMinuteListBox.setItemSelected(0, true);

    final Label to = new Label(stringConstants.toTimeInterval());
    to.setStylePrimaryName("filterLabel");

    toDayListBox = createDayListBox();
    toDayListBox.setItemSelected(0, true);

    final DateBox toDateBox = new DateBox();
    toDateBox.setWidth("15em");
    toDateBox.setFormat(new DateBox.DefaultFormat(DateTimeFormat.getFullDateFormat()));
    toDateBox.getDatePicker().setWidth("12.5em");
    toDateBox.setValue(new Date());
    toDateBox.addValueChangeHandler(new ListBoxValueChangeHandler(toDateBox, toDayListBox));

    final ListBoxChangeHandler toListBoxChangeHandler = new ListBoxChangeHandler(toDateBox, toDayListBox);
    toDayListBox.addChangeHandler(toListBoxChangeHandler);

    toHourListBox = createHourListBox();
    toHourListBox.addChangeHandler(changeHandler);
    toHourListBox.setItemSelected(23, true);

    toMinuteListBox = createMinuteListBox();
    toMinuteListBox.addChangeHandler(changeHandler);
    toMinuteListBox.setItemSelected(59, true);

    final Grid grid = new Grid(2, 5);
    grid.setCellPadding(7);
    grid.setCellSpacing(7);

    grid.setWidget(0, 0, from);
    grid.setWidget(0, 1, fromDateBox);
    grid.setWidget(0, 2, fromDayListBox);
    grid.setWidget(0, 3, fromHourListBox);
    grid.setWidget(0, 4, fromMinuteListBox);

    grid.setWidget(1, 0, to);
    grid.setWidget(1, 1, toDateBox);
    grid.setWidget(1, 2, toDayListBox);
    grid.setWidget(1, 3, toHourListBox);
    grid.setWidget(1, 4, toMinuteListBox);

    showErrorsCheckBox = new CheckBox("&nbsp;" + stringConstants.showWithErrors(), true);
    showErrorsCheckBox.setStylePrimaryName("filterLabel");
    showErrorsCheckBox.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            FilterWidget.this.mediator.showSubjects();
        }
    });

    add(label);
    add(grid);
    add(showErrorsCheckBox);
}