java类javafx.event.EventDispatcher的实例源码

GoogleMapScene.java 文件源码 项目:travelimg 阅读 21 收藏 0 点赞 0 评论 0
public GoogleMapScene() {
    webView = new WebView();
    EventDispatcher originalDispatcher = webView.getEventDispatcher();
    webView.setEventDispatcher(new CustomizedEventDispatcher(originalDispatcher));
    webEngine = webView.getEngine();

    webEngine.setOnAlert(this::handleAlert);
    webEngine.load(getClass().getClassLoader().getResource("html/map.html").toString());

    getChildren().add(webView);

    setVgrow(webView, Priority.ALWAYS);

}
CustomTreeCell.java 文件源码 项目:Gamma-Music-Manager 阅读 19 收藏 0 点赞 0 评论 0
@Override
public void updateItem(Item item, boolean empty) {
    super.updateItem(item, empty);
    m_selectedItem = item;
    EventDispatcher originalDispatcher = getEventDispatcher();
    setEventDispatcher(new CustomEventDispatcher(originalDispatcher,
                                                    m_model,
                                                    m_tree,
                                                    m_selectedItem,
                                                    m_isLeftPane,
                                                    m_databaseManager));
    createContextMenu();
    setContextMenu(m_contextMenu);

    if (m_selectedItem != null) {
        boolean isLeftPaneRoot = ((m_cellType == CellType.LEFT_FILE_PANE) && m_selectedItem.isRootItem());
        boolean isRightPaneRoot = ((m_cellType == CellType.RIGHT_FILE_PANE) && m_selectedItem.isRightRootItem());
        if (isLeftPaneRoot || isRightPaneRoot) {
            setText(m_selectedItem.getFile().getAbsolutePath());
        } else {
            setText(m_selectedItem.getFile().getName());
        }

        if (m_cellType == CellType.LEFT_FILE_PANE
                && m_model.getM_selectedCenterFolder() != null
                && m_model.getM_selectedCenterFolder().equals(item.getFile())) {
            setGraphic(new ImageView(OPEN_FOLDER_ICON_URL));
        } else {
            String iconPath = item.getFile().isDirectory() ? FOLDER_ICON_URL : SONG_ICON_URL;
            setGraphic(new ImageView(iconPath));
        }
    }
}
CustomEventDispatcher.java 文件源码 项目:Gamma-Music-Manager 阅读 20 收藏 0 点赞 0 评论 0
public CustomEventDispatcher(EventDispatcher originalDispatcher,
                             SongManager model,
                             TreeView<Item> tree,
                             Item selectedItem,
                             boolean isLeftPane,
                             DatabaseManager databaseManager) {
    m_originalDispatcher = originalDispatcher;
    m_model = model;
    m_musicPlayerManager = m_model.getMusicPlayerManager();
    m_tree = tree;
    m_selectedItem = selectedItem;
    m_isLeftPane = isLeftPane;
    m_databaseManager = databaseManager;
}
SqlTab.java 文件源码 项目:Gargoyle 阅读 22 收藏 0 点赞 0 评论 0
/**
 *
 */
public SqlTab(EventHandler<KeyEvent> excutable) {
    this();
    setText(NEW_TAB);

    SqlKeywords createNewSqlPane = createNewSqlPane();
    sqlPane.set(createNewSqlPane);

    setContent(createNewSqlPane);
    //      content.setOnKeyPressed(excutable);
    createNewSqlPane.addEventHandler(KeyEvent.KEY_RELEASED, excutable);

    EventDispatcher eventDispatcher = createNewSqlPane.getEventDispatcher();

    createNewSqlPane.setEventDispatcher((event, tail) -> {

        EventType<? extends Event> eventType = event.getEventType();
        if (eventType == KeyEvent.KEY_PRESSED) {

            tail.append(keyEventDispatcher);
            tail.append(eventDispatcher);

        }

        Event dispatchEvent = eventDispatcher.dispatchEvent(event, tail);
        return dispatchEvent;

    });

    /***************************************************************************************************************************/
    /* 컨텍스트 메뉴 추가. */
    ContextMenu contextMenu = createNewSqlPane.getCodeArea().getContextMenu();
    ObservableList<MenuItem> items = contextMenu.getItems();
    MenuItem muOpen = new MenuItem("Open");
    muOpen.setAccelerator(new KeyCodeCombination(KeyCode.O, KeyCombination.CONTROL_DOWN));
    muOpen.setOnAction(this::miOenOnAction);
    items.add(0, muOpen);

    MenuItem muSave = new MenuItem("Save");
    muSave.setAccelerator(new KeyCodeCombination(KeyCode.S, KeyCombination.CONTROL_DOWN));
    muSave.setOnAction(this::muSaveOnAction);
    items.add(1, muSave);
    /***************************************************************************************************************************/

}
GoogleMapScene.java 文件源码 项目:travelimg 阅读 20 收藏 0 点赞 0 评论 0
public CustomizedEventDispatcher(EventDispatcher originalDispatcher) {
    this.originalDispatcher = originalDispatcher;
}
WebEventDispatcher.java 文件源码 项目:mars-sim 阅读 24 收藏 0 点赞 0 评论 0
public WebEventDispatcher(EventDispatcher oldDispatcher) {
    this.oldDispatcher = oldDispatcher;
}
GoogleMapView.java 文件源码 项目:GMapsFX 阅读 22 收藏 0 点赞 0 评论 0
public MyEventDispatcher(EventDispatcher originalDispatcher) {
    this.originalDispatcher = originalDispatcher;
}


问题


面经


文章

微信
公众号

扫码关注公众号