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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations