Example usage for com.google.gwt.user.client.ui ModalLayoutPanel ModalLayoutPanel

List of usage examples for com.google.gwt.user.client.ui ModalLayoutPanel ModalLayoutPanel

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui ModalLayoutPanel ModalLayoutPanel.

Prototype

ModalLayoutPanel

Source Link

Usage

From source file:org.onebusaway.webapp.gwt.stop_and_route_selection.AbstractStopAndRouteSelectionWidget.java

License:Apache License

@UiHandler("_addStopAnchor")
public void handleAddStopClick(ClickEvent e) {
    e.preventDefault();/*from   w  ww .  j  a  v  a 2s  .  c  o  m*/

    _stop = null;

    _dialog = new ModalLayoutPanel();

    StopFinderWidgetExtension widget = new StopFinderWidgetExtension();

    final StopFinderPresenter stopFinder = new StopFinderPresenter();
    stopFinder.setDefaultOperationHandler(new DefaultOperationHandler());

    stopFinder.setWidget(widget);
    widget.setStopFinder(stopFinder);

    widget.addStyleName(style.StopFinderDialog());

    _dialog.add(widget);
    _dialog.setWidgetLeftRight(widget, 5, Unit.PCT, 5, Unit.PCT);
    _dialog.setWidgetTopBottom(widget, 10, Unit.PCT, 10, Unit.PCT);

    _dialog.addCloseHandler(new CloseHandler<ModalLayoutPanel>() {
        @Override
        public void onClose(CloseEvent<ModalLayoutPanel> arg0) {
            if (_stop != null)
                addStop(_stop);
        }
    });

    _dialog.show();

    Context context = new ContextImpl();

    if (!_stopsById.isEmpty()) {
        CoordinateBounds b = new CoordinateBounds();
        for (StopBean stop : _stopsById.values())
            b.addPoint(stop.getLat(), stop.getLon());
        b = SphericalGeometryLibrary.bounds(b, 100);
        context = stopFinder.getCoordinateBoundsAsContext(b);
        System.out.println("context=" + context);
    }

    final Context c = context;

    DeferredCommand.addCommand(new Command() {
        @Override
        public void execute() {
            stopFinder.onContextChanged(c);
        }
    });
}