1ce12f55f4530950f7fc6ddc73d1867ebb954d356showardpackage autotest.tko; 2ce12f55f4530950f7fc6ddc73d1867ebb954d356showard 3ce12f55f4530950f7fc6ddc73d1867ebb954d356showardimport autotest.common.Utils; 4e5ae165c706c465f08a732a361ea0aa5d75075eashowardimport autotest.common.ui.ExtendedListBox; 5ce12f55f4530950f7fc6ddc73d1867ebb954d356showard 60d92da0fe19a095fc5678c4159e6a1756df65e48showardimport com.google.gwt.event.dom.client.ChangeEvent; 70d92da0fe19a095fc5678c4159e6a1756df65e48showardimport com.google.gwt.event.dom.client.ChangeHandler; 8a5e4d84c9616b0a987e904d3b1d1d3fd9ca1be86showardimport com.google.gwt.event.dom.client.ClickEvent; 9a5e4d84c9616b0a987e904d3b1d1d3fd9ca1be86showardimport com.google.gwt.event.dom.client.ClickHandler; 108a7f36583afe076a7198d1b34fe109aa491dc277jamesrenimport com.google.gwt.user.client.ui.Anchor; 11ce12f55f4530950f7fc6ddc73d1867ebb954d356showardimport com.google.gwt.user.client.ui.CheckBox; 12ce12f55f4530950f7fc6ddc73d1867ebb954d356showardimport com.google.gwt.user.client.ui.Composite; 13ce12f55f4530950f7fc6ddc73d1867ebb954d356showardimport com.google.gwt.user.client.ui.FlexTable; 14ce12f55f4530950f7fc6ddc73d1867ebb954d356showardimport com.google.gwt.user.client.ui.HasHorizontalAlignment; 15ce12f55f4530950f7fc6ddc73d1867ebb954d356showardimport com.google.gwt.user.client.ui.HasVerticalAlignment; 16ce12f55f4530950f7fc6ddc73d1867ebb954d356showardimport com.google.gwt.user.client.ui.HorizontalPanel; 17ce12f55f4530950f7fc6ddc73d1867ebb954d356showardimport com.google.gwt.user.client.ui.Panel; 18ce12f55f4530950f7fc6ddc73d1867ebb954d356showardimport com.google.gwt.user.client.ui.TextBox; 19ce12f55f4530950f7fc6ddc73d1867ebb954d356showardimport com.google.gwt.user.client.ui.Widget; 20ce12f55f4530950f7fc6ddc73d1867ebb954d356showard 21ce12f55f4530950f7fc6ddc73d1867ebb954d356showardimport java.util.ArrayList; 22e5ae165c706c465f08a732a361ea0aa5d75075eashowardimport java.util.Collections; 23ce12f55f4530950f7fc6ddc73d1867ebb954d356showardimport java.util.HashSet; 24ce12f55f4530950f7fc6ddc73d1867ebb954d356showardimport java.util.List; 25ce12f55f4530950f7fc6ddc73d1867ebb954d356showardimport java.util.Map; 26ce12f55f4530950f7fc6ddc73d1867ebb954d356showardimport java.util.Set; 27ce12f55f4530950f7fc6ddc73d1867ebb954d356showard 28ce12f55f4530950f7fc6ddc73d1867ebb954d356showardpublic class SeriesSelector extends Composite { 298a7f36583afe076a7198d1b34fe109aa491dc277jamesren 30ce12f55f4530950f7fc6ddc73d1867ebb954d356showard private FlexTable table = new FlexTable(); 31ce12f55f4530950f7fc6ddc73d1867ebb954d356showard private ArrayList<Series> series = new ArrayList<Series>(); 328a7f36583afe076a7198d1b34fe109aa491dc277jamesren private Anchor addLink = new Anchor("[Add Series]"); 33ce12f55f4530950f7fc6ddc73d1867ebb954d356showard private boolean enabled = true; 34ce12f55f4530950f7fc6ddc73d1867ebb954d356showard private boolean invertible = false; 350d92da0fe19a095fc5678c4159e6a1756df65e48showard private final ChangeHandler handler; 368a7f36583afe076a7198d1b34fe109aa491dc277jamesren 37ce12f55f4530950f7fc6ddc73d1867ebb954d356showard public class Series extends Composite { 388a7f36583afe076a7198d1b34fe109aa491dc277jamesren 39ce12f55f4530950f7fc6ddc73d1867ebb954d356showard private FlexTable seriesTable = new FlexTable(); 40ce12f55f4530950f7fc6ddc73d1867ebb954d356showard private TextBox name = new TextBox(); 41ce12f55f4530950f7fc6ddc73d1867ebb954d356showard private CheckBox invert = new CheckBox("Invert y-axis"); 42e5ae165c706c465f08a732a361ea0aa5d75075eashoward private ExtendedListBox values = new DBColumnSelector(DBColumnSelector.PERF_VIEW); 43e5ae165c706c465f08a732a361ea0aa5d75075eashoward private ExtendedListBox aggregation = new ExtendedListBox(); 44ce12f55f4530950f7fc6ddc73d1867ebb954d356showard private CheckBox errorBars = new CheckBox(); 45ce12f55f4530950f7fc6ddc73d1867ebb954d356showard private FilterSelector filter = new FilterSelector(DBColumnSelector.PERF_VIEW); 468a7f36583afe076a7198d1b34fe109aa491dc277jamesren private Anchor deleteLink = new Anchor("Delete Series"); 47ce12f55f4530950f7fc6ddc73d1867ebb954d356showard private int row; 488a7f36583afe076a7198d1b34fe109aa491dc277jamesren 49ce12f55f4530950f7fc6ddc73d1867ebb954d356showard private Series(int aRow) { 50ce12f55f4530950f7fc6ddc73d1867ebb954d356showard this.row = aRow; 51a5e4d84c9616b0a987e904d3b1d1d3fd9ca1be86showard deleteLink.addClickHandler(new ClickHandler() { 52a5e4d84c9616b0a987e904d3b1d1d3fd9ca1be86showard public void onClick(ClickEvent event) { 53ce12f55f4530950f7fc6ddc73d1867ebb954d356showard if (enabled) { 54ce12f55f4530950f7fc6ddc73d1867ebb954d356showard deleteSeries(row); 55ce12f55f4530950f7fc6ddc73d1867ebb954d356showard } 56ce12f55f4530950f7fc6ddc73d1867ebb954d356showard } 57ce12f55f4530950f7fc6ddc73d1867ebb954d356showard }); 588a7f36583afe076a7198d1b34fe109aa491dc277jamesren 590d92da0fe19a095fc5678c4159e6a1756df65e48showard name.addChangeHandler(handler); 608a7f36583afe076a7198d1b34fe109aa491dc277jamesren 61ce12f55f4530950f7fc6ddc73d1867ebb954d356showard aggregation.addItem("AVG", "AVG("); 62ce12f55f4530950f7fc6ddc73d1867ebb954d356showard aggregation.addItem("COUNT (DISTINCT)", "COUNT(DISTINCT "); 63ce12f55f4530950f7fc6ddc73d1867ebb954d356showard aggregation.addItem("MIN", "MIN("); 64ce12f55f4530950f7fc6ddc73d1867ebb954d356showard aggregation.addItem("MAX", "MAX("); 65e5ae165c706c465f08a732a361ea0aa5d75075eashoward aggregation.setSelectedIndex(0); 660d92da0fe19a095fc5678c4159e6a1756df65e48showard aggregation.addChangeHandler(new ChangeHandler() { 670d92da0fe19a095fc5678c4159e6a1756df65e48showard public void onChange(ChangeEvent event) { 68e5ae165c706c465f08a732a361ea0aa5d75075eashoward if (getAggregation().equals("AVG(")) { 69ce12f55f4530950f7fc6ddc73d1867ebb954d356showard errorBars.setEnabled(true); 70ce12f55f4530950f7fc6ddc73d1867ebb954d356showard } else { 71ce12f55f4530950f7fc6ddc73d1867ebb954d356showard errorBars.setEnabled(false); 727f2b0e15c5928ea2914d078e385ca717d078c6d5showard errorBars.setValue(false); 73ce12f55f4530950f7fc6ddc73d1867ebb954d356showard } 74ce12f55f4530950f7fc6ddc73d1867ebb954d356showard } 75ce12f55f4530950f7fc6ddc73d1867ebb954d356showard }); 768a7f36583afe076a7198d1b34fe109aa491dc277jamesren 77ce12f55f4530950f7fc6ddc73d1867ebb954d356showard errorBars.setText("error bars"); 788a7f36583afe076a7198d1b34fe109aa491dc277jamesren 79ce12f55f4530950f7fc6ddc73d1867ebb954d356showard Panel aggregationPanel = new HorizontalPanel(); 80ce12f55f4530950f7fc6ddc73d1867ebb954d356showard aggregationPanel.add(aggregation); 81ce12f55f4530950f7fc6ddc73d1867ebb954d356showard aggregationPanel.add(errorBars); 828a7f36583afe076a7198d1b34fe109aa491dc277jamesren 83ce12f55f4530950f7fc6ddc73d1867ebb954d356showard addControl("Name:", name); 84ce12f55f4530950f7fc6ddc73d1867ebb954d356showard addControl("Values:", values); 85ce12f55f4530950f7fc6ddc73d1867ebb954d356showard addControl("Aggregation:", aggregationPanel); 86ce12f55f4530950f7fc6ddc73d1867ebb954d356showard addControl("Filters:", filter); 87ce12f55f4530950f7fc6ddc73d1867ebb954d356showard seriesTable.getFlexCellFormatter().setVerticalAlignment( 88ce12f55f4530950f7fc6ddc73d1867ebb954d356showard seriesTable.getRowCount() - 1, 0, HasVerticalAlignment.ALIGN_TOP); 898a7f36583afe076a7198d1b34fe109aa491dc277jamesren 90ce12f55f4530950f7fc6ddc73d1867ebb954d356showard seriesTable.setWidget(seriesTable.getRowCount() - 1, 2, deleteLink); 91ce12f55f4530950f7fc6ddc73d1867ebb954d356showard seriesTable.getFlexCellFormatter().setHorizontalAlignment( 92ce12f55f4530950f7fc6ddc73d1867ebb954d356showard seriesTable.getRowCount() - 1, 2, HasHorizontalAlignment.ALIGN_RIGHT); 93ce12f55f4530950f7fc6ddc73d1867ebb954d356showard seriesTable.getFlexCellFormatter().setVerticalAlignment( 94ce12f55f4530950f7fc6ddc73d1867ebb954d356showard seriesTable.getRowCount() - 1, 2, HasVerticalAlignment.ALIGN_BOTTOM); 958a7f36583afe076a7198d1b34fe109aa491dc277jamesren 96ce12f55f4530950f7fc6ddc73d1867ebb954d356showard seriesTable.setWidget(0, 2, invert); 97ce12f55f4530950f7fc6ddc73d1867ebb954d356showard seriesTable.getFlexCellFormatter().setHorizontalAlignment( 98ce12f55f4530950f7fc6ddc73d1867ebb954d356showard 0, 2, HasHorizontalAlignment.ALIGN_RIGHT); 998a7f36583afe076a7198d1b34fe109aa491dc277jamesren 100ce12f55f4530950f7fc6ddc73d1867ebb954d356showard initWidget(seriesTable); 101ce12f55f4530950f7fc6ddc73d1867ebb954d356showard } 1028a7f36583afe076a7198d1b34fe109aa491dc277jamesren 103ce12f55f4530950f7fc6ddc73d1867ebb954d356showard private void addControl(String text, Widget control) { 104e5ae165c706c465f08a732a361ea0aa5d75075eashoward TkoUtils.addControlRow(seriesTable, text, control); 105ce12f55f4530950f7fc6ddc73d1867ebb954d356showard } 1068a7f36583afe076a7198d1b34fe109aa491dc277jamesren 107ce12f55f4530950f7fc6ddc73d1867ebb954d356showard public String getAggregation() { 108e5ae165c706c465f08a732a361ea0aa5d75075eashoward return aggregation.getSelectedValue(); 109ce12f55f4530950f7fc6ddc73d1867ebb954d356showard } 1108a7f36583afe076a7198d1b34fe109aa491dc277jamesren 111e5ae165c706c465f08a732a361ea0aa5d75075eashoward public ExtendedListBox getDBColumnSelector() { 112ce12f55f4530950f7fc6ddc73d1867ebb954d356showard return values; 113ce12f55f4530950f7fc6ddc73d1867ebb954d356showard } 1148a7f36583afe076a7198d1b34fe109aa491dc277jamesren 115ce12f55f4530950f7fc6ddc73d1867ebb954d356showard public boolean wantErrorBars() { 1167f2b0e15c5928ea2914d078e385ca717d078c6d5showard return errorBars.getValue(); 117ce12f55f4530950f7fc6ddc73d1867ebb954d356showard } 1188a7f36583afe076a7198d1b34fe109aa491dc277jamesren 119ce12f55f4530950f7fc6ddc73d1867ebb954d356showard public String getName() { 120ce12f55f4530950f7fc6ddc73d1867ebb954d356showard return name.getText(); 121ce12f55f4530950f7fc6ddc73d1867ebb954d356showard } 1228a7f36583afe076a7198d1b34fe109aa491dc277jamesren 123ce12f55f4530950f7fc6ddc73d1867ebb954d356showard public String getFilterString() { 124ce12f55f4530950f7fc6ddc73d1867ebb954d356showard return filter.getFilterString(); 125ce12f55f4530950f7fc6ddc73d1867ebb954d356showard } 1268a7f36583afe076a7198d1b34fe109aa491dc277jamesren 127e5ae165c706c465f08a732a361ea0aa5d75075eashoward public void setInverted(boolean isInverted) { 1287f2b0e15c5928ea2914d078e385ca717d078c6d5showard invert.setValue(isInverted); 129e5ae165c706c465f08a732a361ea0aa5d75075eashoward } 1308a7f36583afe076a7198d1b34fe109aa491dc277jamesren 131e5ae165c706c465f08a732a361ea0aa5d75075eashoward public void addToHistory(Map<String, String> args, int index) { 132e5ae165c706c465f08a732a361ea0aa5d75075eashoward args.put(parameterString("name", index), getName()); 133e5ae165c706c465f08a732a361ea0aa5d75075eashoward args.put(parameterString("values", index), getDBColumnSelector().getSelectedValue()); 134e5ae165c706c465f08a732a361ea0aa5d75075eashoward args.put(parameterString("aggregation", index), aggregation.getSelectedName()); 135e5ae165c706c465f08a732a361ea0aa5d75075eashoward args.put(parameterString("errorBars", index), String.valueOf(wantErrorBars())); 136e5ae165c706c465f08a732a361ea0aa5d75075eashoward filter.addToHistory(args, parameterString("seriesFilters", index)); 137e5ae165c706c465f08a732a361ea0aa5d75075eashoward } 1388a7f36583afe076a7198d1b34fe109aa491dc277jamesren 139e5ae165c706c465f08a732a361ea0aa5d75075eashoward public void readHistoryArguments(Map<String, String> args, int index) { 140e5ae165c706c465f08a732a361ea0aa5d75075eashoward name.setText(args.get(parameterString("name", index))); 141e5ae165c706c465f08a732a361ea0aa5d75075eashoward 142e5ae165c706c465f08a732a361ea0aa5d75075eashoward String valueColumn = args.get(parameterString("values", index)); 143e5ae165c706c465f08a732a361ea0aa5d75075eashoward getDBColumnSelector().selectByValue(valueColumn); 144e5ae165c706c465f08a732a361ea0aa5d75075eashoward 145e5ae165c706c465f08a732a361ea0aa5d75075eashoward String aggregationString = args.get(parameterString("aggregation", index)); 146e5ae165c706c465f08a732a361ea0aa5d75075eashoward aggregation.selectByName(aggregationString); 147e5ae165c706c465f08a732a361ea0aa5d75075eashoward 1488a7f36583afe076a7198d1b34fe109aa491dc277jamesren boolean errorBarsChecked = 149e5ae165c706c465f08a732a361ea0aa5d75075eashoward Boolean.parseBoolean(args.get(parameterString("errorBars", index))); 1507f2b0e15c5928ea2914d078e385ca717d078c6d5showard errorBars.setValue(errorBarsChecked); 151e5ae165c706c465f08a732a361ea0aa5d75075eashoward 152e5ae165c706c465f08a732a361ea0aa5d75075eashoward filter.handleHistoryArguments(args, parameterString("seriesFilters", index)); 153e5ae165c706c465f08a732a361ea0aa5d75075eashoward } 154ce12f55f4530950f7fc6ddc73d1867ebb954d356showard } 1558a7f36583afe076a7198d1b34fe109aa491dc277jamesren 1560d92da0fe19a095fc5678c4159e6a1756df65e48showard public SeriesSelector(ChangeHandler handler) { 1570d92da0fe19a095fc5678c4159e6a1756df65e48showard this.handler = handler; 1588a7f36583afe076a7198d1b34fe109aa491dc277jamesren 159a5e4d84c9616b0a987e904d3b1d1d3fd9ca1be86showard addLink.addClickHandler(new ClickHandler() { 160a5e4d84c9616b0a987e904d3b1d1d3fd9ca1be86showard public void onClick(ClickEvent event) { 161ce12f55f4530950f7fc6ddc73d1867ebb954d356showard if (enabled) { 162ce12f55f4530950f7fc6ddc73d1867ebb954d356showard addSeries(); 163ce12f55f4530950f7fc6ddc73d1867ebb954d356showard } 164ce12f55f4530950f7fc6ddc73d1867ebb954d356showard } 165ce12f55f4530950f7fc6ddc73d1867ebb954d356showard }); 166ce12f55f4530950f7fc6ddc73d1867ebb954d356showard table.setWidget(0, 0, addLink); 167ce12f55f4530950f7fc6ddc73d1867ebb954d356showard table.setText(0, 1, ""); 1688a7f36583afe076a7198d1b34fe109aa491dc277jamesren 169ce12f55f4530950f7fc6ddc73d1867ebb954d356showard addSeries(); 1708a7f36583afe076a7198d1b34fe109aa491dc277jamesren 171ce12f55f4530950f7fc6ddc73d1867ebb954d356showard initWidget(table); 172ce12f55f4530950f7fc6ddc73d1867ebb954d356showard } 1738a7f36583afe076a7198d1b34fe109aa491dc277jamesren 174e5ae165c706c465f08a732a361ea0aa5d75075eashoward public List<Series> getAllSeries() { 175e5ae165c706c465f08a732a361ea0aa5d75075eashoward return Collections.unmodifiableList(series); 176ce12f55f4530950f7fc6ddc73d1867ebb954d356showard } 1778a7f36583afe076a7198d1b34fe109aa491dc277jamesren 178ce12f55f4530950f7fc6ddc73d1867ebb954d356showard public void reset() { 179ce12f55f4530950f7fc6ddc73d1867ebb954d356showard for (int i = 0; i < series.size(); i++) { 180ce12f55f4530950f7fc6ddc73d1867ebb954d356showard table.removeRow(0); 181ce12f55f4530950f7fc6ddc73d1867ebb954d356showard } 182ce12f55f4530950f7fc6ddc73d1867ebb954d356showard series.clear(); 183ce12f55f4530950f7fc6ddc73d1867ebb954d356showard addSeries(); 184ce12f55f4530950f7fc6ddc73d1867ebb954d356showard } 1858a7f36583afe076a7198d1b34fe109aa491dc277jamesren 186ce12f55f4530950f7fc6ddc73d1867ebb954d356showard public List<String> getInverted() { 187ce12f55f4530950f7fc6ddc73d1867ebb954d356showard List<String> inverted = new ArrayList<String>(); 188ce12f55f4530950f7fc6ddc73d1867ebb954d356showard for (Series s : series) { 1897f2b0e15c5928ea2914d078e385ca717d078c6d5showard if (s.invert.getValue()) { 190ce12f55f4530950f7fc6ddc73d1867ebb954d356showard inverted.add(s.getName()); 191ce12f55f4530950f7fc6ddc73d1867ebb954d356showard } 192ce12f55f4530950f7fc6ddc73d1867ebb954d356showard } 193ce12f55f4530950f7fc6ddc73d1867ebb954d356showard return inverted; 194ce12f55f4530950f7fc6ddc73d1867ebb954d356showard } 1958a7f36583afe076a7198d1b34fe109aa491dc277jamesren 196ce12f55f4530950f7fc6ddc73d1867ebb954d356showard public void setInvertible(boolean invertible) { 197ce12f55f4530950f7fc6ddc73d1867ebb954d356showard for (Series s : series) { 198ce12f55f4530950f7fc6ddc73d1867ebb954d356showard s.invert.setEnabled(invertible); 199ce12f55f4530950f7fc6ddc73d1867ebb954d356showard if (!invertible) { 2007f2b0e15c5928ea2914d078e385ca717d078c6d5showard s.invert.setValue(false); 201ce12f55f4530950f7fc6ddc73d1867ebb954d356showard } 202ce12f55f4530950f7fc6ddc73d1867ebb954d356showard } 203ce12f55f4530950f7fc6ddc73d1867ebb954d356showard this.invertible = invertible; 204ce12f55f4530950f7fc6ddc73d1867ebb954d356showard } 2058a7f36583afe076a7198d1b34fe109aa491dc277jamesren 206e5ae165c706c465f08a732a361ea0aa5d75075eashoward private static String parameterString(String parameterName, int index) { 207e5ae165c706c465f08a732a361ea0aa5d75075eashoward return parameterName + "[" + index + "]"; 208e5ae165c706c465f08a732a361ea0aa5d75075eashoward } 2098a7f36583afe076a7198d1b34fe109aa491dc277jamesren 210ce12f55f4530950f7fc6ddc73d1867ebb954d356showard protected void addToHistory(Map<String, String> args) { 211ce12f55f4530950f7fc6ddc73d1867ebb954d356showard for (int index = 0; index < series.size(); index++) { 212e5ae165c706c465f08a732a361ea0aa5d75075eashoward series.get(index).addToHistory(args, index); 213ce12f55f4530950f7fc6ddc73d1867ebb954d356showard } 214ce12f55f4530950f7fc6ddc73d1867ebb954d356showard List<String> inverted = getInverted(); 215ce12f55f4530950f7fc6ddc73d1867ebb954d356showard if (!inverted.isEmpty()) { 216ce12f55f4530950f7fc6ddc73d1867ebb954d356showard args.put("inverted", Utils.joinStrings(",", inverted)); 217ce12f55f4530950f7fc6ddc73d1867ebb954d356showard } 218ce12f55f4530950f7fc6ddc73d1867ebb954d356showard } 2198a7f36583afe076a7198d1b34fe109aa491dc277jamesren 220ce12f55f4530950f7fc6ddc73d1867ebb954d356showard protected void handleHistoryArguments(Map<String, String> args) { 221ce12f55f4530950f7fc6ddc73d1867ebb954d356showard String invertedString = args.get("inverted"); 222e5ae165c706c465f08a732a361ea0aa5d75075eashoward Set<String> inverted = new HashSet<String>(); 223ce12f55f4530950f7fc6ddc73d1867ebb954d356showard if (invertedString != null) { 224ce12f55f4530950f7fc6ddc73d1867ebb954d356showard for (String s : invertedString.split(",")) { 225ce12f55f4530950f7fc6ddc73d1867ebb954d356showard inverted.add(s); 226ce12f55f4530950f7fc6ddc73d1867ebb954d356showard } 227ce12f55f4530950f7fc6ddc73d1867ebb954d356showard } 228e5ae165c706c465f08a732a361ea0aa5d75075eashoward 229e5ae165c706c465f08a732a361ea0aa5d75075eashoward for (int index = 0; args.get(parameterString("name", index)) != null; index++) { 230e5ae165c706c465f08a732a361ea0aa5d75075eashoward Series thisSeries; 231ce12f55f4530950f7fc6ddc73d1867ebb954d356showard if (index == 0) { 232e5ae165c706c465f08a732a361ea0aa5d75075eashoward thisSeries = series.get(0); 233ce12f55f4530950f7fc6ddc73d1867ebb954d356showard } else { 234e5ae165c706c465f08a732a361ea0aa5d75075eashoward thisSeries = addSeries(); 235ce12f55f4530950f7fc6ddc73d1867ebb954d356showard } 236e5ae165c706c465f08a732a361ea0aa5d75075eashoward 237e5ae165c706c465f08a732a361ea0aa5d75075eashoward thisSeries.readHistoryArguments(args, index); 238e5ae165c706c465f08a732a361ea0aa5d75075eashoward thisSeries.setInverted(inverted.contains(thisSeries.getName())); 239ce12f55f4530950f7fc6ddc73d1867ebb954d356showard } 240ce12f55f4530950f7fc6ddc73d1867ebb954d356showard } 2418a7f36583afe076a7198d1b34fe109aa491dc277jamesren 242ce12f55f4530950f7fc6ddc73d1867ebb954d356showard private Series addSeries() { 243ce12f55f4530950f7fc6ddc73d1867ebb954d356showard int row = table.getRowCount() - 1; 244ce12f55f4530950f7fc6ddc73d1867ebb954d356showard Series nextSeries = new Series(row); 245ce12f55f4530950f7fc6ddc73d1867ebb954d356showard nextSeries.invert.setEnabled(invertible); 246ce12f55f4530950f7fc6ddc73d1867ebb954d356showard series.add(nextSeries); 247ce12f55f4530950f7fc6ddc73d1867ebb954d356showard table.insertRow(row); 248ce12f55f4530950f7fc6ddc73d1867ebb954d356showard table.setWidget(row, 0, nextSeries); 249ce12f55f4530950f7fc6ddc73d1867ebb954d356showard table.getFlexCellFormatter().setColSpan(row, 0, 2); 250ce12f55f4530950f7fc6ddc73d1867ebb954d356showard table.getFlexCellFormatter().setStylePrimaryName(row, 0, "box"); 251ce12f55f4530950f7fc6ddc73d1867ebb954d356showard return nextSeries; 252ce12f55f4530950f7fc6ddc73d1867ebb954d356showard } 2538a7f36583afe076a7198d1b34fe109aa491dc277jamesren 254ce12f55f4530950f7fc6ddc73d1867ebb954d356showard private void deleteSeries(int row) { 255ce12f55f4530950f7fc6ddc73d1867ebb954d356showard if (series.size() == 1) { 256ce12f55f4530950f7fc6ddc73d1867ebb954d356showard reset(); 257ce12f55f4530950f7fc6ddc73d1867ebb954d356showard return; 258ce12f55f4530950f7fc6ddc73d1867ebb954d356showard } 2598a7f36583afe076a7198d1b34fe109aa491dc277jamesren 260ce12f55f4530950f7fc6ddc73d1867ebb954d356showard series.remove(row); 261ce12f55f4530950f7fc6ddc73d1867ebb954d356showard table.removeRow(row); 262ce12f55f4530950f7fc6ddc73d1867ebb954d356showard for (int i = row; i < series.size(); i++) { 263ce12f55f4530950f7fc6ddc73d1867ebb954d356showard series.get(i).row--; 264ce12f55f4530950f7fc6ddc73d1867ebb954d356showard } 265ce12f55f4530950f7fc6ddc73d1867ebb954d356showard } 266ce12f55f4530950f7fc6ddc73d1867ebb954d356showard} 267