use of com.vaadin.ui.CheckBox in project v-leaflet by mstahv.
the class LayerGroupTest method setup.
@Override
protected void setup() {
super.setup();
addMarkers = new CheckBox("Add markers");
content.addComponentAsFirst(addMarkers);
delete = new CheckBox("Delete on click");
content.addComponentAsFirst(delete);
showLayerGroupCB = new CheckBox("Show first layer (switch on/off from server side)");
showLayerGroupCB.setValue(true);
content.addComponentAsFirst(showLayerGroupCB);
showLayerGroupCB.addValueChangeListener(new HasValue.ValueChangeListener<Boolean>() {
@Override
public void valueChange(ValueChangeEvent<Boolean> event) {
if (event.getValue()) {
if (!leafletMap.hasComponent(llg)) {
leafletMap.addComponent(llg);
}
} else {
leafletMap.removeComponent(llg);
}
}
});
Button button = new Button("Delete first component from map (may also be a layer containing many components)");
button.addClickListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
for (Component c : leafletMap) {
if (!(c instanceof LTileLayer)) {
leafletMap.removeComponent(c);
break;
}
}
}
});
content.addComponentAsFirst(button);
button = new Button("Delete first component from first layer group (may also be a layer containing many components)");
button.addClickListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
LLayerGroup group = null;
for (Component c : leafletMap) {
if (c instanceof LLayerGroup) {
group = (LLayerGroup) c;
break;
}
}
if (group.getComponentCount() > 0) {
Component next = group.iterator().next();
group.removeComponent(next);
} else {
Notification.show("No component in first component group");
}
}
});
content.addComponentAsFirst(button);
button = new Button("Add polyline to first group on map (creates if does not exist)");
button.addClickListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
LLayerGroup group = null;
for (Component c : leafletMap) {
if (c instanceof LLayerGroup) {
group = (LLayerGroup) c;
break;
}
}
if (group == null) {
group = new LLayerGroup();
leafletMap.addOverlay(group, "new group");
}
LPolyline lPolyline = new LPolyline(new Point(60.44, 22.30), new Point(60.456, 22.304));
lPolyline.addClickListener(listener);
group.addComponent(lPolyline);
}
});
content.addComponentAsFirst(button);
}
use of com.vaadin.ui.CheckBox in project v-leaflet by mstahv.
the class BasicTest method setup.
@Override
protected void setup() {
super.setup();
addMarkers = new CheckBox("Add markers");
content.addComponentAsFirst(addMarkers);
delete = new CheckBox("Delete on click");
content.addComponentAsFirst(delete);
Button openPopup = new Button("Open popup", new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
leafletMarker.openPopup();
}
});
Button closePopup = new Button("Close popup", new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
leafletMarker.closePopup();
}
});
content.addComponentAsFirst(closePopup);
content.addComponentAsFirst(openPopup);
Button button = new Button("Delete first component from map");
button.addClickListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
Component next = leafletMap.iterator().next();
leafletMap.removeComponent(next);
}
});
content.addComponentAsFirst(button);
button = new Button("Add polyline to map");
button.addClickListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
LPolyline lPolyline = new LPolyline(new Point(60.44, 22.30), new Point(60.456, 22.304));
lPolyline.addClickListener(listener);
leafletMap.addComponent(lPolyline);
}
});
content.addComponentAsFirst(button);
}
use of com.vaadin.ui.CheckBox in project v-leaflet by mstahv.
the class PopupTest method setup.
@Override
protected void setup() {
super.setup();
final TextField lat = new TextField("Lat");
lat.setValue("" + 60.4525);
content.addComponentAsFirst(lat);
final TextField lon = new TextField("Lon");
lon.setValue("" + 22.301);
content.addComponentAsFirst(lon);
final TextField html = new TextField("html");
content.addComponentAsFirst(html);
final CheckBox closeButton = new CheckBox("Close button");
content.addComponentAsFirst(closeButton);
final CheckBox closeonclick = new CheckBox("Close on click");
content.addComponentAsFirst(closeonclick);
content.addComponentAsFirst(new Button("Open popup", new ClickListener() {
@Override
public void buttonClick(Button.ClickEvent event) {
Double lonValue = Double.valueOf(lon.getValue());
Double latValue = Double.valueOf(lat.getValue());
LPopup lPopup = new LPopup(latValue, lonValue).setContent(html.getValue());
lPopup.setCloseButton(closeButton.getValue());
lPopup.setCloseOnClick(closeonclick.getValue());
leafletMap.addComponent(lPopup);
leafletMap.zoomToContent();
popups.add(lPopup);
lPopup.addDetachListener(PopupTest.this);
}
}));
content.addComponentAsFirst(new Button("Remove first", new ClickListener() {
@Override
public void buttonClick(Button.ClickEvent event) {
popups.remove(0).close();
}
}));
}
use of com.vaadin.ui.CheckBox in project v-leaflet by mstahv.
the class JtsPointFieldTest method getTestComponent.
// private Polygon polygon;
@Override
public Component getTestComponent() {
content.setMargin(true);
display.setContentMode(ContentMode.PREFORMATTED);
display.setCaption("Pojo state:");
display.setValue(pojo.toString());
HorizontalLayout horizontalLayout = new HorizontalLayout();
horizontalLayout.setSizeFull();
VerticalLayout editorform = new VerticalLayout();
editorform.setSizeFull();
editorform.setSpacing(true);
editorform.setCaption("Edit JTS pojo:");
TabSheet jtsFields = new TabSheet(point);
jtsFields.setCaption("JTS fiels:");
jtsFields.setSizeFull();
editorform.addComponents(new HorizontalLayout(name, date), jtsFields);
editorform.setExpandRatio(jtsFields, 1);
final Binder<JtsPojo> beanBinder = new Binder<>(JtsPojo.class);
beanBinder.readBean(pojo);
beanBinder.bindInstanceFields(this);
HorizontalLayout buttonLayout = new HorizontalLayout();
buttonLayout.addComponent(new Button("Save", (ClickListener) event -> {
try {
beanBinder.writeBean(pojo);
display.setValue(pojo.toString());
} catch (ValidationException e) {
System.err.println("Validation errors:" + Arrays.toString(e.getBeanValidationErrors().toArray()));
}
}));
CheckBox roCheckBox = new CheckBox("Read only", false);
roCheckBox.addValueChangeListener(event -> beanBinder.setReadOnly(event.getValue()));
buttonLayout.addComponent(roCheckBox);
buttonLayout.addComponent(new Button("Assign new empty bean", (ClickListener) event -> {
pojo = new JtsPojo();
beanBinder.readBean(pojo);
display.setValue(pojo.toString());
}));
buttonLayout.addComponent(new Button("Assign bean with preset data", (ClickListener) event -> {
pojo = new JtsPojo();
pojo.setPoint(JTSUtil.toPoint(new org.vaadin.addon.leaflet.shared.Point(61, 22)));
beanBinder.readBean(pojo);
display.setValue(pojo.toString());
}));
editorform.addComponent(buttonLayout);
horizontalLayout.addComponents(editorform, display);
horizontalLayout.setExpandRatio(editorform, 1);
horizontalLayout.setExpandRatio(display, 1);
return horizontalLayout;
}
use of com.vaadin.ui.CheckBox in project Activiti by Activiti.
the class TaskTable method getSteps.
public List<HumanStepDefinition> getSteps() {
List<HumanStepDefinition> steps = new ArrayList<HumanStepDefinition>();
for (Object itemId : getItemIds()) {
Item item = getItem(itemId);
HumanStepDefinition humanStepDefinition = new HumanStepDefinition();
String name = (String) item.getItemProperty(ID_NAME).getValue();
if (name != null && name.length() > 0) {
humanStepDefinition.setName(name);
}
String assignee = (String) ((ComboBox) item.getItemProperty(ID_ASSIGNEE).getValue()).getValue();
if (assignee != null && assignee.length() > 0) {
humanStepDefinition.setAssignee(assignee);
}
String groups = (String) ((ComboBox) item.getItemProperty("groups").getValue()).getValue();
List<String> candidateGroups = new ArrayList<String>();
if (groups != null && groups.length() > 0) {
for (String group : groups.split(",")) {
candidateGroups.add(group.trim());
}
}
humanStepDefinition.setCandidateGroups(candidateGroups);
String description = (String) ((TextField) item.getItemProperty(ID_DESCRIPTION).getValue()).getValue();
if (description != null && description.length() > 0) {
humanStepDefinition.setDescription(description);
}
humanStepDefinition.setStartsWithPrevious((boolean) ((CheckBox) item.getItemProperty(ID_START_WITH_PREVIOUS).getValue()).booleanValue());
FormDefinition formDefinition = taskFormModel.getForm(itemId);
humanStepDefinition.setForm(formDefinition);
steps.add(humanStepDefinition);
}
return steps;
}
Aggregations