// disableLive();
// }
//
// }
// });
toggleLive.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
if (pushListener == null){
enableLive();
toggleLive.setValue(true, false, true);
} else {
disableLive();
toggleLive.setValue(false, false, true);
}
}
});
// final ComboBox<LineSeries<TimeSeriesDataVO>> box = new ComboBox<LineSeries<TimeSeriesDataVO>>(fieldStore,
// new LabelProvider<LineSeries<TimeSeriesDataVO>>() {
// public String getLabel(LineSeries<TimeSeriesDataVO> item) {
// return item.getYField().getPath();
// }
// });
final TextField fieldInput = new TextField();
fieldInput.setValue("first");
fieldInput.setAllowBlank(false);
fieldInput.addValidator(new MaxLengthValidator(20));
final RegExp regex = RegExp.compile("\\s");
fieldInput.addValidator(new Validator<String>() {
public List<EditorError> validate(Editor<String> editor, String value) {
if (regex.test(value)) {
List<EditorError> errors = new ArrayList<EditorError>();
errors.add(new DefaultEditorError(editor, "Field name cannot contain spaces.", ""));
return errors;
}
return null;
}
});
TextButton add = new TextButton("Add");
add.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
// String field = fieldInput.getValue();
// if (fieldInput.isCurrentValid() && field.length() > 0 && fieldStore.findModelWithKey(field) == null && fieldStore.size() < 10) {
// for (int i = 0; i < store.size(); i++) {
// TimeSeriesDataVO item = store.get(i);
// item.put(field, Math.random() * 100);
// }
// LineSeries<TimeSeriesDataVO> series = createLine(field);
// fieldStore.add(series);
// axis.addField(series.getYField());
// chart.addSeries(series);
// chart.redrawChart();
// }
}
});
TextButton remove = new TextButton("Remove");
remove.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
// String field = box.getText();
// LineSeries<TimeSeriesDataVO> series = fieldStore.findModelWithKey(field);
// if (field.length() > 0 && series != null && fieldStore.size() > 0) {
// for (int i = 0; i < store.size(); i++) {