listener.registerChangeListener(tab.textProperty(), "TEXT"); listener.registerChangeListener(tab.graphicProperty(), "GRAPHIC"); listener.registerChangeListener(tab.tooltipProperty(), "TOOLTIP");
@Override public void handle(Event event) { // workaround for javafx memeoryleaks RT-25652, RT-32087 formTabFinal.setContent(null); formTabFinal.textProperty().unbind(); formTabFinal.setOnClosed(null); form.close(); } });
public void openPage(String location) { final URL url; try { url = URLVerifier.verifyURL(location); } catch (MalformedURLException ex) { Logger.getLogger(BrowserFXController.class.getName()).log(Level.SEVERE, null, ex); return; } URLHandler urlHandler = URLHandlersRegistry.getHandler(url); if (urlHandler == null) { return; } Platform.runLater(() -> { URLHandler.Result handleResult = urlHandler.handle(url); if (handleResult.contentDescriptor != ContentDescriptor.NoContent.instance()) { BrowserTab browserTab = TabFactory.newTab(this, locale, handleResult.contentDescriptor); browserTab.getNavigationContext().goTo(url); selectionTab.getSelectedItem().contentProperty().bind(browserTab.contentProperty()); browserMap.put(selectionTab.getSelectedIndex(), browserTab); // if(!urlField.isFocused()){ urlField.textProperty().bind(browserTab.locationProperty()); // } stopButton.disableProperty().set(!browserTab.isStoppable()); selectionTab.getSelectedItem().textProperty().bind(browserTab.titleProperty()); } }); }
private void addTab(PositionableAdapter<FXDockableEntry> dockable) { final Tab tab = new Tab(); final FXDockableData dockableData = dockable.getAdapted().getDockableData(); tab.textProperty().bind(dockableData.titleProperty()); tab.graphicProperty().bind(dockableData.graphicProperty()); tab.contextMenuProperty().bind(dockableData.contextMenuProperty()); tab.setContent(dockable.getAdapted().getDockable()); tabPane.getTabs().add(control.getDockables().indexOf(dockable), tab); } }
public <T extends Node> Tab startInTab(FlowContainer<T> container) throws FlowException { Tab tab = new Tab(); getCurrentViewMetadata().addListener((e) -> { tab.textProperty().unbind(); tab.graphicProperty().unbind(); tab.textProperty().bind(getCurrentViewMetadata().get().titleProperty()); tab.graphicProperty().bind(getCurrentViewMetadata().get().graphicsProperty()); }); tab.setOnClosed(e -> { try { destroy(); } catch (Exception exception) { exceptionHandler.setException(exception); } }); tab.setContent(start(container)); return tab; }
formTab.textProperty().bind(form.displayedTitleProperty()); formTab.setContent(form.getCachedContent()); component.getTabs().add(formTab);
private void addTab(PositionableAdapter<FXDockableEntry> dockable) { final Tab tab = new Tab(); final FXDockableData dockableData = dockable.getAdapted().getDockableData(); tab.textProperty().bind(dockableData.titleProperty()); tab.graphicProperty().bind(dockableData.graphicProperty()); tab.tooltipProperty().bind(dockableData.tooltipProperty()); tab.contextMenuProperty().bind(dockableData.contextMenuProperty()); tab.setContent(dockable.getAdapted().getDockable()); tab.setOnCloseRequest(tabManager.createOnCloseRequestHandler(tab, dockable.getAdapted(), control)); observeDockableData(dockableData, tab); tabPane.getTabs().add(control.getDockables().indexOf(dockable), tab); }
/** * This methods creates a tab that contains the given view. * By doing so the metadata of the view will be bound to the tab properties. * So the text and icon of the tab can be changed by the view. * * @param context the context of the view. This includes the view and its controller instance * so that all needed informations are part of the context * @param exceptionHandler the exception handle for the view. This handler will handle all exceptions that will be thrown in the DataFX container context */ public <T> Tab createTab(ViewContext<T> context, ExceptionHandler exceptionHandler) { Tab tab = new Tab(); tab.textProperty().bind(context.getMetadata().titleProperty()); tab.graphicProperty().bind(context.getMetadata().graphicsProperty()); tab.setOnClosed(e -> { try { context.destroy(); } catch (Exception exception) { exceptionHandler.setException(exception); } }); tab.setContent(context.getRootNode()); return tab; }
updateInnerUI(); }); listener.registerChangeListener(tab.textProperty(), obs-> tabLabel.setText(tab.getText())); listener.registerChangeListener(tab.graphicProperty(), obs-> tabLabel.setGraphic(tab.getGraphic())); listener.registerChangeListener(widthProperty(), obs-> header.updateSelectionLine(true));