Java Code Examples for javafx.scene.input.MouseEvent#isShortcutDown()

The following examples show how to use javafx.scene.input.MouseEvent#isShortcutDown() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ActionButtonRepresentation.java    From phoebus with Eclipse Public License 1.0 6 votes vote down vote up
/** @param event Mouse event to check for target modifier keys */
private void checkModifiers(final MouseEvent event)
{
    // 'control' ('command' on Mac OS X)
    if (event.isShortcutDown())
        target_modifier = Optional.of(OpenDisplayActionInfo.Target.TAB);
    else if (event.isShiftDown())
        target_modifier = Optional.of(OpenDisplayActionInfo.Target.WINDOW);
    else
        target_modifier = Optional.empty();

    // At least on Linux, a Control-click or Shift-click
    // will not 'arm' the button, so the click is basically ignored.
    // Force the 'arm', so user can Control-click or Shift-click to
    // invoke the button
    if (target_modifier.isPresent())
    {
        logger.log(Level.FINE, "{0} modifier: {1}", new Object[] { model_widget, target_modifier.get() });
        base.arm();
    }
}
 
Example 2
Source File: SelectionCreator.java    From graph-editor with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Handles mouse-pressed events on the given joint.
 *
 * @param event a mouse-pressed event
 * @param joint the {@link GJoint} on which this event occured
 */
private void handleJointPressed(final MouseEvent event, final GJoint joint) {

    if (!event.getButton().equals(MouseButton.PRIMARY)) {
        return;
    }

    final GJointSkin jointSkin = skinLookup.lookupJoint(joint);

    if (!jointSkin.isSelected()) {
        if (!event.isShortcutDown()) {
            deselectAll();
        } else {
            backupSelections();
            jointSkin.setSelected(true);
        }
        jointSkin.getRoot().toFront();
    } else {
        if (event.isShortcutDown()) {
            jointSkin.setSelected(false);
        }
    }

    selectionDragManager.bindPositions(joint, model);
    event.consume();
}
 
Example 3
Source File: SelectionCreator.java    From graph-editor with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Handles mouse-pressed events on the view.
 *
 * @param event a mouse-pressed event
 */
private void handleViewPressed(final MouseEvent event) {

    if (!event.getButton().equals(MouseButton.PRIMARY)) {
        return;
    }

    if (!event.isShortcutDown()) {
        deselectAll();
    } else {
        backupSelections();
    }

    final double scale = view.getLocalToSceneTransform().getMxx();
    final Point2D cursorPosition = GeometryUtils.getCursorPosition(event, view);

    selectionBoxStart = new Point2D(cursorPosition.getX() / scale, cursorPosition.getY() / scale);
}
 
Example 4
Source File: TreeConnectionSkin.java    From graph-editor with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Handles mouse-pressed events on the connection skin to select / de-select the connection.
 *
 * @param event the mouse-pressed event
 */
private void handleMousePressed(final MouseEvent event) {

    if (event.isShortcutDown()) {
        setSelected(!isSelected());
    } else if (!isSelected()) {
        getGraphEditor().getSelectionManager().clearSelection();
        setSelected(true);
    }

    event.consume();
}
 
Example 5
Source File: SelectionCreator.java    From graph-editor with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Handles mouse-pressed events on the given node.
 *
 * @param event a mouse-pressed event
 * @param node the {@link GNode} on which this event occurred
 */
private void handleNodePressed(final MouseEvent event, final GNode node) {

    if (!event.getButton().equals(MouseButton.PRIMARY)) {
        return;
    }

    final GNodeSkin nodeSkin = skinLookup.lookupNode(node);

    if (!nodeSkin.isSelected()) {
        if (!event.isShortcutDown()) {
            deselectAll();
        } else {
            backupSelections();
        }
        nodeSkin.setSelected(true);
    } else {
        if (event.isShortcutDown()) {
            nodeSkin.setSelected(false);
        }
    }

    // Do not bind the positions of other selected nodes if this node is about to be resized.
    if (!nodeSkin.getRoot().isMouseInPositionForResize()) {
        selectionDragManager.bindPositions(node, model);
    }

    // Consume this event so it's not passed up to the parent (i.e. the view).
    event.consume();
}
 
Example 6
Source File: SelectionCreator.java    From graph-editor with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Handles mouse-pressed events on any connector.
 *
 * @param event a mouse-pressed event
 */
private void handleConnectorPressed(final MouseEvent event) {

    if (!event.getButton().equals(MouseButton.PRIMARY)) {
        return;
    }

    if (!event.isShortcutDown()) {
        deselectAll();
    }

    event.consume();
}
 
Example 7
Source File: RFXComponent.java    From marathonv5 with Apache License 2.0 4 votes vote down vote up
public boolean isMenuShortcutKeyDown(MouseEvent event) {
    return event.isShortcutDown();
}
 
Example 8
Source File: BendOnSegmentDragHandler.java    From gef with Eclipse Public License 2.0 2 votes vote down vote up
/**
 * Returns <code>true</code> if precise manipulations should be performed
 * for the given {@link MouseEvent}. Otherwise returns <code>false</code>.
 *
 * @param e
 *            The {@link MouseEvent} that is used to determine if precise
 *            manipulations should be performed (i.e. if the corresponding
 *            modifier key is pressed).
 * @return <code>true</code> if precise manipulations should be performed,
 *         <code>false</code> otherwise.
 */
protected boolean isPrecise(MouseEvent e) {
	return e.isShortcutDown();
}
 
Example 9
Source File: ResizeTranslateFirstAnchorageOnHandleDragHandler.java    From gef with Eclipse Public License 2.0 2 votes vote down vote up
/**
 * Returns <code>true</code> if precise manipulations should be performed
 * for the given {@link MouseEvent}. Otherwise returns <code>false</code>.
 *
 * @param e
 *            The {@link MouseEvent} that is used to determine if precise
 *            manipulations should be performed (i.e. if the corresponding
 *            modifier key is pressed).
 * @return <code>true</code> if precise manipulations should be performed,
 *         <code>false</code> otherwise.
 */
protected boolean isPrecise(MouseEvent e) {
	return e.isShortcutDown();
}
 
Example 10
Source File: FocusAndSelectOnClickHandler.java    From gef with Eclipse Public License 2.0 2 votes vote down vote up
/**
 * Returns <code>true</code> if the selection should be extended according
 * to the given {@link MouseEvent}, <code>false</code> if it should be
 * replaced.
 *
 * @param e
 *            The {@link MouseEvent} for which to determine if the selection
 *            is to be replaced or extended.
 * @return <code>true</code> if the selection should be extended according
 *         to the given {@link MouseEvent}, <code>false</code> if it should
 *         be replaced.
 */
protected boolean isAppend(MouseEvent e) {
	return e.isShortcutDown();
}
 
Example 11
Source File: BendFirstAnchorageOnSegmentHandleDragHandler.java    From gef with Eclipse Public License 2.0 2 votes vote down vote up
/**
 * Returns <code>true</code> if precise manipulations should be performed
 * for the given {@link MouseEvent}. Otherwise returns <code>false</code>.
 *
 * @param e
 *            The {@link MouseEvent} that is used to determine if precise
 *            manipulations should be performed (i.e. if the corresponding
 *            modifier key is pressed).
 * @return <code>true</code> if precise manipulations should be performed,
 *         <code>false</code> otherwise.
 */
protected boolean isPrecise(MouseEvent e) {
	return e.isShortcutDown();
}
 
Example 12
Source File: TranslateSelectedOnDragHandler.java    From gef with Eclipse Public License 2.0 2 votes vote down vote up
/**
 * Returns <code>true</code> if precise manipulations should be performed
 * for the given {@link MouseEvent}. Otherwise returns <code>false</code>.
 *
 * @param e
 *            The {@link MouseEvent} that is used to determine if precise
 *            manipulations should be performed (i.e. if the corresponding
 *            modifier key is pressed).
 * @return <code>true</code> if precise manipulations should be performed,
 *         <code>false</code> otherwise.
 */
protected boolean isPrecise(MouseEvent e) {
	return e.isShortcutDown();
}
 
Example 13
Source File: ResizeTransformSelectedOnHandleDragHandler.java    From gef with Eclipse Public License 2.0 2 votes vote down vote up
/**
 * Returns <code>true</code> if precise manipulations should be performed
 * for the given {@link MouseEvent}. Otherwise returns <code>false</code>.
 *
 * @param e
 *            The {@link MouseEvent} that is used to determine if precise
 *            manipulations should be performed (i.e. if the corresponding
 *            modifier key is pressed).
 * @return <code>true</code> if precise manipulations should be performed,
 *         <code>false</code> otherwise.
 */
protected boolean isPrecise(MouseEvent e) {
	return e.isShortcutDown();
}