private void showAutocompletePopup(int insertionIndex, String input) { CompletionResultSource suggestionMaker = mySuggestionProvider.get(); List<MenuItem> suggestions = suggestionMaker.getSortedMatches(input, 5) .map(result -> { Label entryLabel = new Label(); entryLabel.setGraphic(result.getTextFlow()); entryLabel.setPrefHeight(5); CustomMenuItem item = new CustomMenuItem(entryLabel, true); item.setUserData(result); item.setOnAction(e -> applySuggestion(insertionIndex, input, result.getNodeName())); return item; }) .collect(Collectors.toList()); autoCompletePopup.getItems().setAll(suggestions); myCodeArea.getCharacterBoundsOnScreen(insertionIndex, insertionIndex + input.length()) .ifPresent(bounds -> autoCompletePopup.show(myCodeArea, bounds.getMinX(), bounds.getMaxY())); Skin<?> skin = autoCompletePopup.getSkin(); if (skin != null) { Node fstItem = skin.getNode().lookup(".menu-item"); if (fstItem != null) { fstItem.requestFocus(); } } }
PopupWindow popupWindow = getPopupWindow(); Node popup = popupWindow.getScene().getRoot().getChildrenUnmodifiable().get(0); StackPane hover = (StackPane) popup.lookup(".hover-square"); Rectangle rectH = (Rectangle) hover.getChildren().get(0); Set<Node> squares = popup.lookupAll(".color-rect");
public void show(Node node) { if (text == null) { text = (Text) node.lookup(".text"); } node = text; if (!isShowing()) { if (node.getScene() == null || node.getScene().getWindow() == null) { throw new IllegalStateException("Can not show popup. The node must be attached to a scene/window."); } Window parent = node.getScene().getWindow(); this.show(parent, parent.getX() + node.localToScene(0, 0).getX() + node.getScene().getX(), parent.getY() + node.localToScene(0, 0).getY() + node.getScene().getY() + node.getLayoutBounds().getHeight() + shift); ((JFXAutoCompletePopupSkin<T>) getSkin()).animate(); } else { // if already showing update location if needed Window parent = node.getScene().getWindow(); this.show(parent, parent.getX() + node.localToScene(0, 0).getX() + node.getScene().getX(), parent.getY() + node.localToScene(0, 0).getY() + node.getScene().getY() + node.getLayoutBounds().getHeight() + shift); } } }
if(root.getChildrenUnmodifiable().size()>0){ Node popup = root.getChildrenUnmodifiable().get(0); if(popup.lookup(".combo-box-popup")!=null){
@Override public void run() { if (node != null) { Node subNode = node.lookup(subNodeStyleClass); if (subNode != null) { withState(node.lookup(subNodeStyleClass), subNodeState); } else { System.err.println("node = " + node+" node.lookup("+subNodeStyleClass+") = " + subNode); } } else { System.err.println("node = " + node); } } });
/** * {@inheritDoc} */ @Override public Node lookup(final String selector) { return node().lookup(selector); }
@Override public void run() { final Node macRB2 = macWindowContent.lookup("#RadioButton2"); macRB2.setMouseTransparent(true); macRB2.pseudoClassStateChanged(PseudoClass.getPseudoClass("focused"), true); final Node windows7RB2 = windows7WindowContent.lookup("#RadioButton2"); windows7RB2.setMouseTransparent(true); windows7RB2.pseudoClassStateChanged(PseudoClass.getPseudoClass("focused"), true); final Node windows8RB2 = windows8WindowContent.lookup("#RadioButton2"); windows8RB2.setMouseTransparent(true); windows8RB2.pseudoClassStateChanged(PseudoClass.getPseudoClass("focused"), true); final Node ubuntuRB2 = ubuntuWindowContent.lookup("#RadioButton2"); ubuntuRB2.setMouseTransparent(true); ubuntuRB2.pseudoClassStateChanged(PseudoClass.getPseudoClass("focused"), true); } });
if (DataFXUtils.getPrivileged(field, controller) == null) { if (Node.class.isAssignableFrom(field.getType())) { Node toInject = n.lookup("#" + field.getName()); if(toInject != null) { DataFXUtils.setPrivileged(field, controller, toInject);
/** * Updates node hierarchy with current values from resource bundles. * * @param node hierarchy root node */ public void updateNodeHierarchy(Node node){ for(String id : propertyMap.keySet()){ Node target = node.lookup("#" + id); if(target != null){ updateProperties(target, id); // special handling for popup controls if(target instanceof Control){ Tooltip tl = ((Control)target).getTooltip(); if(tl != null && propertyMap.containsKey(tl.getId())){ updateProperties(tl, tl.getId()); } } } } }
macWindow.getStyleClass().add("macWindow"); macWindowContent = (Node)FXMLLoader.load(SimpleWindowPage.class.getResource("simple-window.fxml")); macWindowContent.lookup("#MenuBar").setVisible(false); macWindowContent.lookup("#MenuBar").setManaged(false); macWindow.getChildren().add(macWindowContent);
public void show(Node node) { if (text == null) { text = (Text) node.lookup(".text"); } node = text; if (!isShowing()) { if (node.getScene() == null || node.getScene().getWindow() == null) { throw new IllegalStateException("Can not show popup. The node must be attached to a scene/window."); } Window parent = node.getScene().getWindow(); this.show(parent, parent.getX() + node.localToScene(0, 0).getX() + node.getScene().getX(), parent.getY() + node.localToScene(0, 0).getY() + node.getScene().getY() + node.getLayoutBounds().getHeight() + shift); ((JFXAutoCompletePopupSkin<T>) getSkin()).animate(); } else { // if already showing update location if needed Window parent = node.getScene().getWindow(); this.show(parent, parent.getX() + node.localToScene(0, 0).getX() + node.getScene().getX(), parent.getY() + node.localToScene(0, 0).getY() + node.getScene().getY() + node.getLayoutBounds().getHeight() + shift); } } }
Node titlebar = newValue.getNode().lookup("." + getTitleBarStyleClass());