Search in sources :

Example 31 with CheckBox

use of com.vaadin.ui.CheckBox in project VaadinUtils by rlsutton1.

the class FormHelper method bindBooleanField.

public CheckBox bindBooleanField(String fieldLabel, String fieldName) {
    CheckBox field = bindBooleanField(form, group, fieldLabel, fieldName);
    this.fieldList.add(field);
    return field;
}
Also used : CheckBox(com.vaadin.ui.CheckBox) SplitCheckBox(au.com.vaadinutils.crud.splitFields.SplitCheckBox)

Example 32 with CheckBox

use of com.vaadin.ui.CheckBox in project VaadinUtils by rlsutton1.

the class MultiColumnFormLayout method bindBooleanField.

public CheckBox bindBooleanField(String fieldLabel, SingularAttribute<E, Boolean> member) {
    CheckBox field = formHelper.bindBooleanField(this, fieldGroup, fieldLabel, member);
    this.fieldList.add(field);
    return field;
}
Also used : CheckBox(com.vaadin.ui.CheckBox)

Example 33 with CheckBox

use of com.vaadin.ui.CheckBox in project VaadinUtils by rlsutton1.

the class CheckboxColumnGenerator method generateCell.

@Override
public Object generateCell(Table source, Object itemId, Object columnId) {
    // Need a layout to set center alignment on the checkbox.
    // http://dev.vaadin.com/ticket/12027
    final VerticalLayout layout = new VerticalLayout();
    final CheckBox checkbox = new CheckBox();
    layout.addComponent(checkbox);
    layout.setComponentAlignment(checkbox, Alignment.MIDDLE_CENTER);
    @SuppressWarnings("unchecked") final Property<Boolean> property = source.getItem(itemId).getItemProperty(columnId);
    checkbox.setValue(property.getValue());
    checkbox.addValueChangeListener(new ValueChangeListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            property.setValue((Boolean) event.getProperty().getValue());
        }
    });
    ((ValueChangeNotifier) property).addValueChangeListener(new ValueChangeListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            checkbox.setValue((Boolean) event.getProperty().getValue());
        }
    });
    return layout;
}
Also used : ValueChangeEvent(com.vaadin.data.Property.ValueChangeEvent) ValueChangeListener(com.vaadin.data.Property.ValueChangeListener) CheckBox(com.vaadin.ui.CheckBox) VerticalLayout(com.vaadin.ui.VerticalLayout) ValueChangeNotifier(com.vaadin.data.Property.ValueChangeNotifier)

Example 34 with CheckBox

use of com.vaadin.ui.CheckBox in project charts by vaadin.

the class PieWithGradientFill method getChart.

@Override
protected Component getChart() {
    Chart chart = new Chart(ChartType.PIE);
    Configuration conf = chart.getConfiguration();
    conf.setTitle("Browser market shares at a specific website, 2010");
    PlotOptionsPie plotOptions = new PlotOptionsPie();
    plotOptions.setCursor(Cursor.POINTER);
    DataLabels dataLabels = new DataLabels();
    dataLabels.setEnabled(true);
    dataLabels.setColor(SolidColor.BLACK);
    dataLabels.setConnectorColor(SolidColor.BLACK);
    dataLabels.setFormatter("'<b>'+ this.point.name +'</b>: '+ this.percentage +' %'");
    plotOptions.setDataLabels(dataLabels);
    conf.setPlotOptions(plotOptions);
    final DataSeries series = getBrowserMarketShareSeries();
    conf.setSeries(series);
    chart.drawChart();
    VerticalLayout layout = new VerticalLayout();
    layout.setSpacing(false);
    layout.setMargin(false);
    layout.addComponent(chart);
    CheckBox button = new CheckBox("Slice one part");
    button.addValueChangeListener(e -> {
        series.setItemSliced(1, e.getValue());
    });
    layout.addComponent(button);
    return layout;
}
Also used : PlotOptionsPie(com.vaadin.addon.charts.model.PlotOptionsPie) DataLabels(com.vaadin.addon.charts.model.DataLabels) Configuration(com.vaadin.addon.charts.model.Configuration) CheckBox(com.vaadin.ui.CheckBox) VerticalLayout(com.vaadin.ui.VerticalLayout) DataSeries(com.vaadin.addon.charts.model.DataSeries) Chart(com.vaadin.addon.charts.Chart)

Example 35 with CheckBox

use of com.vaadin.ui.CheckBox in project charts by vaadin.

the class ServerSideEvents method createControls.

private Layout createControls() {
    visibilityToggling = new CheckBox("Disable series visibility toggling");
    visibilityToggling.addValueChangeListener(e -> {
        chart.setSeriesVisibilityTogglingDisabled(visibilityToggling.getValue());
    });
    final Button firstSeriesVisible = new Button("Hide first series");
    firstSeriesVisible.setId("hideFirstSeries");
    firstSeriesVisible.addClickListener(new Button.ClickListener() {

        boolean hideSeries = true;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            Series firstSeries = chart.getConfiguration().getSeries().get(0);
            ((AbstractSeries) firstSeries).setVisible(!hideSeries);
            hideSeries = !hideSeries;
            String caption = hideSeries ? "Hide first series" : "Show first series";
            firstSeriesVisible.setCaption(caption);
        }
    });
    Button setExtremes = new Button("Toggle extremes");
    setExtremes.setId("setExtremes");
    setExtremes.addClickListener(new Button.ClickListener() {

        public boolean extremesSet;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            if (extremesSet) {
                chart.getConfiguration().getxAxis().setExtremes(10, 90);
            } else {
                chart.getConfiguration().getxAxis().setExtremes(20, 80);
            }
            extremesSet = !extremesSet;
        }
    });
    final OptionGroup zoomLevels = new OptionGroup("Zoom Type");
    zoomLevels.addItem(ZoomType.XY);
    zoomLevels.addItem(ZoomType.X);
    zoomLevels.addItem(ZoomType.Y);
    zoomLevels.setValue(ZoomType.XY);
    zoomLevels.addValueChangeListener(new Property.ValueChangeListener() {

        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            ZoomType zoom = (ZoomType) zoomLevels.getValue();
            chart.getConfiguration().getChart().setZoomType(zoom);
            chart.drawChart();
        }
    });
    Button resetHistory = new Button("Reset history");
    resetHistory.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            lastEvent.setValue(null);
            eventDetails.setValue(null);
            historyLayout.removeAllComponents();
        }
    });
    HorizontalLayout controls = new HorizontalLayout();
    controls.setId("controls");
    controls.setSpacing(true);
    controls.addComponent(visibilityToggling);
    controls.addComponent(firstSeriesVisible);
    controls.addComponent(setExtremes);
    controls.addComponent(zoomLevels);
    controls.addComponent(resetHistory);
    return controls;
}
Also used : ZoomType(com.vaadin.addon.charts.model.ZoomType) HorizontalLayout(com.vaadin.ui.HorizontalLayout) PlotOptionsSeries(com.vaadin.addon.charts.model.PlotOptionsSeries) Series(com.vaadin.addon.charts.model.Series) AbstractSeries(com.vaadin.addon.charts.model.AbstractSeries) DataSeries(com.vaadin.addon.charts.model.DataSeries) OptionGroup(com.vaadin.v7.ui.OptionGroup) Button(com.vaadin.ui.Button) CheckBox(com.vaadin.ui.CheckBox) Property(com.vaadin.v7.data.Property)

Aggregations

CheckBox (com.vaadin.ui.CheckBox)40 Button (com.vaadin.ui.Button)8 ClickListener (com.vaadin.ui.Button.ClickListener)7 HorizontalLayout (com.vaadin.ui.HorizontalLayout)6 ClickEvent (com.vaadin.ui.Button.ClickEvent)5 VerticalLayout (com.vaadin.ui.VerticalLayout)5 SplitCheckBox (au.com.vaadinutils.crud.splitFields.SplitCheckBox)4 ValueChangeEvent (com.vaadin.data.Property.ValueChangeEvent)4 ValueChangeListener (com.vaadin.data.Property.ValueChangeListener)4 TextField (com.vaadin.ui.TextField)4 Test (org.junit.Test)4 Item (com.vaadin.data.Item)3 Property (com.vaadin.data.Property)3 ComboBox (com.vaadin.ui.ComboBox)3 Component (com.vaadin.ui.Component)3 Label (com.vaadin.ui.Label)3 ArrayList (java.util.ArrayList)3 Chart (com.vaadin.addon.charts.Chart)2 Configuration (com.vaadin.addon.charts.model.Configuration)2 DataLabels (com.vaadin.addon.charts.model.DataLabels)2