Search in sources :

Example 1 with CoordinateFields

use of org.activityinfo.client.widget.CoordinateFields in project activityinfo by bedatadriven.

the class LocationForm method addCoordFields.

private void addCoordFields() {
    coordinateFields = new CoordinateFields();
    coordinateFields.setToolTip(I18N.CONSTANTS.coordinateToolTip());
    add(coordinateFields.getLatitudeField());
    add(coordinateFields.getLongitudeField());
    newLocationPresenter.addListener(NewLocationPresenter.POSITION_CHANGED, new Listener<BaseEvent>() {

        @Override
        public void handleEvent(BaseEvent be) {
            if (!newLocationPresenter.isProvisional()) {
                coordinateFields.setValue(newLocationPresenter.getLatLng());
            }
        }
    });
    coordinateFields.addChangeListener(new Listener<FieldEvent>() {

        @Override
        public void handleEvent(FieldEvent be) {
            AiLatLng value = coordinateFields.getValue();
            if (value != null) {
                newLocationPresenter.setLatLng(value);
            }
        }
    });
}
Also used : FieldEvent(com.extjs.gxt.ui.client.event.FieldEvent) BaseEvent(com.extjs.gxt.ui.client.event.BaseEvent) AiLatLng(org.activityinfo.shared.report.content.AiLatLng) CoordinateFields(org.activityinfo.client.widget.CoordinateFields)

Aggregations

BaseEvent (com.extjs.gxt.ui.client.event.BaseEvent)1 FieldEvent (com.extjs.gxt.ui.client.event.FieldEvent)1 CoordinateFields (org.activityinfo.client.widget.CoordinateFields)1 AiLatLng (org.activityinfo.shared.report.content.AiLatLng)1