/**
* @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;
}
java类javafx.event.EventTarget的实例源码
UIUtils.java 文件源码
项目:jmonkeybuilder
阅读 36
收藏 0
点赞 0
评论 0
GoogleTrendChartEvent.java 文件源码
项目:Gargoyle
阅读 28
收藏 0
点赞 0
评论 0
/**
* @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;
}
DockEvent.java 文件源码
项目:Gargoyle
阅读 23
收藏 0
点赞 0
评论 0
/**
* 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;
}
DockEvent.java 文件源码
项目:DockFX
阅读 21
收藏 0
点赞 0
评论 0
/**
* 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;
}
JavaFXTree.java 文件源码
项目:JVx.javafx
阅读 23
收藏 0
点赞 0
评论 0
/**
* 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;
}
AutoScrollPane.java 文件源码
项目:CalendarFX
阅读 20
收藏 0
点赞 0
评论 0
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);
}
AutoScrollPane.java 文件源码
项目:CalendarFX
阅读 21
收藏 0
点赞 0
评论 0
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());
}
AutoScrollPane.java 文件源码
项目:CalendarFX
阅读 20
收藏 0
点赞 0
评论 0
private boolean isScrollBar(EventTarget target) {
if (target instanceof Node) {
return isScrollBar((Node) target);
}
return false;
}
DayViewScrollPane.java 文件源码
项目:CalendarFX
阅读 19
收藏 0
点赞 0
评论 0
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);
}
DayViewScrollPane.java 文件源码
项目:CalendarFX
阅读 29
收藏 0
点赞 0
评论 0
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());
}
EventRedirector.java 文件源码
项目:jmonkeybuilder
阅读 27
收藏 0
点赞 0
评论 0
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));
}
EventRedirector.java 文件源码
项目:jmonkeybuilder
阅读 22
收藏 0
点赞 0
评论 0
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));
}
TabToolComponent.java 文件源码
项目:jmonkeybuilder
阅读 25
收藏 0
点赞 0
评论 0
/**
* 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();
}
JavaFXTable.java 文件源码
项目:JVx.javafx
阅读 23
收藏 0
点赞 0
评论 0
/**
* 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;
}
DBTreeController.java 文件源码
项目:mongofx
阅读 20
收藏 0
点赞 0
评论 0
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();
}
}
}
}
DraggableAudioFileListView.java 文件源码
项目:interval-music-compositor
阅读 21
收藏 0
点赞 0
评论 0
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()));
}
}
});
}
DraggableAudioFileListView.java 文件源码
项目:interval-music-compositor
阅读 24
收藏 0
点赞 0
评论 0
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()));
}
}
});
}
GameEvent.java 文件源码
项目:Suji
阅读 22
收藏 0
点赞 0
评论 0
public GameEvent(GameHandler source, EventTarget target, EventType<? extends GameEvent> eventType) {
super(source, target, eventType);
}
SujiEvent.java 文件源码
项目:Suji
阅读 18
收藏 0
点赞 0
评论 0
public SujiEvent(EventPublisher source, EventTarget target, EventType<? extends SujiEvent> eventType) {
super(source, target, eventType);
publisher = source;
}
ScoreEvent.java 文件源码
项目:Suji
阅读 22
收藏 0
点赞 0
评论 0
private ScoreEvent(GameHandler source, EventTarget eventTarget, EventType<? extends ScoreEvent> eventType) {
super(source, eventTarget, eventType);
}
HoverEvent.java 文件源码
项目:Suji
阅读 20
收藏 0
点赞 0
评论 0
public HoverEvent(GameHandler source, DrawCoords location, EventTarget target) {
super(source, target, HOVER);
point = location;
}
CUDEvent.java 文件源码
项目:ReqMan
阅读 19
收藏 0
点赞 0
评论 0
CUDEvent(Object source, EventTarget target, EventType<CUDEvent> type, TargetEntity targetEntity) {
super(source, target);
this.eventType = type;
this.targetEntity = targetEntity;
}
CUDEvent.java 文件源码
项目:ReqMan
阅读 20
收藏 0
点赞 0
评论 0
public static CUDEvent generateCreationEvent(Object source, EventTarget target, TargetEntity targetEntity) {
return new CUDEvent(source, target, CREATION, targetEntity);
}
CUDEvent.java 文件源码
项目:ReqMan
阅读 19
收藏 0
点赞 0
评论 0
public static CUDEvent generateDeletionEvent(Object source, EventTarget target, TargetEntity targetEntity) {
return new CUDEvent(source, target, DELETION, targetEntity);
}
CompletableService.java 文件源码
项目:mokka7
阅读 21
收藏 0
点赞 0
评论 0
/**
* {@link Service#setOnCancelled(javafx.event.EventHandler)}
*/
public CompletableService<T> onCancelled(Consumer<? super EventTarget> action) {
setOnCancelled(t -> action.accept(t.getTarget()));
return this;
}
SmoothedChartEvent.java 文件源码
项目:smoothcharts
阅读 19
收藏 0
点赞 0
评论 0
public SmoothedChartEvent(final Object SRC, final EventTarget TARGET, final EventType<SmoothedChartEvent> TYPE, final double Y_VALUE) {
super(SRC, TARGET, TYPE);
yValue = Y_VALUE;
}
TouchEvent.java 文件源码
项目:GazePlay
阅读 22
收藏 0
点赞 0
评论 0
@Override
public TouchEvent copyFor(Object newSource, EventTarget newTarget) {
return (TouchEvent) super.copyFor(newSource, newTarget);
}
GazeEvent.java 文件源码
项目:GazePlay
阅读 23
收藏 0
点赞 0
评论 0
@Override
public GazeEvent copyFor(Object newSource, EventTarget newTarget) {
return (GazeEvent) super.copyFor(newSource, newTarget);
}
LightningSimulator.java 文件源码
项目:GazePlay
阅读 19
收藏 0
点赞 0
评论 0
@Override
public LightningEvent copyFor(Object newSource, EventTarget newTarget) {
return (LightningEvent) super.copyFor(newSource, newTarget);
}
NotificationEvent.java 文件源码
项目:Clipcon-Client
阅读 21
收藏 0
点赞 0
评论 0
public NotificationEvent(Object source, EventTarget target, EventType<NotificationEvent> type) {
super(source, target, type);
}