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); }
@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)); } } }
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; }
/** * */ 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); /***************************************************************************************************************************/ }
public CustomizedEventDispatcher(EventDispatcher originalDispatcher) { this.originalDispatcher = originalDispatcher; }
public WebEventDispatcher(EventDispatcher oldDispatcher) { this.oldDispatcher = oldDispatcher; }
public MyEventDispatcher(EventDispatcher originalDispatcher) { this.originalDispatcher = originalDispatcher; }