All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.vaadin.flow.component.charts.events.SeriesCheckboxClickEvent Maven / Gradle / Ivy

There is a newer version: 24.5.4
Show newest version
/**
 * Copyright 2000-2024 Vaadin Ltd.
 *
 * This program is available under Vaadin Commercial License and Service Terms.
 *
 * See {@literal } for the full
 * license.
 */
package com.vaadin.flow.component.charts.events;

import com.vaadin.flow.component.ComponentEvent;
import com.vaadin.flow.component.DomEvent;
import com.vaadin.flow.component.EventData;
import com.vaadin.flow.component.charts.Chart;

/**
 * SeriesCheckboxClickEvent triggered when a checkbox in a legend is clicked
 */
@DomEvent("series-checkbox-click")
public class SeriesCheckboxClickEvent extends ComponentEvent
        implements HasSeries {

    private final boolean checked;
    private final int seriesIndex;

    /**
     * Constructs a SeriesCheckboxClickEvent
     *
     * @param source
     * @param fromClient
     * @param isChecked
     * @param seriesIndex
     */
    public SeriesCheckboxClickEvent(Chart source, boolean fromClient,
            @EventData("event.detail.originalEvent.checked") boolean isChecked,
            @EventData("event.detail.originalEvent.item.index") int seriesIndex) {
        super(source, fromClient);
        this.checked = isChecked;
        this.seriesIndex = seriesIndex;
    }

    /**
     * Checks if the checkbox is checked
     *
     * @return
     */
    public boolean isChecked() {
        return checked;
    }

    @Override
    public int getSeriesItemIndex() {
        return seriesIndex;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy