use of com.vaadin.shared.Registration in project cuba by cuba-platform.
the class AceEditor method addBlurListener.
@Override
public Registration addBlurListener(BlurListener listener) {
Registration registration = addListener(BlurEvent.EVENT_ID, BlurEvent.class, listener, BlurListener.blurMethod);
getState().listenToFocusChanges = true;
return registration;
}
use of com.vaadin.shared.Registration in project cuba by cuba-platform.
the class AceEditor method addFocusListener.
@Override
public Registration addFocusListener(FocusListener listener) {
Registration registration = addListener(FocusEvent.EVENT_ID, FocusEvent.class, listener, FocusListener.focusMethod);
getState().listenToFocusChanges = true;
return registration;
}
use of com.vaadin.shared.Registration in project v-leaflet by mstahv.
the class DynamicChanges method setup.
@Override
protected void setup() {
super.setup();
HorizontalLayout tools = new HorizontalLayout();
Button button = new Button("Random new point");
button.addClickListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
ArrayList<Point> arrayList = new ArrayList<Point>(Arrays.asList(polyline.getPoints()));
arrayList.add(new Point(60 + r.nextInt(10), 20 + r.nextInt(10)));
polyline.setPoints(arrayList.toArray(new Point[0]));
}
});
tools.addComponent(button);
button = new Button("Zoom to polyline");
button.addClickListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
leafletMap.zoomToExtent(new Bounds(polyline.getPoints()));
}
});
tools.addComponent(button);
button = new Button("Center to last point ");
button.addClickListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
Point[] points = polyline.getPoints();
leafletMap.setCenter(points[points.length - 1]);
}
});
tools.addComponent(button);
button = new Button("Zoom to last point");
button.addClickListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
Point[] points = polyline.getPoints();
leafletMap.zoomToExtent(new Bounds(points[points.length - 1]));
}
});
tools.addComponent(button);
button = new Button("Show current zoom");
button.addClickListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
Double zoomLevel = leafletMap.getZoomLevel();
Notification.show("Zoomlevel is " + zoomLevel);
}
});
tools.addComponent(button);
button = new Button("Show current center point");
button.addClickListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
Notification.show("Center point is " + leafletMap.getCenter());
}
});
tools.addComponent(button);
button = new Button("Show current size of the map");
button.addClickListener((e) -> leafletMap.getSize(point -> Notification.show("Map size: " + point)));
tools.addComponent(button);
final LeafletMoveEndListener moveEndListener = new LeafletMoveEndListener() {
@Override
public void onMoveEnd(LeafletMoveEndEvent event) {
Notification.show("Moved or zoomed", Type.TRAY_NOTIFICATION);
}
};
final CheckBox checkBox = new CheckBox("Toggle move listener");
checkBox.addValueChangeListener(new HasValue.ValueChangeListener<Boolean>() {
@Override
public void valueChange(ValueChangeEvent<Boolean> event) {
if (event.getValue()) {
registration = leafletMap.addMoveEndListener(moveEndListener);
} else if (registration != null) {
registration.remove();
}
}
});
tools.addComponent(checkBox);
content.addComponentAsFirst(tools);
}
Aggregations