public Node getContent() { return contentContainer.getChildren().size() == 2 ? contentContainer.getChildren().get(1) : null; }
private void clearSelection(JFXListView<?> selectedList) { if (allowClear) { allowClear = false; if (this != selectedList) { this.getSelectionModel().clearSelection(); } for (int i = 0; i < sublistsProperty.get().size(); i++) { if (sublistsProperty.get().get(i) != selectedList) { sublistsProperty.get().get(i).getSelectionModel().clearSelection(); } } allowClear = true; } }
@Override protected void updateChildren() { super.updateChildren(); if(buttonRippler!=null) getChildren().add(0, buttonRippler); for (int i = 1; i < getChildren().size(); i++) { final Node child = getChildren().get(i); if(child instanceof Text) child.setMouseTransparent(true); } }
@Override protected void updateChildren() { super.updateChildren(); if (rippler != null) { getChildren().add(0, rippler); } for (int i = 1; i < getChildren().size(); i++) { getChildren().get(i).setMouseTransparent(true); } }
@Override protected double computePrefWidth(double height) { if (!getChildren().isEmpty()) { return getChildren().get(0).prefWidth(height); } return super.computePrefWidth(height); }
@Override protected double computePrefHeight(double width) { if (!getChildren().isEmpty()) { return getChildren().get(0).prefHeight(width); } return super.computePrefHeight(width); }
public HamburgerSlideCloseTransition(JFXHamburger burger) { super(burger, createTimeline(burger)); timeline.bind(Bindings.createObjectBinding(() -> createTimeline(burger), ((Region) burger.getChildren().get(0)).widthProperty(), ((Region) burger.getChildren().get(0)).heightProperty())); setCycleDuration(Duration.seconds(0.3)); setDelay(Duration.seconds(0)); setOnFinished((finish) -> { if (this.getRate() == 1) { burger.getChildren().get(1).setVisible(false); } }); }
/** * init fxml when loaded. */ @PostConstruct public void init() { for (int i = 0; i < 100; i++) { contentList.getItems().add("Item " + i); } contentList.setMaxHeight(3400); JFXScrollPane.smoothScrolling((ScrollPane) scroll.getChildren().get(0)); SVGGlyph arrow = new SVGGlyph(0, "FULLSCREEN", "M402.746 877.254l-320-320c-24.994-24.992-24.994-65.516 0-90.51l320-320c24.994-24.992 65.516-24.992 90.51 0 24.994 24.994 " + "24.994 65.516 0 90.51l-210.746 210.746h613.49c35.346 0 64 28.654 64 64s-28.654 64-64 64h-613.49l210.746 210.746c12.496 " + "12.496 18.744 28.876 18.744 45.254s-6.248 32.758-18.744 45.254c-24.994 24.994-65.516 24.994-90.51 0z", Color.WHITE); arrow.setSize(20, 16); backButton.setGraphic(arrow); backButton.setRipplerFill(Color.WHITE); } }
public HamburgerNextArrowBasicTransition(JFXHamburger burger) { super(burger, createTimeline(burger)); timeline.bind(Bindings.createObjectBinding(() -> createTimeline(burger), burger.widthProperty(), burger.heightProperty(), ((Region) burger.getChildren().get(0)).widthProperty(), ((Region) burger.getChildren().get(0)).heightProperty())); // reduce the number to increase the shifting , increase number to reduce shifting setCycleDuration(Duration.seconds(0.3)); setDelay(Duration.seconds(0)); }
public HamburgerBackArrowBasicTransition(JFXHamburger burger) { super(burger, createTimeline(burger)); timeline.bind(Bindings.createObjectBinding(() -> createTimeline(burger), burger.widthProperty(), burger.heightProperty(), ((Region) burger.getChildren().get(0)).widthProperty(), ((Region) burger.getChildren().get(0)).heightProperty())); // reduce the number to increase the shifting , increase number to reduce shifting setCycleDuration(Duration.seconds(0.3)); setDelay(Duration.seconds(0)); }
public HamburgerBasicCloseTransition(JFXHamburger burger) { super(burger, createTimeline(burger)); timeline.bind(Bindings.createObjectBinding(() -> createTimeline(burger), burger.widthProperty(), burger.heightProperty(), ((Region) burger.getChildren().get(0)).widthProperty(), ((Region) burger.getChildren().get(0)).heightProperty())); // reduce the number to increase the shifting , increase number to reduce shifting setCycleDuration(Duration.seconds(0.3)); setDelay(Duration.seconds(0)); }
@Override protected Node createUndecoratedEditor() { final ChoiceBox<T> box = new ChoiceBox<>(alternatives); final T val = currentValue.getValue(); if (alternatives.contains(val)) { box.setValue(val); } else { box.setValue(alternatives.get(0)); } currentValue.bindBidirectional(box.valueProperty()); return box; } }
public JFXTextFieldSkinAndroid(T textField) { super(textField); textPane = (Pane) this.getChildren().get(0); // get parent fields reflectionFieldConsumer("textNode", field -> textNode = (Node) field.get(this)); reflectionFieldConsumer("textTranslateX", field -> textTranslateX = (DoubleProperty) field.get(this)); linesWrapper = new PromptLinesWrapper<T>( textField, super.promptTextFill, textField.textProperty(), textField.promptTextProperty(), () -> promptText); linesWrapper.init(() -> createPromptNode(), textPane); reflectionFieldConsumer("usePromptText", field -> field.set(this, linesWrapper.usePromptText)); errorContainer = new ValidationPane<>(textField); getChildren().addAll(linesWrapper.line, linesWrapper.focusedLine, linesWrapper.promptContainer, errorContainer); registerChangeListener(textField.disableProperty(), "DISABLE_NODE"); registerChangeListener(textField.focusColorProperty(), "FOCUS_COLOR"); registerChangeListener(textField.unFocusColorProperty(), "UNFOCUS_COLOR"); registerChangeListener(textField.disableAnimationProperty(), "DISABLE_ANIMATION"); }
public JFXTextFieldSkin(T textField) { super(textField); textPane = (Pane) this.getChildren().get(0); // get parent fields reflectionFieldConsumer("textNode", field -> textNode = (Node) field.get(this)); reflectionFieldConsumer("textTranslateX", field -> textTranslateX = (DoubleProperty) field.get(this)); linesWrapper = new PromptLinesWrapper<T>( textField, super.promptTextFill, textField.textProperty(), textField.promptTextProperty(), () -> promptText); linesWrapper.init(() -> createPromptNode(), textPane); reflectionFieldConsumer("usePromptText", field -> field.set(this, linesWrapper.usePromptText)); errorContainer = new ValidationPane<>(textField); getChildren().addAll(linesWrapper.line, linesWrapper.focusedLine, linesWrapper.promptContainer, errorContainer); registerChangeListener(textField.disableProperty(), "DISABLE_NODE"); registerChangeListener(textField.focusColorProperty(), "FOCUS_COLOR"); registerChangeListener(textField.unFocusColorProperty(), "UNFOCUS_COLOR"); registerChangeListener(textField.disableAnimationProperty(), "DISABLE_ANIMATION"); }
@Override protected void starting() { super.starting(); if (node.getParent() instanceof JFXRippler) { JFXRippler rippler = (JFXRippler) node.getParent(); BorderPane p = new BorderPane(node); p.setMaxWidth(((JFXHamburger) node).getWidth()); p.setMinWidth(((JFXHamburger) node).getWidth()); p.addEventHandler(MouseEvent.ANY, (event) -> { if (!event.isConsumed()) { event.consume(); node.fireEvent(event); } }); rippler.setControl(p); } if (this.getRate() == -1) { ((JFXHamburger) node).getChildren().get(1).setVisible(true); } }
@Override protected void layoutChildren(final double x, final double y, final double w, final double h) { super.layoutChildren(x, y, w, h); final double height = getSkinnable().getHeight(); linesWrapper.layoutLines(x, y, w, h, height, promptText == null ? 0 : promptText.getLayoutBounds().getHeight() + 3); errorContainer.layoutPane(x, height + linesWrapper.focusedLine.getHeight(), w, h); linesWrapper.updateLabelFloatLayout(); if (invalid) { invalid = false; // set the default background of text area viewport to white Region viewPort = (Region) scrollPane.getChildrenUnmodifiable().get(0); viewPort.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, CornerRadii.EMPTY, Insets.EMPTY))); // reapply css of scroll pane in case set by the user viewPort.applyCss(); errorContainer.invalid(w); // focus linesWrapper.invalid(); } }
@Override protected void layoutChildren(final double x, final double y, final double w, final double h) { super.layoutChildren(x, y, w, h); final double height = getSkinnable().getHeight(); linesWrapper.layoutLines(x, y, w, h, height, promptText == null ? 0 : promptText.getLayoutBounds().getHeight() + 3); errorContainer.layoutPane(x, height + linesWrapper.focusedLine.getHeight(), w, h); linesWrapper.updateLabelFloatLayout(); if (invalid) { invalid = false; // set the default background of text area viewport to white Region viewPort = (Region) scrollPane.getChildrenUnmodifiable().get(0); viewPort.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, CornerRadii.EMPTY, Insets.EMPTY))); // reapply css of scroll pane in case set by the user viewPort.applyCss(); errorContainer.invalid(w); // focus linesWrapper.invalid(); } }
public JFXTextAreaSkinAndroid(JFXTextArea textArea) { super(textArea); // init text area properties scrollPane = (ScrollPane) getChildren().get(0); textArea.setWrapText(true); linesWrapper = new PromptLinesWrapper<>( textArea, super.promptTextFill, textArea.textProperty(), textArea.promptTextProperty(), () -> promptText); linesWrapper.init(() -> createPromptNode(), scrollPane); errorContainer = new ValidationPane<>(textArea); getChildren().addAll(linesWrapper.line, linesWrapper.focusedLine, linesWrapper.promptContainer, errorContainer); registerChangeListener(textArea.disableProperty(), "DISABLE_NODE"); registerChangeListener(textArea.focusColorProperty(), "FOCUS_COLOR"); registerChangeListener(textArea.unFocusColorProperty(), "UNFOCUS_COLOR"); registerChangeListener(textArea.disableAnimationProperty(), "DISABLE_ANIMATION"); }
public JFXTextAreaSkin(JFXTextArea textArea) { super(textArea); // init text area properties scrollPane = (ScrollPane) getChildren().get(0); textArea.setWrapText(true); linesWrapper = new PromptLinesWrapper<>( textArea, super.promptTextFill, textArea.textProperty(), textArea.promptTextProperty(), () -> promptText); linesWrapper.init(() -> createPromptNode(), scrollPane); errorContainer = new ValidationPane<>(textArea); getChildren().addAll(linesWrapper.line, linesWrapper.focusedLine, linesWrapper.promptContainer, errorContainer); registerChangeListener(textArea.disableProperty(), "DISABLE_NODE"); registerChangeListener(textArea.focusColorProperty(), "FOCUS_COLOR"); registerChangeListener(textArea.unFocusColorProperty(), "UNFOCUS_COLOR"); registerChangeListener(textArea.disableAnimationProperty(), "DISABLE_ANIMATION"); }