本文整理汇总了Java中com.google.gwt.i18n.shared.DateTimeFormat.getFormat方法的典型用法代码示例。如果您正苦于以下问题:Java DateTimeFormat.getFormat方法的具体用法?Java DateTimeFormat.getFormat怎么用?Java DateTimeFormat.getFormat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.i18n.shared.DateTimeFormat
的用法示例。
在下文中一共展示了DateTimeFormat.getFormat方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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();
}
示例4: 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;
}
示例5: 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"));
}
示例6: 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);
}
示例7: 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);
}
示例8: 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;
}
示例9: initPowerChart
import com.google.gwt.i18n.shared.DateTimeFormat; //导入方法依赖的package包/类
private void initPowerChart() {
powerChart = new Chart();
powerChart.setChartTitleText("Power");
powerChart.setHeight(350);
powerChart.setZoomType(BaseChart.ZoomType.X);
powerChart.setShadow(false);
powerChart.setAnimation(false);
powerChart.setOption("/plotOptions/series/turboThreshold", 10);
powerChart.setAreaPlotOptions(new AreaPlotOptions().setStacking(Stacking.NORMAL).setMarker(
new Marker().setEnabled(false).setHoverState(new Marker().setEnabled(true).setRadius(5))));
powerChart.setSeriesPlotOptions(new SeriesPlotOptions().setDataGrouping(new DataGrouping().setEnabled(true)));
powerChart.getXAxis().setType(Axis.Type.DATE_TIME);
powerChart.getXAxis().setAxisTitleText("Date");
powerChart.getYAxis(0).setType(Axis.Type.LINEAR);
powerChart.getYAxis(0).setAxisTitleText("MH/s");
powerChart.getYAxis(0).setMinorTickIntervalAuto();
powerChart.getYAxis(0).setGridLineWidth(2);
acceptedMHSeries = powerChart.createSeries();
acceptedMHSeries.setType(Series.Type.AREA);
acceptedMHSeries.setName("Accepted MH/s");
acceptedMHSeries.setStack("mhs");
acceptedMHSeries.setYAxis(0);
acceptedMHSeries.setPlotOptions(new AreaPlotOptions().setShadow(false).setHoverStateLineWidth(2).setColor(new Color(0, 170, 0, 0.5))
.setFillOpacity(0.5));
powerChart.addSeries(acceptedMHSeries);
rejectedMHSeries = powerChart.createSeries();
rejectedMHSeries.setType(Series.Type.AREA);
rejectedMHSeries.setName("Rejected MH/s");
rejectedMHSeries.setStack("mhs");
rejectedMHSeries.setYAxis(0);
rejectedMHSeries.setPlotOptions(new AreaPlotOptions().setShadow(false).setHoverStateLineWidth(2).setColor(new Color(255, 0, 0, 0.5))
.setFillOpacity(0.5));
powerChart.addSeries(rejectedMHSeries);
final DateTimeFormat dtf = DateTimeFormat.getFormat("EEE d MMM HH:mm:ss");
final NumberFormat nf = NumberFormat.getFormat("#.##");
powerChart.setToolTip(new ToolTip().setFormatter(new ToolTipFormatter() {
public String format(ToolTipData toolTipData) {
String result = "";
GlobalStatsDTO stat = getStatsFromDate(toolTipData.getXAsLong());
if (stat != null) {
result = "<b>Accepted MH/s:</b> " + formatPowerValue(stat.getTotalMegahashesPerSecond());
result += "<br/><b>Rejected MH/s:</b> " + formatPowerValue(stat.getTotalRejectedMegahashesPerSecond());
result += "<br/><b>Total MH/s:</b> "
+ formatPowerValue(stat.getTotalMegahashesPerSecond() + stat.getTotalRejectedMegahashesPerSecond());
result += "<br/><b>% of rejected shares:</b> "
+ nf.format((((stat.getTotalRejectedMegahashesPerSecond()) * 100F) / (stat.getTotalMegahashesPerSecond() + stat
.getTotalRejectedMegahashesPerSecond())));
result += "<br/><b>Date:</b> " + dtf.format(stat.getRefreshTime());
}
return result;
}
}).setFollowPointer(true).setShadow(false).setUseHTML(true));
contentPanel.addResizeHandler(new ResizeHandler() {
public void onResize(ResizeEvent event) {
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
public void execute() {
powerChart.setSizeToMatchContainer();
}
});
}
});
}
示例10: initBTCChart
import com.google.gwt.i18n.shared.DateTimeFormat; //导入方法依赖的package包/类
private void initBTCChart() {
btcChart = new Chart();
btcChart.setChartTitleText("BTC");
btcChart.setHeight(350);
btcChart.setShadow(false);
btcChart.setAnimation(false);
btcChart.setZoomType(BaseChart.ZoomType.X);
btcChart.setOption("/plotOptions/series/turboThreshold", 10);
btcChart.setAreaPlotOptions(new AreaPlotOptions().setStacking(Stacking.NORMAL).setMarker(
new Marker().setEnabled(false).setHoverState(new Marker().setEnabled(true).setRadius(5))));
btcChart.setLinePlotOptions(new LinePlotOptions().setMarker(new Marker().setEnabled(false).setHoverState(
new Marker().setEnabled(true).setRadius(5))));
btcChart.setSeriesPlotOptions(new SeriesPlotOptions().setDataGrouping(new DataGrouping().setEnabled(true)));
btcChart.getXAxis().setType(Axis.Type.DATE_TIME);
btcChart.getXAxis().setAxisTitleText("Date");
btcChart.getYAxis().setType(Axis.Type.LINEAR);
btcChart.getYAxis().setAxisTitleText("BTC");
btcChart.getYAxis().setMinorTickIntervalAuto();
btcChart.getYAxis().setGridLineWidth(2);
unexchangedSeries = btcChart.createSeries();
unexchangedSeries.setType(Series.Type.AREA);
unexchangedSeries.setName("Unexchanged");
unexchangedSeries.setStack("btc");
unexchangedSeries.setPlotOptions(new AreaPlotOptions().setShadow(false).setHoverStateLineWidth(2).setColor(new Color(0, 55, 255, 0.5))
.setFillOpacity(0.5));
btcChart.addSeries(unexchangedSeries);
immatureSeries = btcChart.createSeries();
immatureSeries.setType(Series.Type.AREA);
immatureSeries.setName("Immature");
immatureSeries.setStack("btc");
immatureSeries.setPlotOptions(new AreaPlotOptions().setShadow(false).setHoverStateLineWidth(2).setColor(new Color(0, 170, 0, 0.5))
.setFillOpacity(0.5));
btcChart.addSeries(immatureSeries);
balanceSeries = btcChart.createSeries();
balanceSeries.setType(Series.Type.LINE).setName("Balance");
balanceSeries.setPlotOptions(new SeriesPlotOptions().setShadow(false).setHoverStateLineWidth(2).setColor("red"));
btcChart.addSeries(balanceSeries);
final DateTimeFormat dtf = DateTimeFormat.getFormat("EEE d MMM HH:mm:ss");
btcChart.setToolTip(new ToolTip().setFormatter(new ToolTipFormatter() {
public String format(ToolTipData toolTipData) {
String result = "";
AddressStatsDTO stat = getStatsFromDate(toolTipData.getXAsLong());
if (stat != null) {
result = "<b>Balance:</b> " + formatBTCValue(stat.getBalance());
result += "<br/><b>Unexchanged:</b> " + formatBTCValue(stat.getUnexchanged());
result += "<br/><b>Immature:</b> " + formatBTCValue(stat.getImmature());
result += "<br/><b>Total:</b> " + formatBTCValue(stat.getBalance() + stat.getUnexchanged() + stat.getImmature());
result += "<br/><b>Paid out:</b> " + formatBTCValue(stat.getPaidOut());
result += "<br/><b>Date:</b> " + dtf.format(stat.getRefreshTime());
}
return result;
}
}).setFollowPointer(true).setShadow(false).setUseHTML(true));
contentPanel.addResizeHandler(new ResizeHandler() {
public void onResize(ResizeEvent event) {
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
public void execute() {
btcChart.setSizeToMatchContainer();
}
});
}
});
}
示例11: getYearDateTimeFormat
import com.google.gwt.i18n.shared.DateTimeFormat; //导入方法依赖的package包/类
public DateTimeFormat getYearDateTimeFormat() {
if (yearDateTimeFormat == null) {
yearDateTimeFormat = DateTimeFormat.getFormat("yyyy");
}
return yearDateTimeFormat;
}
示例12: initPowerChart
import com.google.gwt.i18n.shared.DateTimeFormat; //导入方法依赖的package包/类
private void initPowerChart() {
powerChart = new Chart();
powerChart.setChartTitleText("Power");
powerChart.setHeight(350);
powerChart.setZoomType(BaseChart.ZoomType.X);
powerChart.setAnimation(false);
powerChart.setShadow(false);
powerChart.setOption("/plotOptions/series/turboThreshold", 10);
powerChart.setAreaPlotOptions(new AreaPlotOptions().setStacking(Stacking.NORMAL).setMarker(
new Marker().setEnabled(false).setHoverState(new Marker().setEnabled(true).setRadius(5))));
powerChart.setColumnPlotOptions(new ColumnPlotOptions().setStacking(Stacking.NORMAL).setMarker(
new Marker().setEnabled(false).setHoverState(new Marker().setEnabled(true).setRadius(5))));
powerChart.setLinePlotOptions(new LinePlotOptions().setMarker(new Marker().setEnabled(false).setHoverState(
new Marker().setEnabled(true).setRadius(5))));
powerChart.setSeriesPlotOptions(new SeriesPlotOptions().setDataGrouping(new DataGrouping().setEnabled(true)));
powerChart.getXAxis().setType(Axis.Type.DATE_TIME);
powerChart.getXAxis().setAxisTitleText("Date");
powerChart.getYAxis(0).setType(Axis.Type.LINEAR);
powerChart.getYAxis(0).setAxisTitleText("Total");
powerChart.getYAxis(0).setMinorTickIntervalAuto();
powerChart.getYAxis(0).setGridLineWidth(2);
powerChart.getYAxis(1).setType(Axis.Type.LINEAR);
powerChart.getYAxis(1).setAxisTitleText("Shares");
powerChart.getYAxis(1).setMinorTickIntervalAuto();
powerChart.getYAxis(1).setGridLineWidth(2);
powerChart.getYAxis(1).setOpposite(true);
acceptedMHSeries = powerChart.createSeries();
acceptedMHSeries.setType(Series.Type.AREA);
acceptedMHSeries.setName("Total");
acceptedMHSeries.setStack("mhs");
acceptedMHSeries.setYAxis(0);
acceptedMHSeries.setPlotOptions(new AreaPlotOptions().setShadow(false).setHoverStateLineWidth(2).setColor(new Color(0, 170, 0, 0.5))
.setFillOpacity(0.5));
powerChart.addSeries(acceptedMHSeries);
final DateTimeFormat dtf = DateTimeFormat.getFormat("EEE d MMM HH:mm:ss");
powerChart.setToolTip(new ToolTip().setFormatter(new ToolTipFormatter() {
public String format(ToolTipData toolTipData) {
String result = "";
AddressStatsDTO stat = getStatsFromDate(toolTipData.getXAsLong());
if (stat != null) {
result = "<b>Total MH/s:</b> " + formatPowerValue(stat.getMegaHashesPerSeconds());
if (stat.getWorkerStats() != null) {
for (WorkerStatsDTO workerStats : stat.getWorkerStats()) {
if (workerStats.getStaleRate() > WARNING_STALERATE_THRESHOLD || workerStats.getHashrate() < WARNING_HASHRATE_THRESHOLD) {
result += "<span style=\"color: red;\">";
}
result += "<br/><b>" + formatUsername(workerStats.getUsername()) + "</b>: " + formatPowerValue(workerStats.getHashrate())
+ "MH/s, " + workerStats.getStaleRate() + "% Staled";
if (workerStats.getStaleRate() > WARNING_STALERATE_THRESHOLD || workerStats.getHashrate() < WARNING_HASHRATE_THRESHOLD) {
result += "</span>";
}
}
}
result += "<br/><b>Date:</b> " + dtf.format(stat.getRefreshTime());
}
return result;
}
}).setFollowPointer(true).setShadow(false).setUseHTML(true));
contentPanel.addResizeHandler(new ResizeHandler() {
public void onResize(ResizeEvent event) {
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
public void execute() {
powerChart.setSizeToMatchContainer();
}
});
}
});
}
示例13: 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;
}
示例14: getDayDateTimeFormat
import com.google.gwt.i18n.shared.DateTimeFormat; //导入方法依赖的package包/类
public DateTimeFormat getDayDateTimeFormat() {
if (dayDateTimeFormat == null) {
dayDateTimeFormat = DateTimeFormat.getFormat("d");
}
return dayDateTimeFormat;
}
示例15: initPowerChart
import com.google.gwt.i18n.shared.DateTimeFormat; //导入方法依赖的package包/类
private void initPowerChart() {
powerChart = new Chart();
powerChart.setChartTitleText("Power");
powerChart.setHeight(350);
powerChart.setZoomType(BaseChart.ZoomType.X);
powerChart.setShadow(false);
powerChart.setAnimation(false);
powerChart.setOption("/plotOptions/series/turboThreshold", 10);
powerChart.setAreaPlotOptions(new AreaPlotOptions().setStacking(Stacking.NORMAL).setMarker(
new Marker().setEnabled(false).setHoverState(new Marker().setEnabled(true).setRadius(5))));
powerChart.setSeriesPlotOptions(new SeriesPlotOptions().setDataGrouping(new DataGrouping().setEnabled(true)));
powerChart.setLinePlotOptions(new LinePlotOptions().setOption("turboThreshold", 10).setMarker(
new Marker().setEnabled(false).setHoverState(new Marker().setEnabled(true).setRadius(5))));
powerChart.getXAxis().setType(Axis.Type.DATE_TIME);
powerChart.getXAxis().setAxisTitleText("Date");
powerChart.getYAxis(0).setType(Axis.Type.LINEAR);
powerChart.getYAxis(0).setAxisTitleText("MH/s");
powerChart.getYAxis(0).setMinorTickIntervalAuto();
powerChart.getYAxis(0).setGridLineWidth(2);
powerChart.getYAxis(1).setType(Axis.Type.LINEAR);
powerChart.getYAxis(1).setAxisTitleText("Miners");
powerChart.getYAxis(1).setMinorTickIntervalAuto();
powerChart.getYAxis(1).setOpposite(true);
powerChart.getYAxis(1).setGridLineWidth(2);
acceptedMHSeries = powerChart.createSeries();
acceptedMHSeries.setType(Series.Type.AREA);
acceptedMHSeries.setName("MH/s");
acceptedMHSeries.setStack("mhs");
acceptedMHSeries.setYAxis(0);
acceptedMHSeries.setPlotOptions(new AreaPlotOptions().setShadow(false).setHoverStateLineWidth(2).setColor(new Color(0, 170, 0, 0.5))
.setFillOpacity(0.5));
powerChart.addSeries(acceptedMHSeries);
nbOfMinersSeries = powerChart.createSeries();
nbOfMinersSeries.setType(Series.Type.LINE);
nbOfMinersSeries.setName("Number of miners");
nbOfMinersSeries.setStack("miners");
nbOfMinersSeries.setYAxis(1);
nbOfMinersSeries.setPlotOptions(new LinePlotOptions().setShadow(false).setHoverStateLineWidth(2).setColor(new Color(240, 0, 0, 0.5))
.setMarker(new Marker().setEnabled(false).setHoverState(new Marker().setEnabled(true).setRadius(5))));
powerChart.addSeries(nbOfMinersSeries);
final DateTimeFormat dtf = DateTimeFormat.getFormat("EEE d MMM HH:mm:ss");
powerChart.setToolTip(new ToolTip().setFormatter(new ToolTipFormatter() {
public String format(ToolTipData toolTipData) {
String result = "";
GlobalStatsDTO stat = getStatsFromDate(toolTipData.getXAsLong());
if (stat != null) {
result = "<b>MH/s:</b> " + formatPowerValue(stat.getTotalMegahashesPerSecond());
result += "<br/><b>Number of miners:</b> " + stat.getNbMiners();
result += "<br/><b>Date:</b> " + dtf.format(stat.getRefreshTime());
}
return result;
}
}).setFollowPointer(true).setShadow(false).setUseHTML(true));
contentPanel.addResizeHandler(new ResizeHandler() {
public void onResize(ResizeEvent event) {
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
public void execute() {
powerChart.setSizeToMatchContainer();
}
});
}
});
}