Example usage for com.google.gwt.user.client.ui FocusPanel addMouseDownHandler

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

Introduction

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

Prototype

public HandlerRegistration addMouseDownHandler(MouseDownHandler handler) 

Source Link

Usage

From source file:com.moesol.gwt.maps.client.MapController.java

License:Open Source License

public void bindHandlers(FocusPanel focusPanel) {
    focusPanel.addMouseMoveHandler(this);
    focusPanel.addMouseDownHandler(this);
    focusPanel.addMouseUpHandler(this);
    focusPanel.addMouseOutHandler(this);
    focusPanel.addMouseWheelHandler(this);
    focusPanel.addKeyDownHandler(this);
    focusPanel.addKeyUpHandler(this);
    focusPanel.addKeyPressHandler(this);
}

From source file:com.objetdirect.gwt.umlapi.client.umlCanvas.DecoratorCanvas.java

License:Open Source License

private void addSidePanelHandlers(final Direction direction, final FocusPanel sidePanel) {
    sidePanel.getElement().getStyle().setBackgroundColor(backgroundColor);
    sidePanel.getElement().getStyle().setOpacity(opacityValue);

    sidePanel.addMouseOverHandler(new MouseOverHandler() {
        @Override/* w  ww . j  av  a  2 s  .co m*/
        public void onMouseOver(final MouseOverEvent event) {
            for (double d = opacityValue; d <= opacityMax; d += 0.05) {
                final double opacity = Math.ceil(d * 100) / 100;

                new Scheduler.Task("Opacifying") {
                    @Override
                    public void process() {
                        sidePanel.getElement().getStyle().setOpacity(opacity);
                    }
                };
            }
            new Scheduler.Task("MovingAllArtifacts") {
                @Override
                public void process() {
                    Scheduler.cancel("MovingAllArtifactsRecursive");
                    umlCanvas.moveAll(direction.withSpeed(Direction.getDependingOnQualityLevelSpeed()), true);
                }
            };
        }
    });

    sidePanel.addMouseOutHandler(new MouseOutHandler() {
        @Override
        public void onMouseOut(final MouseOutEvent event) {
            Scheduler.cancel("Opacifying");
            Scheduler.cancel("MovingAllArtifacts");
            Scheduler.cancel("MovingAllArtifactsRecursive");

            sidePanel.getElement().getStyle().setOpacity(opacityValue);

        }
    });

    sidePanel.addMouseDownHandler(new MouseDownHandler() {
        @Override
        public void onMouseDown(final MouseDownEvent event) {
            sidePanel.getElement().getStyle()
                    .setBackgroundColor(ThemeManager.getTheme().getDirectionPanelPressedColor().toString());
            Scheduler.cancel("MovingAllArtifactsRecursive");
        }
    });

    sidePanel.addMouseUpHandler(new MouseUpHandler() {
        @Override
        public void onMouseUp(final MouseUpEvent event) {
            sidePanel.getElement().getStyle()
                    .setBackgroundColor(ThemeManager.getTheme().getDirectionPanelColor().toString());
            umlCanvas.moveAll(direction.withSpeed(
                    Math.min(DecoratorCanvas.this.getOffsetHeight(), DecoratorCanvas.this.getOffsetWidth())),
                    false);
        }
    });
}

From source file:com.risevision.ui.client.common.dnd.WindowPanel.java

License:Apache License

private Widget setupCell(int row, int col, DirectionConstant direction) {
    final FocusPanel widget = new FocusPanel();
    widget.setPixelSize(BORDER_THICKNESS, BORDER_THICKNESS);
    grid.setWidget(row, col, widget);/* ww  w.ja v a  2 s  . com*/
    windowController.getResizeDragController().makeDraggable(widget, direction);
    grid.getCellFormatter().addStyleName(row, col,
            CSS_DEMO_RESIZE_EDGE + " demo-resize-" + direction.directionLetters);

    widget.addMouseDownHandler(this);
    widget.addMouseUpHandler(this);

    return widget;
}

From source file:org.openelis.gwt.widget.table.TableHeaderBar.java

License:Open Source License

/**
 * Catches mouses Events for resizing columns.
 *//*from w  ww.ja va  2  s . c om*/
public void onMouseDown(MouseDownEvent event) {
    Widget sender = (Widget) event.getSource();
    // TODO Auto-generated method stub
    resizing = true;
    startx = sender.getAbsoluteLeft();
    resizeColumn1 = headers.indexOf(sender.getParent());
    tableCol1 = resizeColumn1;
    if (columns.get(tableCol1).getFixedWidth()) {
        resizing = false;
        resizeColumn1 = -1;
        tableCol1 = -1;
        return;
    }
    if (pop.isShowing()) {
        pop.hide();
        menuItem = null;
    }
    //menuItem.removeFromParent();
    FocusPanel bar = new FocusPanel();
    bar.addMouseUpHandler(this);
    bar.addMouseDownHandler(this);
    bar.addMouseMoveHandler(this);
    bar.setHeight((controller.view.cellView.getOffsetHeight() + 17) + "px");
    bar.setWidth("1px");
    DOM.setStyleAttribute(bar.getElement(), "background", "red");
    DOM.setStyleAttribute(bar.getElement(), "position", "absolute");
    DOM.setStyleAttribute(bar.getElement(), "left", sender.getAbsoluteLeft() + "px");
    DOM.setStyleAttribute(bar.getElement(), "top", sender.getAbsoluteTop() + "px");
    RootPanel.get().add(bar);
    DOM.setCapture(bar.getElement());
    DOM.setStyleAttribute(bar.getElement(), "zIndex", "1000");
}

From source file:org.openelis.gwt.widget.tree.TreeHeaderBar.java

License:Open Source License

/**
 * Catches mouses Events for resizing columns.
 *//* www .  j  a va 2s .c  om*/
public void onMouseDown(MouseDownEvent event) {
    Widget sender = (Widget) event.getSource();
    // TODO Auto-generated method stub
    resizing = true;
    startx = sender.getAbsoluteLeft();
    resizeColumn1 = headers.indexOf(sender.getParent());
    tableCol1 = resizeColumn1;
    if (columns.get(tableCol1).getFixedWidth()) {
        resizing = false;
        resizeColumn1 = -1;
        tableCol1 = -1;
        return;
    }
    if (pop.isShowing()) {
        pop.hide();
        menuItem = null;
    }
    FocusPanel bar = new FocusPanel();
    bar.addMouseUpHandler(this);
    bar.addMouseDownHandler(this);
    bar.addMouseMoveHandler(this);
    bar.setHeight((controller.view.table.getOffsetHeight() + 17) + "px");
    bar.setWidth("1px");
    DOM.setStyleAttribute(bar.getElement(), "background", "red");
    DOM.setStyleAttribute(bar.getElement(), "position", "absolute");
    DOM.setStyleAttribute(bar.getElement(), "left", sender.getAbsoluteLeft() + "px");
    DOM.setStyleAttribute(bar.getElement(), "top", sender.getAbsoluteTop() + "px");
    RootPanel.get().add(bar);
    DOM.setCapture(bar.getElement());
    DOM.setStyleAttribute(bar.getElement(), "zIndex", "1000");

}