本文整理匯總了Java中com.google.gwt.i18n.client.DateTimeFormat.getFormat方法的典型用法代碼示例。如果您正苦於以下問題:Java DateTimeFormat.getFormat方法的具體用法?Java DateTimeFormat.getFormat怎麽用?Java DateTimeFormat.getFormat使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.gwt.i18n.client.DateTimeFormat
的用法示例。
在下文中一共展示了DateTimeFormat.getFormat方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getDatasetPanelValue
import com.google.gwt.i18n.client.DateTimeFormat; //導入方法依賴的package包/類
/**
* 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 ("General".equals(TypeString)) values[2] = "General/TSV/CSV";
if ("TSV".equals(TypeString)) values[2] = "TSV/General/TSV";
if ("CSV".equals(TypeString)) values[2] = "CSV/General/TSV";
else values[2] = "General/TSV/CSV";
values[0] = dataset.getName();
values[5] = AppController.email;
values[6] = dataset.getDescription();
return values;
}
示例2: writeComment
import com.google.gwt.i18n.client.DateTimeFormat; //導入方法依賴的package包/類
/**
* Writes the note
*/
private void writeComment(GWTWorkflowComment comment) {
int row = tableNotes.getRowCount();
tableNotes.setHTML(row, 0, "<b>" + comment.getActorId() + "</b>");
DateTimeFormat dtf = DateTimeFormat.getFormat(Main.i18n("general.date.pattern"));
tableNotes.setHTML(row, 1, dtf.format(comment.getTime()));
tableNotes.getCellFormatter().setHorizontalAlignment(row, 1, HasAlignment.ALIGN_RIGHT);
tableNotes.getRowFormatter().setStyleName(row, "okm-Notes-Title");
tableNotes.getCellFormatter().setHeight(row, 1, "30px");
tableNotes.getCellFormatter().setVerticalAlignment(row, 0, HasAlignment.ALIGN_BOTTOM);
tableNotes.getCellFormatter().setVerticalAlignment(row, 1, HasAlignment.ALIGN_BOTTOM);
row++;
tableNotes.setHTML(row, 0, "");
tableNotes.getCellFormatter().setHeight(row, 0, "6px");
tableNotes.getRowFormatter().setStyleName(row, "okm-Notes-Line");
tableNotes.getFlexCellFormatter().setColSpan(row, 0, 2);
row++;
tableNotes.setHTML(row, 0, comment.getMessage());
tableNotes.getFlexCellFormatter().setColSpan(row, 0, 2);
}
示例3: refreshMessageReceivedRow
import com.google.gwt.i18n.client.DateTimeFormat; //導入方法依賴的package包/類
/**
* Refresh message received row
*
* @param messageReceived
*/
private void refreshMessageReceivedRow(final GWTMessageReceived messageReceived, int row) {
boolean seen = (messageReceived.getSeenDate() == null);
// Sets folder object
data.put(new Integer(dataTable.getHTML(row, 5)), messageReceived);
dataTable.setHTML(row, 0, "");
dataTable.setHTML(row, 1, UtilComunicator.getTextAsBoldHTML(messageReceived.getFrom(), seen));
dataTable.setHTML(
row,
2,
UtilComunicator.getTextAsBoldHTML(
GeneralComunicator.i18nExtension("messaging.message.type.message.sent"), seen));
DateTimeFormat dtf = DateTimeFormat.getFormat(GeneralComunicator.i18nExtension("general.date.pattern"));
dataTable.setHTML(row, 3, UtilComunicator.getTextAsBoldHTML(dtf.format(messageReceived.getSentDate()), seen));
dataTable.setHTML(row, 4, UtilComunicator.getTextAsBoldHTML(messageReceived.getSubject(), seen));
}
示例4: buildUrl
import com.google.gwt.i18n.client.DateTimeFormat; //導入方法依賴的package包/類
private void buildUrl() {
UrlBuilder urlBuilder = Window.Location.createUrlBuilder();
PlanRequestBean planRequest = getPlanRequestBean();
if (planRequest.getDeparture().isSet(false))
urlBuilder.setParameter("origin",
getLocationAsStringParam(planRequest.getDeparture()));
if (planRequest.getArrival().isSet(false))
urlBuilder.setParameter("destination",
getLocationAsStringParam(planRequest.getArrival()));
DateTimeFormat dtf = DateTimeFormat.getFormat("yyyy/MM/[email protected]:mm");
urlBuilder.setParameter(
planRequest.isDateDeparture() ? "depart" : "arrive",
dtf.format(planRequest.getDate()));
if (planRequest.isWheelchairAccessible())
urlBuilder.setParameter("wheelchair", "y");
Set<TransportMode> modes = planRequest.getModes();
String modesStr = "";
for (TransportMode mode : modes) {
modesStr = modesStr + mode.toString() + ",";
}
modesStr = modesStr.substring(0, modesStr.length() - 1);
urlBuilder.setParameter("modes", modesStr);
url = urlBuilder.buildString();
}
示例5: testSetFormat
import com.google.gwt.i18n.client.DateTimeFormat; //導入方法依賴的package包/類
@Test
public void testSetFormat() {
datePicker = new DatePicker(datePickerMock);
String gwtDateFormat = "dd-MMM-yyyy";
DateTimeFormat gwtDateTimeFormat = DateTimeFormat.getFormat(gwtDateFormat);
datePicker.setLocaleName("en");
datePicker.setFormat(gwtDateFormat);
verify(datePickerMock).setLanguage(DatePickerLanguage.EN);
verify(datePickerMock).setFormat(DatePickerFormatUtilities.convertToBS3DateFormat(gwtDateFormat));
Date now = new Date();
now = gwtDateTimeFormat.parse(gwtDateTimeFormat.format(now));
datePicker.setValue(now);
verify(textBox).setValue(gwtDateTimeFormat.format(now));
when(textBox.getValue()).thenReturn(gwtDateTimeFormat.format(now));
assertEquals(now,
datePicker.getValue());
}
示例6: relativeTime
import com.google.gwt.i18n.client.DateTimeFormat; //導入方法依賴的package包/類
/**
*
* @param createdAt
* @param datePattern
* @param isUTC
* @return
*/
public static String relativeTime(String createdAt, String datePattern, boolean isUTC) {
DateTimeFormat parseDateFormat = DateTimeFormat.getFormat(datePattern);
Date parseDate;
try {
if (isUTC) {
parseDate = parseDateFormat.parse(parseDateFormat.format(
parseDateFormat.parse(createdAt),
TimeZone.createTimeZone(0)));
} else {
parseDate = parseDateFormat.parse(createdAt);
}
} catch (IllegalArgumentException e) {
return "Unavailable";
}
return getRelative(parseDate);
}
示例7: insert
import com.google.gwt.i18n.client.DateTimeFormat; //導入方法依賴的package包/類
public static SingleDateSelector insert(RootPanel panel) {
String format = panel.getElement().getAttribute("format");
final String onchange = panel.getElement().getAttribute("onchange");
String error = panel.getElement().getAttribute("error");
AriaTextBox text = new AriaTextBox(panel.getElement().getFirstChildElement());
SingleDateSelector selector = new SingleDateSelector(text, null, false);
if (format != null)
selector.iFormat = DateTimeFormat.getFormat(format);
if (onchange != null)
selector.addValueChangeHandler(new ValueChangeHandler<Date>() {
@Override
public void onValueChange(ValueChangeEvent<Date> event) {
ToolBox.eval(onchange);
}
});
if (text.getText() != null && !text.getText().isEmpty()) {
Date date = null;
try {
date = selector.iFormat.parse(text.getText());
} catch (IllegalArgumentException e) {}
if (date != null)
selector.setValue(date);
}
if (error != null && !error.isEmpty())
selector.setErrorHint(error);
panel.add(selector);
return selector;
}
示例8: getValue
import com.google.gwt.i18n.client.DateTimeFormat; //導入方法依賴的package包/類
@Override
public List<Date> getValue() {
List<Date> ret = new ArrayList<Date>();
DateTimeFormat df = DateTimeFormat.getFormat("yyyy/MM/dd");
for (int i = 0; i < iPanel.getWidget().getWidgetCount(); i ++) {
Widget w = iPanel.getWidget().getWidget(i);
if (w instanceof SingleMonth) {
SingleMonth s = (SingleMonth)w;
for (D d: s.getDays()) {
if (d.getValue()) ret.add(df.parse(s.getYear() + "/" + (1 + s.getMonth()) + "/" + (1 + d.getNumber())));
}
}
}
return ret;
}
示例9: getRetweets
import com.google.gwt.i18n.client.DateTimeFormat; //導入方法依賴的package包/類
public static void getRetweets(String account, Date start, Date end, final MaterialCollection list, final String listType){
list.clear();
DateTimeFormat fmt = DateTimeFormat.getFormat("/yyyy/M/d");
String startDate = fmt.format(start);
String endDate = fmt.format(end);
String screenName = account;
String url = Consts.HOST_URL + "/summary/statuses/retweets/" + listType + "/" + screenName + startDate + endDate;
loader.setVisible(true);
JsonpRequestBuilder jsonp = new JsonpRequestBuilder();
// Set timeout for 30 seconds (30000 milliseconds)
jsonp.setTimeout(30000);
jsonp.requestObject(url, new AsyncCallback<Mention>() {
@Override
public void onFailure(Throwable caught) {
Window.alert("Failure: " + caught.getMessage());
loader.setVisible(false);
}
@Override
public void onSuccess(Mention mention) {
if (mention.getMentions() != null) {
list.clear();
updateRetweetList(mention.getMentions(), list, listType);
loader.setVisible(false);
}
}
});
}
示例10: addRow
import com.google.gwt.i18n.client.DateTimeFormat; //導入方法依賴的package包/類
/**
* addRow
*
* @param instanceLogEntry
*/
public void addRow(GWTProcessInstanceLogEntry instanceLogEntry) {
int rows = dataTable.getRowCount();
dataTable.insertRow(rows);
dataTable.setHTML(rows, 0, String.valueOf(instanceLogEntry.getProcessDefinitionId()));
dataTable.setHTML(rows, 1, instanceLogEntry.getProcessDefinitionName());
dataTable.setHTML(rows, 2, instanceLogEntry.getToken());
DateTimeFormat dtf = DateTimeFormat.getFormat(GeneralComunicator.i18n("general.date.pattern"));
dataTable.setHTML(rows, 3, dtf.format(instanceLogEntry.getDate()));
dataTable.setHTML(rows, 4, instanceLogEntry.getType());
dataTable.setHTML(rows, 5, instanceLogEntry.getInfo());
dataTable.getCellFormatter().setHorizontalAlignment(rows, 0, HasAlignment.ALIGN_CENTER);
dataTable.getCellFormatter().setHorizontalAlignment(rows, 3, HasAlignment.ALIGN_CENTER);
}
示例11: parseExtended
import com.google.gwt.i18n.client.DateTimeFormat; //導入方法依賴的package包/類
/**
* Parse string date in format "YYYY-MM-DDThh:mm:ss.SSSTZD"
*/
public static Date parseExtended(String value) {
if (value == null) {
return null;
} else {
DateTimeFormat dtf = DateTimeFormat.getFormat(PredefinedFormat.ISO_8601);
return dtf.parse(value);
}
}
示例12: parseBasic
import com.google.gwt.i18n.client.DateTimeFormat; //導入方法依賴的package包/類
/**
* 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);
}
}
示例13: addMessage
import com.google.gwt.i18n.client.DateTimeFormat; //導入方法依賴的package包/類
public void addMessage(ConsoleLogType code, String content) {
Date date = new Date();
DateTimeFormat dtf = DateTimeFormat.getFormat("HH:mm:ss:SS");
String output = "";
output += "<span style=\"color:grey\">"
+ dtf.format(date, TimeZone.createTimeZone(this.getClientOffsetTimeZone())) + "</span> ";
switch (code) {
case ERROR:
output += "<span style=\"color:red\">ERROR</span> ";
break;
case SUCCESS:
output += "<span style=\"color:green\">SUCCESS</span> ";
break;
case INFO:
output += "<span style=\"color:grey\">INFO</span> ";
break;
case WARNING:
output += "<span style=\"color:orange\">WARNING</span> ";
break;
case ACTION:
output += "<span style=\"color: #3F51B5;\">ACTION</span> ";
default:
break;
}
output += content;
Element div = DOM.createElement("div");
div.setInnerHTML(output);
this.JSNI_appendChild(this.element, div);
this.JSNI_updatePosition(this.element);
}
示例14: addMessageSentRow
import com.google.gwt.i18n.client.DateTimeFormat; //導入方法依賴的package包/類
/**
* 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");
}
}
示例15: getLikes
import com.google.gwt.i18n.client.DateTimeFormat; //導入方法依賴的package包/類
public static void getLikes(String account, Date start, Date end, final MaterialCollection list, final String listType){
list.clear();
DateTimeFormat fmt = DateTimeFormat.getFormat("/yyyy/M/d");
String startDate = fmt.format(start);
String endDate = fmt.format(end);
String screenName = account;
String url = Consts.HOST_URL + "/summary/statuses/favorites/" + listType + "/" + screenName + startDate + endDate;
loader.setVisible(true);
JsonpRequestBuilder jsonp = new JsonpRequestBuilder();
// Set timeout for 30 seconds (30000 milliseconds)
jsonp.setTimeout(30000);
jsonp.requestObject(url, new AsyncCallback<Mention>() {
@Override
public void onFailure(Throwable caught) {
Window.alert("Failure: " + caught.getMessage());
loader.setVisible(false);
}
@Override
public void onSuccess(Mention mention) {
if (mention.getMentions() != null) {
list.clear();
updateLikesList(mention.getMentions(), list, listType);
loader.setVisible(false);
}
}
});
}