當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。