use of com.vaadin.addon.charts.CheckboxClickEvent in project charts by vaadin.
the class ServerSideEvents method addEventListeners.
private Layout addEventListeners() {
eventListeners = new VerticalLayout();
eventListeners.setCaption("Event listeners:");
final ChartClickListener listener = new ChartClickListener() {
@Override
public void onClick(ChartClickEvent event) {
logEvent(event);
}
};
addToggleForListener("Chart click", "ChartClick", new ListenerToggle() {
@Override
public void add() {
chart.addChartClickListener(listener);
}
@Override
public void remove() {
chart.removeChartClickListener(listener);
}
});
final PointClickListener pcListener = new PointClickListener() {
@Override
public void onClick(PointClickEvent event) {
logEvent(event);
}
};
addToggleForListener("Point click", "PointClick", new ListenerToggle() {
@Override
public void add() {
chart.addPointClickListener(pcListener);
}
@Override
public void remove() {
chart.removePointClickListener(pcListener);
}
});
final CheckboxClickListener cbListener = new CheckboxClickListener() {
@Override
public void onClick(CheckboxClickEvent event) {
logEvent(event);
}
};
addToggleForListener("Checkbox click", "CheckboxClick", new ListenerToggle() {
@Override
public void add() {
chart.addCheckBoxClickListener(cbListener);
}
@Override
public void remove() {
chart.removeCheckBoxClickListener(cbListener);
}
});
final LegendItemClickListener legendItemListener = new LegendItemClickListener() {
@Override
public void onClick(LegendItemClickEvent event) {
logEvent(event);
}
};
addToggleForListener("Legend item click", "LegendItemClick", new ListenerToggle() {
@Override
public void add() {
chart.addLegendItemClickListener(legendItemListener);
visibilityToggling.setValue(true);
}
@Override
public void remove() {
chart.removeLegendItemClickListener(legendItemListener);
}
});
final SeriesHideListener hideListener = new SeriesHideListener() {
@Override
public void onHide(SeriesHideEvent event) {
logEvent(event);
}
};
addToggleForListener("Series hide", "SeriesHide", new ListenerToggle() {
@Override
public void add() {
chart.addSeriesHideListener(hideListener);
}
@Override
public void remove() {
chart.removeSeriesHideListener(hideListener);
}
});
final SeriesShowListener show = new SeriesShowListener() {
@Override
public void onShow(SeriesShowEvent event) {
logEvent(event);
}
};
addToggleForListener("Series show", "SeriesShow", new ListenerToggle() {
@Override
public void add() {
chart.addSeriesShowListener(show);
}
@Override
public void remove() {
chart.removeSeriesShowListener(show);
}
});
final XAxesExtremesChangeListener xaxesListener = new XAxesExtremesChangeListener() {
@Override
public void onXAxesExtremesChange(XAxesExtremesChangeEvent event) {
logEvent(event);
}
};
addToggleForListener("XAxes extremes change", "XAxesExtremes", new ListenerToggle() {
@Override
public void add() {
chart.addXAxesExtremesChangeListener(xaxesListener);
}
@Override
public void remove() {
chart.removeXAxesExtremesChangeListener(xaxesListener);
}
});
final YAxesExtremesChangeListener yaxesListener = new YAxesExtremesChangeListener() {
@Override
public void onYAxesExtremesChange(YAxesExtremesChangeEvent event) {
logEvent(event);
}
};
addToggleForListener("Y axes extremes change", "YAxesExtremes", new ListenerToggle() {
@Override
public void add() {
chart.addYAxesExtremesChangeListener(yaxesListener);
}
@Override
public void remove() {
chart.removeYAxesExtremesChangeListener(yaxesListener);
}
});
final PointSelectListener selectListener = new PointSelectListener() {
@Override
public void onSelect(PointSelectEvent event) {
logEvent(event);
}
};
addToggleForListener("Point select", "PointSelect", new ListenerToggle() {
@Override
public void add() {
chart.addPointSelectListener(selectListener);
}
@Override
public void remove() {
chart.removePointSelectListener(selectListener);
}
});
final PointUnselectListener unselectListener = new PointUnselectListener() {
@Override
public void onUnselect(PointUnselectEvent event) {
logEvent(event);
}
};
addToggleForListener("Point unselect", "PointUnselect", new ListenerToggle() {
@Override
public void add() {
chart.addPointUnselectListener(unselectListener);
}
@Override
public void remove() {
chart.removePointUnselectListener(unselectListener);
}
});
return eventListeners;
}
use of com.vaadin.addon.charts.CheckboxClickEvent in project charts by vaadin.
the class ServerSideEventsTBTest method checkBoxClick_secondCheckboxClicked_secondSeriesIsReturned.
@Test
public void checkBoxClick_secondCheckboxClicked_secondSeriesIsReturned() {
openTestUI();
disableAxesEvents();
WebElement secondCheckBox = findSecondCheckbox();
click(secondCheckBox);
CheckboxClickEvent checkboxClickEvent = readCheckboxEventDetails();
Assert.assertNotNull(checkboxClickEvent.getSeries());
Assert.assertEquals("1", checkboxClickEvent.getSeries().getId());
Assert.assertEquals(1, checkboxClickEvent.getSeriesItemIndex());
}
use of com.vaadin.addon.charts.CheckboxClickEvent in project charts by vaadin.
the class ServerSideEventsTBTest method checkBoxClick_seriesWasNotSelected_checkBoxIsChecked.
@Test
public void checkBoxClick_seriesWasNotSelected_checkBoxIsChecked() {
openTestUI();
disableAxesEvents();
WebElement secondCheckBox = findSecondCheckbox();
click(secondCheckBox);
CheckboxClickEvent checkboxClickEvent = readCheckboxEventDetails();
Assert.assertTrue(checkboxClickEvent.isChecked());
}
Aggregations