本文整理汇总了Java中com.google.gwt.i18n.shared.DateTimeFormat类的典型用法代码示例。如果您正苦于以下问题:Java DateTimeFormat类的具体用法?Java DateTimeFormat怎么用?Java DateTimeFormat使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DateTimeFormat类属于com.google.gwt.i18n.shared包,在下文中一共展示了DateTimeFormat类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toString
import com.google.gwt.i18n.shared.DateTimeFormat; //导入依赖的package包/类
@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();
}
示例2: getTimeInfo
import com.google.gwt.i18n.shared.DateTimeFormat; //导入依赖的package包/类
public static int[] getTimeInfo(){
int[] t = new int[4];
try{
Date now = new Date();
DateTimeFormat fmt = DateTimeFormat.getFormat("yyyy/MM/dd/Z");
String s[] = fmt.format(now).split("/");
t[0] = Integer.parseInt(s[0]);
t[1] = Integer.parseInt(s[1]);
t[2] = Integer.parseInt(s[2]);
t[3] = getZone(s);
GWT.log(""+t[3]);
}catch(Exception e){
e.printStackTrace();
}
return t;
}
示例3: getTimeInfo
import com.google.gwt.i18n.shared.DateTimeFormat; //导入依赖的package包/类
public static int[] getTimeInfo(int i){
int[] t = new int[4];
try{
Date now = new Date();
CalendarUtil.addDaysToDate(now, i);
DateTimeFormat fmt = DateTimeFormat.getFormat("yyyy/MM/dd/Z");
String s[] = fmt.format(now).split("/");
t[0] = Integer.parseInt(s[0]);
t[1] = Integer.parseInt(s[1]);
t[2] = Integer.parseInt(s[2]);
t[3] = getZone(s);
GWT.log(""+t[3]);
}catch(Exception e){
e.printStackTrace();
}
return t;
}
示例4: getTimeInfo
import com.google.gwt.i18n.shared.DateTimeFormat; //导入依赖的package包/类
public static int[] getTimeInfo(int i){
int[] t = new int[4];
try{
Date now = new Date();
CalendarUtil.addDaysToDate(now, i);
DateTimeFormat fmt = DateTimeFormat.getFormat("yyyy/MM/dd/Z");
String s[] = fmt.format(now).split("/");
t[0] = Integer.parseInt(s[0]);
t[1] = Integer.parseInt(s[1]);
t[2] = Integer.parseInt(s[2]);
t[3] = getZone(s);
}catch(Exception e){
e.printStackTrace();
}
return t;
}
示例5: createApplicationListener
import com.google.gwt.i18n.shared.DateTimeFormat; //导入依赖的package包/类
@Override
public ApplicationListener createApplicationListener() {
instance = this;
setLogLevel(LOG_NONE);
setLoadingListener(new LoadingListener() {
@Override
public void beforeSetup() {
}
@Override
public void afterSetup() {
scaleCanvas();
setupResizeHook();
}
});
Net.setClientProvider(new WebsocketClient());
Mindustry.platforms = new PlatformFunction(){
DateTimeFormat format = DateTimeFormat.getFormat("EEE, dd MMM yyyy HH:mm:ss");
@Override
public String format(Date date){
return format.format(date);
}
@Override
public String format(int number){
return NumberFormat.getDecimalFormat().format(number);
}
@Override
public void openLink(String link){
Window.open(link, "_blank", "");
}
};
return new Mindustry();
}
示例6: getResubmitAt
import com.google.gwt.i18n.shared.DateTimeFormat; //导入依赖的package包/类
/**
* @return The date and time of the last resubmit
*/
public String getResubmitAt() {
if (!getProperties().containsKey("resubmitAt")) {
return null;
}
Date date = new Date(Long.valueOf(getProperties().get("resubmitAt")));
return DateTimeFormat.getFormat(DATE_TIME_FULL).format(date);
}
示例7: submitRegistration
import com.google.gwt.i18n.shared.DateTimeFormat; //导入依赖的package包/类
public void submitRegistration(UserResults userResults, RegistrationListener registrationListener, final String reportDateFormat) {
final String registratinoUrl = serviceLocations.registrationUrl();
final RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, registratinoUrl);
builder.setHeader("Content-type", "application/x-www-form-urlencoded");
StringBuilder stringBuilder = new StringBuilder();
for (String key : userResults.getMetadataKeys()) {
String value = URL.encodeQueryString(userResults.getMetadataValue(key));
if (stringBuilder.length() > 0) {
stringBuilder.append("&");
}
stringBuilder.append(key).append("=").append(value);
}
if (stringBuilder.length() > 0) {
stringBuilder.append("&");
}
stringBuilder.append("applicationversion").append("=").append(version.projectVersion()).append("&");
String scoreLog = URL.encodeQueryString(userResults.getScoreLog());
stringBuilder.append("scorelog").append("=").append(scoreLog).append("&");
String restultsData = URL.encodeQueryString(new ResultsSerialiser() {
final DateTimeFormat format = DateTimeFormat.getFormat(reportDateFormat);
@Override
protected String formatDate(Date date) {
return format.format(date);
}
}.serialise(userResults, mateadataFields.postName_email()));
stringBuilder.append("quiz_results=").append(restultsData);
try {
builder.sendRequest(stringBuilder.toString(), geRequestBuilder(builder, registrationListener, registratinoUrl));
} catch (RequestException exception) {
registrationListener.registrationFailed(new RegistrationException(RegistrationException.ErrorType.buildererror, exception));
logger.log(Level.SEVERE, "SubmitRegistration", exception);
}
}
开发者ID:languageininteraction,项目名称:GraphemeColourSynaesthesiaApp,代码行数:35,代码来源:RegistrationService.java
示例8: createShiftWidget
import com.google.gwt.i18n.shared.DateTimeFormat; //导入依赖的package包/类
private Widget createShiftWidget( final Shift shift )
{
final HorizontalPanel panel = new HorizontalPanel();
final DateTimeFormat dtf = DateTimeFormat.getFormat( PredefinedFormat.DATE_TIME_FULL );
panel.add( new Label( shift.getName() + " - Started At " + dtf.format( shift.getStartAt() ) ) );
return panel;
}
示例9: RosterUI
import com.google.gwt.i18n.shared.DateTimeFormat; //导入依赖的package包/类
RosterUI( final ApplicationController controller )
{
_controller = controller;
initWidget( UI_BINDER.createAndBindUi( this ) );
final com.google.gwt.i18n.client.DateTimeFormat format =
com.google.gwt.i18n.client.DateTimeFormat.getFormat(
com.google.gwt.i18n.client.DateTimeFormat.PredefinedFormat.YEAR_MONTH_DAY );
_shiftDateCreate.setFormat( new DefaultFormat( format ) );
}
示例10: createShiftWidget
import com.google.gwt.i18n.shared.DateTimeFormat; //导入依赖的package包/类
private Widget createShiftWidget( final Shift shift )
{
final HorizontalPanel panel = new HorizontalPanel();
final DateTimeFormat dtf = DateTimeFormat.getFormat( PredefinedFormat.DATE_TIME_SHORT );
panel.add( new Label( dtf.format( shift.getStartAt() ) + " - " + shift.getName() ) );
final Button delete = new Button( "X" );
delete.addClickHandler( event -> _controller.doDeleteShift( shift ) );
panel.add( delete );
return panel;
}
示例11: createStatsPanel
import com.google.gwt.i18n.shared.DateTimeFormat; //导入依赖的package包/类
private Widget createStatsPanel(AddressStatsDTO stats) {
StatsPanelTemplate templates = GWT.create(StatsPanelTemplate.class);
HtmlLayoutContainer result = new HtmlLayoutContainer(templates.getTemplate());
result.setWidth(500);
final DateTimeFormat dtf = DateTimeFormat.getFormat("EEE d MMM HH:mm:ss");
Label balanceLabel = new Label("Balance:");
Label unexchangedLabel = new Label("Unexchanged:");
Label totalLabel = new Label("Total:");
Label paidoutLabel = new Label("Paidout:");
Label updateTimeLabel = new Label("Refreshed:");
Label balanceValue = new Label(formatCurrencyValue(stats.getBalance() * currentTicker.getLast()) + " " + currentTicker.getCurrencyCode());
Label unexchangedValue = new Label(formatCurrencyValue(stats.getUnexchanged() * currentTicker.getLast()) + " "
+ currentTicker.getCurrencyCode());
Label totalValue = new Label(formatCurrencyValue((stats.getBalance() + stats.getUnexchanged()) * currentTicker.getLast()) + " "
+ currentTicker.getCurrencyCode());
Label paidoutValue = new Label(formatCurrencyValue(stats.getPaidOut() * currentTicker.getLast()) + " " + currentTicker.getCurrencyCode());
Label updateTimeValue = new Label(dtf.format(stats.getRefreshTime()));
result.add(balanceLabel, new HtmlData(".label1"));
result.add(unexchangedLabel, new HtmlData(".label2"));
result.add(totalLabel, new HtmlData(".label3"));
result.add(paidoutLabel, new HtmlData(".label4"));
result.add(updateTimeLabel, new HtmlData(".label5"));
result.add(balanceValue, new HtmlData(".value1"));
result.add(unexchangedValue, new HtmlData(".value2"));
result.add(totalValue, new HtmlData(".value3"));
result.add(paidoutValue, new HtmlData(".value4"));
result.add(updateTimeValue, new HtmlData(".value5"));
return result;
}
示例12: setDonationDetails
import com.google.gwt.i18n.shared.DateTimeFormat; //导入依赖的package包/类
@Override
public void setDonationDetails(DonationDetailsDTO donationDetails) {
float percent = (float) donationDetails.getDonationsInBTC() / (float) donationDetails.getDonationsNeeded();
progressBar.updateProgress(percent, "{0} %");
DateTimeFormat dtf = DateTimeFormat.getFormat("d MMM HH:mm:ss");
String result = "Server rent price: " + formatCurrencyValue(donationDetails.getRentPriceInEuro()) + " € ("
+ formatBTCValue(donationDetails.getDonationsNeeded()) + " BTC)";
result += "<br/>Current BTC price: " + formatCurrencyValue(donationDetails.getBtcPriceInEuro()) + " €";
result += "<br/>Total month donations: " + formatCurrencyValue(donationDetails.getDonationsInBTC() * donationDetails.getBtcPriceInEuro())
+ " € (" + formatBTCValue(donationDetails.getDonationsInBTC()) + " BTC)";
result += "<br/>Last " + NB_DISPLAYED_LAST_TRANSACTIONS + " donations:";
if (donationDetails.getTransactions() != null && donationDetails.getTransactions().size() > 0) {
result += "<table class=\"donationTable\">";
List<DonationTransactionDetailsDTO> transactions = donationDetails.getTransactions();
for (int i = 0; i < transactions.size() && i < NB_DISPLAYED_LAST_TRANSACTIONS; i++) {
DonationTransactionDetailsDTO transaction = transactions.get(i);
result += "<tr><td class=\"donationDate\">" + dtf.format(transaction.getTime()) + ":</td><td class=\"donationValue\">"
+ formatBTCValue(transaction.getValue()) + " BTC</td></tr>";
}
result += "</table>";
} else {
result += "<br/><i>None</i>";
}
result += "<br/>Last month donations: " + formatBTCValue(donationDetails.getLastMonthDonationsValue()) + " BTC";
tooltipConfig.setBodyHtml(result);
progressBar.getToolTip().update(tooltipConfig);
btcAddressLabel.setText("BTC: " + donationDetails.getDonationBtcAddress());
mainContainer.remove(notAvailablePanel);
mainContainer.add(progressBar, new HtmlData(".donationProgressBar"));
}
示例13: nextTime
import com.google.gwt.i18n.shared.DateTimeFormat; //导入依赖的package包/类
public static int nextTime(ArrayList<String> input){
int res = -1;
Date d = new Date();
DateTimeFormat fmt = DateTimeFormat.getFormat("hh:mm a");
int i = 0;
for(String s: input){
if(i != 1 && i != 4){
if(d.before(fmt.parse(s))){
return i;
}
}
i++;
}
return res;
}
示例14: getMonthInfo
import com.google.gwt.i18n.shared.DateTimeFormat; //导入依赖的package包/类
public String[] getMonthInfo(int i){
String[] s = new String[2];
try{
Date now = new Date();
CalendarUtil.addDaysToDate(now, i);
DateTimeFormat fmt = DateTimeFormat.getFormat("dd/MMM");
String s1[] = fmt.format(now).split("/");
return s1;
}catch(Exception e){
e.printStackTrace();
}
return s;
}
示例15: createPanel
import com.google.gwt.i18n.shared.DateTimeFormat; //导入依赖的package包/类
/**
* Init Menu panel.
* @return
*/
private Widget createPanel() {
final FlowPanel rootPanel = new FlowPanel();
rootPanel.getElement().setId(MENU_ID);
Date dateActivation = UpdateDates.getSigmahActivationTraceDate();
dateActivationModeVariable = createVariable(dateActivation != null?DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_TIME_SHORT).format(dateActivation):null);
rootPanel.add(dateActivationModeVariable);
dateActivationModeLabel = createVariable(I18N.CONSTANTS.probesDateTraceActivation());
rootPanel.add(dateActivationModeLabel);
if(dateActivation == null){
Profiler.INSTANCE.setActive(false);
dateActivationModeLabel.setVisible(false);
dateActivationModeVariable.setVisible(false);
}else{
Profiler.INSTANCE.setActive(true);
dateActivationModeLabel.setVisible(true);
dateActivationModeVariable.setVisible(true);
}
//disable/enable
activeDesactiveModeAnchor = Profiler.INSTANCE.isActive()? createActionButton(I18N.CONSTANTS.probesDisableTrace()):createActionButton(I18N.CONSTANTS.probesEnableTrace());
activeDesactiveModeAnchor.addStyleName(Profiler.INSTANCE.isActive()?DISABLE_ACTION_STYLE:ENABLE_ACTION_STYLE);
activeDesactiveModeAnchor.getElement().setId(ACTIVE_DESACTIVE_BUTTON_ID);
rootPanel.add(activeDesactiveModeAnchor);
// send report
sendReportAnchor = createActionButton(I18N.CONSTANTS.probesSendReport());
sendReportAnchor.getElement().setId(SEND_REPORT_BUTTON_ID);
sendReportAnchor.addStyleName(SEND_REPORT_ACTION_STYLE);
rootPanel.add(sendReportAnchor);
return rootPanel;
}