当前位置: 首页>>代码示例>>Java>>正文


Java Event.fireEvent方法代码示例

本文整理汇总了Java中javafx.event.Event.fireEvent方法的典型用法代码示例。如果您正苦于以下问题:Java Event.fireEvent方法的具体用法?Java Event.fireEvent怎么用?Java Event.fireEvent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.event.Event的用法示例。


在下文中一共展示了Event.fireEvent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: delete

import javafx.event.Event; //导入方法依赖的package包/类
@Override public Optional<ButtonType> delete(Optional<ButtonType> option) {
    if (!option.isPresent() || option.get() != FXUIUtils.YES_ALL) {
        option = FXUIUtils.showConfirmDialog(null, "Do you want to delete `" + group.getName() + "`?", "Confirm",
                AlertType.CONFIRMATION, ButtonType.YES, ButtonType.NO, FXUIUtils.YES_ALL, ButtonType.CANCEL);
    }
    if (option.isPresent() && (option.get() == ButtonType.YES || option.get() == FXUIUtils.YES_ALL)) {
        try {
            Group.delete(type, group);
            Event.fireEvent(this, new ResourceModificationEvent(ResourceModificationEvent.DELETE, this));
            getParent().getChildren().remove(this);
        } catch (Exception e) {
            e.printStackTrace();
            String message = String.format("Unable to delete: %s: %s%n", group.getName(), e);
            FXUIUtils.showMessageDialog(null, message, "Unable to delete", AlertType.ERROR);
        }
    }
    return option;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:19,代码来源:GroupResource.java

示例2: delete

import javafx.event.Event; //导入方法依赖的package包/类
@Override public Optional<ButtonType> delete(Optional<ButtonType> option) {
    if (!option.isPresent() || option.get() != FXUIUtils.YES_ALL) {
        option = FXUIUtils.showConfirmDialog(null, "Do you want to delete the entry `" + entry.getName() + "`?", "Confirm",
                AlertType.CONFIRMATION, ButtonType.YES, ButtonType.NO, FXUIUtils.YES_ALL, ButtonType.CANCEL);
    }
    if (option.isPresent() && (option.get() == ButtonType.YES || option.get() == FXUIUtils.YES_ALL)) {
        GroupResource parent = (GroupResource) getParent();
        parent.deleteEntry(this);
        try {
            Group.updateFile(parent.getSuite());
            Event.fireEvent(parent, new ResourceModificationEvent(ResourceModificationEvent.UPDATE, parent));
        } catch (IOException e) {
            e.printStackTrace();
            return option;
        }
    }
    return option;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:19,代码来源:GroupEntryResource.java

示例3: delete

import javafx.event.Event; //导入方法依赖的package包/类
@Override public Optional<ButtonType> delete(Optional<ButtonType> option) {
    if (!option.isPresent() || option.get() != FXUIUtils.YES_ALL) {
        option = FXUIUtils.showConfirmDialog(null, "Do you want to delete `" + path + "`?", "Confirm", AlertType.CONFIRMATION,
                ButtonType.YES, ButtonType.NO, FXUIUtils.YES_ALL, ButtonType.CANCEL);
    }
    if (option.isPresent() && (option.get() == ButtonType.YES || option.get() == FXUIUtils.YES_ALL)) {
        if (Files.exists(path)) {
            try {
                Files.delete(path);
                Event.fireEvent(this, new ResourceModificationEvent(ResourceModificationEvent.DELETE, this));
                getParent().getChildren().remove(this);
            } catch (IOException e) {
                String message = String.format("Unable to delete: %s: %s%n", path, e);
                FXUIUtils.showMessageDialog(null, message, "Unable to delete", AlertType.ERROR);
            }
        }
    }
    return option;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:20,代码来源:FileResource.java

示例4: delete

import javafx.event.Event; //导入方法依赖的package包/类
@Override public Optional<ButtonType> delete(Optional<ButtonType> option) {
    if (!option.isPresent() || option.get() != FXUIUtils.YES_ALL) {
        option = FXUIUtils.showConfirmDialog(null, "Do you want to delete the folder `" + path + "` and all its children?",
                "Confirm", AlertType.CONFIRMATION, ButtonType.YES, ButtonType.NO, FXUIUtils.YES_ALL, ButtonType.CANCEL);
    }
    if (option.isPresent() && (option.get() == ButtonType.YES || option.get() == FXUIUtils.YES_ALL)) {
        if (Files.exists(path)) {
            try {
                File file = path.toFile();
                File[] listFiles = file.listFiles();
                option = Copy.delete(path, option);
                if (listFiles.length > 0)
                    for (File f : listFiles) {
                        Event.fireEvent(this,
                                new ResourceModificationEvent(ResourceModificationEvent.DELETE, new FileResource(f)));
                    }
                Event.fireEvent(this, new ResourceModificationEvent(ResourceModificationEvent.DELETE, this));
                getParent().getChildren().remove(this);
            } catch (IOException e) {
                String message = String.format("Unable to delete: %s: %s%n", path, e);
                FXUIUtils.showMessageDialog(null, message, "Unable to delete", AlertType.ERROR);
            }
        }
    }
    return option;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:27,代码来源:FolderResource.java

示例5: rename

import javafx.event.Event; //导入方法依赖的package包/类
@Override public Resource rename(String text) {
    group.setName(text);
    try {
        Group.updateFile(group);
        Event.fireEvent(this, new ResourceModificationEvent(ResourceModificationEvent.UPDATE, this));
    } catch (IOException e) {
        e.printStackTrace();
    }
    return this;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:11,代码来源:GroupResource.java

示例6: updated

import javafx.event.Event; //导入方法依赖的package包/类
@Override public void updated(Resource resource) {
    try {
        group = Group.findByFile(type, group.getPath());
        loadEntries();
        Event.fireEvent(this, new TreeModificationEvent<Resource>(valueChangedEvent(), this, this));
    } catch (IOException e) {
        throw new RuntimeException("Could not read " + type.fileType() + " resource", e);
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:10,代码来源:GroupResource.java

示例7: paste

import javafx.event.Event; //导入方法依赖的package包/类
public void paste(int index, Clipboard clipboard, Operation operation) {
    if (!clipboard.hasFiles() || !type.droppable(clipboard.getFiles(), getFilePath())) {
        return;
    }
    List<File> files = clipboard.getFiles();
    ObservableList<TreeItem<Resource>> cs = getChildren();
    for (File file : files) {
        GroupEntry ge = null;
        try {
            if (Constants.isSuiteFile(file)) {
                ge = new GroupGroupEntry(GroupEntryType.SUITE, file.toPath().toString());
            } else if (Constants.isFeatureFile(file)) {
                ge = new GroupGroupEntry(GroupEntryType.FEATURE, file.toPath().toString());
            } else if (Constants.isStoryFile(file)) {
                ge = new GroupGroupEntry(GroupEntryType.STORY, file.toPath().toString());
            } else if (Constants.isIssueFile(file)) {
                ge = new GroupGroupEntry(GroupEntryType.ISSUE, file.toPath().toString());
            } else if (Constants.isTestFile(file)) {
                ge = getTestEntry(file);
            }
        } catch (IOException e) {
            e.printStackTrace();
            continue;
        }
        cs.add(index, new GroupEntryResource(ge));
        group.getEntries().add(index, ge);
        index++;
    }
    try {
        Group.updateFile(group);
    } catch (IOException e1) {
        e1.printStackTrace();
    }
    Event.fireEvent(this, new ResourceModificationEvent(ResourceModificationEvent.UPDATE, this));
    return;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:37,代码来源:GroupResource.java

示例8: moved

import javafx.event.Event; //导入方法依赖的package包/类
@Override public void moved() {
    GroupResource suiteResource = (GroupResource) getParent();
    if (suiteResource != null) {
        suiteResource.getSuite().getEntries().remove(suiteResource.getChildren().indexOf(this));
        suiteResource.getChildren().remove(this);
        try {
            Group.updateFile(suiteResource.getSuite());
        } catch (IOException e1) {
            e1.printStackTrace();
        }
        Event.fireEvent(suiteResource, new ResourceModificationEvent(ResourceModificationEvent.UPDATE, suiteResource));
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:14,代码来源:GroupEntryResource.java

示例9: redirect

import javafx.event.Event; //导入方法依赖的package包/类
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));
    }
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:33,代码来源:EventRedirector.java

示例10: rename

import javafx.event.Event; //导入方法依赖的package包/类
@Override public Resource rename(String text) {
    try {
        Path moved = Files.move(path, path.resolveSibling(text));
        FileResource to = new FileResource(moved.toFile());
        Event.fireEvent(this, new ResourceModificationEvent(ResourceModificationEvent.MOVED, this, to));
        return to;
    } catch (IOException e) {
        FXUIUtils.showMessageDialog(null, "Unable to rename folder: " + e.getMessage(), e.getClass().getName(),
                AlertType.ERROR);
        return null;
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:13,代码来源:FolderResource.java

示例11: pasteInto

import javafx.event.Event; //导入方法依赖的package包/类
@Override public void pasteInto(Clipboard clipboard, Operation operation) {
    if (clipboard.hasFiles()) {
        List<File> files = clipboard.getFiles();
        List<Path> paths = new ArrayList<>();
        for (File file : files) {
            paths.add(file.toPath().toAbsolutePath());
        }
        Collections.sort(paths);
        Path lastCopiedPath = null;
        for (Path path : paths) {
            try {
                if (lastCopiedPath == null || !path.startsWith(lastCopiedPath)) {
                    Path newPath = Copy.copy(path, this.path, operation);
                    if (newPath == null) {
                        continue;
                    }
                    Resource to;
                    if (Files.isDirectory(newPath)) {
                        to = new FolderResource(newPath.toFile(), watcher);
                    } else {
                        to = new FileResource(newPath.toFile());
                    }
                    lastCopiedPath = path;
                    Resource from;
                    if (path.toFile().isDirectory()) {
                        from = new FolderResource(path.toFile(), watcher);
                    } else {
                        from = new FileResource(path.toFile());
                    }
                    Event.fireEvent(this, new ResourceView.ResourceModificationEvent(
                            operation == Operation.CUT ? ResourceModificationEvent.MOVED : ResourceModificationEvent.COPIED,
                            from, to));
                }
            } catch (IOException e) {
                FXUIUtils.showMessageDialog(null, "Error in copying files.", e.getMessage(), AlertType.ERROR);
            }
        }
    }
    Platform.runLater(() -> refresh());
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:41,代码来源:FolderResource.java

示例12: rename

import javafx.event.Event; //导入方法依赖的package包/类
@Override public Resource rename(String text) {
    try {
        ProjectFile.updateProjectProperty(Constants.PROP_PROJECT_NAME, text);
        name = text;
        Event.fireEvent(this, new ResourceModificationEvent(ResourceModificationEvent.UPDATE, this));
    } catch (IOException e) {
        e.printStackTrace();
    }
    return this;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:11,代码来源:ProjectFolderResource.java

示例13: updated

import javafx.event.Event; //导入方法依赖的package包/类
@Override public void updated(Resource resource) {
    Path projectFilePath = super.getFilePath().resolve(ProjectFile.PROJECT_FILE);
    if (projectFilePath.equals(resource.getFilePath())) {
        setName();
        Event.fireEvent(this, new TreeModificationEvent<Resource>(valueChangedEvent(), this, this));
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:8,代码来源:ProjectFolderResource.java

示例14: marathon_select

import javafx.event.Event; //导入方法依赖的package包/类
@Override public boolean marathon_select(String value) {
    ColorPicker colorPicker = (ColorPicker) getComponent();
    if (!value.equals("")) {
        try {
            colorPicker.setValue(Color.valueOf(value));
            Event.fireEvent(colorPicker, new ActionEvent());
            return true;
        } catch (Throwable t) {
            throw new IllegalArgumentException("Invalid value for '" + value + "' for color-picker '");
        }
    }
    return false;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:14,代码来源:JavaFXColorPickerElement.java

示例15: fireEvent

import javafx.event.Event; //导入方法依赖的package包/类
/**
 * Fires the given calendar event to all event handlers currently registered
 * with this calendar.
 *
 * @param evt the event to fire
 */
public final void fireEvent(CalendarEvent evt) {
    if (fireEvents && !batchUpdates) {
        if (MODEL.isLoggable(FINER)) {
            MODEL.finer(getName() + ": fireing event: " + evt); //$NON-NLS-1$
        }

        requireNonNull(evt);
        Event.fireEvent(this, evt);
    }
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:17,代码来源:Calendar.java


注:本文中的javafx.event.Event.fireEvent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。