Java Code Examples for com.google.gwt.i18n.client.DateTimeFormat
The following examples show how to use
com.google.gwt.i18n.client.DateTimeFormat. These examples are extracted from open source projects.
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 Project: EasyML Source File: DBController.java License: Apache License 2.0 | 6 votes |
/** * Get dataset panel show values . * * @param dataset * @param isUpdate * @return Data panel show value array */ public static String[] getDatasetPanelValue(final Dataset dataset, boolean isUpdate) { String[] values = new String[7]; Date dateNow = new Date(); DateTimeFormat dateFormat = DateTimeFormat .getFormat("yyyy-MM-dd KK:mm:ss a"); values[4] = dateFormat.format(dateNow); double version = 0; if ((!dataset.getVersion().contains("n"))&&isUpdate){ version = Double.parseDouble(dataset.getVersion()) + 0.1; }else version = Double.parseDouble(dataset.getVersion()); values[3] = NumberFormat. getFormat("#0.0").format(version); values[1] = null; String TypeString = dataset.getContenttype(); if (TypeString == null || TypeString.equals("") || "General".equals(TypeString)) values[2] = "General/CSV/TSV/JSON"; else if ("TSV".equals(TypeString)) values[2] = "TSV/General/CSV/JSON"; else if ("CSV".equals(TypeString)) values[2] = "CSV/General/TSV/JSON"; else values[2] = "JSON/General/TSV/CSV"; values[0] = dataset.getName(); values[5] = AppController.email; values[6] = dataset.getDescription(); return values; }
Example 2
Source Project: SensorWebClient Source File: Header.java License: GNU General Public License v2.0 | 6 votes |
private Label getCopyrightLink() { DateTimeFormat dateFormatter = DateTimeFormat.getFormat("yyyy"); String year = dateFormatter.format(new Date()); Label copyright = getHeaderLinkLabel("© 52°North, GmbH " + year); copyright.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { String url = "http://www.52north.org"; Window.open(url, "_blank", ""); } }); return copyright; }
Example 3
Source Project: proarc Source File: WorkflowTaskFormView.java License: GNU General Public License v3.0 | 6 votes |
private Object getParameterValue(Record record, ValueType valueType, DisplayType displayType) { Object val = record.getAttributeAsObject(WorkflowParameterDataSource.FIELD_VALUE); if (valueType == ValueType.DATETIME && val instanceof String) { DateTimeFormat format = DateTimeFormat.getFormat(PredefinedFormat.ISO_8601); val = format.parse((String) val); } else if (displayType == DisplayType.CHECKBOX && val instanceof String) { if (Boolean.TRUE.toString().equalsIgnoreCase((String) val)) { val = true; } else if (Boolean.FALSE.toString().equalsIgnoreCase((String) val)) { val = false; } else { try { val = new BigDecimal((String) val).compareTo(BigDecimal.ZERO) > 0; } catch (NumberFormatException e) { // ignore } } } else if (displayType == DisplayType.CHECKBOX && val instanceof Number) { val = ((Number) val).doubleValue() > 0; } return val; }
Example 4
Source Project: proarc Source File: RepeatableFormItem.java License: GNU General Public License v3.0 | 6 votes |
/** * Replace string values of record attributes with types declared by item children. * This is necessary as declarative forms do not use DataSource stuff. * @param record record to scan for attributes * @param item item with possible profile * @return resolved record */ private static Record resolveRecordValues(Record record, FormItem item) { Field f = getProfile(item); if (f != null) { for (Field field : f.getFields()) { String fType = field.getType(); if ("date".equals(fType) || "datetime".equals(fType)) { // parses ISO dateTime to Date; otherwise DateItem cannot recognize the value! Object value = record.getAttributeAsObject(field.getName()); if (!(value instanceof String)) { continue; } String sd = (String) value; // ClientUtils.severe(LOG, "name: %s, is date, %s", field.getName(), sd); // Date d = DateTimeFormat.getFormat(PredefinedFormat.ISO_8601).parse("1994-11-05T13:15:30Z"); try { Date d = DateTimeFormat.getFormat(PredefinedFormat.ISO_8601).parse(sd); record.setAttribute(field.getName(), d); } catch (IllegalArgumentException ex) { LOG.log(Level.WARNING, sd, ex); } } } } return record; }
Example 5
Source Project: gwt-material-addins Source File: DateOfBirthPicker.java License: Apache License 2.0 | 6 votes |
public boolean validateLeapYear(Integer month, Integer day, Integer year) { if (month != null && day != null && year != null) { String dateToValidate = month + 1 + "/" + day + "/" + year; if (dateToValidate == null) { return false; } DateTimeFormat sdf = DateTimeFormat.getFormat("MM/dd/yyyy"); try { Date date = sdf.parse(dateToValidate); if (date.getMonth() != month) { return false; } value = date; } catch (Exception e) { e.printStackTrace(); return false; } return true; } return false; }
Example 6
Source Project: unitime Source File: PeriodPreferencesWidget.java License: Apache License 2.0 | 6 votes |
Cell(int day, int slot, Date date, PeriodInterface period) { super("cell", "item", isEditable() && period != null ? "clickable" : null, period == null ? "disabled" : null, period != null && iModel.isAssigned(period) ? "highlight" : null); iDay = day; iSlot = slot; iDate = date; iPeriod = period; if (period != null) { PreferenceInterface preference = iModel.getPreference(day, slot); if (preference == null) { getElement().getStyle().clearBackgroundColor(); setHTML(""); setTitle(""); } else { getElement().getStyle().setBackgroundColor(preference.getColor()); setTitle(DateTimeFormat.getFormat(CONSTANTS.examPeriodDateFormat()).format(date) + " " + slot2short(slot) + (period == null ? "" : " - " + slot2short(slot + period.getLength())) + ": " + preference.getName()); } if (isEditable()) addMouseDownHandler(new MouseDownHandler() { @Override public void onMouseDown(MouseDownEvent event) { setOption(iPreference); } }); } }
Example 7
Source Project: unitime Source File: PeriodPreferencesWidget.java License: Apache License 2.0 | 6 votes |
private D(int day, int slot, Date date, PeriodInterface period) { super("cell", "day", isEditable() && period != null ? "clickable" : null, period == null ? "unavailable" : null); iDay = day; iSlot = slot; iDate = date; iPeriod = period; setText(DateTimeFormat.getFormat("d").format(date)); if (period != null) { PreferenceInterface preference = iModel.getPreference(day, slot); if (preference == null) { getElement().getStyle().clearBackgroundColor(); setTitle(""); } else { getElement().getStyle().setBackgroundColor(preference.getColor()); setTitle(DateTimeFormat.getFormat(CONSTANTS.examPeriodDateFormat()).format(date) + " " + slot2short(slot) + (period == null ? "" : " - " + slot2short(slot + period.getLength())) + ": " + preference.getName()); } if (isEditable()) addMouseDownHandler(new MouseDownHandler() { @Override public void onMouseDown(MouseDownEvent event) { setOption(iPreference); } }); } }
Example 8
Source Project: unitime Source File: EventRoomAvailability.java License: Apache License 2.0 | 6 votes |
@Override public SessionMonth.Flag getDateFlag(EventType type, Date date) { if (iSessionMonths == null || iSessionMonths.isEmpty()) return null; if (date == null) return null; int m = Integer.parseInt(DateTimeFormat.getFormat("MM").format(date)); for (SessionMonth month: iSessionMonths) if (m == month.getMonth() + 1) { int d = Integer.parseInt(DateTimeFormat.getFormat("dd").format(date)) - 1; if (month.hasFlag(d, SessionMonth.Flag.FINALS) && type != EventType.FinalExam) return SessionMonth.Flag.FINALS; if (month.hasFlag(d, SessionMonth.Flag.BREAK)) return SessionMonth.Flag.BREAK; if (month.hasFlag(d, SessionMonth.Flag.WEEKEND)) return SessionMonth.Flag.WEEKEND; if (month.hasFlag(d, SessionMonth.Flag.HOLIDAY)) return SessionMonth.Flag.HOLIDAY; if (month.hasFlag(d, SessionMonth.Flag.MIDTERMS) && type != EventType.MidtermExam) return SessionMonth.Flag.MIDTERMS; return null; } return null; }
Example 9
Source Project: swellrt Source File: DateUtils.java License: Apache License 2.0 | 6 votes |
/** * Package-private version, takes a fixed "now" time - used for testing */ String formatPastDate(Date date, Date now) { // NOTE(zdwang): For now skip it for junit code; also see formatDateTime() if (!GWT.isClient()) { return "formatPastDate is not yet implemented in unit test code"; } if (!isValid(date, now)) { GWT.log("formatPastDate can only format time in the past, trying anyway", null); } if (isRecent(date, now, 6 * HOUR_MS) || onSameDay(date, now)) { return formatTime(date); } else if (isRecent(date, now, 30 * DAY_MS)) { return getMonthDayFormat().format(date) + " " + formatTime(date); } else if (isSameYear(date, now)) { return getMonthDayFormat().format(date); } else { return DateTimeFormat.getMediumDateFormat().format(date); } }
Example 10
Source Project: document-management-software Source File: I18N.java License: GNU Lesser General Public License v3.0 | 5 votes |
public static void init(GUIInfo info) { setLanguages(info.getSupportedLanguages()); setGuiLanguages(info.getSupportedGUILanguages()); initBundle(info.getBundle()); /* * Prepare the date formatters */ dateFormatShort = DateTimeFormat.getFormat(message("format_dateshort")); dateFormat = DateTimeFormat.getFormat(message("format_date")); }
Example 11
Source Project: gwtbootstrap3-extras Source File: DatePickerBase.java License: Apache License 2.0 | 5 votes |
private void setDateTimeFormat(final String format) { final StringBuilder fb = new StringBuilder(format); for (int i = 0; i < fb.length(); i++) { if (DATE_TIME_FORMAT_MAP.containsKey(fb.charAt(i))) { fb.setCharAt(i, DATE_TIME_FORMAT_MAP.get(fb.charAt(i))); } } this.dateTimeFormat = DateTimeFormat.getFormat(fb.toString()); }
Example 12
Source Project: appinventor-extensions Source File: ShowProgressBarCommand.java License: Apache License 2.0 | 5 votes |
/** * Creates a new command for showing a barcode for the target of a project. * * @param target the build target * @param nextCommand * @param serviceName */ public ShowProgressBarCommand(String target, ChainableCommand nextCommand, String serviceName) { // Since we don't know when the barcode dialog is finished, we can't // support a command after this one. super(nextCommand); // no next command this.target = target; this.nextCommand = nextCommand; this.buildRequestTime = DateTimeFormat.getMediumDateTimeFormat().format(new Date()); this.serviceName = serviceName; }
Example 13
Source Project: appinventor-extensions Source File: CopyYoungAndroidProjectCommand.java License: Apache License 2.0 | 5 votes |
private Widget createPreviousCheckpointsTable(List<Project> checkpointProjects) { Grid table = new Grid(1 + checkpointProjects.size(), 3); table.addStyleName("ode-ProjectTable"); // Set the widgets for the header row. table.getRowFormatter().setStyleName(0, "ode-ProjectHeaderRow"); table.setWidget(0, 0, new Label(MESSAGES.projectNameHeader())); table.setWidget(0, 1, new Label(MESSAGES.projectDateCreatedHeader())); table.setWidget(0, 2, new Label(MESSAGES.projectDateModifiedHeader())); // Set the widgets for the rows representing previous checkpoints DateTimeFormat dateTimeFormat = DateTimeFormat.getMediumDateTimeFormat(); int row = 1; for (Project checkpointProject : checkpointProjects) { table.getRowFormatter().setStyleName(row, "ode-ProjectRowUnHighlighted"); Label nameLabel = new Label(checkpointProject.getProjectName()); table.setWidget(row, 0, nameLabel); Date dateCreated = new Date(checkpointProject.getDateCreated()); table.setWidget(row, 1, new Label(dateTimeFormat.format(dateCreated))); Date dateModified = new Date(checkpointProject.getDateModified()); table.setWidget(row, 2, new Label(dateTimeFormat.format(dateModified))); row++; } return table; }
Example 14
Source Project: appinventor-extensions Source File: ReportList.java License: Apache License 2.0 | 5 votes |
/** * Constructor of ReportWidgets * @param report GalleryAppReport */ private ReportWidgets(final GalleryAppReport report) { reportTextLabel = new Label(report.getReportText()); reportTextLabel.addStyleName("ode-ProjectNameLabel"); reportTextLabel.setWordWrap(true); reportTextLabel.setWidth("200px"); appLabel = new Label(report.getApp().getTitle()); appLabel.addStyleName("primary-link"); DateTimeFormat dateTimeFormat = DateTimeFormat.getMediumDateTimeFormat(); Date dateCreated = new Date(report.getTimeStamp()); dateCreatedLabel = new Label(dateTimeFormat.format(dateCreated)); appAuthorlabel = new Label(report.getOffender().getUserName()); appAuthorlabel.addStyleName("primary-link"); reporterLabel = new Label(report.getReporter().getUserName()); reporterLabel.addStyleName("primary-link"); sendEmailButton = new Button(MESSAGES.buttonSendEmail()); deactiveAppButton = new Button(MESSAGES.labelDeactivateApp()); markAsResolvedButton = new Button(MESSAGES.labelmarkAsResolved()); seeAllActions = new Button(MESSAGES.labelSeeAllActions()); }
Example 15
Source Project: document-management-system Source File: LogScrollTable.java License: GNU General Public License v2.0 | 5 votes |
/** * Adds new user name row * * @param userName The user name value */ public void addRow(GWTActivity activity) { int rows = dataTable.getRowCount(); dataTable.insertRow(rows); dataTable.setHTML(rows, 0, activity.getAction()); dataTable.setHTML(rows, 1, activity.getUser()); DateTimeFormat dtf = DateTimeFormat.getFormat(GeneralComunicator.i18n("general.date.pattern")); dataTable.setHTML(rows, 2, dtf.format(activity.getDate())); dataTable.setHTML(rows, 3, activity.getParams()); dataTable.getCellFormatter().setHorizontalAlignment(rows, 1, HasAlignment.ALIGN_CENTER); dataTable.getCellFormatter().setHorizontalAlignment(rows, 2, HasAlignment.ALIGN_CENTER); }
Example 16
Source Project: putnami-web-toolkit Source File: DateParser.java License: GNU Lesser General Public License v3.0 | 5 votes |
public DateParser(String format) { if (format == null) { this.formater = DateTimeFormat.getFormat(WidgetParams.Util.get().inputDateSimpleFormat()); } else { this.formater = DateTimeFormat.getFormat(format); } }
Example 17
Source Project: SensorWebClient Source File: Toaster.java License: GNU General Public License v2.0 | 5 votes |
public void addErrorMessage(String error) { Date d = new Date(); String timeStamp = DateTimeFormat.getFormat("dd.MM.yyyy HH:mm").format(d); Label l = new Label(timeStamp + " " + error); l.setCanSelectText(true); l.setStyleName("n52_sensorweb_client_toasterErrorMsg"); l.setAutoHeight(); for (int i = 0; i < this.messages.size(); i++) { this.layout.removeMember(this.messages.get(i)); } this.messages.add(l); for (int i = this.messages.size() - 1; i >= 0; i--) { this.layout.addMember(this.messages.get(i)); } this.left = this.toasterWindow.getParentElement().getWidth().intValue() - this.width - 10; this.top = this.toasterWindow.getParentElement().getHeight().intValue() - this.height - 30; this.toasterWindow.setLeft(this.left); this.toasterWindow.setTop(this.top); animateToaster(); }
Example 18
Source Project: SensorWebClient Source File: DataControlsTimeSeries.java License: GNU General Public License v2.0 | 5 votes |
protected void resetDatePicker() { this.fromDateItem.setValue(new Date(TimeManager.getInst().getBegin())); this.toDateItem.setValue(new Date(TimeManager.getInst().getEnd())); String beg = DateTimeFormat.getFormat("HH:mm").format(new Date(TimeManager.getInst().getBegin())); String en = DateTimeFormat.getFormat("HH:mm").format(new Date(TimeManager.getInst().getEnd())); this.fromTimeItem.setValue(beg); this.toTimeItem.setValue(en); }
Example 19
Source Project: SensorWebClient Source File: Application.java License: GNU General Public License v2.0 | 5 votes |
private static void fireNewTimeRangeEvent(TimeRange timeRange) { try { DateTimeFormat formatter = DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.ISO_8601); long begin = formatter.parseStrict(timeRange.getStart()).getTime(); long end = formatter.parseStrict(timeRange.getEnd()).getTime(); Toaster.getToasterInstance().addMessage("Begin: " + timeRange.getStart()); Toaster.getToasterInstance().addMessage("End: " + timeRange.getEnd()); EventBus.getMainEventBus().fireEvent(new DatesChangedEvent(begin, end, true)); } catch (Exception e) { if ( !GWT.isProdMode()) { GWT.log("Unparsable TimeRange: " + timeRange, e); } } }
Example 20
Source Project: document-management-system Source File: ExtendedScrollTable.java License: GNU General Public License v2.0 | 5 votes |
/** * Refresh proposed query row * * @param propose */ private void refreshProposedQueryRow(final GWTProposedQueryReceived propose, int row) { boolean seen = (propose.getSeenDate() == null); // Sets folder object data.put(new Integer(dataTable.getHTML(row, 5)), propose); if (propose.isAccepted()) { dataTable.setWidget(row, 0, new Image(OKMBundleResources.INSTANCE.yes())); } else { dataTable.setHTML(row, 0, ""); } dataTable.setHTML(row, 1, UtilComunicator.getTextAsBoldHTML(propose.getFrom(), seen)); String queryType = ""; if (!propose.getParams().isDashboard()) { queryType = GeneralComunicator.i18nExtension("messaging.message.type.propose.query"); } else { queryType = GeneralComunicator.i18nExtension("messaging.message.type.propose.user.query"); } dataTable.setHTML(row, 2, UtilComunicator.getTextAsBoldHTML(queryType, seen)); DateTimeFormat dtf = DateTimeFormat.getFormat(GeneralComunicator.i18nExtension("general.date.pattern")); dataTable.setHTML(row, 3, UtilComunicator.getTextAsBoldHTML(dtf.format(propose.getSentDate()), seen)); Anchor anchor = new Anchor(); String queryName = propose.getParams().getQueryName(); anchor.setHTML(UtilComunicator.getTextAsBoldHTML(queryName, seen)); anchor.setTitle(queryName); anchor.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent arg0) { WorkspaceComunicator.changeSelectedTab(UIDockPanelConstants.SEARCH); SearchComunicator.setSavedSearch(propose.getParams()); } }); anchor.setStyleName("okm-KeyMap-ImageHover"); dataTable.setWidget(row, 4, anchor); }
Example 21
Source Project: document-management-system Source File: ExtendedScrollTable.java License: GNU General Public License v2.0 | 5 votes |
/** * Adding addMessageSentRow * * @param messageSent */ private void addMessageSentRow(final GWTTextMessageSent messageSent) { int rows = dataTable.getRowCount(); dataTable.insertRow(rows); // Sets folder object data.put(new Integer(dataIndexValue), messageSent); dataTable.setHTML(rows, 0, ""); dataTable.setHTML(rows, 1, messageSent.getTo()); dataTable.setHTML(rows, 2, GeneralComunicator.i18nExtension("messaging.message.type.message.sent")); DateTimeFormat dtf = DateTimeFormat.getFormat(GeneralComunicator.i18nExtension("general.date.pattern")); dataTable.setHTML(rows, 3, dtf.format(messageSent.getSentDate())); dataTable.setHTML(rows, 4, messageSent.getSubject()); dataTable.setHTML(rows, 5, "" + (dataIndexValue++)); // Format dataTable.getCellFormatter().setHorizontalAlignment(rows, 0, HasHorizontalAlignment.ALIGN_CENTER); dataTable.getCellFormatter().setHorizontalAlignment(rows, 1, HasHorizontalAlignment.ALIGN_LEFT); dataTable.getCellFormatter().setHorizontalAlignment(rows, 2, HasHorizontalAlignment.ALIGN_LEFT); dataTable.getCellFormatter().setHorizontalAlignment(rows, 3, HasHorizontalAlignment.ALIGN_CENTER); dataTable.getCellFormatter().setHorizontalAlignment(rows, 4, HasHorizontalAlignment.ALIGN_LEFT); dataTable.getCellFormatter().setVisible(rows, 5, false); for (int i = 0; i < 5; i++) { dataTable.getCellFormatter().addStyleName(rows, i, "okm-DisableSelect"); } }
Example 22
Source Project: document-management-system Source File: ExtendedScrollTable.java License: GNU General Public License v2.0 | 5 votes |
/** * Adding addMessageReceivedRow * * @param messageReceived */ private void addMessageReceivedRow(final GWTMessageReceived messageReceived) { int rows = dataTable.getRowCount(); boolean seen = (messageReceived.getSeenDate() == null); dataTable.insertRow(rows); // Sets folder object data.put(new Integer(dataIndexValue), messageReceived); dataTable.setHTML(rows, 0, ""); dataTable.setHTML(rows, 1, UtilComunicator.getTextAsBoldHTML(messageReceived.getFrom(), seen)); dataTable.setHTML( rows, 2, UtilComunicator.getTextAsBoldHTML( GeneralComunicator.i18nExtension("messaging.message.type.message.sent"), seen)); DateTimeFormat dtf = DateTimeFormat.getFormat(GeneralComunicator.i18nExtension("general.date.pattern")); dataTable.setHTML(rows, 3, UtilComunicator.getTextAsBoldHTML(dtf.format(messageReceived.getSentDate()), seen)); dataTable.setHTML(rows, 4, UtilComunicator.getTextAsBoldHTML(messageReceived.getSubject(), seen)); dataTable.setHTML(rows, 5, "" + (dataIndexValue++)); // Format dataTable.getCellFormatter().setHorizontalAlignment(rows, 0, HasHorizontalAlignment.ALIGN_CENTER); dataTable.getCellFormatter().setHorizontalAlignment(rows, 1, HasHorizontalAlignment.ALIGN_LEFT); dataTable.getCellFormatter().setHorizontalAlignment(rows, 2, HasHorizontalAlignment.ALIGN_LEFT); dataTable.getCellFormatter().setHorizontalAlignment(rows, 3, HasHorizontalAlignment.ALIGN_CENTER); dataTable.getCellFormatter().setHorizontalAlignment(rows, 4, HasHorizontalAlignment.ALIGN_LEFT); dataTable.getCellFormatter().setVisible(rows, 5, false); for (int i = 0; i < 5; i++) { dataTable.getCellFormatter().addStyleName(rows, i, "okm-DisableSelect"); } }
Example 23
Source Project: document-management-system Source File: ProposedSubscriptionSentDetail.java License: GNU General Public License v2.0 | 5 votes |
/** * set * * @param propose */ public void set(final GWTProposedSubscriptionSent propose) { this.propose = propose; from.setHTML(propose.getFrom()); to.setHTML(propose.getTo()); if (propose.getType().equals(GWTFolder.TYPE)) { docType.setHTML(GeneralComunicator.i18nExtension("messaging.message.type.propose.folder")); table.setHTML(2, 0, "<b>" + GeneralComunicator.i18nExtension("messaging.detail.folder") + "</b>"); } else { docType.setHTML(GeneralComunicator.i18nExtension("messaging.message.type.propose.document")); table.setHTML(2, 0, "<b>" + GeneralComunicator.i18nExtension("messaging.detail.document") + "</b>"); } DateTimeFormat dtf = DateTimeFormat.getFormat(GeneralComunicator.i18nExtension("general.date.pattern")); date.setHTML(dtf.format(propose.getSentDate())); String path = propose.getPath().substring(propose.getPath().lastIndexOf("/") + 1); anchor.setHTML(path); anchor.setTitle(propose.getPath()); anchor.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent arg0) { if (propose.getType().equals(GWTFolder.TYPE)) { GeneralComunicator.openPath(propose.getPath(), null); } else if (propose.getType().equals(GWTDocument.TYPE)) { String fldPath = propose.getPath().substring(0, propose.getPath().lastIndexOf("/")); GeneralComunicator.openPath(fldPath, propose.getPath()); } } }); content.setHTML(propose.getComment().replaceAll("\n", "</br>")); }
Example 24
Source Project: gwt-traction Source File: UTCTimeBoxImplShared.java License: Apache License 2.0 | 5 votes |
/** * Formats the value provided with the specified DateTimeFormat */ protected static final String formatUsingFormat(Long value, DateTimeFormat fmt) { if (value == null) { return ""; } else { // midnight GMT Date date = new Date(0); // offset by timezone and value date.setTime(UTCDateBox.timezoneOffsetMillis(date) + value.longValue()); // format it return fmt.format(date); } }
Example 25
Source Project: document-management-system Source File: ProposedQuerySentDetail.java License: GNU General Public License v2.0 | 5 votes |
/** * set * * @param propose */ public void set(final GWTProposedQuerySent propose) { from.setHTML(propose.getFrom()); to.setHTML(propose.getTo()); String queryType = ""; if (!propose.getParams().isDashboard()) { queryType = GeneralComunicator.i18nExtension("messaging.message.type.propose.query"); } else { queryType = GeneralComunicator.i18nExtension("messaging.message.type.propose.user.query"); } docType.setHTML(queryType); table.setHTML(2, 0, "<b>" + GeneralComunicator.i18nExtension("messaging.detail.query") + "</b>"); DateTimeFormat dtf = DateTimeFormat.getFormat(GeneralComunicator.i18nExtension("general.date.pattern")); date.setHTML(dtf.format(propose.getSentDate())); Anchor anchor = new Anchor(); String queryName = propose.getParams().getQueryName(); anchor.setHTML(queryName); anchor.setTitle(queryName); anchor.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent arg0) { WorkspaceComunicator.changeSelectedTab(UIDockPanelConstants.SEARCH); SearchComunicator.setSavedSearch(propose.getParams()); } }); anchor.setStyleName("okm-KeyMap-ImageHover"); Image runImage = new Image(OKMBundleResources.INSTANCE.run()); HorizontalPanel hPanel = new HorizontalPanel(); hPanel.add(runImage); hPanel.add(anchor); hPanel.setCellVerticalAlignment(anchor, HasAlignment.ALIGN_MIDDLE); table.setWidget(2, 1, hPanel); content.setHTML(propose.getComment().replaceAll("\n", "</br>")); }
Example 26
Source Project: document-management-system Source File: MessageReceivedDetail.java License: GNU General Public License v2.0 | 5 votes |
/** * set * * @param messageReceived */ public void set(final GWTMessageReceived messageReceived) { from.setHTML(messageReceived.getFrom()); to.setHTML(messageReceived.getTo()); docType.setHTML(GeneralComunicator.i18nExtension("messaging.message.type.message.sent")); DateTimeFormat dtf = DateTimeFormat.getFormat(GeneralComunicator.i18nExtension("general.date.pattern")); date.setHTML(dtf.format(messageReceived.getSentDate())); table.setHTML(2, 1, messageReceived.getSubject()); content.setHTML(messageReceived.getContent().replaceAll("\n", "</br>")); }
Example 27
Source Project: incubator-retired-wave Source File: DateUtils.java License: Apache License 2.0 | 5 votes |
/** * Formats the specified time as a String. */ public String formatTime(Date date) { // NOTE(zdwang): For now skip it for junit code; also see formatPastDate() if (!GWT.isClient()) { return "formatDateTime is not yet implemented in unit test code"; } // AM/PM -> am/pm for consistency with formatPastDate() return DateTimeFormat.getShortTimeFormat().format(date).toLowerCase(); }
Example 28
Source Project: document-management-system Source File: ISO8601.java License: GNU General Public License v2.0 | 5 votes |
/** * Format date with format "YYYY-MM-DDThh:mm:ss.SSSTZD" */ public static String formatExtended(Date value) { if (value == null) { return null; } else { DateTimeFormat dtf = DateTimeFormat.getFormat(PredefinedFormat.ISO_8601); return dtf.format(value); } }
Example 29
Source Project: document-management-system Source File: ISO8601.java License: GNU General Public License v2.0 | 5 votes |
/** * Parse string date in format "yyyyMMddHHmmss" */ public static Date parseBasic(String value) { if (value == null) { return null; } else { DateTimeFormat dtf = DateTimeFormat.getFormat(BASIC_PATTER); return dtf.parse(value); } }
Example 30
Source Project: document-management-system Source File: ISO8601.java License: GNU General Public License v2.0 | 5 votes |
/** * Format date with format "yyyyMMddHHmmss" */ public static String formatBasic(Date value) { if (value == null) { return null; } else { DateTimeFormat dtf = DateTimeFormat.getFormat(BASIC_PATTER); return dtf.format(value); } }