Java 类javafx.event.EventTarget 实例源码

项目:jmonkeybuilder    文件:UIUtils.java   
/**
 * @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;
}
项目:Gargoyle    文件:GoogleTrendChartEvent.java   
/**
 * @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;
}
项目:Gargoyle    文件:DockEvent.java   
/**
 * 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;
}
项目:DockFX    文件:DockEvent.java   
/**
 * 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;
}
项目:JVx.javafx    文件:JavaFXTree.java   
/**
 * 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;
}
项目:CalendarFX    文件:AutoScrollPane.java   
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);
}
项目:CalendarFX    文件:AutoScrollPane.java   
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());
}
项目:CalendarFX    文件:AutoScrollPane.java   
private boolean isScrollBar(EventTarget target) {
    if (target instanceof Node) {
        return isScrollBar((Node) target);
    }

    return false;
}
项目:CalendarFX    文件:DayViewScrollPane.java   
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);
}
项目:CalendarFX    文件:DayViewScrollPane.java   
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());
}
项目:jmonkeybuilder    文件:EventRedirector.java   
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));
    }
项目:jmonkeybuilder    文件:EventRedirector.java   
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));
    }
项目:jmonkeybuilder    文件:TabToolComponent.java   
/**
 * 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();
}
项目:JVx.javafx    文件:JavaFXTable.java   
/**
 * 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;
}
项目:mongofx    文件:DBTreeController.java   
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();
      }
    }
  }
}
项目:interval-music-compositor    文件:DraggableAudioFileListView.java   
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()));
      }
    }
  });
}
项目:interval-music-compositor    文件:DraggableAudioFileListView.java   
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()));
      }
    }
  });
}
项目:Suji    文件:GameEvent.java   
public GameEvent(GameHandler source, EventTarget target, EventType<? extends GameEvent> eventType) {
    super(source, target, eventType);
}
项目:Suji    文件:SujiEvent.java   
public SujiEvent(EventPublisher source, EventTarget target, EventType<? extends SujiEvent> eventType) {
    super(source, target, eventType);
    publisher = source;
}
项目:Suji    文件:ScoreEvent.java   
private ScoreEvent(GameHandler source, EventTarget eventTarget, EventType<? extends ScoreEvent> eventType) {
    super(source, eventTarget, eventType);
}
项目:Suji    文件:HoverEvent.java   
public HoverEvent(GameHandler source, DrawCoords location, EventTarget target) {
    super(source, target, HOVER);
    point = location;
}
项目:ReqMan    文件:CUDEvent.java   
CUDEvent(Object source, EventTarget target, EventType<CUDEvent> type, TargetEntity targetEntity) {
    super(source, target);
    this.eventType = type;
    this.targetEntity = targetEntity;
}
项目:ReqMan    文件:CUDEvent.java   
public static CUDEvent generateCreationEvent(Object source, EventTarget target, TargetEntity targetEntity) {
    return new CUDEvent(source, target, CREATION, targetEntity);
}
项目:ReqMan    文件:CUDEvent.java   
public static CUDEvent generateDeletionEvent(Object source, EventTarget target, TargetEntity targetEntity) {
    return new CUDEvent(source, target, DELETION, targetEntity);
}
项目:mokka7    文件:CompletableService.java   
/**
 * {@link Service#setOnCancelled(javafx.event.EventHandler)}
 */
public CompletableService<T> onCancelled(Consumer<? super EventTarget> action) {
    setOnCancelled(t -> action.accept(t.getTarget()));
    return this;
}
项目:smoothcharts    文件:SmoothedChartEvent.java   
public SmoothedChartEvent(final Object SRC, final EventTarget TARGET, final EventType<SmoothedChartEvent> TYPE, final double Y_VALUE) {
    super(SRC, TARGET, TYPE);
    yValue = Y_VALUE;
}
项目:GazePlay    文件:TouchEvent.java   
@Override
public TouchEvent copyFor(Object newSource, EventTarget newTarget) {
    return (TouchEvent) super.copyFor(newSource, newTarget);
}
项目:GazePlay    文件:GazeEvent.java   
@Override
public GazeEvent copyFor(Object newSource, EventTarget newTarget) {
    return (GazeEvent) super.copyFor(newSource, newTarget);
}
项目:GazePlay    文件:LightningSimulator.java   
@Override
public LightningEvent copyFor(Object newSource, EventTarget newTarget) {
    return (LightningEvent) super.copyFor(newSource, newTarget);
}
项目:Clipcon-Client    文件:NotificationEvent.java   
public NotificationEvent(Object source, EventTarget target, EventType<NotificationEvent> type) {
    super(source, target, type);
}
项目:cassandra-client    文件:ErrorEvent.java   
public ErrorEvent(Object source, EventTarget target, Throwable error) {
    super(source, target, ERROR);
    this.error = error;
}
项目:KNOBS    文件:KnobEvent.java   
public KnobEvent( final Object source, final EventTarget target, final EventType<KnobEvent> type ) {
    super(source, target, type);
}
项目:tilesfx    文件:Section.java   
public SectionEvent(final Object SOURCE, final EventTarget TARGET, EventType<SectionEvent> TYPE) {
    super(SOURCE, TARGET, TYPE);
}
项目:tilesfx    文件:TimeSection.java   
public TimeSectionEvent(final Object SOURCE, final EventTarget TARGET, EventType<TimeSectionEvent> TYPE) {
    super(SOURCE, TARGET, TYPE);
}
项目:tilesfx    文件:Alarm.java   
public AlarmMarkerEvent(final Object SOURCE, final EventTarget TARGET, EventType<AlarmMarkerEvent> TYPE) {
    super(SOURCE, TARGET, TYPE);
}
项目:tilesfx    文件:SmoothedChartEvent.java   
public SmoothedChartEvent(final Object SRC, final EventTarget TARGET, final EventType<SmoothedChartEvent> TYPE, final double VALUE) {
    super(SRC, TARGET, TYPE);
    value = VALUE;
}
项目:Incubator    文件:FlipEvent.java   
public FlipEvent(final Object SOURCE, final EventTarget TARGET, final EventType<FlipEvent> EVENT_TYPE) {
    super(SOURCE, TARGET, EVENT_TYPE);
}
项目:Gargoyle    文件:GridBaseTableCellChangeEvent.java   
public GridBaseTableCellChangeEvent(Object source, EventTarget target) {
    super(source, target);
}
项目:Gargoyle    文件:GridBaseTableCellValueChangeEvent.java   
public GridBaseTableCellValueChangeEvent(Object source, EventTarget target) {
    super(source, target);
}
项目:javaone2016    文件:Section.java   
public SectionEvent(final Object SOURCE, final EventTarget TARGET, EventType<SectionEvent> TYPE) {
    super(SOURCE, TARGET, TYPE);
}