com.google.gwt.i18n.shared.DateTimeFormat Java Examples
The following examples show how to use
com.google.gwt.i18n.shared.DateTimeFormat.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MaterialTimePicker.java From gwt-material-addins with Apache License 2.0 | 6 votes |
/** * Called after the lolliclock event <code>afterHide</code>. */ protected void afterHide() { String timeString = getTime(); Date parsedDate = null; if (timeString != null && !timeString.equals("")) { try { parsedDate = DateTimeFormat.getFormat(options.hour24 ? "HH:mm" : "hh:mm aa").parse(timeString); } catch (IllegalArgumentException e) { // Silently catch parse errors } } setValue(parsedDate, true); // Remove class 'valid' after hide. getValidMixin().setOn(false); CloseEvent.fire(this, this.time); fireEvent(new BlurEvent() {}); }
Example #2
Source File: Contact.java From errai-tutorial with Apache License 2.0 | 6 votes |
@Override public String toString() { final StringBuilder builder = new StringBuilder(); builder.append("[Contact: id=") .append(id) .append(", nickname=") .append(nickname) .append(", fullname=") .append(fullname) .append(", phonenumber=") .append(phonenumber) .append(", email=") .append(email) .append(", birthday=") .append(DateTimeFormat.getFormat(PredefinedFormat.ISO_8601).format(birthday).substring(0, 10)) .append(", notes=\"") .append(notes.substring(0, 20) + (notes.length() > 20 ? "..." : "")); return builder.toString(); }
Example #3
Source File: CubaTimeFieldWidget.java From cuba with Apache License 2.0 | 6 votes |
protected boolean isValueParsable(String time) { if (nullRepresentation.equals(time)) { return true; } if (timeFormat == null || timeFormat.isEmpty()) { // let server side to parse return true; } DateTimeFormat dateTimeFormat = DateTimeFormat.getFormat(timeFormat); try { dateTimeFormat.parseStrict(time); return true; } catch (Exception e) { return false; } }
Example #4
Source File: MaterialTimePicker.java From gwt-material-addins with Apache License 2.0 | 5 votes |
@Override public void setValue(Date time, boolean fireEvents) { this.time = time; if (this.time == null) { return; } label.removeStyleName(CssName.ACTIVE); label.addStyleName(CssName.ACTIVE); $(timeInput.getElement()).val(DateTimeFormat.getFormat(options.hour24 ? "HH:mm" : "hh:mm aa").format(time)); super.setValue(time, fireEvents); }
Example #5
Source File: TimelineWidget.java From gantt with Apache License 2.0 | 5 votes |
private long adjustToMiddleOfDay(long zonedDate) { DateTimeFormat hourFormat = DateTimeFormat.getFormat("HH"); String hourStr = hourFormat.format(new Date(zonedDate), getLocaleDataProvider().getTimeZone()); int h = Integer.parseInt(hourStr); int addHours = 12 - h; return zonedDate + (addHours * HOUR_INTERVAL); }
Example #6
Source File: WordCloudLatestApp.java From swcv with MIT License | 4 votes |
private Grid createTable(List<WordCloud> clouds, boolean debug) { Grid table = new Grid(clouds.size() + 1, debug ? 4 : 3); table.addStyleName("latest"); CellFormatter cf = table.getCellFormatter(); table.setHTML(0, 0, "<b>id</b>"); table.setHTML(0, 1, "<b>creation date</b>"); table.setHTML(0, 2, "<b>source</b>"); cf.setWidth(0, 0, "10%"); cf.setWidth(0, 1, "25%"); cf.setWidth(0, 2, "65%"); cf.setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER); cf.setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_CENTER); cf.setHorizontalAlignment(0, 2, HasHorizontalAlignment.ALIGN_CENTER); if (debug) { table.setHTML(0, 3, "<b>ip</b>"); cf.setWidth(0, 1, "20%"); cf.setWidth(0, 2, "60%"); cf.setWidth(0, 3, "10%"); cf.setHorizontalAlignment(0, 3, HasHorizontalAlignment.ALIGN_CENTER); } for (int i = 0; i < clouds.size(); i++) { WordCloud cloud = clouds.get(i); table.setHTML(i + 1, 0, "<a href='/cloud.html?id=" + cloud.getId() + "'>" + cloud.getId() + "</a>"); Date dt = cloud.getCreationDateAsDate(); table.setHTML(i + 1, 1, DateTimeFormat.getFormat("yyyy-MM-dd HH:mm:ss").format(dt)); table.setWidget(i + 1, 2, createSourceField(cloud, debug)); cf.setHorizontalAlignment(i + 1, 2, HasHorizontalAlignment.ALIGN_LEFT); if (debug) { table.setHTML(i + 1, 3, cloud.getCreatorIP()); } } return table; }
Example #7
Source File: LocaleDataProvider.java From gantt with Apache License 2.0 | 4 votes |
/** Format zoned date. */ String formatDate(Date zonedDate, DateTimeFormat formatter);
Example #8
Source File: GanttConnector.java From gantt with Apache License 2.0 | 4 votes |
@Override public String formatDate(Date zonedDate, DateTimeFormat formatter) { return formatter.format(zonedDate, getTimeZone()); }
Example #9
Source File: TimelineWidget.java From gantt with Apache License 2.0 | 4 votes |
public DateTimeFormat getYearDateTimeFormat() { if (yearDateTimeFormat == null) { yearDateTimeFormat = DateTimeFormat.getFormat("yyyy"); } return yearDateTimeFormat; }
Example #10
Source File: TimelineWidget.java From gantt with Apache License 2.0 | 4 votes |
public DateTimeFormat getMonthDateTimeFormat() { if (monthDateTimeFormat == null) { monthDateTimeFormat = DateTimeFormat.getFormat("M"); } return monthDateTimeFormat; }
Example #11
Source File: TimelineWidget.java From gantt with Apache License 2.0 | 4 votes |
public DateTimeFormat getWeekDateTimeFormat() { if (weekDateTimeFormat == null) { weekDateTimeFormat = DateTimeFormat.getFormat("d"); } return weekDateTimeFormat; }
Example #12
Source File: TimelineWidget.java From gantt with Apache License 2.0 | 4 votes |
public DateTimeFormat getDayDateTimeFormat() { if (dayDateTimeFormat == null) { dayDateTimeFormat = DateTimeFormat.getFormat("d"); } return dayDateTimeFormat; }
Example #13
Source File: TimelineWidget.java From gantt with Apache License 2.0 | 4 votes |
public DateTimeFormat getHour12DateTimeFormat() { if (hour12DateTimeFormat == null) { hour12DateTimeFormat = DateTimeFormat.getFormat("h"); } return hour12DateTimeFormat; }
Example #14
Source File: TimelineWidget.java From gantt with Apache License 2.0 | 4 votes |
public DateTimeFormat getHour24DateTimeFormat() { if (hour24DateTimeFormat == null) { hour24DateTimeFormat = DateTimeFormat.getFormat("HH"); } return hour24DateTimeFormat; }
Example #15
Source File: TimelineWidget.java From gantt with Apache License 2.0 | 4 votes |
public DateTimeFormat getCustomHourDateTimeFormat() { if (customHourDateTimeFormat == null) { customHourDateTimeFormat = DateTimeFormat.getFormat(hourFormat); } return customHourDateTimeFormat; }
Example #16
Source File: TimelineWidget.java From gantt with Apache License 2.0 | 4 votes |
public void setHour24DateTimeFormat(DateTimeFormat hour24DateTimeFormat) { this.hour24DateTimeFormat = hour24DateTimeFormat; }
Example #17
Source File: TimelineWidget.java From gantt with Apache License 2.0 | 4 votes |
public void setHour12DateTimeFormat(DateTimeFormat hour12DateTimeFormat) { this.hour12DateTimeFormat = hour12DateTimeFormat; }