Search in sources :

Example 1 with PointField

use of org.vaadin.addon.leaflet.util.PointField in project v-leaflet by mstahv.

the class WithoutBeanBindingTest method getTestComponent.

@Override
public Component getTestComponent() {
    final PointField pointFieldEmpty = new PointField("empty PointField");
    pointFieldEmpty.setSizeFull();
    final PointField pointFieldInitialized = new PointField("PointField with value");
    pointFieldInitialized.setSizeFull();
    pointFieldInitialized.getMap().setZoomLevel(8);
    pointFieldInitialized.setValue(getPoint());
    Button getValueButton = new Button("Get values");
    getValueButton.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            Point value1 = pointFieldEmpty.getValue();
            Point value2 = pointFieldInitialized.getValue();
            Notification.show(value1 + "\n" + value2);
        }
    });
    HorizontalLayout fieldLayout = new HorizontalLayout(pointFieldEmpty, pointFieldInitialized);
    fieldLayout.setSizeFull();
    fieldLayout.setSpacing(true);
    VerticalLayout layout = new VerticalLayout(fieldLayout, getValueButton);
    layout.setExpandRatio(fieldLayout, 1f);
    layout.setSizeFull();
    layout.setSpacing(true);
    return layout;
}
Also used : Button(com.vaadin.ui.Button) ClickEvent(com.vaadin.ui.Button.ClickEvent) VerticalLayout(com.vaadin.ui.VerticalLayout) Point(org.locationtech.jts.geom.Point) PointField(org.vaadin.addon.leaflet.util.PointField) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Aggregations

Button (com.vaadin.ui.Button)1 ClickEvent (com.vaadin.ui.Button.ClickEvent)1 HorizontalLayout (com.vaadin.ui.HorizontalLayout)1 VerticalLayout (com.vaadin.ui.VerticalLayout)1 Point (org.locationtech.jts.geom.Point)1 PointField (org.vaadin.addon.leaflet.util.PointField)1