List of usage examples for javafx.scene Node getId
public final String getId()
From source file:Main.java
private static Node lookupInternal(Node node, String id) { if (id.equals(node.getId())) { return node; }//from ww w . j a v a2 s . c o m if (node instanceof Parent) { for (Node child : ((Parent) node).getChildrenUnmodifiable()) { Node result = lookupInternal(child, id); if (result != null) { return result; } } if (node instanceof SplitPane) { SplitPane sp = (SplitPane) node; Node result = null; for (Node child : sp.getItems()) { result = lookupInternal(child, id); if (result != null) { return result; } } } if (node instanceof ScrollPane) { ScrollPane sp = (ScrollPane) node; Node result = null; if (sp.getContent() != null) { result = lookupInternal(sp.getContent(), id); if (result != null) { return result; } } } if (node instanceof BorderPane) { BorderPane sp = (BorderPane) node; Node result = null; if (sp.getBottom() != null) { result = lookupInternal(sp.getBottom(), id); if (result != null) { return result; } } if (sp.getTop() != null) { result = lookupInternal(sp.getTop(), id); if (result != null) { return result; } } if (sp.getLeft() != null) { result = lookupInternal(sp.getLeft(), id); if (result != null) { return result; } } if (sp.getRight() != null) { result = lookupInternal(sp.getRight(), id); if (result != null) { return result; } } if (sp.getCenter() != null) { result = lookupInternal(sp.getCenter(), id); if (result != null) { return result; } } } if (node instanceof TitledPane) { TitledPane sp = (TitledPane) node; Node result = null; if (sp.getContent() != null) { result = lookupInternal(sp.getContent(), id); if (result != null) { return result; } } } if (node instanceof Accordion) { Accordion sp = (Accordion) node; for (Node child : ((Accordion) node).getPanes()) { Node result = lookupInternal(child, id); if (result != null) { return result; } } } if (node instanceof TabPane) { TabPane bp = (TabPane) node; Node result = null; for (Tab tab : bp.getTabs()) { result = lookupInternal(tab.getContent(), id); if (result != null) { return result; } } } } return null; }
From source file:Main.java
private static Node lookupInternal(Node node, String id) { if (id.equals(node.getId())) { return node; }/*from w ww . j av a 2 s . c o m*/ if (node instanceof Parent) { for (Node child : ((Parent) node).getChildrenUnmodifiable()) { Node result = lookupInternal(child, id); if (result != null) { return result; } } if (node instanceof SplitPane) { SplitPane sp = (SplitPane) node; Node result = null; for (Node child : sp.getItems()) { result = lookupInternal(child, id); if (result != null) { return result; } } } if (node instanceof ScrollPane) { ScrollPane sp = (ScrollPane) node; Node result = null; if (sp.getContent() != null) { result = lookupInternal(sp.getContent(), id); if (result != null) { return result; } } } if (node instanceof BorderPane) { BorderPane sp = (BorderPane) node; Node result = null; if (sp.getBottom() != null) { result = lookupInternal(sp.getBottom(), id); if (result != null) { return result; } } if (sp.getTop() != null) { result = lookupInternal(sp.getTop(), id); if (result != null) { return result; } } if (sp.getLeft() != null) { result = lookupInternal(sp.getLeft(), id); if (result != null) { return result; } } if (sp.getRight() != null) { result = lookupInternal(sp.getRight(), id); if (result != null) { return result; } } if (sp.getCenter() != null) { result = lookupInternal(sp.getCenter(), id); if (result != null) { return result; } } } if (node instanceof TitledPane) { TitledPane sp = (TitledPane) node; Node result = null; if (sp.getContent() != null) { result = lookupInternal(sp.getContent(), id); if (result != null) { return result; } } } if (node instanceof Accordion) { for (Node child : ((Accordion) node).getPanes()) { Node result = lookupInternal(child, id); if (result != null) { return result; } } } if (node instanceof TabPane) { TabPane bp = (TabPane) node; Node result = null; for (Tab tab : bp.getTabs()) { result = lookupInternal(tab.getContent(), id); if (result != null) { return result; } } } } return null; }
From source file:com.rcs.shoe.shop.fx.controller.ui.SaleEnterController.java
private void initializeQuantityFields() { quantityLabels = new HashMap<>(); quantityButtons = new HashMap<>(); ObservableList<Node> children = sizesPane.getChildren(); for (Node node : children) { if (node instanceof Label && node.getId() != null && node.getId().startsWith("label")) { Label label = (Label) node; quantityLabels.put(label.getId(), label); } else if (node instanceof Button) { Button button = (Button) node; if (button.getId() != null && button.getId().startsWith("button")) { quantityButtons.put(button.getId(), button); }/* ww w . ja va 2 s. c o m*/ } } }
From source file:ipat_fx.FXMLDocumentController.java
@FXML public void nextGeneration() { //check if num of profiles is a valid input int numOfProfiles = Integer.parseInt(noOfProfiles.getText()); if (numOfProfiles > 8) { JOptionPane.showMessageDialog(null, "Please make the number of profiles smaller than 8."); } else {//from w w w .j a va 2s .com HashMap<String, Object> scores = new HashMap<>(); // TODO get the scores from the user input to then get the next gen ObservableList<Tab> tabs = null; if (tabFlag.equalsIgnoreCase("byImage")) { tabs = byImageTab.getTabs(); } else if (tabFlag.equalsIgnoreCase("byProfile")) { tabs = byProfileTab.getTabs(); } else { System.out.println("Something is wrong with tabFlag in FXML DOC CONT"); } Iterator<Tab> profileTabIterator = tabs.iterator(); while (profileTabIterator.hasNext()) { Tab profileTab = profileTabIterator.next(); ScrollPane scrollPane = (ScrollPane) profileTab.getContent(); FlowPane cells = (FlowPane) scrollPane.getContent(); Iterator<Node> cellIterator = cells.getChildren().iterator(); while (cellIterator.hasNext()) { GridPane cell = (GridPane) cellIterator.next(); Iterator<Node> nodeIterator = cell.getChildren().iterator(); while (nodeIterator.hasNext()) { Node cellElement = nodeIterator.next(); if (cellElement instanceof Slider) { scores.put(cellElement.getId(), String.valueOf(((Slider) cellElement).getValue())); } if (cellElement instanceof CheckBox) { scores.put(cellElement.getId(), ((CheckBox) cellElement).isSelected()); } } } } HashMap<String, Object> display = controller.mainloop(scores, numOfProfiles); WebView previewView = (WebView) display.get("previewView"); previewPane.getChildren().add(previewView); @SuppressWarnings("unchecked") HashMap<String, ArrayList<GridPane>> map = (HashMap<String, ArrayList<GridPane>>) display .get("results"); if (tabFlag.equalsIgnoreCase("byImage")) { byImageTab = getByImage(map); byImagePane.setCenter(byImageTab); } else if (tabFlag.equalsIgnoreCase("byProfile")) { byProfileTab = getByProfile(map, numOfProfiles); byProfilePane.setCenter(byProfileTab); } tabPane.getSelectionModel().selectedIndexProperty() .addListener((ObservableValue<? extends Number> ov, Number oldValue, Number newValue) -> { if (newValue == Number.class.cast(1)) { byImageTab = getByImage(map); byImagePane.setCenter(byImageTab); } else if (newValue == Number.class.cast(0)) { byProfileTab = getByProfile(map, numOfProfiles); byProfilePane.setCenter(byProfileTab); } else { System.out.println("Error this tab has not been created."); } }); } }