/** * creates empty dialog layout */ public JFXDialogLayout() { initialize(); heading.getStyleClass().addAll("jfx-layout-heading", "title"); body.getStyleClass().add("jfx-layout-body"); VBox.setVgrow(body, Priority.ALWAYS); actions.getStyleClass().add("jfx-layout-actions"); getChildren().setAll(heading, body, actions); }
/** * Animates all the children of a Region. * <code> * VBox myVbox = new VBox(); * LayoutAnimator animator = new LayoutAnimator(); * animator.observe(myVbox.getChildren()); * </code> * * @param nodes the nodes to observe */ public void observe(ObservableList<Node> nodes) { nodes.forEach((node) -> { this.observe(node); }); nodes.addListener(this); }
originalItems.add(treeItem); itemsMap.put(child, treeItem); this.getChildren().addAll(originalItems); children.addListener((ListChangeListener<T>) change -> { while (change.next()) { if (change.wasRemoved()) { if (originalItems.size() == removedItems.size()) { originalItems.clear(); getChildren().clear(); } else { getChildren().removeAll(removedItems); originalItems.removeAll(removedItems); itemsMap.put(newChild, newTreeItem); getChildren().addAll(addedItems); originalItems.addAll(addedItems);
private void initialize() { this.getStyleClass().add(DEFAULT_STYLE_CLASS); if ("dalvik".equals(System.getProperty("java.vm.name").toLowerCase())) { this.setStyle("-fx-skin: \"com.jfoenix.android.skins.JFXTextFieldSkinAndroid\";"); } }
public JFXColorPalette(final ColorPicker colorPicker) { getStyleClass().add("color-palette-region"); this.colorPicker = colorPicker; colorPickerGrid = new JFXColorGrid(); colorPickerGrid.getChildren().get(0).requestFocus(); customColorLabel.setAlignment(Pos.CENTER_LEFT); customColorLink.setPrefWidth(colorPickerGrid.prefWidth(-1)); Color customColor = customColorDialog.customColorProperty().get(); buildCustomColors(); colorPicker.getCustomColors().add(customColor); updateSelection(customColor); Event.fireEvent(colorPicker, new ActionEvent()); customColorGrid.getStyleClass().add("color-picker-grid"); customColorGrid.setVisible(false); colorPicker.getCustomColors().addListener((Change<? extends Color> change) -> buildCustomColors()); VBox paletteBox = new VBox(); paletteBox.getStyleClass().add("color-palette"); paletteBox.setBackground(new Background(new BackgroundFill(Color.WHITE, CornerRadii.EMPTY, Insets.EMPTY))); paletteBox.setBorder(new Border(new BorderStroke(Color.valueOf("#9E9E9E"), CornerRadii.EMPTY, BorderWidths.DEFAULT))); paletteBox.getChildren().addAll(colorPickerGrid, customColorLabel, customColorGrid, customColorLink); hoverSquare.getStyleClass().addAll("hover-square"); setFocusedSquare(null);
public void setContent(Node content) { if (contentContainer.getChildren().size() == 2) { contentContainer.getChildren().set(1, content); } else if (contentContainer.getChildren().size() == 1) { contentContainer.getChildren().add(content); } else { contentContainer.getChildren().setAll(headerSpace, content); } VBox.setVgrow(content, Priority.ALWAYS); }
public TabHeaderContainer(final Tab tab) { this.tab = tab; getStyleClass().setAll(tab.getStyleClass()); setId(tab.getId()); setStyle(tab.getStyle()); tabLabel.getStyleClass().setAll("tab-label"); closeButton.getStyleClass().add("tab-close-button"); closeButton.setOnAction(action->{ TabPaneBehavior behavior = getBehavior(); inner.getChildren().setAll(tabLabel, closeButton); inner.setAlignment(Pos.CENTER); inner.getStyleClass().add("tab-container"); inner.setRotate(getSkinnable().getSide().equals(Side.BOTTOM) ? 180.0F : 0.0F); getChildren().addAll(rippler); listener.registerChangeListener(getSkinnable().sideProperty(), "SIDE"); listener.registerChangeListener(widthProperty(), "WIDTH"); tab.getStyleClass().addListener(weakStyleClassListener);
@Override public void setValidators(ValidatorBase... validators) { this.validators.addAll(validators); }
private void createChip(T item) { JFXChip<T> chip = null; try { if (getSkinnable().getChipFactory() != null) { chip = getSkinnable().getChipFactory().apply(getSkinnable(), item); } else { chip = new JFXDefaultChip<T>(getSkinnable(), item); } } catch (Exception e) { throw new RuntimeException("can't create chip for item '" + item + "' make sure to override the string converter and return null if text input is not valid.", e); } int size = root.getChildren().size(); root.getChildren().add(size - 1, chip); }
@Override public <U> void setViewContext(ViewContext<U> context) { updatePlaceholder(context.getRootNode()); if (animation != null) { animation.stop(); } animation = new Timeline(); animation.getKeyFrames().addAll(animationProducer.apply(this)); animation.getKeyFrames().add(new KeyFrame(duration, (e) -> clearPlaceholder())); animation.play(); }
root.getStyleClass().add("chips-pane"); setupEditor(); scrollPane.setFitToWidth(true); getChildren().add(scrollPane); selectedItem = getSkinnable().getSelectionHandler().apply(selectedItem); getSkinnable().getChips().add(selectedItem); editor.clear(); }); createChip(item); control.getChips().addListener(new WeakListChangeListener<>(chipsChangeListeners));
private void initialize() { this.getStyleClass().add(DEFAULT_STYLE_CLASS); expanded.addListener((o, oldVal, newVal) -> { if (newVal) { sublistsProperty.get().addListener((ListChangeListener.Change<? extends JFXListView<?>> c) -> { while (c.next()) { if (c.wasAdded() || c.wasUpdated() || c.wasReplaced()) { if (sublistsProperty.get().size() == 1) { this.getSelectionModel() .selectedItemProperty()
notifications.addListener((ListChangeListener.Change<? extends Notification> change) -> { while (change.next()) { if (change.wasAdded()) { ); notifications.remove(n); }); while (!notifications.isEmpty()) { final Notification n = notifications.get(0); NotificationController.showNotification( notificationArea, n.onClose() ); notifications.remove(0);
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"); }