isConsumed()源码实例Demo

java.awt.event.MouseEvent#isConsumed()源码实例Demo

下面列出了java.awt.event.MouseEvent#isConsumed() 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: consulo   文件: mxInsertHandler.java
/**
 *
 */
public void mouseReleased(MouseEvent e) {
  if (graphComponent.isEnabled() && isEnabled() && !e.isConsumed() && current != null) {
    mxGraph graph = graphComponent.getGraph();
    double scale = graph.getView().getScale();
    mxPoint tr = graph.getView().getTranslate();
    current.setX(current.getX() / scale - tr.getX());
    current.setY(current.getY() / scale - tr.getY());
    current.setWidth(current.getWidth() / scale);
    current.setHeight(current.getHeight() / scale);

    Object cell = insertCell(current);
    eventSource.fireEvent(new mxEventObject(mxEvent.INSERT, "cell", cell));
    e.consume();
  }

  reset();
}
 
源代码2 项目: consulo   文件: WindowMoveListener.java
@Override
public void mouseClicked(MouseEvent event) {
  if (event.isConsumed()) return;
  if (BUTTON1_MASK == (BUTTON1_MASK & event.getModifiers()) && 1 < event.getClickCount()) {
    Component view = getView(getContent(event));
    if (view instanceof Frame) {
      Frame frame = (Frame)view;
      int state = frame.getExtendedState();
      if (!isStateSet(Frame.ICONIFIED, state) && frame.isResizable()) {
        event.consume();
        frame.setExtendedState(isStateSet(Frame.MAXIMIZED_BOTH, state) ? (state & ~Frame.MAXIMIZED_BOTH) : (state | Frame.MAXIMIZED_BOTH));
      }
    }
  }
  super.mouseClicked(event);
}
 
源代码3 项目: rscplus   文件: MouseHandler.java
@Override
public void mouseMoved(MouseEvent e) {
  if (listener_mouse_motion == null) return;

  if (Replay.isRecording) {
    Replay.dumpMouseInput(
        Replay.MOUSE_MOVED,
        e.getX(),
        e.getY(),
        0,
        e.getModifiers(),
        e.getClickCount(),
        0,
        0,
        e.isPopupTrigger(),
        e.getButton());
  }

  if (!e.isConsumed()) {
    x = e.getX();
    y = e.getY();
    listener_mouse_motion.mouseMoved(e);
  }
}
 
源代码4 项目: weblaf   文件: ComponentResizeBehavior.java
@Override
public void mouseReleased ( @NotNull final MouseEvent e )
{
    if ( !e.isConsumed () && SwingUtilities.isLeftMouseButton ( e ) && resizing )
    {
        final int cursor = getCursor ( e.getPoint () );
        if ( cursor != -1 )
        {
            e.getComponent ().setCursor ( Cursor.getPredefinedCursor ( cursor ) );
        }
        else if ( initialCursor != null )
        {
            e.getComponent ().setCursor ( initialCursor );
            initialCursor = null;
        }

        resizing = false;
        initialPoint = null;
        initialBounds = null;
        currentDirection = null;

        // Consume event
        e.consume ();
    }
}
 
源代码5 项目: consulo   文件: mxConnectionHandler.java
/**
 *
 */
public void mousePressed(MouseEvent e) {
  if (!graphComponent.isForceMarqueeEvent(e) &&
      !graphComponent.isPanningEvent(e) &&
      !e.isPopupTrigger() &&
      graphComponent.isEnabled() &&
      isEnabled() &&
      !e.isConsumed() &&
      ((isHighlighting() && marker.hasValidState()) || (!isHighlighting() && bounds != null && bounds.contains(e.getPoint())))) {
    start(e, marker.getValidState());
    e.consume();
  }
}
 
源代码6 项目: blog-codes   文件: mxGraphOutline.java
public void mousePressed(MouseEvent e)
{
	zoomGesture = hitZoomHandle(e.getX(), e.getY());

	if (graphComponent != null && !e.isConsumed()
			&& !e.isPopupTrigger()
			&& (finderBounds.contains(e.getPoint()) || zoomGesture))
	{
		start = e.getPoint();
	}
}
 
源代码7 项目: rscplus   文件: MouseHandler.java
@Override
public void mouseReleased(MouseEvent e) {
  if (inConsumableButton()) {
    e.consume();
  }
  if (listener_mouse == null) return;

  if (Replay.isRecording) {
    Replay.dumpMouseInput(
        Replay.MOUSE_RELEASED,
        e.getX(),
        e.getY(),
        0,
        e.getModifiers(),
        e.getClickCount(),
        0,
        0,
        e.isPopupTrigger(),
        e.getButton());
  }

  if (e.getButton() == MouseEvent.BUTTON2) {
    m_rotating = false;
    e.consume();
  }

  if (!e.isConsumed()) {
    x = e.getX();
    y = e.getY();
    listener_mouse.mouseReleased(e);
  }
}
 
源代码8 项目: blog-codes   文件: mxInsertHandler.java
/**
 * 
 */
public void mouseDragged(MouseEvent e)
{
	if (graphComponent.isEnabled() && isEnabled() && !e.isConsumed()
			&& first != null)
	{
		mxRectangle dirty = current;

		current = new mxRectangle(first.x, first.y, 0, 0);
		current.add(new mxRectangle(e.getX(), e.getY(), 0, 0));

		if (dirty != null)
		{
			dirty.add(current);
		}
		else
		{
			dirty = current;
		}

		Rectangle tmp = dirty.getRectangle();
		int b = (int) Math.ceil(lineWidth);
		graphComponent.getGraphControl().repaint(tmp.x - b, tmp.y - b,
				tmp.width + 2 * b, tmp.height + 2 * b);

		e.consume();
	}
}
 
源代码9 项目: wpcleaner   文件: PageListMouseListener.java
/**
 * @param e Event.
 * @see java.awt.event.MouseAdapter#mouseClicked(java.awt.event.MouseEvent)
 */
@Override
public void mouseClicked(MouseEvent e) {
  if ((!e.isConsumed()) &&
      (e.getButton() == MouseEvent.BUTTON1) &&
      (e.getClickCount() == 2)) {
    if (e.getSource() instanceof JTable) {
      JTable table = (JTable) e.getSource();
      if (table.getModel() instanceof PageListTableModel) {
        PageListTableModel model = (PageListTableModel) table.getModel();
        int column = table.columnAtPoint(e.getPoint());
        int row = table.rowAtPoint(e.getPoint());
        if ((column >= 0) && (row >= 0)) {
          row = Utilities.convertRowIndexToModel(table, row);
          Page page = model.getPage(row);
          if (Boolean.TRUE.equals(page.isDisambiguationPage())) {
            Controller.runDisambiguationAnalysis(page.getTitle(), page.getWikipedia());
          } else {
            Controller.runFullAnalysis(page.getTitle(), null, page.getWikipedia());
          }
          e.consume();
        }
      }
    }
  }
  super.mouseClicked(e);
}
 
源代码10 项目: lucene-solr   文件: OverviewPanelProvider.java
void showTopTermsContextMenu(MouseEvent e) {
  if (e.getClickCount() == 2 && !e.isConsumed()) {
    int row = topTermsTable.rowAtPoint(e.getPoint());
    if (row != topTermsTable.getSelectedRow()) {
      topTermsTable.changeSelection(row, topTermsTable.getSelectedColumn(), false, false);
    }
    topTermsContextMenu.show(e.getComponent(), e.getX(), e.getY());
  }
}
 
源代码11 项目: consulo   文件: mxSelectionCellsHandler.java
/**
 *
 */
public void mouseMoved(MouseEvent e) {
  if (graphComponent.isEnabled() && isEnabled()) {
    Iterator<mxCellHandler> it = handlers.values().iterator();

    while (it.hasNext() && !e.isConsumed()) {
      it.next().mouseMoved(e);
    }
  }
}
 
源代码12 项目: consulo   文件: mxRotationHandler.java
/**
 *
 */
public void mouseReleased(MouseEvent e) {
  if (graphComponent.isEnabled() && isEnabled() && !e.isConsumed() && first != null) {
    double deg = 0;
    Object cell = null;

    if (currentState != null) {
      cell = currentState.getCell();
                              /*deg = mxUtils.getDouble(currentState.getStyle(),
				mxConstants.STYLE_ROTATION);*/
    }

    deg += currentAngle * mxConstants.DEG_PER_RAD;
    boolean willExecute = cell != null && first != null;

    // TODO: Call reset before execute in all handlers that
    // offer an execute method
    reset();

    if (graphComponent.isEnabled() && isEnabled() && !e.isConsumed() && willExecute) {
      graphComponent.getGraph().setCellStyles(mxConstants.STYLE_ROTATION, String.valueOf(deg), new Object[]{cell});

      graphComponent.getGraphControl().repaint();

      e.consume();
    }
  }

  currentState = null;
}
 
void showAttributeValues(MouseEvent e) {
  if (e.getClickCount() != 2 || e.isConsumed()) {
    return;
  }
  int rowIndex = namedTokensTable.rowAtPoint(e.getPoint());
  int columnIndex = namedTokensTable.columnAtPoint(e.getPoint());
  if (rowIndex < 0 || rowIndex >= namedTokensTable.getRowCount()) {
    return;
  } else if (columnIndex < 0 || columnIndex >= namedTokensTable.getColumnCount()) {
    return;
  }
  StepByStepAnalyzeResultPanelProvider.this.showAttributeValues(rowIndex, columnIndex);
}
 
源代码14 项目: lucene-solr   文件: DocumentsPanelProvider.java
void showDocumentContextMenu(MouseEvent e) {
  if (e.getClickCount() == 2 && !e.isConsumed()) {
    int row = documentTable.rowAtPoint(e.getPoint());
    if (row != documentTable.getSelectedRow()) {
      documentTable.changeSelection(row, documentTable.getSelectedColumn(), false, false);
    }
    documentContextMenu.show(e.getComponent(), e.getX(), e.getY());
  }
}
 
源代码15 项目: visualvm   文件: HeaderPanel.java
protected void processMouseEvent(MouseEvent e) {
    if (processMouseEvents()) header.processMouseEvent(e);
    if (!e.isConsumed()) super.processMouseEvent(e);
}
 
源代码16 项目: netbeans   文件: StayOpenPopupMenu.java
protected void processMouseEvent(MouseEvent e) {
    performAction(this, e);
    if (!e.isConsumed()) super.processMouseEvent(e);
}
 
源代码17 项目: visualvm   文件: HeaderPanel.java
protected void processMouseEvent(MouseEvent e) {
    if (processMouseEvents()) header.processMouseEvent(e);
    if (!e.isConsumed()) super.processMouseEvent(e);
}
 
源代码18 项目: Bytecoder   文件: SwingUtilities2.java
/**
 * Ignore mouse events if the component is null, not enabled, the event
 * is not associated with the left mouse button, or the event has been
 * consumed.
 */
public static boolean shouldIgnore(MouseEvent me, JComponent c) {
    return c == null || !c.isEnabled()
                     || !SwingUtilities.isLeftMouseButton(me)
                     || me.isConsumed();
}
 
源代码19 项目: consulo   文件: mxEdgeHandler.java
/**
 *
 */
public void mouseReleased(MouseEvent e) {
  mxGraph graph = graphComponent.getGraph();

  if (!e.isConsumed() && first != null) {
    double dx = e.getX() - first.x;
    double dy = e.getY() - first.y;

    if (graphComponent.isSignificant(dx, dy)) {
      if (error != null) {
        if (error.length() > 0) {
          JOptionPane.showMessageDialog(graphComponent, error);
        }
      }
      else if (isLabel(index)) {
        mxPoint abs = state.getAbsoluteOffset();
        dx = abs.getX() - first.x;
        dy = abs.getY() - first.y;

        mxPoint pt = new mxPoint(e.getPoint());

        if (gridEnabledEvent) {
          pt = graphComponent.snapScaledPoint(pt, dx, dy);
        }

        if (constrainedEvent) {
          if (Math.abs(e.getX() - first.x) > Math.abs(e.getY() - first.y)) {
            pt.setY(abs.getY());
          }
          else {
            pt.setX(abs.getX());
          }
        }

        moveLabelTo(state, pt.getX() + dx, pt.getY() + dy);
      }
      else if (marker.hasValidState() && (isSource(index) || isTarget(index))) {
        connect(state.getCell(), marker.getValidState().getCell(), isSource(index), graphComponent.isCloneEvent(e) && isCloneEnabled());
      }
      else if ((!isSource(index) && !isTarget(index)) || graphComponent.getGraph().isAllowDanglingEdges()) {
        movePoint(state.getCell(), index, convertPoint(new mxPoint(e.getPoint()), gridEnabledEvent));
      }

      e.consume();
    }
  }

  if (!e.isConsumed() && isFlipEvent(e)) {
    graph.flipEdge(state.getCell());
    e.consume();
  }

  super.mouseReleased(e);
}
 
源代码20 项目: lucene-solr   文件: SearchPanelProvider.java
void showContextMenuInResultsTable(MouseEvent e) {
  if (e.getClickCount() == 2 && !e.isConsumed()) {
    SearchPanelProvider.this.setupResultsContextMenuPopup().show(e.getComponent(), e.getX(), e.getY());
    setupResultsContextMenuPopup().show(e.getComponent(), e.getX(), e.getY());
  }
}