List of usage examples for com.google.gwt.user.client.ui DialogBox getText
public String getText()
From source file:com.google.caliper.cloud.client.BenchmarkDataViewer.java
License:Apache License
public void rebuildResultsTable() { if (plainText) { Label label = new Label(); label.setStyleName("plaintext"); label.setText(gridToString(toGrid())); resultsDiv.clear();//from w w w . j a v a2 s . co m resultsDiv.add(label); resultsDiv.add(new PlainTextEditor().getWidget()); HTML dash = new HTML(" - ", false); dash.setStyleName("inline"); resultsDiv.add(dash); resultsDiv.add(new SnapshotCreator().getWidget()); return; } FlexTable table = new FlexTable(); table.setStyleName("data"); int r = 0; int c = 0; int evenRowMod = 0; // results header #1: cValue variables if (cVariable != null) { evenRowMod = 1; table.insertRow(r); table.getRowFormatter().setStyleName(r, "valueRow"); table.getRowFormatter().addStyleName(r, "headerRow"); table.addCell(r); table.getFlexCellFormatter().setColSpan(r, 0, rVariables.size()); c++; for (Value cValue : cValues) { table.addCell(r); table.getFlexCellFormatter().setColSpan(r, c, 3); table.getCellFormatter().setStyleName(r, c, "parameterKey"); Widget contents = newVariableLabel(cVariable, cValue.getLabel(), rVariables.size()); contents.setStyleName("valueHeader"); table.setWidget(r, c++, contents); } r++; } // results header 2: rValue variables, followed by "nanos/barchart" column pairs c = 0; table.insertRow(r); table.getRowFormatter().setStyleName(r, "evenRow"); table.getRowFormatter().addStyleName(r, "headerRow"); for (Variable variable : rVariables) { table.addCell(r); table.getCellFormatter().setStyleName(r, c, "parameterKey"); table.setWidget(r, c, newVariableLabel(variable, variable.getName(), c)); c++; } for (Value unused : cValues) { table.addCell(r); table.getCellFormatter().setStyleName(r, c, "parameterKey"); table.setWidget(r, c++, newUnitLabel(unitMap.get(selectedType).trim())); table.addCell(r); table.getCellFormatter().setStyleName(r, c, "parameterKey"); table.setWidget(r, c++, newRuntimeLabel()); table.addCell(r); table.getCellFormatter().setStyleName(r, c, "parameterKey"); table.setWidget(r, c++, new InlineLabel("%")); } r++; Key key = newDefaultKey(); for (RowsIterator rows = new RowsIterator(rVariables); rows.nextRow();) { rows.updateKey(key); table.insertRow(r); table.getRowFormatter().setStyleName(r, r % 2 == evenRowMod ? "evenRow" : "oddRow"); c = 0; for (int v = 0, size = rVariables.size(); v < size; v++) { table.addCell(r); table.setWidget(r, c++, new Label(rows.getRValue(v).getLabel())); } for (Value value : cValues) { table.addCell(r); table.addCell(r); if (cVariable != null) { key.set(cVariable, value); } final Datapoint datapoint = keysToDatapoints.get(key); table.getCellFormatter().setStyleName(r, c, "numericCell"); table.getCellFormatter().setStyleName(r, c + 1, "bar"); table.getCellFormatter().setStyleName(r, c + 2, "numericCell"); MeasurementSet measurementSet; if (datapoint != null && (measurementSet = datapoint.scenarioResults.getMeasurementSet(selectedType)) != null) { double rawMedian = getMedian(selectedType, measurementSet); String displayedValue = numberFormatMap.get(selectedType) .format(rawMedian / divideByMap.get(selectedType)); Anchor valueAnchor = new Anchor(displayedValue, false); valueAnchor.setStyleName("subtleLink"); valueAnchor.setStyleName("nanos", true); final DialogBox eventLogPopup = new DialogBox(true); eventLogPopup.setText(""); valueAnchor.addClickHandler(new ClickHandler() { public void onClick(ClickEvent clickEvent) { // Do this lazily since it takes quite a bit of time to render these popups for all // the scenarios shown, and quite often they won't even be used. if (eventLogPopup.getText().isEmpty()) { eventLogPopup.setText("Event Log"); String eventLog = datapoint.scenarioResults.getEventLog(selectedType); if (eventLog == null || eventLog.isEmpty()) { eventLog = "No event log recorded."; } FlowPanel panel = new FlowPanel(); for (String line : eventLog.split("\n")) { panel.add(new Label(line)); } panel.setStyleName("eventLog"); eventLogPopup.add(panel); } eventLogPopup.center(); eventLogPopup.show(); } }); table.setWidget(r, c, valueAnchor); table.setWidget(r, c + 1, newBar(datapoint.style, measurementSet, value)); table.setWidget(r, c + 2, newPercentOfReferencePointLabel(rawMedian, value)); } else { table.setWidget(r, c, new Label("")); table.setWidget(r, c + 1, new Label("")); table.setWidget(r, c + 2, new Label("")); } c += 3; } r++; } resultsDiv.clear(); resultsDiv.add(table); resultsDiv.add(new PlainTextEditor().getWidget()); HTML dash = new HTML(" - ", false); dash.setStyleName("inline"); resultsDiv.add(dash); resultsDiv.add(new SnapshotCreator().getWidget()); }