/** * @param event the event. * @return true if the event is not hotkey. */ @FXThread public static boolean isNotHotKey(@Nullable final KeyEvent event) { if (event == null) return false; final String text = event.getText(); if (text.isEmpty()) return false; final KeyCode code = event.getCode(); final EventTarget target = event.getTarget(); if (code == KeyCode.TAB && !(target instanceof TextInputControl)) { return false; } if (event.isControlDown()) { return false; } else if (event.isShiftDown()) { return false; } return true; }
/** * @param source * @param target * @param eventType * @param x * @param y * @param screenX * @param screenY * @param pickResult * @param clickCount * @param contents */ public GoogleTrendChartEvent(Object source, EventTarget target, EventType<? extends GoogleTrendChartEvent> eventType, double x, double y, double screenX, double screenY, PickResult pickResult, int clickCount, List<Node> contents) { super(source, target, eventType); this.x = x; this.y = y; this.screenX = screenX; this.screenY = screenY; this.sceneX = x; this.sceneY = y; this.pickResult = pickResult != null ? pickResult : new PickResult(target, x, y); final Point3D p = InputEventUtils.recomputeCoordinates(this.pickResult, null); this.x = p.getX(); this.y = p.getY(); this.z = p.getZ(); this.clickCount = clickCount; this.contents = contents; }
/** * Constructs new DockEvent event.. * * @param source the source of the event. Can be null. * @param target the target of the event. Can be null. * @param eventType The type of the event. * @param x The x with respect to the source. Should be in scene coordinates if source == null or * source is not a Node. * @param y The y with respect to the source. Should be in scene coordinates if source == null or * source is not a Node. * @param screenX The x coordinate relative to screen. * @param screenY The y coordinate relative to screen. * @param pickResult pick result. Can be null, in this case a 2D pick result without any further * values is constructed based on the scene coordinates * @param contents The contents being dragged during this event. */ public DockEvent(Object source, EventTarget target, EventType<? extends DockEvent> eventType, double x, double y, double screenX, double screenY, PickResult pickResult, Node contents) { super(source, target, eventType); this.x = x; this.y = y; this.screenX = screenX; this.screenY = screenY; this.sceneX = x; this.sceneY = y; this.pickResult = pickResult != null ? pickResult : new PickResult(target, x, y); final Point3D p = InputEventUtils.recomputeCoordinates(this.pickResult, null); this.x = p.getX(); this.y = p.getY(); this.z = p.getZ(); this.contents = contents; }
/** * Checks if the given {@link MouseEvent} is on the selected cell. * * @param pMouseEvent the {@link MouseEvent}. * @return {@code true} if the given event is on the selected cell. */ private boolean isOnSelectedCell(MouseEvent pMouseEvent) { EventTarget target = pMouseEvent.getTarget(); if (target instanceof Node) { Node targetNode = (Node)target; while (targetNode != null && !(targetNode instanceof FXDataBooksTree)) { if (targetNode instanceof TreeCell<?>) { return ((TreeCell<?>)targetNode).isSelected(); } targetNode = targetNode.getParent(); } } return false; }
private void startDrag(MouseEvent evt) { EventTarget target = evt.getTarget(); if (isScrollBar(target) || !isOnEntry(target)) { return; } Dragboard db = startDragAndDrop(TransferMode.MOVE); ClipboardContent content = new ClipboardContent(); /* * We have to add some content, otherwise drag over will not be called. */ content.putString("dummy"); //$NON-NLS-1$ db.setContent(content); }
private boolean isOnEntry(EventTarget target) { if (target == null || !(target instanceof Node)) { return false; } Node node = (Node) target; if (node instanceof DayEntryView) { return true; } return isOnEntry(node.getParent()); }
private boolean isScrollBar(EventTarget target) { if (target instanceof Node) { return isScrollBar((Node) target); } return false; }
private void startDrag(MouseEvent evt) { EventTarget target = evt.getTarget(); if (!isOnEntry(target)) { return; } Dragboard db = startDragAndDrop(TransferMode.MOVE); ClipboardContent content = new ClipboardContent(); /* * We have to add some content, otherwise drag over will not be called. */ content.putString("dummy"); //$NON-NLS-1$ db.setContent(content); }
private void redirect(@NotNull final GestureEvent event) { final EventTarget target = event.getTarget(); if (target == destination) return; final FileEditor currentEditor = editorAreaComponent.getCurrentEditor(); if (currentEditor == null || !currentEditor.isInside(event.getSceneX(), event.getSceneY(), event.getClass())) { return; } Event.fireEvent(destination, event.copyFor(event.getSource(), destination)); }
private void redirect(@NotNull final InputEvent event) { final EventTarget target = event.getTarget(); if (target == destination) { return; } else if (target instanceof TextInputControl) { if (event instanceof KeyEvent && UIUtils.isNotHotKey((KeyEvent) event)) { if (Config.DEV_DEBUG_JFX_KEY_INPUT) { LOGGER.debug(this, target, ev -> "Key event was skipped because it was from " + ev); } return; } } final EventType<? extends InputEvent> eventType = event.getEventType(); final FileEditor currentEditor = editorAreaComponent.getCurrentEditor(); if (Config.DEV_DEBUG_JFX_KEY_INPUT) { LOGGER.debug(this, event, notNull(currentEditor), (red, ev, editor) -> "Key event " + ev.getEventType() + " is inside " + editor.isInside(red.getSceneX(), red.getSceneY(), ev.getClass())); } if (currentEditor == null || eventType != KeyEvent.KEY_RELEASED && !currentEditor.isInside(getSceneX(), getSceneY(), event.getClass())) { return; } if (Config.DEV_DEBUG_JFX_KEY_INPUT) { LOGGER.debug(this, event, ev -> "Redirect event " + ev); } Event.fireEvent(destination, event.copyFor(event.getSource(), destination)); }
/** * Handle a click to a tab. */ private void processMouseClick(@NotNull final MouseEvent event) { final EventTarget target = event.getTarget(); if (!(target instanceof Node)) return; final Node node = (Node) target; if (!(node instanceof Text) || node.getStyleClass().contains("tab-container")) { return; } final Parent label = node.getParent(); if (!(label instanceof Label)) { return; } final Parent tabContainer = label.getParent(); if (!tabContainer.getStyleClass().contains("tab-container")) { return; } if (isChangingTab()) { setChangingTab(false); return; } processExpandOrCollapse(); }
/** * Checks if the given {@link MouseEvent} is on the selected cell. * * @param pMouseEvent the {@link MouseEvent}. * @return {@code true} if the given event is on the selected cell. */ private boolean isOnSelectedCell(MouseEvent pMouseEvent) { EventTarget target = pMouseEvent.getTarget(); if (target instanceof Node) { boolean isCellSelection = resource.getSelectionModel().isCellSelectionEnabled(); Node targetNode = (Node)target; while (targetNode != null && !(targetNode instanceof FXDataBookView)) { if (isCellSelection && targetNode instanceof TableCell<?, ?>) { return ((TableCell<?, ?>)targetNode).isSelected(); } else if (!isCellSelection && targetNode instanceof TableRow<?>) { return ((TableRow<?>)targetNode).isSelected(); } targetNode = targetNode.getParent(); } } return false; }
public void treeViewClicked(MouseEvent ev) { if (ev.getClickCount() == 2) { // don't process click on triangle EventTarget target = ev.getTarget(); if (target instanceof Node && !"arrow".equals(((Node)target).getStyleClass())) { TreeItem<DbTreeValue> selectedItem = treeView.getSelectionModel().getSelectedItem(); if (selectedItem != null && selectedItem.getValue().getValueType() == TreeValueType.COLLECTION) { mainFrameController.openTab(); ev.consume(); } } } }
private void initializeKeyActions() { addEventHandler(KeyEvent.KEY_RELEASED, event -> { if (isDeleteCode(event.getCode())) { EventTarget target = event.getTarget(); if (target instanceof DraggableAudioFileListView) { DraggableAudioFileListView listView = (DraggableAudioFileListView) target; removeTracks(newArrayList(listView.getSelectionModel().getSelectedIndices())); } } }); }
public GameEvent(GameHandler source, EventTarget target, EventType<? extends GameEvent> eventType) { super(source, target, eventType); }
public SujiEvent(EventPublisher source, EventTarget target, EventType<? extends SujiEvent> eventType) { super(source, target, eventType); publisher = source; }
private ScoreEvent(GameHandler source, EventTarget eventTarget, EventType<? extends ScoreEvent> eventType) { super(source, eventTarget, eventType); }
public HoverEvent(GameHandler source, DrawCoords location, EventTarget target) { super(source, target, HOVER); point = location; }
CUDEvent(Object source, EventTarget target, EventType<CUDEvent> type, TargetEntity targetEntity) { super(source, target); this.eventType = type; this.targetEntity = targetEntity; }
public static CUDEvent generateCreationEvent(Object source, EventTarget target, TargetEntity targetEntity) { return new CUDEvent(source, target, CREATION, targetEntity); }
public static CUDEvent generateDeletionEvent(Object source, EventTarget target, TargetEntity targetEntity) { return new CUDEvent(source, target, DELETION, targetEntity); }
/** * {@link Service#setOnCancelled(javafx.event.EventHandler)} */ public CompletableService<T> onCancelled(Consumer<? super EventTarget> action) { setOnCancelled(t -> action.accept(t.getTarget())); return this; }
public SmoothedChartEvent(final Object SRC, final EventTarget TARGET, final EventType<SmoothedChartEvent> TYPE, final double Y_VALUE) { super(SRC, TARGET, TYPE); yValue = Y_VALUE; }
@Override public TouchEvent copyFor(Object newSource, EventTarget newTarget) { return (TouchEvent) super.copyFor(newSource, newTarget); }
@Override public GazeEvent copyFor(Object newSource, EventTarget newTarget) { return (GazeEvent) super.copyFor(newSource, newTarget); }
@Override public LightningEvent copyFor(Object newSource, EventTarget newTarget) { return (LightningEvent) super.copyFor(newSource, newTarget); }
public NotificationEvent(Object source, EventTarget target, EventType<NotificationEvent> type) { super(source, target, type); }
public ErrorEvent(Object source, EventTarget target, Throwable error) { super(source, target, ERROR); this.error = error; }
public KnobEvent( final Object source, final EventTarget target, final EventType<KnobEvent> type ) { super(source, target, type); }
public SectionEvent(final Object SOURCE, final EventTarget TARGET, EventType<SectionEvent> TYPE) { super(SOURCE, TARGET, TYPE); }
public TimeSectionEvent(final Object SOURCE, final EventTarget TARGET, EventType<TimeSectionEvent> TYPE) { super(SOURCE, TARGET, TYPE); }
public AlarmMarkerEvent(final Object SOURCE, final EventTarget TARGET, EventType<AlarmMarkerEvent> TYPE) { super(SOURCE, TARGET, TYPE); }
public SmoothedChartEvent(final Object SRC, final EventTarget TARGET, final EventType<SmoothedChartEvent> TYPE, final double VALUE) { super(SRC, TARGET, TYPE); value = VALUE; }
public FlipEvent(final Object SOURCE, final EventTarget TARGET, final EventType<FlipEvent> EVENT_TYPE) { super(SOURCE, TARGET, EVENT_TYPE); }
public GridBaseTableCellChangeEvent(Object source, EventTarget target) { super(source, target); }
public GridBaseTableCellValueChangeEvent(Object source, EventTarget target) { super(source, target); }