Search in sources :

Example 1 with ResizeHandler

use of com.google.gwt.event.logical.shared.ResizeHandler in project opennms by OpenNMS.

the class VSearchBox method onLoad.

@Override
public void onLoad() {
    m_componentHolder.clear();
    this.setStyleName("topology-search");
    final TextBoxBase textField = new TextBox();
    textField.setWidth("245px");
    textField.setStyleName("topology-search-box");
    textField.getElement().setAttribute("placeholder", "Search...");
    textField.setFocus(true);
    RemoteSuggestOracle oracle = new RemoteSuggestOracle();
    m_suggestBox = new SuggestBox(oracle, textField);
    m_suggestBox.addSelectionHandler(new SelectionHandler<SuggestOracle.Suggestion>() {

        @Override
        public void onSelection(SelectionEvent<SuggestOracle.Suggestion> event) {
            SearchSuggestion selectedItem = (SearchSuggestion) event.getSelectedItem();
            textField.setText("");
            m_connector.addToFocus(selectedItem);
        }
    });
    if (m_isMultiValued) {
        m_suggestBox.setStyleName("multivalue");
    }
    m_suggestBox.addStyleName("wideTextField");
    m_suggestBox.addSelectionHandler(this);
    m_suggestBox.addKeyUpHandler(this);
    m_componentHolder.setWidth("245px");
    m_componentHolder.add(m_suggestBox);
    if (m_focusedContainer == null) {
        m_focusedContainer = new VerticalPanel();
        m_scrollContainer = new FlowPanel();
        m_scrollContainer.add(m_focusedContainer);
    }
    m_focusedContainer.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    m_focusedContainer.setTitle("Focused Vertices");
    m_componentHolder.add(m_scrollContainer);
    Timer timer = new Timer() {

        @Override
        public void run() {
            updateScrollPanelSize();
        }
    };
    timer.schedule(1000);
    m_windowResizeRegistration = Window.addResizeHandler(new ResizeHandler() {

        @Override
        public void onResize(ResizeEvent event) {
            updateScrollPanelSize();
        }
    });
}
Also used : TextBox(com.google.gwt.user.client.ui.TextBox) TextBoxBase(com.google.gwt.user.client.ui.TextBoxBase) ResizeEvent(com.google.gwt.event.logical.shared.ResizeEvent) SuggestBox(com.google.gwt.user.client.ui.SuggestBox) VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) Timer(com.google.gwt.user.client.Timer) ResizeHandler(com.google.gwt.event.logical.shared.ResizeHandler) FlowPanel(com.google.gwt.user.client.ui.FlowPanel)

Example 2 with ResizeHandler

use of com.google.gwt.event.logical.shared.ResizeHandler in project opennms by OpenNMS.

the class OpenLayersMapPanel method initializeMap.

/**
     * <p>initializeMap</p>
     */
private void initializeMap() {
    final MapOptions mo = new MapOptions();
    mo.setProjection(PROJECTION_SPHERICAL_MERCATOR.getProjectionCode());
    mo.setDisplayProjection(PROJECTION_LAT_LON);
    mo.setMaxExtent(new Bounds(-180, -90, 180, 90).transform(PROJECTION_LAT_LON, PROJECTION_SPHERICAL_MERCATOR));
    m_mapWidget = new MapWidget("100%", "100%", mo);
    m_mapHolder.add(m_mapWidget);
    m_map = m_mapWidget.getMap();
    m_map.addControl(new PanZoomBar());
    m_map.addControl(new MousePosition());
    m_map.zoomTo(2);
    initializeImageError();
    XYZOptions xyzOptions = new XYZOptions();
    xyzOptions.setSphericalMercator(true);
    xyzOptions.setAttribution(getAttribution());
    XYZ x = new XYZ("OpenStreetMap", getLayerUrl(), xyzOptions);
    x.setIsBaseLayer(true);
    x.setIsVisible(true);
    m_map.addLayer(x);
    m_markersLayer = new Markers("Remote Pollers");
    m_markersLayer.setIsVisible(true);
    m_markersLayer.setIsBaseLayer(false);
    m_map.addLayer(m_markersLayer);
    /*
        final LayerSwitcher switcher = new LayerSwitcher();
        m_map.addControl(switcher);
        */
    m_map.zoomToMaxExtent();
    Window.addResizeHandler(new ResizeHandler() {

        @Override
        public void onResize(ResizeEvent event) {
            syncMapSizeWithParent();
        }
    });
}
Also used : MousePosition(org.gwtopenmaps.openlayers.client.control.MousePosition) MapOptions(org.gwtopenmaps.openlayers.client.MapOptions) Bounds(org.gwtopenmaps.openlayers.client.Bounds) XYZOptions(org.gwtopenmaps.openlayers.client.layer.XYZOptions) Markers(org.gwtopenmaps.openlayers.client.layer.Markers) ResizeHandler(com.google.gwt.event.logical.shared.ResizeHandler) XYZ(org.gwtopenmaps.openlayers.client.layer.XYZ) MapWidget(org.gwtopenmaps.openlayers.client.MapWidget) PanZoomBar(org.gwtopenmaps.openlayers.client.control.PanZoomBar) ResizeEvent(com.google.gwt.event.logical.shared.ResizeEvent)

Example 3 with ResizeHandler

use of com.google.gwt.event.logical.shared.ResizeHandler in project opennms by OpenNMS.

the class PageableApplicationList method registerHandlers.

private void registerHandlers() {
    m_eventBus.addHandler(ApplicationDetailsRetrievedEvent.TYPE, this);
    addHandler(new ResizeHandler() {

        @Override
        public void onResize(final ResizeEvent event) {
            refreshApplicationListResize();
        }
    }, ResizeEvent.getType());
}
Also used : ResizeHandler(com.google.gwt.event.logical.shared.ResizeHandler) ResizeEvent(com.google.gwt.event.logical.shared.ResizeEvent)

Example 4 with ResizeHandler

use of com.google.gwt.event.logical.shared.ResizeHandler in project opennms by OpenNMS.

the class MapQuestMapPanel method initializeMap.

/**
     * <p>initializeMap</p>
     */
private void initializeMap() {
    m_map = MQATileMap.newInstance(m_mapHolder.getElement());
    m_map.addControl(MQALargeZoomControl.newInstance());
    m_map.setZoomLevel(1);
    m_map.setCenter(MQALatLng.newInstance("0,0"));
    m_map.addMoveEndHandler(new MoveEndHandler() {

        @Override
        public void onMoveEnd(final MoveEndEvent event) {
            m_eventBus.fireEvent(new MapPanelBoundsChangedEvent(getBounds()));
        }
    });
    m_map.addClickHandler(new com.googlecode.gwtmapquest.transaction.event.ClickHandler() {

        @Override
        public void onClicked(final com.googlecode.gwtmapquest.transaction.event.ClickEvent event) {
            m_clickCounter.incrementCounter(event.getLL());
        }
    });
    m_map.addDblClickHandler(new DblClickHandler() {

        @Override
        public void onDblClicked(DblClickEvent event) {
            m_clickCounter.incrementCounter(event.getLL());
        }
    });
    m_map.addZoomEndHandler(new ZoomEndHandler() {

        @Override
        public void onZoomEnd(ZoomEndEvent event) {
            m_eventBus.fireEvent(new MapPanelBoundsChangedEvent(getBounds()));
        }
    });
    m_map.addShapeAddedHandler(new ShapeAddedHandler() {

        @Override
        public void onShapeAdded(ShapeAddedEvent event) {
            Element mqPoiDiv = DOM.getElementById("mqpoidiv");
            Element markerElement = Element.as(mqPoiDiv.getLastChild());
            updatePOILayer(markerElement);
        }
    });
    Window.addResizeHandler(new ResizeHandler() {

        @Override
        public void onResize(ResizeEvent event) {
            syncMapSizeWithParent();
        }
    });
}
Also used : DblClickEvent(com.googlecode.gwtmapquest.transaction.event.DblClickEvent) MapPanelBoundsChangedEvent(org.opennms.features.poller.remote.gwt.client.events.MapPanelBoundsChangedEvent) ShapeAddedHandler(com.googlecode.gwtmapquest.transaction.event.ShapeAddedHandler) Element(com.google.gwt.dom.client.Element) MoveEndEvent(com.googlecode.gwtmapquest.transaction.event.MoveEndEvent) ZoomEndEvent(com.googlecode.gwtmapquest.transaction.event.ZoomEndEvent) MoveEndHandler(com.googlecode.gwtmapquest.transaction.event.MoveEndHandler) ResizeEvent(com.google.gwt.event.logical.shared.ResizeEvent) ShapeAddedEvent(com.googlecode.gwtmapquest.transaction.event.ShapeAddedEvent) DblClickHandler(com.googlecode.gwtmapquest.transaction.event.DblClickHandler) ResizeHandler(com.google.gwt.event.logical.shared.ResizeHandler) ZoomEndHandler(com.googlecode.gwtmapquest.transaction.event.ZoomEndHandler)

Example 5 with ResizeHandler

use of com.google.gwt.event.logical.shared.ResizeHandler in project gerrit by GerritCodeReview.

the class EditScreen method onShowView.

@Override
public void onShowView() {
    super.onShowView();
    Window.enableScrolling(false);
    JumpKeys.enable(false);
    if (prefs.hideTopMenu()) {
        Gerrit.setHeaderVisible(false);
    }
    resizeHandler = Window.addResizeHandler(new ResizeHandler() {

        @Override
        public void onResize(ResizeEvent event) {
            adjustHeight();
        }
    });
    closeHandler = Window.addWindowClosingHandler(new ClosingHandler() {

        @Override
        public void onWindowClosing(ClosingEvent event) {
            if (!cmEdit.isClean(generation)) {
                event.setMessage(EditConstants.I.closeUnsavedChanges());
            }
        }
    });
    generation = cmEdit.changeGeneration(true);
    setClean(true);
    cmEdit.on(new ChangesHandler() {

        @Override
        public void handle(CodeMirror cm) {
            setClean(cm.isClean(generation));
        }
    });
    adjustHeight();
    cmEdit.on("cursorActivity", updateCursorPosition());
    setShowTabs(prefs.showTabs());
    setLineLength(prefs.lineLength());
    cmEdit.refresh();
    cmEdit.focus();
    if (startLine > 0) {
        cmEdit.scrollToLine(startLine);
    }
    updateActiveLine();
    editPrefsAction = new EditPreferencesAction(this, prefs);
}
Also used : ChangesHandler(net.codemirror.lib.CodeMirror.ChangesHandler) ResizeHandler(com.google.gwt.event.logical.shared.ResizeHandler) ClosingEvent(com.google.gwt.user.client.Window.ClosingEvent) ClosingHandler(com.google.gwt.user.client.Window.ClosingHandler) CodeMirror(net.codemirror.lib.CodeMirror) ResizeEvent(com.google.gwt.event.logical.shared.ResizeEvent)

Aggregations

ResizeEvent (com.google.gwt.event.logical.shared.ResizeEvent)6 ResizeHandler (com.google.gwt.event.logical.shared.ResizeHandler)6 Element (com.google.gwt.dom.client.Element)1 LargeMapControl (com.google.gwt.maps.client.control.LargeMapControl)1 Timer (com.google.gwt.user.client.Timer)1 ClosingEvent (com.google.gwt.user.client.Window.ClosingEvent)1 ClosingHandler (com.google.gwt.user.client.Window.ClosingHandler)1 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)1 SuggestBox (com.google.gwt.user.client.ui.SuggestBox)1 TextBox (com.google.gwt.user.client.ui.TextBox)1 TextBoxBase (com.google.gwt.user.client.ui.TextBoxBase)1 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)1 DblClickEvent (com.googlecode.gwtmapquest.transaction.event.DblClickEvent)1 DblClickHandler (com.googlecode.gwtmapquest.transaction.event.DblClickHandler)1 MoveEndEvent (com.googlecode.gwtmapquest.transaction.event.MoveEndEvent)1 MoveEndHandler (com.googlecode.gwtmapquest.transaction.event.MoveEndHandler)1 ShapeAddedEvent (com.googlecode.gwtmapquest.transaction.event.ShapeAddedEvent)1 ShapeAddedHandler (com.googlecode.gwtmapquest.transaction.event.ShapeAddedHandler)1 ZoomEndEvent (com.googlecode.gwtmapquest.transaction.event.ZoomEndEvent)1 ZoomEndHandler (com.googlecode.gwtmapquest.transaction.event.ZoomEndHandler)1