Java Code Examples for java.awt.event.MouseEvent.isConsumed()

The following are Jave code examples for showing how to use isConsumed() of the java.awt.event.MouseEvent class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: QN-ACTR-Release   File: ConnectState.java   View Source Code Vote up 6 votes
@Override
public void handlePress(MouseEvent e) {

	if (!e.isConsumed()) {
		start = mediator.snap(e.getPoint());
		firstPort = port = getOutPortViewAt(e.getX(), e.getY());

		if (firstPort != null) {
			start = mediator.toScreen(firstPort.getLocation(null));
			////				Giuseppe De Cicco & Fabio Granara
			//				aa = (JmtCell)((OutputPort)(firstPort.getCell())).getParent();
			//				aa.okout=true;
		}
		e.consume();
	}
	pressed = true;
}
 
Example 2
Project: QN-ACTR-Release   File: SelectState.java   View Source Code Vote up 6 votes
@Override
public void handleMove(MouseEvent e) {

	if (ml.getPreviousCursor() == null) {
		ml.setPreviousCursor(mediator.getGraphCursor());
	}
	if (mediator.isGraphEnabled()) {
		if (ml.getMarquee() != null) {
			ml.getMarquee().mouseMoved(e);
		}
		if (ml.getHandle() != null) {
			ml.getHandle().mouseMoved(e);
		}
		if (!e.isConsumed() && ml.getPreviousCursor() != null) {
			mediator.setGraphCursor(ml.getPreviousCursor());
			ml.setPreviousCursor(null);
		}

	}

	e.consume();
}
 
Example 3
Project: TrabalhoFinalEDA2   File: mxPanningHandler.java   View Source Code Vote up 6 votes
/**
 * 
 */
public void mouseDragged(MouseEvent e)
{
	if (!e.isConsumed() && start != null)
	{
		int dx = e.getX() - start.x;
		int dy = e.getY() - start.y;

		Rectangle r = graphComponent.getViewport().getViewRect();

		int right = r.x + ((dx > 0) ? 0 : r.width) - dx;
		int bottom = r.y + ((dy > 0) ? 0 : r.height) - dy;

		graphComponent.getGraphControl().scrollRectToVisible(
				new Rectangle(right, bottom, 0, 0));

		e.consume();
	}
}
 
Example 4
Project: jmt   File: ConnectState.java   View Source Code Vote up 6 votes
@Override
public void handleDrag(MouseEvent e) {
	if (firstPort != null) {
		if (!e.isConsumed()) {
			Graphics2D g = mediator.getGraphGraphics();
			Color bg = mediator.getGraphBackground();
			Color fg = Color.BLACK;
			g.setColor(fg);
			g.setXORMode(bg);
			overlay(g);

			current = mediator.snap(e.getPoint());
			port = getInPortViewAt(e.getX(), e.getY());
			if (port != null) {
				current = mediator.toScreen(port.getLocation(null));
			}

			g.setColor(bg);
			g.setXORMode(fg);
			overlay(g);
			e.consume();
		}
	}
}
 
Example 5
Project: TrabalhoFinalEDA2   File: mxPanningHandler.java   View Source Code Vote up 6 votes
/**
 * 
 */
public void mouseReleased(MouseEvent e)
{
	if (!e.isConsumed() && start != null)
	{
		int dx = Math.abs(start.x - e.getX());
		int dy = Math.abs(start.y - e.getY());

		if (graphComponent.isSignificant(dx, dy))
		{
			e.consume();
		}
	}

	start = null;
}
 
Example 6
Project: Tarski   File: mxInsertHandler.java   View Source Code Vote up 5 votes
/**
 * 
 */
public void mousePressed(MouseEvent e) {
  if (graphComponent.isEnabled() && isEnabled() && !e.isConsumed() && isStartEvent(e)) {
    start(e);
    e.consume();
  }
}
 
Example 7
Project: QN-ACTR-Release   File: ConnectState.java   View Source Code Vote up 5 votes
@Override
public void handleDrag(MouseEvent e) {

	if (firstPort != null) {
		if (!e.isConsumed()) {
			Graphics2D g = mediator.getGraphGraphics();
			Color bg = mediator.getGraphBackground();
			Color fg = Color.black;
			g.setColor(fg);
			g.setXORMode(bg);
			overlay(g);

			current = mediator.snap(e.getPoint());

			port = getInPortViewAt(e.getX(), e.getY());
			if (port != null) {
				current = mediator.toScreen(port.getLocation(null));
			}

			g.setColor(bg);
			g.setXORMode(fg);
			overlay(g);
			e.consume();
		}
	}

}
 
Example 8
Project: Tarski   File: mxRotationHandler.java   View Source Code Vote up 5 votes
/**
 * 
 */
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;
}
 
Example 9
Project: Tarski   File: mxRubberband.java   View Source Code Vote up 5 votes
/**
 * 
 */
public void mouseReleased(MouseEvent e) {
  Rectangle rect = bounds;
  reset();

  if (!e.isConsumed() && rect != null && graphComponent.isSignificant(rect.width, rect.height)) {
    select(rect, e);
    e.consume();
  }

}
 
Example 10
Project: MFM   File: ClickListener.java   View Source Code Vote up 5 votes
@Override
public void mouseClicked(MouseEvent e) {
    lastEvent = e;
    if (timer.isRunning() && !e.isConsumed() && e.getClickCount() > 1) {
        doubleClick(lastEvent);
        timer.stop();
    } else {
        timer.restart();
    }
}
 
Example 11
Project: Tarski   File: mxSelectionCellsHandler.java   View Source Code Vote up 5 votes
/**
 * Dispatches the mousepressed event to the subhandles. This is called from the connection handler
 * as subhandles have precedence over the connection handler.
 */
public void mousePressed(MouseEvent e) {
  if (graphComponent.isEnabled() && !graphComponent.isForceMarqueeEvent(e) && isEnabled()) {
    Iterator<mxCellHandler> it = handlers.values().iterator();

    while (it.hasNext() && !e.isConsumed()) {
      it.next().mousePressed(e);
    }
  }
}
 
Example 12
Project: Tarski   File: mxSelectionCellsHandler.java   View Source Code Vote up 5 votes
/**
 * 
 */
public void mouseMoved(MouseEvent e) {
  if (graphComponent.isEnabled() && isEnabled()) {
    Iterator<mxCellHandler> it = handlers.values().iterator();

    while (it.hasNext() && !e.isConsumed()) {
      it.next().mouseMoved(e);
    }
  }
}
 
Example 13
Project: TrabalhoFinalEDA2   File: mxConnectionHandler.java   View Source Code Vote up 5 votes
/**
 * 
 */
public void mouseDragged(MouseEvent e)
{
	if (!e.isConsumed() && graphComponent.isEnabled() && isEnabled())
	{
		// Activates the handler
		if (!active && first != null)
		{
			double dx = Math.abs(first.getX() - e.getX());
			double dy = Math.abs(first.getY() - e.getY());
			int tol = graphComponent.getTolerance();
			
			if (dx > tol || dy > tol)
			{
				active = true;
			}
		}
		
		if (e.getButton() == 0 || (isActive() && connectPreview.isActive()))
		{
			mxCellState state = marker.process(e);

			if (connectPreview.isActive())
			{
				connectPreview.update(e, marker.getValidState(), e.getX(),
						e.getY());
				setBounds(null);
				e.consume();
			}
			else
			{
				source = state;
			}
		}
	}
}
 
Example 14
Project: TrabalhoFinalEDA2   File: mxCellHandler.java   View Source Code Vote up 5 votes
/**
 * Processes the given event.
 */
public void mousePressed(MouseEvent e)
{
	if (!e.isConsumed())
	{
		int tmp = getIndexAt(e.getX(), e.getY());

		if (!isIgnoredEvent(e) && tmp >= 0 && isHandleEnabled(tmp))
		{
			graphComponent.stopEditing(true);
			start(e, tmp);
			e.consume();
		}
	}
}
 
Example 15
Project: cuttlefish   File: CrookedRun.java   View Source Code Vote up 5 votes
public synchronized void mouseClicked(MouseEvent e) {
    if (!e.isConsumed()) {
        if (selected != null) selected.removeUserDatum("SELECTED");
        selected = null;
        msgBox.setText("---");
    }
}
 
Example 16
Project: VASSAL-src   File: StackExpander.java   View Source Code Vote up 5 votes
public void mouseReleased(MouseEvent e) {
  if (!e.isConsumed()) {
    if (e.getClickCount() == 2) {
      GamePiece p = map.findPiece(e.getPoint(), PieceFinder.STACK_ONLY);
      if (p != null) {
        KeyBuffer.getBuffer().clear();
        ((Stack) p).setExpanded(!((Stack) p).isExpanded());
        KeyBuffer.getBuffer().add(((Stack) p).topPiece());
      }
      e.consume();
    }
  }
}
 
Example 17
Project: VASSAL-src   File: PieceMover.java   View Source Code Vote up 5 votes
protected boolean canHandleEvent(MouseEvent e) {
  return !e.isShiftDown() &&
         !e.isControlDown() &&
         !e.isMetaDown() &&
          e.getClickCount() < 2 &&
         !e.isConsumed();
}
 
Example 18
Project: incubator-netbeans   File: HeaderPanel.java   View Source Code Vote up 4 votes
protected void processMouseEvent(MouseEvent e) {
    if (processMouseEvents()) header.processMouseEvent(e);
    if (!e.isConsumed()) super.processMouseEvent(e);
}
 
Example 19
Project: incubator-netbeans   File: StayOpenPopupMenu.java   View Source Code Vote up 4 votes
protected void processMouseEvent(MouseEvent e) {
    performAction(this, e);
    if (!e.isConsumed()) super.processMouseEvent(e);
}
 
Example 20
Project: Tarski   File: mxVertexHandler.java   View Source Code Vote up 4 votes
/**
 * 
 */
public void mouseDragged(MouseEvent e) {
  if (!e.isConsumed() && first != null) {
    gridEnabledEvent = graphComponent.isGridEnabledEvent(e);
    constrainedEvent = graphComponent.isConstrainedEvent(e);

    double dx = e.getX() - first.x;
    double dy = e.getY() - first.y;

    if (isLabel(index)) {
      mxPoint pt = new mxPoint(e.getPoint());

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

      int idx = (int) Math.round(pt.getX() - first.x);
      int idy = (int) Math.round(pt.getY() - first.y);

      if (constrainedEvent) {
        if (Math.abs(idx) > Math.abs(idy)) {
          idy = 0;
        } else {
          idx = 0;
        }
      }

      Rectangle rect = state.getLabelBounds().getRectangle();
      rect.translate(idx, idy);
      preview.setBounds(rect);
    } else {
      mxGraph graph = graphComponent.getGraph();
      double scale = graph.getView().getScale();

      if (gridEnabledEvent) {
        dx = graph.snap(dx / scale) * scale;
        dy = graph.snap(dy / scale) * scale;
      }

      mxRectangle bounds = union(getState(), dx, dy, index);
      bounds.setWidth(bounds.getWidth() + 1);
      bounds.setHeight(bounds.getHeight() + 1);
      preview.setBounds(bounds.getRectangle());
    }

    if (!preview.isVisible() && graphComponent.isSignificant(dx, dy)) {
      preview.setVisible(true);
    }

    e.consume();
  }
}