本文整理汇总了Java中com.google.gwt.i18n.shared.DateTimeFormat.format方法的典型用法代码示例。如果您正苦于以下问题:Java DateTimeFormat.format方法的具体用法?Java DateTimeFormat.format怎么用?Java DateTimeFormat.format使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.i18n.shared.DateTimeFormat
的用法示例。
在下文中一共展示了DateTimeFormat.format方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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"));
}
示例3: adjustToMiddleOfDay
import com.google.gwt.i18n.shared.DateTimeFormat; //导入方法依赖的package包/类
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);
}
示例4: getCurrentYear
import com.google.gwt.i18n.shared.DateTimeFormat; //导入方法依赖的package包/类
private static String getCurrentYear() {
DefaultDateTimeFormatInfo info = new DefaultDateTimeFormatInfo();
DateTimeFormat dateTimeFormat = new DateTimeFormat("yyyy", info) {
};
return dateTimeFormat.format(new Date());
}
示例5: createCurrencyPanel
import com.google.gwt.i18n.shared.DateTimeFormat; //导入方法依赖的package包/类
private Widget createCurrencyPanel(CurrencyTickerDTO ticker) {
CurrencyPanelTemplate templates = GWT.create(CurrencyPanelTemplate.class);
HtmlLayoutContainer result = new HtmlLayoutContainer(templates.getTemplate());
result.setWidth(500);
final DateTimeFormat dtf = DateTimeFormat.getFormat("EEE d MMM HH:mm:ss");
Label priceLabel = new Label("Last Price:");
Label highLabel = new Label("High:");
Label lowLabel = new Label("Low:");
Label buyLabel = new Label("Buy:");
Label sellLabel = new Label("Sell:");
Label volumeLabel = new Label("Volume:");
Label updateTimeLabel = new Label("Refreshed:");
Label priceValue = new Label(formatCurrencyValue(ticker.getLast()) + " " + ticker.getCurrencyCode());
Label highValue = new Label(formatCurrencyValue(ticker.getHigh()) + " " + ticker.getCurrencyCode());
Label lowValue = new Label(formatCurrencyValue(ticker.getLow()) + " " + ticker.getCurrencyCode());
Label buyValue = new Label(formatCurrencyValue(ticker.getBuy()) + " " + ticker.getCurrencyCode());
Label sellValue = new Label(formatCurrencyValue(ticker.getSell()) + " " + ticker.getCurrencyCode());
Label volumeValue = new Label(Float.toString(ticker.getVolume()) + " BTC");
Label updateTimeValue = new Label(dtf.format(ticker.getRefreshTime()));
result.add(priceLabel, new HtmlData(".label1"));
result.add(highLabel, new HtmlData(".label2"));
result.add(lowLabel, new HtmlData(".label3"));
result.add(updateTimeLabel, new HtmlData(".label4"));
result.add(buyLabel, new HtmlData(".label5"));
result.add(sellLabel, new HtmlData(".label6"));
result.add(volumeLabel, new HtmlData(".label7"));
result.add(priceValue, new HtmlData(".value1"));
result.add(highValue, new HtmlData(".value2"));
result.add(lowValue, new HtmlData(".value3"));
result.add(updateTimeValue, new HtmlData(".value4"));
result.add(buyValue, new HtmlData(".value5"));
result.add(sellValue, new HtmlData(".value6"));
result.add(volumeValue, new HtmlData(".value7"));
return result;
}
示例6: 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 immatureLabel = new Label("Immature:");
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 immatureValue = new Label(formatCurrencyValue(stats.getImmature() * currentTicker.getLast()) + " " + currentTicker.getCurrencyCode());
Label totalValue = new Label(formatCurrencyValue((stats.getBalance() + stats.getUnexchanged() + stats.getImmature())
* 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(immatureLabel, new HtmlData(".label3"));
result.add(totalLabel, new HtmlData(".label4"));
result.add(paidoutLabel, new HtmlData(".label5"));
result.add(updateTimeLabel, new HtmlData(".label6"));
result.add(balanceValue, new HtmlData(".value1"));
result.add(unexchangedValue, new HtmlData(".value2"));
result.add(immatureValue, new HtmlData(".value3"));
result.add(totalValue, new HtmlData(".value4"));
result.add(paidoutValue, new HtmlData(".value5"));
result.add(updateTimeValue, new HtmlData(".value6"));
return result;
}
示例7: createLastStatsPanel
import com.google.gwt.i18n.shared.DateTimeFormat; //导入方法依赖的package包/类
public Widget createLastStatsPanel(GlobalStatsDTO lastStats) {
HtmlLayoutContainerTemplate templates = GWT.create(HtmlLayoutContainerTemplate.class);
// Remove the last panel
if (lastStatsPanel != null) {
contentPanel.remove(lastStatsPanel);
}
lastStatsPanel = new HtmlLayoutContainer(templates.getTemplate());
lastStatsPanel.setWidth(650);
final DateTimeFormat dtf = DateTimeFormat.getFormat("EEE d MMM HH:mm:ss");
// Name labels
Label balanceLabel = new Label("Balance: ");
Label unexchangedLabel = new Label("Unexchanged: ");
Label totalLabel = new Label("Total: ");
Label acceptedMegaHashLabel = new Label("Accepted MH/s: ");
Label rejectedMegaHashLabel = new Label("Rejected MH/s: ");
Label totalMegaHashLabel = new Label("Total MH/s: ");
Label percentRejectedMegaHashLabel = new Label("% rejected MH/s: ");
Label lastUpdateTimeLabel = new Label("Last update: ");
// Values label
NumberFormat nf = NumberFormat.getFormat("#.##");
String rejectedMHPercentValueString = "";
if (lastStats != null) {
rejectedMHPercentValueString = nf.format((((lastStats.getTotalRejectedMegahashesPerSecond()) * 100F) / (lastStats
.getTotalRejectedMegahashesPerSecond() + lastStats.getTotalMegahashesPerSecond())));
}
Label balanceValue = new Label(lastStats != null ? formatBTCValue(lastStats.getTotalBalance()) : "");
Label unexchangedValue = new Label(lastStats != null ? formatBTCValue(lastStats.getTotalUnexchangedBalance()) : "");
Label totalValue = new Label(lastStats != null ? formatBTCValue(lastStats.getTotalUnexchangedBalance()
+ lastStats.getTotalUnexchangedBalance()) : "");
Label acceptedMegaHashValue = new Label(lastStats != null ? formatPowerValue(lastStats.getTotalMegahashesPerSecond()) : "");
Label rejectedMegaHashValue = new Label(lastStats != null ? formatPowerValue(lastStats.getTotalRejectedMegahashesPerSecond()) : "");
Label totalMegaHashValue = new Label(
lastStats != null ? formatPowerValue((lastStats.getTotalMegahashesPerSecond() + lastStats.getTotalRejectedMegahashesPerSecond()))
: "");
Label percentRejectedMegaHashValue = new Label(lastStats != null ? rejectedMHPercentValueString : "");
Label lastUpdateTimeValue = new Label(lastStats != null ? dtf.format(lastStats.getRefreshTime()) : "");
lastStatsPanel.add(balanceLabel, new HtmlData(".label1"));
lastStatsPanel.add(unexchangedLabel, new HtmlData(".label2"));
lastStatsPanel.add(totalLabel, new HtmlData(".label3"));
lastStatsPanel.add(acceptedMegaHashLabel, new HtmlData(".label6"));
lastStatsPanel.add(rejectedMegaHashLabel, new HtmlData(".label7"));
lastStatsPanel.add(totalMegaHashLabel, new HtmlData(".label8"));
lastStatsPanel.add(percentRejectedMegaHashLabel, new HtmlData(".label9"));
lastStatsPanel.add(lastUpdateTimeLabel, new HtmlData(".label11"));
lastStatsPanel.add(balanceValue, new HtmlData(".value1"));
lastStatsPanel.add(unexchangedValue, new HtmlData(".value2"));
lastStatsPanel.add(totalValue, new HtmlData(".value3"));
lastStatsPanel.add(acceptedMegaHashValue, new HtmlData(".value6"));
lastStatsPanel.add(rejectedMegaHashValue, new HtmlData(".value7"));
lastStatsPanel.add(totalMegaHashValue, new HtmlData(".value8"));
lastStatsPanel.add(percentRejectedMegaHashValue, new HtmlData(".value9"));
lastStatsPanel.add(lastUpdateTimeValue, new HtmlData(".value11"));
ToolTipConfig config = new ToolTipConfig();
String tooltip = "<b>" + balanceLabel.getText() + "</b>" + balanceValue.getText();
tooltip += "<br/><b>" + unexchangedLabel.getText() + "</b>" + unexchangedValue.getText();
tooltip += "<br/><b>" + totalLabel.getText() + "</b>" + totalValue.getText();
tooltip += "<br/><b>" + acceptedMegaHashLabel.getText() + "</b>" + acceptedMegaHashValue.getText();
tooltip += "<br/><b>" + rejectedMegaHashLabel.getText() + "</b>" + rejectedMegaHashValue.getText();
tooltip += "<br/><b>" + totalMegaHashLabel.getText() + "</b>" + totalMegaHashValue.getText();
tooltip += "<br/><b>" + percentRejectedMegaHashLabel.getText() + "</b>" + percentRejectedMegaHashValue.getText();
tooltip += "<br/><b>" + lastUpdateTimeLabel.getText() + "</b>" + lastUpdateTimeValue.getText();
config.setBodyHtml(tooltip);
config.setTrackMouse(true);
config.setDismissDelay(0);
config.setHideDelay(0);
lastStatsPanel.setToolTipConfig(config);
return lastStatsPanel;
}
示例8: createLastStatsPanel
import com.google.gwt.i18n.shared.DateTimeFormat; //导入方法依赖的package包/类
public Widget createLastStatsPanel(GlobalStatsDTO lastStats) {
HtmlLayoutContainerTemplate templates = GWT.create(HtmlLayoutContainerTemplate.class);
// Remove the last panel
if (lastStatsPanel != null) {
contentPanel.remove(lastStatsPanel);
}
lastStatsPanel = new HtmlLayoutContainer(templates.getTemplate());
lastStatsPanel.setWidth(460);
final DateTimeFormat dtf = DateTimeFormat.getFormat("EEE d MMM HH:mm:ss");
// Name labels
Label balanceLabel = new Label("Balance: ");
Label unexchangedLabel = new Label("Unexchanged: ");
Label immatureLabel = new Label("Immature: ");
Label totalLabel = new Label("Total: ");
Label acceptedMegaHashLabel = new Label("MH/s: ");
Label nbMinersLabel = new Label("Workers: ");
Label lastUpdateTimeLabel = new Label("Last update: ");
Label currentCoinsLabel = new Label("Current coins: ");
// Values label
Label balanceValue = new Label(lastStats != null ? formatBTCValue(lastStats.getTotalBalance()) : "");
Label unexchangedValue = new Label(lastStats != null ? formatBTCValue(lastStats.getTotalUnexchanged()) : "");
Label immatureValue = new Label(lastStats != null ? formatBTCValue(lastStats.getTotalImmature()) : "");
Label totalValue = new Label(lastStats != null ? formatBTCValue(lastStats.getTotalBalance() + lastStats.getTotalUnexchanged()
+ lastStats.getTotalImmature()) : "");
Label acceptedMegaHashValue = new Label(lastStats != null ? formatPowerValue(lastStats.getTotalMegahashesPerSecond()) : "");
Label nbMinersValue = new Label(lastStats != null && lastStats.getNbMiners() != null ? lastStats.getNbMiners().toString() : "");
Label lastUpdateTimeValue = new Label(lastStats != null ? dtf.format(lastStats.getRefreshTime()) : "");
HTML currentCoinsValue = new HTML("");
if (lastStats.getMiningCoins() != null) {
NumberFormat nf = NumberFormat.getFormat("#.##");
String coinsValue = "<ul class=\"miningCoinList\">";
for (CoinInfoDTO coin : lastStats.getMiningCoins()) {
coinsValue += "<li><b>" + coin.getFullname() + ":</b> " + formatPowerValue(coin.getPoolHashrate()) + " MH/s, "
+ nf.format((coin.getPoolHashrate() / lastStats.getTotalMegahashesPerSecond() * 100)) + " %</li>";
}
coinsValue += "</ul>";
currentCoinsValue.setHTML(coinsValue);
}
lastStatsPanel.add(balanceLabel, new HtmlData(".label1"));
lastStatsPanel.add(unexchangedLabel, new HtmlData(".label2"));
lastStatsPanel.add(immatureLabel, new HtmlData(".label3"));
lastStatsPanel.add(totalLabel, new HtmlData(".label4"));
lastStatsPanel.add(acceptedMegaHashLabel, new HtmlData(".label5"));
lastStatsPanel.add(nbMinersLabel, new HtmlData(".label6"));
lastStatsPanel.add(lastUpdateTimeLabel, new HtmlData(".label7"));
lastStatsPanel.add(currentCoinsLabel, new HtmlData(".coinLabel"));
lastStatsPanel.add(balanceValue, new HtmlData(".value1"));
lastStatsPanel.add(unexchangedValue, new HtmlData(".value2"));
lastStatsPanel.add(immatureValue, new HtmlData(".value3"));
lastStatsPanel.add(totalValue, new HtmlData(".value4"));
lastStatsPanel.add(acceptedMegaHashValue, new HtmlData(".value5"));
lastStatsPanel.add(nbMinersValue, new HtmlData(".value6"));
lastStatsPanel.add(lastUpdateTimeValue, new HtmlData(".value7"));
lastStatsPanel.add(currentCoinsValue, new HtmlData(".coinValue"));
ToolTipConfig config = new ToolTipConfig();
String tooltip = "<b>" + balanceLabel.getText() + "</b>" + balanceValue.getText();
tooltip += "<br/><b>" + unexchangedLabel.getText() + "</b>" + unexchangedValue.getText();
tooltip += "<br/><b>" + totalLabel.getText() + "</b>" + totalValue.getText();
tooltip += "<br/><b>" + acceptedMegaHashLabel.getText() + "</b>" + acceptedMegaHashValue.getText();
tooltip += "<br/><b>" + currentCoinsLabel.getText() + "</b>" + currentCoinsValue.getHTML();
tooltip += "<br/><b>" + nbMinersLabel.getText() + "</b>" + nbMinersValue.getText();
tooltip += "<br/><b>" + lastUpdateTimeLabel.getText() + "</b>" + lastUpdateTimeValue.getText();
config.setBodyHtml(tooltip);
config.setTrackMouse(true);
config.setDismissDelay(0);
config.setHideDelay(0);
lastStatsPanel.setToolTipConfig(config);
return lastStatsPanel;
}
示例9: createLastStatsPanel
import com.google.gwt.i18n.shared.DateTimeFormat; //导入方法依赖的package包/类
public Widget createLastStatsPanel(AddressStatsDTO lastStats) {
HtmlLayoutContainerTemplate templates = GWT.create(HtmlLayoutContainerTemplate.class);
// Remove the last panel
if (lastStatsPanel != null) {
contentPanel.remove(lastStatsPanel);
}
lastStatsPanel = new HtmlLayoutContainer(templates.getTemplate());
lastStatsPanel.setWidth(900);
final DateTimeFormat dtf = DateTimeFormat.getFormat("EEE d MMM HH:mm:ss");
// Name labels
Label balanceLabel = new Label("Balance: ");
Label unexchangedLabel = new Label("Unexchanged: ");
Label immatureLabel = new Label("Immature: ");
Label totalLabel = new Label("Total: ");
Label paidoutLabel = new Label("Paid out: ");
Label acceptedMegaHashLabel = new Label("MH/s: ");
Label lastUpdateTimeLabel = new Label("Last update: ");
// Values label
Label balanceValue = new Label(lastStats != null ? formatBTCValue(lastStats.getBalance()) : "");
Label unexchangedValue = new Label(lastStats != null ? formatBTCValue(lastStats.getUnexchanged()) : "");
Label immatureValue = new Label(lastStats != null ? formatBTCValue(lastStats.getImmature()) : "");
paidoutAnchor = new Anchor(lastStats != null ? formatBTCValue(lastStats.getPaidOut()) : "");
Label paidoutValue = new Label(lastStats != null ? formatBTCValue(lastStats.getPaidOut()) : "");
Label totalValue = new Label(
lastStats != null ? formatBTCValue(lastStats.getBalance() + lastStats.getUnexchanged() + lastStats.getImmature()) : "");
Label acceptedMegaHashValue = new Label(lastStats != null ? formatPowerValue(lastStats.getHashrate()) : "");
Label lastUpdateTimeValue = new Label(lastStats != null ? dtf.format(lastStats.getRefreshTime()) : "");
lastStatsPanel.add(balanceLabel, new HtmlData(".label1"));
lastStatsPanel.add(unexchangedLabel, new HtmlData(".label2"));
lastStatsPanel.add(immatureLabel, new HtmlData(".label3"));
lastStatsPanel.add(totalLabel, new HtmlData(".label4"));
lastStatsPanel.add(paidoutLabel, new HtmlData(".label5"));
lastStatsPanel.add(acceptedMegaHashLabel, new HtmlData(".label6"));
lastStatsPanel.add(lastUpdateTimeLabel, new HtmlData(".label7"));
lastStatsPanel.add(balanceValue, new HtmlData(".value1"));
lastStatsPanel.add(unexchangedValue, new HtmlData(".value2"));
lastStatsPanel.add(immatureValue, new HtmlData(".value3"));
lastStatsPanel.add(totalValue, new HtmlData(".value4"));
lastStatsPanel.add(lastStats.getPaidOut() > 0 ? paidoutAnchor : paidoutValue, new HtmlData(".value5"));
lastStatsPanel.add(acceptedMegaHashValue, new HtmlData(".value6"));
lastStatsPanel.add(lastUpdateTimeValue, new HtmlData(".value7"));
ToolTipConfig config = new ToolTipConfig();
String tooltip = "<b>" + balanceLabel.getText() + "</b>" + balanceValue.getText();
tooltip += "<br/><b>" + unexchangedLabel.getText() + "</b>" + unexchangedValue.getText();
tooltip += "<br/><b>" + immatureLabel.getText() + "</b>" + immatureValue.getText();
tooltip += "<br/><b>" + totalLabel.getText() + "</b>" + totalValue.getText();
tooltip += "<br/><b>" + paidoutLabel.getText() + "</b>" + paidoutAnchor.getText();
tooltip += "<br/><b>" + acceptedMegaHashLabel.getText() + "</b>" + acceptedMegaHashValue.getText();
tooltip += "<br/><b>" + lastUpdateTimeLabel.getText() + "</b>" + lastUpdateTimeValue.getText();
config.setBodyHtml(tooltip);
config.setTrackMouse(true);
config.setDismissDelay(0);
config.setHideDelay(0);
lastStatsPanel.setToolTipConfig(config);
return lastStatsPanel;
}
示例10: createLastStatsPanel
import com.google.gwt.i18n.shared.DateTimeFormat; //导入方法依赖的package包/类
public Widget createLastStatsPanel(GlobalStatsDTO lastStats) {
HtmlLayoutContainerTemplate templates = GWT.create(HtmlLayoutContainerTemplate.class);
// Remove the last panel
if (lastStatsPanel != null) {
contentPanel.remove(lastStatsPanel);
}
lastStatsPanel = new HtmlLayoutContainer(templates.getTemplate());
lastStatsPanel.setWidth(500);
final DateTimeFormat dtf = DateTimeFormat.getFormat("EEE d MMM HH:mm:ss");
// Name labels
Label balanceLabel = new Label("Balance: ");
Label unexchangedLabel = new Label("Unexchanged: ");
Label totalLabel = new Label("Total: ");
Label paidoutLabel = new Label("Paid out: ");
Label acceptedMegaHashLabel = new Label("MH/s: ");
Label nbOfMinersLabel = new Label("Number of miners: ");
Label currentMiningCoinLabel = new Label("Mining coin: ");
Label lastUpdateTimeLabel = new Label("Last update: ");
// Values label
Label balanceValue = new Label(lastStats != null ? formatBTCValue(lastStats.getTotalBalance()) : "");
Label unexchangedValue = new Label(lastStats != null ? formatBTCValue(lastStats.getTotalUnexchangedBalance()) : "");
Label totalValue = new Label(lastStats != null ? formatBTCValue(lastStats.getTotalUnexchangedBalance()
+ lastStats.getTotalUnexchangedBalance()) : "");
Label paidoutValue = new Label(lastStats != null ? formatBTCValue(lastStats.getTotalPaidOut()) : "");
Label acceptedMegaHashValue = new Label(lastStats != null ? formatPowerValue(lastStats.getTotalMegahashesPerSecond()) : "");
Label nbOfMinersValue = new Label(lastStats != null ? lastStats.getNbMiners().toString() : "");
Label currentMiningCoinValue = new Label(lastStats != null ? lastStats.getCurrentMiningCoin() : "");
Label lastUpdateTimeValue = new Label(lastStats != null ? dtf.format(lastStats.getRefreshTime()) : "");
lastStatsPanel.add(balanceLabel, new HtmlData(".label1"));
lastStatsPanel.add(unexchangedLabel, new HtmlData(".label2"));
lastStatsPanel.add(totalLabel, new HtmlData(".label3"));
lastStatsPanel.add(paidoutLabel, new HtmlData(".label4"));
lastStatsPanel.add(acceptedMegaHashLabel, new HtmlData(".label6"));
lastStatsPanel.add(nbOfMinersLabel, new HtmlData(".label7"));
lastStatsPanel.add(currentMiningCoinLabel, new HtmlData(".label8"));
lastStatsPanel.add(lastUpdateTimeLabel, new HtmlData(".label9"));
lastStatsPanel.add(balanceValue, new HtmlData(".value1"));
lastStatsPanel.add(unexchangedValue, new HtmlData(".value2"));
lastStatsPanel.add(totalValue, new HtmlData(".value3"));
lastStatsPanel.add(paidoutValue, new HtmlData(".value4"));
lastStatsPanel.add(acceptedMegaHashValue, new HtmlData(".value6"));
lastStatsPanel.add(nbOfMinersValue, new HtmlData(".value7"));
lastStatsPanel.add(currentMiningCoinValue, new HtmlData(".value8"));
lastStatsPanel.add(lastUpdateTimeValue, new HtmlData(".value9"));
ToolTipConfig config = new ToolTipConfig();
String tooltip = "<b>" + balanceLabel.getText() + "</b>" + balanceValue.getText();
tooltip += "<br/><b>" + unexchangedLabel.getText() + "</b>" + unexchangedValue.getText();
tooltip += "<br/><b>" + totalLabel.getText() + "</b>" + totalValue.getText();
tooltip += "<br/><b>" + paidoutLabel.getText() + "</b>" + paidoutValue.getText();
tooltip += "<br/><b>" + acceptedMegaHashLabel.getText() + "</b>" + acceptedMegaHashValue.getText();
tooltip += "<br/><b>" + nbOfMinersLabel.getText() + "</b>" + nbOfMinersValue.getText();
tooltip += "<br/><b>" + currentMiningCoinLabel.getText() + "</b>" + currentMiningCoinValue.getText();
tooltip += "<br/><b>" + lastUpdateTimeLabel.getText() + "</b>" + lastUpdateTimeValue.getText();
config.setBodyHtml(tooltip);
config.setTrackMouse(true);
config.setDismissDelay(0);
config.setHideDelay(0);
lastStatsPanel.setToolTipConfig(config);
return lastStatsPanel;
}
示例11: getMetaDate
import com.google.gwt.i18n.shared.DateTimeFormat; //导入方法依赖的package包/类
public static String getMetaDate(int i){
Date now = new Date();
CalendarUtil.addDaysToDate(now, i);
DateTimeFormat fmt = DateTimeFormat.getFormat("yyyy-MM-dd");
return fmt.format(now);
}
示例12: formatDate
import com.google.gwt.i18n.shared.DateTimeFormat; //导入方法依赖的package包/类
@Override
public String formatDate(Date zonedDate, DateTimeFormat formatter) {
return formatter.format(zonedDate, getTimeZone());
}