List of usage examples for com.google.gwt.user.client.ui Label getText
public String getText()
From source file:org.sonar.plugins.design.ui.page.client.Dsm.java
License:Open Source License
private boolean hasWeight(Label label) { return label.getText().length() > 0; }
From source file:org.thechiselgroup.biomixer.client.core.resources.ui.popup.ResourceSetAvatarPopupWidgetFactory.java
License:Apache License
private void addHeader(VerticalPanel panel) { if (headerUpdatedHandler == null) { Label header = new Label(headerText); header.addStyleName(CSS_POPUP_CONTENT_HEADER); panel.add(header);/*from ww w . jav a 2 s. com*/ } else { final TextBox header = new TextBox(); header.setText(headerText); header.setMaxLength(20); // TODO change to resizable text box header.addStyleName(CSS_POPUP_CONTENT_HEADER); header.addKeyUpHandler(new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { headerUpdatedHandler.headerLabelChanged(header.getText()); } }); header.addBlurHandler(new BlurHandler() { @Override public void onBlur(BlurEvent event) { headerUpdatedHandler.headerLabelChanged(header.getText()); } }); panel.add(header); } Label subheader = new Label(subHeaderText); subheader.addStyleName(CSS_POPUP_CONTENT_SUBHEADER); panel.add(subheader); }
From source file:pl.balon.gwt.diagramsexample.client.examples.DiagramBuilderExample.java
License:Apache License
protected UIObjectConnector createConnector(Label proxy, AbsolutePanel panel) { Label l = new Label(proxy.getText()) { public void onBrowserEvent(Event event) { if (DOM.eventGetType(event) == Event.ONCLICK && DOM.eventGetCtrlKey(event)) { select(this); }/* w w w . j av a 2 s .c om*/ super.onBrowserEvent(event); } }; l.sinkEvents(Event.ONCLICK); l.setPixelSize(proxy.getOffsetWidth(), proxy.getOffsetHeight()); l.addStyleName("example-connector"); panel.add(l, proxy.getAbsoluteLeft() - panel.getAbsoluteLeft(), proxy.getAbsoluteTop() - panel.getAbsoluteTop()); dragController.makeDraggable(l); Direction direction = null; if ("T".equals(l.getText())) { direction = Direction.UP; } else if ("L".equals(l.getText())) { direction = Direction.LEFT; } else if ("B".equals(l.getText())) { direction = Direction.DOWN; } else if ("R".equals(l.getText())) { direction = Direction.RIGHT; } if (direction != null) { return UIObjectConnector.wrap(l, new Direction[] { direction }); } return UIObjectConnector.wrap(l); }
From source file:scrum.client.test.DndTestWidget.java
License:Open Source License
public DndTestWidget() { AbsolutePanel dndPanel = new AbsolutePanel(); dndPanel.setPixelSize(400, 400);/* w w w . jav a2 s. co m*/ final Composite drag = new DragComposite(); final Label drop = new Label("drop"); PickupDragController dragController = new PickupDragController(RootPanel.get(), true); dragController.setBehaviorDragProxy(true); dragController.setBehaviorConstrainedToBoundaryPanel(false); dragController.setBehaviorMultipleSelection(true); DropController dropController = new DropController() { public Widget getDropTarget() { return drop; } public void onDrop(DragContext context) { drop.setText(drop.getText() + "."); } public void onEnter(DragContext context) { } public void onLeave(DragContext context) { } public void onMove(DragContext context) { } public void onPreviewDrop(DragContext context) throws VetoDragException { } }; dragController.registerDropController(dropController); dragController.makeDraggable(drag); dndPanel.add(drag); dndPanel.add(drop); initWidget(dndPanel); }
From source file:strat.mining.multipool.stats.client.mvp.view.coinshift.component.AddressChartPanel.java
License:Open Source License
public Widget createLastStatsPanel(AddressStatsDTO lastStats) { // Remove the last panel if (lastStatsPanel != null) { contentPanel.remove(lastStatsPanel); }/* w w w. j a va 2 s . co m*/ lastStatsPanel = new HorizontalLayoutContainer(); HtmlLayoutContainerTemplate templates = GWT.create(HtmlLayoutContainerTemplate.class); HtmlLayoutContainer htmlLayout = new HtmlLayoutContainer(templates.getTemplate()); 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("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.getRejectedMegaHashesPerSeconds()) * 100F) / (lastStats.getRejectedMegaHashesPerSeconds() + lastStats.getMegaHashesPerSeconds()))); } Label balanceValue = new Label(lastStats != null ? formatBTCValue(lastStats.getBalance()) : ""); Label unexchangedValue = new Label(lastStats != null ? formatBTCValue(lastStats.getUnexchanged()) : ""); paidoutAnchor = new Anchor(lastStats != null ? formatBTCValue(lastStats.getPaidOut()) : ""); Label totalValue = new Label( lastStats != null ? formatBTCValue(lastStats.getBalance() + lastStats.getUnexchanged()) : ""); Label acceptedMegaHashValue = new Label( lastStats != null ? formatPowerValue(lastStats.getMegaHashesPerSeconds()) : ""); Label rejectedMegaHashValue = new Label( lastStats != null ? formatPowerValue(lastStats.getRejectedMegaHashesPerSeconds()) : ""); Label totalMegaHashValue = new Label( lastStats != null ? formatPowerValue( (lastStats.getMegaHashesPerSeconds() + lastStats.getRejectedMegaHashesPerSeconds())) : ""); Label percentRejectedMegaHashValue = new Label(lastStats != null ? rejectedMHPercentValueString : ""); Label lastUpdateTimeValue = new Label(lastStats != null ? dtf.format(lastStats.getRefreshTime()) : ""); htmlLayout.add(balanceLabel, new HtmlData(".label1")); htmlLayout.add(unexchangedLabel, new HtmlData(".label2")); htmlLayout.add(totalLabel, new HtmlData(".label3")); htmlLayout.add(paidoutLabel, new HtmlData(".label4")); htmlLayout.add(acceptedMegaHashLabel, new HtmlData(".label5")); htmlLayout.add(rejectedMegaHashLabel, new HtmlData(".label6")); htmlLayout.add(totalMegaHashLabel, new HtmlData(".label7")); htmlLayout.add(percentRejectedMegaHashLabel, new HtmlData(".label8")); htmlLayout.add(lastUpdateTimeLabel, new HtmlData(".label9")); htmlLayout.add(balanceValue, new HtmlData(".value1")); htmlLayout.add(unexchangedValue, new HtmlData(".value2")); htmlLayout.add(totalValue, new HtmlData(".value3")); htmlLayout.add(paidoutAnchor, new HtmlData(".value4")); htmlLayout.add(acceptedMegaHashValue, new HtmlData(".value5")); htmlLayout.add(rejectedMegaHashValue, new HtmlData(".value6")); htmlLayout.add(totalMegaHashValue, new HtmlData(".value7")); htmlLayout.add(percentRejectedMegaHashValue, new HtmlData(".value8")); htmlLayout.add(lastUpdateTimeValue, new HtmlData(".value9")); lastStatsPanel.add(htmlLayout, new HorizontalLayoutData(650, 100, new Margins(5, 0, 5, 10))); 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>" + paidoutAnchor.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); htmlLayout.setToolTipConfig(config); return lastStatsPanel; }
From source file:strat.mining.multipool.stats.client.mvp.view.coinshift.component.GlobalChartPanel.java
License:Open Source License
public Widget createLastStatsPanel(GlobalStatsDTO lastStats) { HtmlLayoutContainerTemplate templates = GWT.create(HtmlLayoutContainerTemplate.class); // Remove the last panel if (lastStatsPanel != null) { contentPanel.remove(lastStatsPanel); }/*from ww w . ja va 2 s. com*/ 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; }
From source file:strat.mining.multipool.stats.client.mvp.view.coinsolver.component.AddressChartPanel.java
License:Open Source License
public Widget createLastStatsPanel(AddressStatsDTO lastStats) { HtmlLayoutContainerTemplate templates = GWT.create(HtmlLayoutContainerTemplate.class); // Remove the last panel if (lastStatsPanel != null) { contentPanel.remove(lastStatsPanel); }//from ww w .j ava 2 s. c o m 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; }
From source file:strat.mining.multipool.stats.client.mvp.view.coinsolver.component.GlobalChartPanel.java
License:Open Source License
public Widget createLastStatsPanel(GlobalStatsDTO lastStats) { HtmlLayoutContainerTemplate templates = GWT.create(HtmlLayoutContainerTemplate.class); // Remove the last panel if (lastStatsPanel != null) { contentPanel.remove(lastStatsPanel); }/* ww w . j av a 2s . co m*/ 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; }
From source file:strat.mining.multipool.stats.client.mvp.view.middlecoin.component.AddressChartPanel.java
License:Open Source License
public Widget createLastStatsPanel(AddressStatsDTO lastStats) { HtmlLayoutContainerTemplate templates = GWT.create(HtmlLayoutContainerTemplate.class); // Remove the last panel if (lastStatsPanel != null) { contentPanel.remove(lastStatsPanel); }/*from w ww . j a va 2 s. c om*/ 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("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 acceptedSharesLabel = new Label("Accepted shares: "); Label rejectedSharesLabel = new Label("Rejected shares: "); Label totalSharesLabel = new Label("Total shares: "); Label percentRejectedSharesLabel = new Label("% of rejected shares: "); Label lastUpdateTimeLabel = new Label("Last update: "); // Values calcul NumberFormat nf = NumberFormat.getFormat("#.##"); String rejectedMHPercentValueString = ""; if (lastStats != null) { rejectedMHPercentValueString = nf.format((((lastStats.getRejectedMegaHashesPerSeconds()) * 100F) / (lastStats.getRejectedMegaHashesPerSeconds() + lastStats.getMegaHashesPerSeconds()))); } String rejectedSharePercentValueString = ""; if (lastStats != null) { rejectedSharePercentValueString = nf.format(((((float) lastStats.getLastHourRejectedShares()) * 100F) / ((float) lastStats.getLastHourRejectedShares() + (float) lastStats.getLastHourShares()))); } // 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 totalValue = new Label(lastStats != null ? formatBTCValue(lastStats.getBalance() + lastStats.getUnexchanged() + lastStats.getImmature()) : ""); Label acceptedMegaHashValue = new Label( lastStats != null ? formatPowerValue(lastStats.getMegaHashesPerSeconds()) : ""); Label rejectedMegaHashValue = new Label( lastStats != null ? formatPowerValue(lastStats.getRejectedMegaHashesPerSeconds()) : ""); Label totalMegaHashValue = new Label( lastStats != null ? formatPowerValue( (lastStats.getMegaHashesPerSeconds() + lastStats.getRejectedMegaHashesPerSeconds())) : ""); Label percentRejectedMegaHashValue = new Label(lastStats != null ? rejectedMHPercentValueString : ""); Label acceptedSharesValue = new Label(lastStats != null ? lastStats.getLastHourShares().toString() : ""); Label rejectedSharesValue = new Label( lastStats != null ? lastStats.getLastHourRejectedShares().toString() : ""); Label totalSharesValue = new Label(lastStats != null ? Integer.toString((lastStats.getLastHourShares() + lastStats.getLastHourRejectedShares())) : ""); Label percentRejectedSharesValue = new Label(rejectedSharePercentValueString); 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(rejectedMegaHashLabel, new HtmlData(".label7")); lastStatsPanel.add(totalMegaHashLabel, new HtmlData(".label8")); lastStatsPanel.add(percentRejectedMegaHashLabel, new HtmlData(".label9")); lastStatsPanel.add(acceptedSharesLabel, new HtmlData(".label11")); lastStatsPanel.add(rejectedSharesLabel, new HtmlData(".label12")); lastStatsPanel.add(totalSharesLabel, new HtmlData(".label13")); lastStatsPanel.add(percentRejectedSharesLabel, new HtmlData(".label14")); lastStatsPanel.add(lastUpdateTimeLabel, new HtmlData(".label16")); 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(paidoutAnchor, new HtmlData(".value5")); 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(acceptedSharesValue, new HtmlData(".value11")); lastStatsPanel.add(rejectedSharesValue, new HtmlData(".value12")); lastStatsPanel.add(totalSharesValue, new HtmlData(".value13")); lastStatsPanel.add(percentRejectedSharesValue, new HtmlData(".value14")); lastStatsPanel.add(lastUpdateTimeValue, new HtmlData(".value16")); 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>" + rejectedMegaHashLabel.getText() + "</b>" + rejectedMegaHashValue.getText(); tooltip += "<br/><b>" + totalMegaHashLabel.getText() + "</b>" + totalMegaHashValue.getText(); tooltip += "<br/><b>" + percentRejectedMegaHashLabel.getText() + "</b>" + percentRejectedMegaHashValue.getText(); tooltip += "<br/><b>" + acceptedSharesLabel.getText() + "</b>" + acceptedSharesValue.getText(); tooltip += "<br/><b>" + rejectedSharesLabel.getText() + "</b>" + rejectedSharesValue.getText(); tooltip += "<br/><b>" + totalSharesLabel.getText() + "</b>" + totalSharesValue.getText(); tooltip += "<br/><b>" + percentRejectedSharesLabel.getText() + "</b>" + percentRejectedSharesValue.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; }
From source file:strat.mining.multipool.stats.client.mvp.view.middlecoin.component.GlobalChartPanel.java
License:Open Source License
public Widget createLastStatsPanel(GlobalStatsDTO lastStats, GlobalAggregatedStats aggregatedStats) { HtmlLayoutContainerTemplate templates = GWT.create(HtmlLayoutContainerTemplate.class); // Remove the last panel if (lastStatsPanel != null) { contentPanel.remove(lastStatsPanel); }/*from w w w. ja va2s . c om*/ 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 immatureLabel = new Label("Immature: "); Label totalLabel = new Label("Total: "); Label paidoutLabel = new Label("Paid out: "); 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 balanceDailyEarningByMHLabel = new // Label("Balance BTC/Day/MH/s: "); // Label totalDailyEarningByMHLabel = new Label("Total BTC/Day/MH/s: "); Label lastUpdateTimeLabel = new Label("Last update: "); // Values calcul NumberFormat nf = NumberFormat.getFormat("#.##"); String rejectedMHPercentValueString = ""; if (lastStats != null) { rejectedMHPercentValueString = nf.format((((lastStats.getTotalRejectedMegahashesPerSecond()) * 100F) / (lastStats.getTotalRejectedMegahashesPerSecond() + lastStats.getTotalMegahashesPerSecond()))); } // Values label Label balanceValue = new Label(lastStats != null ? formatBTCValue(lastStats.getTotalBalance()) : ""); Label unexchangedValue = new Label( lastStats != null ? formatBTCValue(lastStats.getTotalUnexchangedBalance()) : ""); Label immatureValue = new Label( lastStats != null ? formatBTCValue(lastStats.getTotalImmatureBalance()) : ""); Label paidoutValue = new Label(lastStats != null ? formatBTCValue(lastStats.getTotalPaidOut()) : ""); Label totalValue = new Label(lastStats != null ? formatBTCValue(lastStats.getTotalBalance() + lastStats.getTotalUnexchangedBalance() + lastStats.getTotalImmatureBalance()) : ""); 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 balanceDailyEarningByMHValue = new // Label(aggregatedStats.getEarningByMHBalance().size() > 0 ? // formatBTCValue(aggregatedStats // .getEarningByMHBalance().get(aggregatedStats.getEarningByMHBalance().size() // - 1).getRight()) : ""); // Label totalDailyEarningByMHValue = new // Label(aggregatedStats.getEarningByMHTotal().size() > 0 ? // formatBTCValue(aggregatedStats // .getEarningByMHTotal().get(aggregatedStats.getEarningByMHTotal().size() // - 1).getRight()) : ""); 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(rejectedMegaHashLabel, new HtmlData(".label7")); lastStatsPanel.add(totalMegaHashLabel, new HtmlData(".label8")); lastStatsPanel.add(percentRejectedMegaHashLabel, new HtmlData(".label9")); lastStatsPanel.add(lastUpdateTimeLabel, new HtmlData(".label11")); // lastStatsPanel.add(balanceDailyEarningByMHLabel, new // HtmlData(".label11")); // lastStatsPanel.add(totalDailyEarningByMHLabel, new // HtmlData(".label12")); // lastStatsPanel.add(lastUpdateTimeLabel, new HtmlData(".label13")); 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(paidoutValue, new HtmlData(".value5")); 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")); // lastStatsPanel.add(balanceDailyEarningByMHValue, new // HtmlData(".value11")); // lastStatsPanel.add(totalDailyEarningByMHValue, new // HtmlData(".value12")); // lastStatsPanel.add(lastUpdateTimeValue, new HtmlData(".value13")); 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>" + paidoutValue.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>" + balanceDailyEarningByMHLabel.getText() + // "</b>" + balanceDailyEarningByMHValue.getText(); // tooltip += "<br/><b>" + totalDailyEarningByMHLabel.getText() + "</b>" // + totalDailyEarningByMHValue.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; }