Search in sources :

Example 1 with MouseOutHandler

use of com.google.gwt.event.dom.client.MouseOutHandler in project lienzo-core by ahome-it.

the class LienzoHandlerManager method addHandlers.

private final void addHandlers() {
    m_lienzo.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(final ClickEvent event) {
            if (!m_viewport.getOnEventHandlers().getOnMouseClickEventHandle().onMouseEventBefore(event)) {
                // could have been set previously by a mousedown, it will need cleaning up
                m_dragging_mouse_pressed = false;
                m_dragging_ignore_clicks = false;
                m_dragging = false;
                return;
            }
            onNodeMouseClick(new NodeMouseClickEvent(event));
            m_mouse_button_left = (event.getNativeButton() == NativeEvent.BUTTON_LEFT);
            m_mouse_button_middle = (event.getNativeButton() == NativeEvent.BUTTON_MIDDLE);
            m_mouse_button_right = (event.getNativeButton() == NativeEvent.BUTTON_RIGHT);
            event.preventDefault();
            m_viewport.getOnEventHandlers().getOnMouseClickEventHandle().onMouseEventAfter(event);
        }
    });
    m_lienzo.addDoubleClickHandler(new DoubleClickHandler() {

        @Override
        public void onDoubleClick(final DoubleClickEvent event) {
            if (!m_viewport.getOnEventHandlers().getOnMouseDoubleClickEventHandle().onMouseEventBefore(event)) {
                return;
            }
            onNodeMouseDoubleClick(new NodeMouseDoubleClickEvent(event));
            m_mouse_button_left = (event.getNativeButton() == NativeEvent.BUTTON_LEFT);
            m_mouse_button_middle = (event.getNativeButton() == NativeEvent.BUTTON_MIDDLE);
            m_mouse_button_right = (event.getNativeButton() == NativeEvent.BUTTON_RIGHT);
            event.preventDefault();
            m_viewport.getOnEventHandlers().getOnMouseDoubleClickEventHandle().onMouseEventBefore(event);
        }
    });
    m_lienzo.addMouseMoveHandler(new MouseMoveHandler() {

        @Override
        public void onMouseMove(final MouseMoveEvent event) {
            if (!m_viewport.getOnEventHandlers().getOnMouseMoveEventHandle().onMouseEventBefore(event)) {
                return;
            }
            if ((m_dragging) && (m_dragging_using_touches)) {
                event.preventDefault();
                // Ignore weird Mouse Move (0,0) in the middle of a Touch Drag on iOS/Safari
                return;
            }
            final NodeMouseMoveEvent nevent = new NodeMouseMoveEvent(event);
            if (m_mediators.handleEvent(nevent)) {
                event.preventDefault();
                return;
            }
            m_mouse_button_left = (event.getNativeButton() == NativeEvent.BUTTON_LEFT);
            m_mouse_button_middle = (event.getNativeButton() == NativeEvent.BUTTON_MIDDLE);
            m_mouse_button_right = (event.getNativeButton() == NativeEvent.BUTTON_RIGHT);
            onNodeMouseMove(nevent);
            event.preventDefault();
            m_viewport.getOnEventHandlers().getOnMouseMoveEventHandle().onMouseEventBefore(event);
        }
    });
    m_lienzo.addMouseUpHandler(new MouseUpHandler() {

        @Override
        public void onMouseUp(final MouseUpEvent event) {
            if (!m_viewport.getOnEventHandlers().getOnMouseUpEventHandle().onMouseEventBefore(event)) {
                // could have been set previously by a mousedown, it will need cleaning up
                m_dragging_mouse_pressed = false;
                m_dragging_ignore_clicks = false;
                m_dragging = false;
                return;
            }
            final NodeMouseUpEvent nevent = new NodeMouseUpEvent(event);
            if (m_mediators.handleEvent(nevent)) {
                return;
            }
            m_mouse_button_left = (event.getNativeButton() == NativeEvent.BUTTON_LEFT);
            m_mouse_button_middle = (event.getNativeButton() == NativeEvent.BUTTON_MIDDLE);
            m_mouse_button_right = (event.getNativeButton() == NativeEvent.BUTTON_RIGHT);
            onNodeMouseUp(nevent);
            m_viewport.getOnEventHandlers().getOnMouseUpEventHandle().onMouseEventBefore(event);
        }
    });
    m_lienzo.addMouseDownHandler(new MouseDownHandler() {

        @Override
        public void onMouseDown(final MouseDownEvent event) {
            if (!m_viewport.getOnEventHandlers().getOnMouseDownEventHandle().onMouseEventBefore(event)) {
                return;
            }
            final NodeMouseDownEvent nevent = new NodeMouseDownEvent(event);
            if (m_mediators.handleEvent(nevent)) {
                event.preventDefault();
                return;
            }
            m_mouse_button_left = (event.getNativeButton() == NativeEvent.BUTTON_LEFT);
            m_mouse_button_middle = (event.getNativeButton() == NativeEvent.BUTTON_MIDDLE);
            m_mouse_button_right = (event.getNativeButton() == NativeEvent.BUTTON_RIGHT);
            onNodeMouseDown(nevent);
            event.preventDefault();
            m_viewport.getOnEventHandlers().getOnMouseDownEventHandle().onMouseEventBefore(event);
        }
    });
    m_lienzo.addMouseOutHandler(new MouseOutHandler() {

        @Override
        public void onMouseOut(final MouseOutEvent event) {
            final NodeMouseOutEvent nevent = new NodeMouseOutEvent(event);
            if (m_mediators.handleEvent(nevent)) {
                return;
            }
            onNodeMouseOut(nevent);
        }
    });
    m_lienzo.addMouseOverHandler(new MouseOverHandler() {

        @Override
        public void onMouseOver(final MouseOverEvent event) {
            final NodeMouseOverEvent nevent = new NodeMouseOverEvent(event);
            if (m_mediators.handleEvent(nevent)) {
                return;
            }
            onNodeMouseOver(nevent);
        }
    });
    m_lienzo.addMouseWheelHandler(new MouseWheelHandler() {

        @Override
        public void onMouseWheel(final MouseWheelEvent event) {
            final NodeMouseWheelEvent nevent = new NodeMouseWheelEvent(event);
            if (m_mediators.handleEvent(nevent)) {
                event.preventDefault();
                event.stopPropagation();
            } else {
                fireEvent(nevent);
            }
        }
    });
    m_lienzo.addTouchCancelHandler(new TouchCancelHandler() {

        @Override
        public void onTouchCancel(final TouchCancelEvent event) {
            final NodeTouchCancelEvent nevent = new NodeTouchCancelEvent(event, getTouches(event));
            if (m_mediators.handleEvent(event)) {
                event.preventDefault();
                return;
            }
            onNodeMouseOut(nevent);
            event.preventDefault();
        }
    });
    m_lienzo.addTouchEndHandler(new TouchEndHandler() {

        @Override
        public void onTouchEnd(final TouchEndEvent event) {
            final NodeTouchEndEvent nevent = new NodeTouchEndEvent(event, m_touches);
            if (m_mediators.handleEvent(nevent)) {
                event.preventDefault();
                return;
            }
            onNodeMouseUp(nevent);
            event.preventDefault();
        }
    });
    m_lienzo.addTouchMoveHandler(new TouchMoveHandler() {

        @Override
        public void onTouchMove(final TouchMoveEvent event) {
            m_touches = getTouches(event);
            final NodeTouchMoveEvent nevent = new NodeTouchMoveEvent(event, m_touches);
            if (m_mediators.handleEvent(nevent)) {
                event.preventDefault();
                return;
            }
            onNodeMouseMove(nevent);
            event.preventDefault();
        }
    });
    m_lienzo.addTouchStartHandler(new TouchStartHandler() {

        @Override
        public void onTouchStart(final TouchStartEvent event) {
            m_touches = getTouches(event);
            final NodeTouchStartEvent nevent = new NodeTouchStartEvent(event, m_touches);
            if (m_mediators.handleEvent(nevent)) {
                event.preventDefault();
                return;
            }
            onNodeMouseDown(nevent);
            event.preventDefault();
        }
    });
    m_lienzo.addGestureStartHandler(new GestureStartHandler() {

        @Override
        public void onGestureStart(final GestureStartEvent event) {
            final NodeGestureStartEvent nevent = new NodeGestureStartEvent(event.getScale(), event.getRotation());
            if (m_mediators.handleEvent(nevent)) {
                event.preventDefault();
                return;
            }
            fireEvent(nevent);
            event.preventDefault();
        }
    });
    m_lienzo.addGestureEndHandler(new GestureEndHandler() {

        @Override
        public void onGestureEnd(final GestureEndEvent event) {
            final NodeGestureEndEvent nevent = new NodeGestureEndEvent(event.getScale(), event.getRotation());
            if (m_mediators.handleEvent(nevent)) {
                event.preventDefault();
                return;
            }
            fireEvent(nevent);
            event.preventDefault();
        }
    });
    m_lienzo.addGestureChangeHandler(new GestureChangeHandler() {

        @Override
        public void onGestureChange(final GestureChangeEvent event) {
            final NodeGestureChangeEvent nevent = new NodeGestureChangeEvent(event.getScale(), event.getRotation());
            if (m_mediators.handleEvent(nevent)) {
                event.preventDefault();
                return;
            }
            fireEvent(nevent);
            event.preventDefault();
        }
    });
}
Also used : MouseUpHandler(com.google.gwt.event.dom.client.MouseUpHandler) NodeMouseClickEvent(com.ait.lienzo.client.core.event.NodeMouseClickEvent) NodeMouseDoubleClickEvent(com.ait.lienzo.client.core.event.NodeMouseDoubleClickEvent) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) DoubleClickEvent(com.google.gwt.event.dom.client.DoubleClickEvent) NodeGestureStartEvent(com.ait.lienzo.client.core.event.NodeGestureStartEvent) NodeMouseClickEvent(com.ait.lienzo.client.core.event.NodeMouseClickEvent) MouseOutEvent(com.google.gwt.event.dom.client.MouseOutEvent) NodeMouseOutEvent(com.ait.lienzo.client.core.event.NodeMouseOutEvent) MouseOutHandler(com.google.gwt.event.dom.client.MouseOutHandler) TouchStartHandler(com.google.gwt.event.dom.client.TouchStartHandler) TouchStartEvent(com.google.gwt.event.dom.client.TouchStartEvent) NodeTouchStartEvent(com.ait.lienzo.client.core.event.NodeTouchStartEvent) MouseOverEvent(com.google.gwt.event.dom.client.MouseOverEvent) NodeMouseOverEvent(com.ait.lienzo.client.core.event.NodeMouseOverEvent) GestureStartHandler(com.google.gwt.event.dom.client.GestureStartHandler) MouseOverHandler(com.google.gwt.event.dom.client.MouseOverHandler) GestureChangeHandler(com.google.gwt.event.dom.client.GestureChangeHandler) NodeGestureChangeEvent(com.ait.lienzo.client.core.event.NodeGestureChangeEvent) NodeMouseOverEvent(com.ait.lienzo.client.core.event.NodeMouseOverEvent) NodeMouseWheelEvent(com.ait.lienzo.client.core.event.NodeMouseWheelEvent) MouseWheelHandler(com.google.gwt.event.dom.client.MouseWheelHandler) TouchMoveHandler(com.google.gwt.event.dom.client.TouchMoveHandler) NodeMouseMoveEvent(com.ait.lienzo.client.core.event.NodeMouseMoveEvent) TouchCancelEvent(com.google.gwt.event.dom.client.TouchCancelEvent) NodeTouchCancelEvent(com.ait.lienzo.client.core.event.NodeTouchCancelEvent) NodeMouseMoveEvent(com.ait.lienzo.client.core.event.NodeMouseMoveEvent) MouseMoveEvent(com.google.gwt.event.dom.client.MouseMoveEvent) GestureEndHandler(com.google.gwt.event.dom.client.GestureEndHandler) NodeMouseUpEvent(com.ait.lienzo.client.core.event.NodeMouseUpEvent) NodeTouchEndEvent(com.ait.lienzo.client.core.event.NodeTouchEndEvent) NodeMouseDownEvent(com.ait.lienzo.client.core.event.NodeMouseDownEvent) MouseDownEvent(com.google.gwt.event.dom.client.MouseDownEvent) NodeMouseDoubleClickEvent(com.ait.lienzo.client.core.event.NodeMouseDoubleClickEvent) DoubleClickEvent(com.google.gwt.event.dom.client.DoubleClickEvent) NodeMouseDownEvent(com.ait.lienzo.client.core.event.NodeMouseDownEvent) NodeMouseUpEvent(com.ait.lienzo.client.core.event.NodeMouseUpEvent) MouseUpEvent(com.google.gwt.event.dom.client.MouseUpEvent) TouchMoveEvent(com.google.gwt.event.dom.client.TouchMoveEvent) NodeTouchMoveEvent(com.ait.lienzo.client.core.event.NodeTouchMoveEvent) NodeTouchMoveEvent(com.ait.lienzo.client.core.event.NodeTouchMoveEvent) NodeMouseDoubleClickEvent(com.ait.lienzo.client.core.event.NodeMouseDoubleClickEvent) MouseMoveHandler(com.google.gwt.event.dom.client.MouseMoveHandler) NodeTouchStartEvent(com.ait.lienzo.client.core.event.NodeTouchStartEvent) NodeGestureEndEvent(com.ait.lienzo.client.core.event.NodeGestureEndEvent) NodeTouchCancelEvent(com.ait.lienzo.client.core.event.NodeTouchCancelEvent) GestureStartEvent(com.google.gwt.event.dom.client.GestureStartEvent) NodeGestureStartEvent(com.ait.lienzo.client.core.event.NodeGestureStartEvent) DoubleClickHandler(com.google.gwt.event.dom.client.DoubleClickHandler) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) MouseWheelEvent(com.google.gwt.event.dom.client.MouseWheelEvent) NodeMouseWheelEvent(com.ait.lienzo.client.core.event.NodeMouseWheelEvent) DoubleClickHandler(com.google.gwt.event.dom.client.DoubleClickHandler) NodeGestureChangeEvent(com.ait.lienzo.client.core.event.NodeGestureChangeEvent) GestureChangeEvent(com.google.gwt.event.dom.client.GestureChangeEvent) NodeMouseOutEvent(com.ait.lienzo.client.core.event.NodeMouseOutEvent) TouchEndEvent(com.google.gwt.event.dom.client.TouchEndEvent) NodeTouchEndEvent(com.ait.lienzo.client.core.event.NodeTouchEndEvent) MouseDownHandler(com.google.gwt.event.dom.client.MouseDownHandler) TouchCancelHandler(com.google.gwt.event.dom.client.TouchCancelHandler) TouchEndHandler(com.google.gwt.event.dom.client.TouchEndHandler) NodeGestureEndEvent(com.ait.lienzo.client.core.event.NodeGestureEndEvent) GestureEndEvent(com.google.gwt.event.dom.client.GestureEndEvent)

Example 2 with MouseOutHandler

use of com.google.gwt.event.dom.client.MouseOutHandler in project kie-wb-common by kiegroup.

the class AbstractDecoratedGridHeaderWidgetColumnResizeTest method testMouseOutHandler.

@Test
public void testMouseOutHandler() {
    header.onLoad();
    // Mock a resize operation following a MouseMoveEvent and MouseDownEvent
    when(resizerInformation.isResizing()).thenReturn(true);
    primeResizeOperation();
    // Test MouseOutHandler following a resize operation
    verify(rootPanel).addDomHandler(mouseOutEventHandlerCaptor.capture(), eq(MouseOutEvent.getType()));
    final MouseOutHandler mouseOutHandler = mouseOutEventHandlerCaptor.getValue();
    assertNotNull(mouseOutHandler);
    final MouseOutEvent event = mock(MouseOutEvent.class);
    mouseOutHandler.onMouseOut(event);
    verify(resizerInformation).setResizing(eq(false));
    verify(resizerInformation).setResizePrimed(eq(false));
    verify(event).preventDefault();
}
Also used : MouseOutHandler(com.google.gwt.event.dom.client.MouseOutHandler) MouseOutEvent(com.google.gwt.event.dom.client.MouseOutEvent) Test(org.junit.Test)

Example 3 with MouseOutHandler

use of com.google.gwt.event.dom.client.MouseOutHandler in project che by eclipse.

the class PopupMenu method initPopupMenu.

/**
     * Initialize popup menu.
     *
     * @param actionGroup action group
     * @param presentationFactory presentation factory
     * @param lockLayer lock layer, uses as root for attaching this popup menu
     * @param actionSelectedHandler handler for action selected event
     * @param keyBindingAgent agent for key binding
     * @param itemIdPrefix id prefix of the item
     */
private void initPopupMenu(ActionGroup actionGroup, PresentationFactory presentationFactory, MenuLockLayer lockLayer, ActionSelectedHandler actionSelectedHandler, KeyBindingAgent keyBindingAgent, String itemIdPrefix) {
    this.presentationFactory = presentationFactory;
    this.keyBindingAgent = keyBindingAgent;
    this.itemIdPrefix = itemIdPrefix;
    this.lockLayer = lockLayer;
    this.actionSelectedHandler = actionSelectedHandler;
    List<Utils.VisibleActionGroup> visibleActionGroupList = Utils.renderActionGroup(actionGroup, presentationFactory, actionManager, managerProvider.get());
    list = new ArrayList<>();
    for (Utils.VisibleActionGroup groupActions : visibleActionGroupList) {
        list.addAll(groupActions.getActionList());
    }
    popupMenuPanel = new SimplePanel();
    disableTextSelection(popupMenuPanel.getElement(), true);
    initWidget(popupMenuPanel);
    popupMenuPanel.addDomHandler(new MouseOutHandler() {

        @Override
        public void onMouseOut(MouseOutEvent event) {
            closeSubPopupTimer.cancel();
            PopupMenu.this.setStyleNormal(hoveredTR);
            hoveredTR = null;
            if (subPopupAnchor != null) {
                setStyleHovered(subPopupAnchor);
            }
        }
    }, MouseOutEvent.getType());
    popupMenuPanel.setStyleName(POPUP_RESOURCES.popup().popupMenuMain());
    hasCheckedItems = hasCheckedItems();
}
Also used : MouseOutHandler(com.google.gwt.event.dom.client.MouseOutHandler) SimplePanel(com.google.gwt.user.client.ui.SimplePanel) MouseOutEvent(com.google.gwt.event.dom.client.MouseOutEvent)

Example 4 with MouseOutHandler

use of com.google.gwt.event.dom.client.MouseOutHandler in project opentsdb by OpenTSDB.

the class QueryUi method onModuleLoad.

/**
 * This is the entry point method.
 */
public void onModuleLoad() {
    asyncGetJson(AGGREGATORS_URL, new GotJsonCallback() {

        public void got(final JSONValue json) {
            // Do we need more manual type checking?  Not sure what will happen
            // in the browser if something other than an array is returned.
            final JSONArray aggs = json.isArray();
            for (int i = 0; i < aggs.size(); i++) {
                aggregators.add(aggs.get(i).isString().stringValue());
            }
            ((MetricForm) metrics.getWidget(0)).setAggregators(aggregators);
            refreshFromQueryString();
            refreshGraph();
        }
    });
    // All UI elements need to regenerate the graph when changed.
    {
        final ValueChangeHandler<Date> vch = new ValueChangeHandler<Date>() {

            public void onValueChange(final ValueChangeEvent<Date> event) {
                refreshGraph();
            }
        };
        TextBox tb = start_datebox.getTextBox();
        tb.addBlurHandler(refreshgraph);
        tb.addKeyPressHandler(refreshgraph);
        start_datebox.addValueChangeHandler(vch);
        tb = end_datebox.getTextBox();
        tb.addBlurHandler(refreshgraph);
        tb.addKeyPressHandler(refreshgraph);
        end_datebox.addValueChangeHandler(vch);
    }
    autoreoload_interval.addBlurHandler(refreshgraph);
    autoreoload_interval.addKeyPressHandler(refreshgraph);
    yrange.addBlurHandler(refreshgraph);
    yrange.addKeyPressHandler(refreshgraph);
    y2range.addBlurHandler(refreshgraph);
    y2range.addKeyPressHandler(refreshgraph);
    ylog.addClickHandler(new AdjustYRangeCheckOnClick(ylog, yrange));
    y2log.addClickHandler(new AdjustYRangeCheckOnClick(y2log, y2range));
    ylog.addClickHandler(refreshgraph);
    y2log.addClickHandler(refreshgraph);
    ylabel.addBlurHandler(refreshgraph);
    ylabel.addKeyPressHandler(refreshgraph);
    y2label.addBlurHandler(refreshgraph);
    y2label.addKeyPressHandler(refreshgraph);
    yformat.addBlurHandler(refreshgraph);
    yformat.addKeyPressHandler(refreshgraph);
    y2format.addBlurHandler(refreshgraph);
    y2format.addKeyPressHandler(refreshgraph);
    wxh.addBlurHandler(refreshgraph);
    wxh.addKeyPressHandler(refreshgraph);
    global_annotations.addBlurHandler(refreshgraph);
    global_annotations.addKeyPressHandler(refreshgraph);
    horizontalkey.addClickHandler(refreshgraph);
    keybox.addClickHandler(refreshgraph);
    nokey.addClickHandler(refreshgraph);
    smooth.addClickHandler(refreshgraph);
    styles.addChangeHandler(refreshgraph);
    yrange.setValidationRegexp(// Nothing or
    "^(" + // "[start
    "|\\[([-+.0-9eE]+|\\*)?" + // :end]"
    ":([-+.0-9eE]+|\\*)?\\])$");
    yrange.setVisibleLength(5);
    // MAX=2^26=20 chars: "[-$MAX:$MAX]"
    yrange.setMaxLength(44);
    yrange.setText("[0:]");
    y2range.setValidationRegexp(// Nothing or
    "^(" + // "[start
    "|\\[([-+.0-9eE]+|\\*)?" + // :end]"
    ":([-+.0-9eE]+|\\*)?\\])$");
    y2range.setVisibleLength(5);
    // MAX=2^26=20 chars: "[-$MAX:$MAX]"
    y2range.setMaxLength(44);
    y2range.setText("[0:]");
    y2range.setEnabled(false);
    y2log.setEnabled(false);
    ylabel.setVisibleLength(10);
    // Arbitrary limit.
    ylabel.setMaxLength(50);
    y2label.setVisibleLength(10);
    // Arbitrary limit.
    y2label.setMaxLength(50);
    y2label.setEnabled(false);
    // Nothing or at least one %?
    yformat.setValidationRegexp("^(|.*%..*)$");
    yformat.setVisibleLength(10);
    // Arbitrary limit.
    yformat.setMaxLength(16);
    // Nothing or at least one %?
    y2format.setValidationRegexp("^(|.*%..*)$");
    y2format.setVisibleLength(10);
    // Arbitrary limit.
    y2format.setMaxLength(16);
    y2format.setEnabled(false);
    // 100x100
    wxh.setValidationRegexp("^[1-9][0-9]{2,}x[1-9][0-9]{2,}$");
    wxh.setVisibleLength(9);
    // 99999x99999
    wxh.setMaxLength(11);
    wxh.setText((Window.getClientWidth() - 20) + "x" + (Window.getClientHeight() * 4 / 5));
    final FlexTable table = new FlexTable();
    table.setText(0, 0, "From");
    {
        final HorizontalPanel hbox = new HorizontalPanel();
        hbox.add(new InlineLabel("To"));
        final Anchor now = new Anchor("(now)");
        now.addClickHandler(new ClickHandler() {

            public void onClick(final ClickEvent event) {
                end_datebox.setValue(new Date());
                refreshGraph();
            }
        });
        hbox.add(now);
        hbox.add(autoreload);
        hbox.setWidth("100%");
        table.setWidget(0, 1, hbox);
    }
    autoreload.addValueChangeHandler(new ValueChangeHandler<Boolean>() {

        @Override
        public void onValueChange(final ValueChangeEvent<Boolean> event) {
            if (autoreload.getValue()) {
                final HorizontalPanel hbox = new HorizontalPanel();
                hbox.setWidth("100%");
                hbox.add(new InlineLabel("Every:"));
                hbox.add(autoreoload_interval);
                hbox.add(new InlineLabel("seconds"));
                table.setWidget(1, 1, hbox);
                if (autoreoload_interval.getValue().isEmpty()) {
                    autoreoload_interval.setValue("15");
                }
                autoreoload_interval.setFocus(true);
                // Force refreshGraph.
                lastgraphuri = "";
                // Trigger the 1st auto-reload
                refreshGraph();
            } else {
                table.setWidget(1, 1, end_datebox);
            }
        }
    });
    // >=5s
    autoreoload_interval.setValidationRegexp("^([5-9]|[1-9][0-9]+)$");
    autoreoload_interval.setMaxLength(4);
    autoreoload_interval.setVisibleLength(8);
    table.setWidget(1, 0, start_datebox);
    table.setWidget(1, 1, end_datebox);
    {
        final HorizontalPanel hbox = new HorizontalPanel();
        hbox.add(new InlineLabel("WxH:"));
        hbox.add(wxh);
        table.setWidget(0, 3, hbox);
    }
    {
        final HorizontalPanel hbox = new HorizontalPanel();
        hbox.add(global_annotations);
        table.setWidget(0, 4, hbox);
    }
    {
        addMetricForm("metric 1", 0);
        metrics.selectTab(0);
        metrics.add(new InlineLabel("Loading..."), "+");
        metrics.addBeforeSelectionHandler(new BeforeSelectionHandler<Integer>() {

            public void onBeforeSelection(final BeforeSelectionEvent<Integer> event) {
                final int item = event.getItem();
                final int nitems = metrics.getWidgetCount();
                if (item == nitems - 1) {
                    // Last item: the "+" was clicked.
                    event.cancel();
                    final MetricForm metric = addMetricForm("metric " + nitems, item);
                    metrics.selectTab(item);
                    metric.setFocus(true);
                }
            }
        });
        table.setWidget(2, 0, metrics);
    }
    table.getFlexCellFormatter().setColSpan(2, 0, 2);
    table.getFlexCellFormatter().setRowSpan(1, 3, 2);
    final DecoratedTabPanel optpanel = new DecoratedTabPanel();
    optpanel.add(makeAxesPanel(), "Axes");
    optpanel.add(makeKeyPanel(), "Key");
    optpanel.add(makeStylePanel(), "Style");
    optpanel.selectTab(0);
    table.setWidget(1, 3, optpanel);
    table.getFlexCellFormatter().setColSpan(1, 3, 2);
    final DecoratorPanel decorator = new DecoratorPanel();
    decorator.setWidget(table);
    final VerticalPanel graphpanel = new VerticalPanel();
    graphpanel.add(decorator);
    {
        final VerticalPanel graphvbox = new VerticalPanel();
        graphvbox.add(graphstatus);
        graph.setVisible(false);
        // Put the graph image element and the zoombox elements inside the absolute panel
        graphbox.add(graph, 0, 0);
        zoom_box.setVisible(false);
        graphbox.add(zoom_box, 0, 0);
        graph.addMouseOverHandler(new MouseOverHandler() {

            public void onMouseOver(final MouseOverEvent event) {
                final Style style = graphbox.getElement().getStyle();
                style.setCursor(Cursor.CROSSHAIR);
            }
        });
        graph.addMouseOutHandler(new MouseOutHandler() {

            public void onMouseOut(final MouseOutEvent event) {
                final Style style = graphbox.getElement().getStyle();
                style.setCursor(Cursor.AUTO);
            }
        });
        graphvbox.add(graphbox);
        graph.addErrorHandler(new ErrorHandler() {

            public void onError(final ErrorEvent event) {
                graphstatus.setText("Oops, failed to load the graph.");
            }
        });
        graph.addLoadHandler(new LoadHandler() {

            public void onLoad(final LoadEvent event) {
                graphbox.setWidth(graph.getWidth() + "px");
                graphbox.setHeight(graph.getHeight() + "px");
            }
        });
        graphpanel.add(graphvbox);
    }
    final DecoratedTabPanel mainpanel = new DecoratedTabPanel();
    mainpanel.setWidth("100%");
    mainpanel.add(graphpanel, "Graph");
    mainpanel.add(stats_table, "Stats");
    mainpanel.add(logs, "Logs");
    mainpanel.add(build_data, "Version");
    mainpanel.selectTab(0);
    mainpanel.addBeforeSelectionHandler(new BeforeSelectionHandler<Integer>() {

        public void onBeforeSelection(final BeforeSelectionEvent<Integer> event) {
            clearError();
            final int item = event.getItem();
            switch(item) {
                case 1:
                    refreshStats();
                    return;
                case 2:
                    refreshLogs();
                    return;
                case 3:
                    refreshVersion();
                    return;
            }
        }
    });
    final VerticalPanel root = new VerticalPanel();
    root.setWidth("100%");
    root.add(current_error);
    current_error.setVisible(false);
    current_error.addStyleName("dateBoxFormatError");
    root.add(mainpanel);
    RootPanel.get("queryuimain").add(root);
    // Must be done at the end, once all the widgets are attached.
    ensureSameWidgetSize(optpanel);
    History.addHistoryListener(this);
}
Also used : LoadHandler(com.google.gwt.event.dom.client.LoadHandler) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) TextBox(com.google.gwt.user.client.ui.TextBox) MouseOutEvent(com.google.gwt.event.dom.client.MouseOutEvent) MouseOutHandler(com.google.gwt.event.dom.client.MouseOutHandler) MouseOverEvent(com.google.gwt.event.dom.client.MouseOverEvent) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) InlineLabel(com.google.gwt.user.client.ui.InlineLabel) MouseOverHandler(com.google.gwt.event.dom.client.MouseOverHandler) Style(com.google.gwt.dom.client.Style) ErrorHandler(com.google.gwt.event.dom.client.ErrorHandler) LoadEvent(com.google.gwt.event.dom.client.LoadEvent) JSONArray(com.google.gwt.json.client.JSONArray) FlexTable(com.google.gwt.user.client.ui.FlexTable) ValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler) Date(java.util.Date) EntryPoint(com.google.gwt.core.client.EntryPoint) JSONValue(com.google.gwt.json.client.JSONValue) BeforeSelectionHandler(com.google.gwt.event.logical.shared.BeforeSelectionHandler) Anchor(com.google.gwt.user.client.ui.Anchor) VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) BeforeSelectionEvent(com.google.gwt.event.logical.shared.BeforeSelectionEvent) ErrorEvent(com.google.gwt.event.dom.client.ErrorEvent) DecoratorPanel(com.google.gwt.user.client.ui.DecoratorPanel) DecoratedTabPanel(com.google.gwt.user.client.ui.DecoratedTabPanel)

Aggregations

MouseOutEvent (com.google.gwt.event.dom.client.MouseOutEvent)4 MouseOutHandler (com.google.gwt.event.dom.client.MouseOutHandler)4 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)2 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)2 MouseOverEvent (com.google.gwt.event.dom.client.MouseOverEvent)2 MouseOverHandler (com.google.gwt.event.dom.client.MouseOverHandler)2 NodeGestureChangeEvent (com.ait.lienzo.client.core.event.NodeGestureChangeEvent)1 NodeGestureEndEvent (com.ait.lienzo.client.core.event.NodeGestureEndEvent)1 NodeGestureStartEvent (com.ait.lienzo.client.core.event.NodeGestureStartEvent)1 NodeMouseClickEvent (com.ait.lienzo.client.core.event.NodeMouseClickEvent)1 NodeMouseDoubleClickEvent (com.ait.lienzo.client.core.event.NodeMouseDoubleClickEvent)1 NodeMouseDownEvent (com.ait.lienzo.client.core.event.NodeMouseDownEvent)1 NodeMouseMoveEvent (com.ait.lienzo.client.core.event.NodeMouseMoveEvent)1 NodeMouseOutEvent (com.ait.lienzo.client.core.event.NodeMouseOutEvent)1 NodeMouseOverEvent (com.ait.lienzo.client.core.event.NodeMouseOverEvent)1 NodeMouseUpEvent (com.ait.lienzo.client.core.event.NodeMouseUpEvent)1 NodeMouseWheelEvent (com.ait.lienzo.client.core.event.NodeMouseWheelEvent)1 NodeTouchCancelEvent (com.ait.lienzo.client.core.event.NodeTouchCancelEvent)1 NodeTouchEndEvent (com.ait.lienzo.client.core.event.NodeTouchEndEvent)1 NodeTouchMoveEvent (com.ait.lienzo.client.core.event.NodeTouchMoveEvent)1