use of com.vaadin.addon.charts.SeriesShowEvent 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;
}
Aggregations