Example usage for org.eclipse.swt.widgets Button getData

List of usage examples for org.eclipse.swt.widgets Button getData

Introduction

In this page you can find the example usage for org.eclipse.swt.widgets Button getData.

Prototype

public Object getData(String key) 

Source Link

Document

Returns the application defined property of the receiver with the specified name, or null if it has not been set.

Usage

From source file:org.talend.dataprofiler.chart.TOPChartService.java

@Override
public Object createSelectionAdapterForButton(final Object chart, final boolean isCountAvg,
        final boolean isMinMax) {
    return new SelectionAdapter() {

        private static final String SERIES_KEY_ID = "SERIES_KEY"; //$NON-NLS-1$

        @Override//from www .jav  a 2  s  .c  o m
        public void widgetSelected(SelectionEvent e) {

            Button checkBtn = (Button) e.getSource();
            int seriesid = (Integer) checkBtn.getData(SERIES_KEY_ID);

            if (isCountAvg) {
                XYPlot plot = ((JFreeChart) chart).getXYPlot();
                XYItemRenderer xyRenderer = plot.getRenderer();
                xyRenderer.setSeriesVisible(seriesid, checkBtn.getSelection());
            }

            if (isMinMax) {
                CategoryPlot plot = (CategoryPlot) ((JFreeChart) chart).getPlot();
                CategoryItemRenderer render = plot.getRenderer();
                render.setSeriesVisible(seriesid, checkBtn.getSelection());
            }
        }
    };
}