Java 类javafx.event.EventDispatcher 实例源码

项目:travelimg    文件:GoogleMapScene.java   
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);

}
项目:Gamma-Music-Manager    文件:CustomTreeCell.java   
@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));
        }
    }
}
项目:Gamma-Music-Manager    文件:CustomEventDispatcher.java   
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;
}
项目:Gargoyle    文件:SqlTab.java   
/**
 *
 */
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);
    /***************************************************************************************************************************/

}
项目:travelimg    文件:GoogleMapScene.java   
public CustomizedEventDispatcher(EventDispatcher originalDispatcher) {
    this.originalDispatcher = originalDispatcher;
}
项目:mars-sim    文件:WebEventDispatcher.java   
public WebEventDispatcher(EventDispatcher oldDispatcher) {
    this.oldDispatcher = oldDispatcher;
}
项目:GMapsFX    文件:GoogleMapView.java   
public MyEventDispatcher(EventDispatcher originalDispatcher) {
    this.originalDispatcher = originalDispatcher;
}