List of usage examples for javafx.scene.control Tab getContent
public final Node getContent()
The content associated with the tab.
From source file:mesclasses.view.JourneeController.java
private void initTab(Tab tab, SmartGrid grid) { tab.getContent().setManaged(false); tab.getContent().setVisible(false);//from www . j av a2 s . co m tab.selectedProperty().addListener((ob, o, n) -> { if (n) { selectTab(tab, grid); } else { unselectTab(tab); } }); }
From source file:org.noroomattheinn.visibletesla.MainController.java
/** * Utility method that returns the BaseController object associated with * a given tab. It does this by extracting the userData object which each * BaseController sets to itself./* w w w . j a v a2s .co m*/ * @param t The tab for which we want the BaseController * @return The BaseController */ private BaseController controllerFromTab(Tab t) { Object userData = t.getContent().getUserData(); return (userData instanceof BaseController) ? (BaseController) userData : null; }
From source file:ipat_fx.FXMLDocumentController.java
@FXML public void resetScores() { HashMap<String, Hint> hintMap = controller.hints; TabPane tabpane = (TabPane) byProfilePane.getChildren().get(0); Tab tab = null; if (tabFlag.equalsIgnoreCase("byProfile")) { tab = tabpane.getTabs().get(0);//w ww.j a v a 2 s .c o m } else if (tabFlag.equalsIgnoreCase("byImage")) { tab = tabpane.getTabs().get(0); } else { Logger.getLogger(FXMLDocumentController.class.getName()).log(Level.SEVERE, null, "Something wrong with tabFlag"); } ScrollPane scrollPane = (ScrollPane) tab.getContent(); FlowPane flowPane = (FlowPane) scrollPane.getContent(); Iterator<Node> cellsIterator = flowPane.getChildren().iterator(); while (cellsIterator.hasNext()) { GridPane cell = (GridPane) cellsIterator.next(); Iterator<Node> cellIterator = cell.getChildren().iterator(); while (cellIterator.hasNext()) { Node cellElement = cellIterator.next(); if (cellElement instanceof Slider) { Set<String> keySet = hintMap.keySet();// get the hints one by one and apply to cell int keyCount = 0; for (String key : keySet) { Hint h = hintMap.get(key); Slider slider = ((Slider) cellElement); String[] split = slider.getId().split("_"); if (split[0].equalsIgnoreCase(h.getHintName())) { slider.setValue(Double.valueOf(h.getDefaultValue())); } } } if (cellElement instanceof CheckBox) { ((CheckBox) cellElement).setSelected(false); } } } }
From source file:org.beryx.viewreka.fxapp.Viewreka.java
public void onShown() { projectTabPane.requestFocus();/*from w w w .ja va2s . com*/ Tab tab = projectTabPane.getSelectionModel().getSelectedItem(); if (tab != null) { Platform.runLater(() -> tab.getContent().requestFocus()); } }
From source file:org.beryx.viewreka.fxapp.Viewreka.java
private ViewPane<?> getCurrentViewPane() { Tab tab = viewsTabPane.getSelectionModel().getSelectedItem(); if (tab == null) return null; Node content = tab.getContent(); return (content instanceof ViewPane<?>) ? (ViewPane<?>) content : null; }
From source file:org.noroomattheinn.visibletesla.MainController.java
/** * Called by the main application to allow us to store away the fxApp context * and perform any other fxApp startup tasks. In particular, we (1) distribute * fxApp context to all of the controllers, and (2) we set a listener for login * completion and try and automatic login. *///from ww w. ja v a2 s .c o m void start(App theApp, VTVehicle v, VTData data, Prefs prefs) { this.app = theApp; this.vtVehicle = v; // This is defined in BaseController this.vtData = data; // This is defined in BaseController this.prefs = prefs; // This is defined in BaseController logAppInfo(); addSystemSpecificHandlers(app.stage); refreshTitle(); app.stage.getIcons().add(new Image(getClass().getClassLoader() .getResourceAsStream("org/noroomattheinn/TeslaResources/Icon-72@2x.png"))); tabPane.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Tab>() { @Override public void changed(ObservableValue<? extends Tab> ov, Tab t, Tab t1) { BaseController c = controllerFromTab(t1); if (c != null) { c.activate(); } } }); tabs = Arrays.asList(prefsTab, loginTab, schedulerTab, graphTab, chargeTab, hvacTab, locationTab, overviewTab, tripsTab, notifierTab); for (Tab t : tabs) { controllerFromTab(t).setAppContext(theApp, v, data, prefs); } // Handle font scaling int fontScale = prefs.fontScale.get(); if (fontScale != 100) { for (Tab t : tabs) { Node n = t.getContent(); n.setStyle(String.format("-fx-font-size: %d%%;", fontScale)); } } showDisclaimer(); // Watch for changes to the inactivity mode and state in order to update the UI App.addTracker(app.api.mode, new Runnable() { @Override public void run() { setAppModeMenu(); } }); App.addTracker(app.api.state, new Runnable() { @Override public void run() { refreshTitle(); } }); // Kick off the login process LoginController lc = Utils.cast(controllerFromTab(loginTab)); App.addTracker(lc.loggedIn, new LoginStateChange(lc.loggedIn, false)); lc.activate(); }