public void onMouseUp(@Nonnull final MouseUpEvent event) {
    dragging = false;
    DOM.releaseCapture(container.getElement());
    ClientLog.log("UP", null);
    event.stopPropagation();
    event.preventDefault();
    DOM.setStyleAttribute(widget.getElement(), "border", "red 2px solid");
    y += delta;

    //        widget.getElement().setAttribute("style", originalStyle);
  }
예제 #2
0
  public void onMouseUp(MouseUpEvent event) {
    if (mouseMoveCanceled) {
      return;
    }

    Event.releaseCapture(getElement());
    setFocus(false);
    if (moveRegistration != null) {
      moveRegistration.removeHandler();
      moveRegistration = null;
    }
    int endX = event.getClientX();
    int endY = event.getClientY();
    int xDiff = startX - endX;
    int yDiff = startY - endY;
    startX = -1;
    startY = -1;
    mouseMoveStarted = false;
    Style s = getElement().getStyle();
    s.setZIndex(1);
    if (!clickTargetsResize()) {
      // check if mouse has moved over threshold of 3 pixels
      boolean mouseMoved = (xDiff < -3 || xDiff > 3 || yDiff < -3 || yDiff > 3);

      if (!weekGrid.getCalendar().isDisabledOrReadOnly() && mouseMoved) {
        // Event Move:
        // - calendar must be enabled
        // - calendar must not be in read-only mode
        weekGrid.eventMoved(this);
      } else if (!weekGrid.getCalendar().isDisabled()) {
        // Event Click:
        // - calendar must be enabled (read-only is allowed)
        EventTarget et = event.getNativeEvent().getEventTarget();
        Element e = Element.as(et);
        if (e == caption || e == eventContent || e.getParentElement() == caption) {
          if (weekGrid.getCalendar().getEventClickListener() != null) {
            weekGrid.getCalendar().getEventClickListener().eventClick(calendarEvent);
          }
        }
      }

    } else { // click targeted resize bar
      removeGlobalResizeStyle();
      if (weekGrid.getCalendar().getEventResizeListener() != null) {
        weekGrid.getCalendar().getEventResizeListener().eventResized(calendarEvent);
      }
    }
  }
  @Override
  public void onMouseUp(MouseUpEvent event) {
    event.preventDefault();
    event.stopPropagation();

    if (this.activeLook) {
      switch (event.getNativeButton()) {
        case NativeEvent.BUTTON_LEFT:
          this.moveForward = false;
          break;
        case NativeEvent.BUTTON_RIGHT:
          this.moveBackward = false;
          break;
      }
    }
  }
예제 #4
0
파일: BaseView.java 프로젝트: raphsoft/che
  public BaseView(PartStackUIResources resources) {
    container = new DockLayoutPanel(Style.Unit.PX);
    container.getElement().setAttribute("role", "part");
    container.setSize("100%", "100%");
    container.getElement().getStyle().setOutlineStyle(Style.OutlineStyle.NONE);
    initWidget(container);

    toolBar = new DockLayoutPanel(Style.Unit.PX);
    toolBar.addStyleName(resources.partStackCss().ideBasePartToolbar());
    toolBar.getElement().setAttribute("role", "toolbar");
    toolBar.addDomHandler(
        new MouseUpHandler() {
          @Override
          public void onMouseUp(MouseUpEvent event) {
            // activate last focused element if user clicked on part header
            if (lastFocused != null) {
              lastFocused.setFocus(true);
            }
          }
        },
        MouseUpEvent.getType());
    container.addNorth(toolBar, 23);

    // this hack used for adding box shadow effect to toolbar
    toolBar.getElement().getParentElement().getStyle().setOverflow(Style.Overflow.VISIBLE);

    toolbarHeader = new DockLayoutPanel(Style.Unit.PX);
    toolbarHeader.getElement().setAttribute("role", "toolbar-header");
    toolBar.addNorth(toolbarHeader, 22);

    titleLabel = new Label();
    titleLabel.setStyleName(resources.partStackCss().ideBasePartTitleLabel());
    toolbarHeader.addWest(titleLabel, 200);

    SVGImage minimize = new SVGImage(resources.collapseExpandIcon());
    minimize.getElement().setAttribute("name", "workBenchIconMinimize");
    minimizeButton = new ToolButton(minimize);

    minimizeButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            minimize();
          }
        });

    addToolButton(minimizeButton);

    if (minimizeButton.getElement() instanceof elemental.dom.Element) {
      Tooltip.create(
          (elemental.dom.Element) minimizeButton.getElement(),
          PositionController.VerticalAlign.BOTTOM,
          PositionController.HorizontalAlign.MIDDLE,
          "Hide");
    }
  }
예제 #5
0
  NodePresenter(VGraphExplorer parent, NodeProxy model) {
    this.parent = parent;
    this.model = model;
    graph = parent.getGraph();

    view.setTitle(model.getId());
    Style style = view.getElement().getStyle();
    style.setLeft(model.getX(), Unit.PX);
    style.setTop(model.getY(), Unit.PX);

    view.addDomHandler(this, MouseDownEvent.getType());
    view.addDomHandler(this, MouseMoveEvent.getType());
    view.addDomHandler(this, MouseUpEvent.getType());

    parent.add(view);
  }
  public FirstPersonControls(Object3D object, Widget widget) {
    super(object, widget);

    this.viewHalfX = widget.getOffsetWidth() / 2;
    this.viewHalfY = widget.getOffsetHeight() / 2;

    if (getWidget().getClass() != RootPanel.class)
      getWidget().getElement().setAttribute("tabindex", "-1");

    this.target = new Vector3();

    getWidget().addDomHandler(this, ContextMenuEvent.getType());

    getWidget().addDomHandler(this, MouseMoveEvent.getType());
    getWidget().addDomHandler(this, MouseDownEvent.getType());
    getWidget().addDomHandler(this, MouseUpEvent.getType());
    RootPanel.get().addDomHandler(this, KeyDownEvent.getType());
    RootPanel.get().addDomHandler(this, KeyUpEvent.getType());
  }
예제 #7
0
 public void onMouseUp(MouseUpEvent event) {
   Element element = view.getElement();
   if (!isDragging()) {
     updateCSS();
     limitToBoundingBox();
     if (NodeProxy.EXPANDED.equals(model.getState())) {
       model.setState(NodeProxy.COLLAPSED);
       for (NodeProxy neighbor : graph.getNeighbors(model)) {
         boolean collapsed = NodeProxy.COLLAPSED.equals(neighbor.getState());
         boolean leafNode = graph.degree(neighbor) == 1;
         if (collapsed && leafNode) {
           graph.removeNode(neighbor);
         }
       }
     }
     parent.toggle(model);
   } else {
     parent.save(model, true);
     setDragging(false);
   }
   setMouseDown(false);
   DOM.releaseCapture(element);
   event.preventDefault();
 }
예제 #8
0
 public void attachHandlers() {
   if (handlerRegistration != null) return;
   handlerRegistration = parent.addDomHandler(this, MouseMoveEvent.getType());
   handlerRegistration2 = parent.addDomHandler(this, MouseUpEvent.getType());
   DOM.setCapture(parent.getElement());
 }
예제 #9
0
 public HandlerRegistration addMouseUpHandler(MouseUpHandler handler) {
   return addDomHandler(handler, MouseUpEvent.getType());
 }
예제 #10
0
 public void onMouseUp(MouseUpEvent anEvent) {
   Object theSource = anEvent.getSource();
   if (theSource instanceof MenuChoice) {
     ((MenuChoice) theSource).removeStyleDependentName(DEPENDENT_STYLENAME_SELECTED_ITEM);
   }
 }
  public void onMouseUp(MouseUpEvent e) {

    GPoint p = table.getIndexFromPixel(e.getClientX(), e.getClientY());
    if (p.getY() == 0 && p.getX() > 0) {
      if (table.isEditing()) editor.cancelCellEditing();
      table.scc.onMouseUp(e);
      return;
    } else if (p.getX() == 0 && p.getY() > 0) {
      if (table.isEditing()) editor.cancelCellEditing();
      table.srh.onMouseUp(e);
      return;
    }

    mouseIsDown = false;
    e.preventDefault();
    boolean eConsumed = false;

    boolean rightClick = (e.getNativeButton() == NativeEvent.BUTTON_RIGHT);

    if (table.getTableMode() == MyTable.TABLE_MODE_AUTOFUNCTION) {
      table.stopAutoFunction();
      return;
    }

    if (!rightClick) {
      if (editor.isEditing()) {
        String text = editor.getEditingValue();
        if (text.startsWith("=")) {
          GPoint point = table.getIndexFromPixel(e.getClientX(), e.getClientY());
          if (point != null) {
            int column = point.getX();
            int row = point.getY();
            if (column != editor.column || row != editor.row) {
              eConsumed = true;
            }
          }
        }
        selectedCellName = null;
        prefix0 = null;
        postfix0 = null;
        table.isDragging2 = false;
        table.repaint();
      }

      if (table.isOverDot) {
        // prevent UI manager from changing selection when mouse
        // is in a neighbor cell but is still over the dot region
        eConsumed = true;
      }

      if (table.isDragingDot) {
        if (table.dragingToColumn == -1 || table.dragingToRow == -1) return;
        int x1 = -1;
        int y1 = -1;
        int x2 = -1;
        int y2 = -1;
        // -|1|-
        // 2|-|3
        // -|4|-
        if (table.dragingToColumn < table.minSelectionColumn) { // 2
          x1 = table.dragingToColumn;
          y1 = table.minSelectionRow;
          x2 = table.minSelectionColumn - 1;
          y2 = table.maxSelectionRow;
        } else if (table.dragingToRow > table.maxSelectionRow) { // 4
          x1 = table.minSelectionColumn;
          y1 = table.maxSelectionRow + 1;
          x2 = table.maxSelectionColumn;
          y2 = table.dragingToRow;
        } else if (table.dragingToRow < table.minSelectionRow) { // 1
          x1 = table.minSelectionColumn;
          y1 = table.dragingToRow;
          x2 = table.maxSelectionColumn;
          y2 = table.minSelectionRow - 1;
        } else if (table.dragingToColumn > table.maxSelectionColumn) { // 3
          x1 = table.maxSelectionColumn + 1;
          y1 = table.minSelectionRow;
          x2 = table.dragingToColumn;
          y2 = table.maxSelectionRow;
        }

        // copy the cells
        boolean succ =
            relativeCopy.doDragCopy(
                table.minSelectionColumn - 1,
                table.minSelectionRow - 1,
                table.maxSelectionColumn - 1,
                table.maxSelectionRow - 1,
                x1 - 1,
                y1 - 1,
                x2 - 1,
                y2 - 1);
        if (succ) {
          app.storeUndoInfo();
        }

        // extend the selection to include the drag copy selection
        table.setSelection(
            Math.min(x1, table.minSelectionColumn) - 1,
            Math.min(y1, table.minSelectionRow) - 1,
            Math.max(x2, table.maxSelectionColumn) - 1,
            Math.max(y2, table.maxSelectionRow) - 1);

        // reset flags and cursor
        table.isOverDot = false;
        table.isDragingDot = false;
        table.dragingToRow = -1;
        table.dragingToColumn = -1;
        // TODO//setTableCursor();

        // prevent UI manager from changing selection
        eConsumed = true;

        table.repaint();
      }
    }

    // Alt click: copy definition to input field
    if (!table.isEditing() && e.isAltKeyDown() && app.showAlgebraInput()) {
      int row = p.getY(); // table.rowAtPoint(e.getPoint());
      int col = p.getX(); // table.columnAtPoint(e.getPoint());
      GeoElement geo = (GeoElement) model.getValueAt(row - 1, col - 1);

      if (geo != null) {
        // F3 key: copy definition to input bar
        app.getGlobalKeyDispatcher().handleFunctionKeyForAlgebraInput(3, geo);
        return;
      }
    }

    // handle right click
    if (rightClick) {
      if (!((AppW) kernel.getApplication()).letShowPopupMenu()) return;

      // change selection if right click is outside current selection
      if (p.getY() < table.minSelectionRow
          || p.getY() > table.maxSelectionRow
          || p.getX() < table.minSelectionColumn
          || p.getX() > table.maxSelectionColumn) {
        // switch to cell selection mode

        if (table.getSelectionType() != MyTable.CELL_SELECT) {
          table.setSelectionType(MyTable.CELL_SELECT);
        }

        // now change the selection
        if (p.getX() > 0 && p.getY() > 0)
          table.changeSelection(p.getY() - 1, p.getX() - 1, false, false);
      }

      // create and show context menu
      /*TODO SpreadsheetContextMenu popupMenu = new SpreadsheetContextMenu(
      		table, e.isShiftDown());
      popupMenu.show(e.getComponent(), e.getX(), e.getY());*/
    }

    if (eConsumed) return;

    // MyTable's default listeners follow, they should be simulated in Web e.g. here

    // change selection if right click is outside current selection
    if (p.getY() != table.leadSelectionRow + 1 || p.getX() != table.leadSelectionColumn + 1) {
      // switch to cell selection mode

      if (p.getY() > 0 && p.getX() > 0) {

        if (table.getSelectionType() != MyTable.CELL_SELECT) {
          table.setSelectionType(MyTable.CELL_SELECT);
        }

        // now change the selection
        table.changeSelection(p.getY() - 1, p.getX() - 1, false, true);
        table.repaint();
      }
    }
  }
예제 #12
0
 public void onMouseUp(MouseUpEvent event) {
   // TODO: make it care for mouse down too
   mouseClicked(MouseEvent.wrapEvent(event.getNativeEvent(), ZeroOffset.instance));
 }
예제 #13
0
 @Override
 public HandlerRegistration addMouseUpHandler(final MouseUpHandler handler) {
   return handlers.addHandler(MouseUpEvent.getType(), handler);
 }
예제 #14
0
 private void addDomHandlers(Widget w) {
   w.addDomHandler(this, MouseDownEvent.getType());
   w.addDomHandler(this, MouseUpEvent.getType());
   w.addDomHandler(this, TouchStartEvent.getType());
   w.addDomHandler(this, TouchEndEvent.getType());
 }