private void updateOverAllSelectedIndex() { if (this.getSelectionModel().getSelectedIndex() != -1) { int selectedIndex = this.getSelectionModel().getSelectedIndex(); Iterator<Map.Entry<Integer, JFXListView<?>>> itr = sublistsIndices.entrySet().iterator(); int preItemsSize = 0; Map.Entry<Integer, JFXListView<?>> entry = itr.next(); if (entry.getKey() < selectedIndex) { preItemsSize += entry.getValue().getItems().size() - 1; while (itr.hasNext()) { Map.Entry<Integer, JFXListView<?>> entry = itr.next(); if (entry.getValue().getSelectionModel().getSelectedIndex() != -1) { selectedList.add(entry.getKey()); Map.Entry<Integer, JFXListView<?>> entry = itr.next(); if (entry.getKey() < ((Integer) selectedList.get(0))) { preItemsSize += entry.getValue().getItems().size() - 1; .getSelectionModel() .getSelectedIndex()); } else {
/** * init fxml when loaded. */ @PostConstruct public void init() { button3D.setOnMouseClicked((e) -> { int val = ++counter % 2; list1.depthProperty().set(val); list2.depthProperty().set(val); }); expand.setOnMouseClicked((e) -> list2.expandedProperty().set(true)); collapse.setOnMouseClicked((e) -> list2.expandedProperty().set(false)); list1.depthProperty().set(1); }
private void initialize() { this.getStyleClass().add(DEFAULT_STYLE_CLASS); expanded.addListener((o, oldVal, newVal) -> { if (newVal) { expand(); } else { collapse(); if (isExpanded()) { expand(); } else { collapse(); if (c.wasAdded() || c.wasUpdated() || c.wasReplaced()) { if (sublistsProperty.get().size() == 1) { this.getSelectionModel() .selectedItemProperty() .addListener((o, oldVal, newVal) -> clearSelection(this)); this.addEventFilter(ContextMenuEvent.CONTEXT_MENU_REQUESTED, Event::consume); .forEach(item -> item.getSelectionModel() .selectedItemProperty() .addListener((o, oldVal, newVal) -> clearSelection(item))); this.getSelectionModel().selectedIndexProperty().addListener((o, oldVal, newVal) -> { if (newVal.intValue() != -1) { updateOverAllSelectedIndex();
/** * propagate mouse events to the parent node ( e.g. to allow dragging while clicking on the list) */ public void propagateMouseEventsToParent() { this.addEventHandler(MouseEvent.ANY, e -> { e.consume(); this.getParent().fireEvent(e); }); }
@Deprecated void addSublist(JFXListView<?> subList, int index) { if (!sublistsProperty.get().contains(subList)) { sublistsProperty.get().add(subList); sublistsIndices.put(index, subList); subList.getSelectionModel().selectedIndexProperty().addListener((o, oldVal, newVal) -> { if (newVal.intValue() != -1) { updateOverAllSelectedIndex(); } }); } }
@Override public void start(Stage stage) throws Exception { JFXListView<Label> list = new JFXListView<>(); for (int i = 0; i < 4; i++) { list.getItems().add(new Label(ITEM + i)); list.getStyleClass().add("mylistview"); button3D.setOnMouseClicked(e -> list.depthProperty().set(++counter % 2)); list.depthProperty().set(1); list.setExpanded(true); }); list.depthProperty().set(1); list.setExpanded(false); });
@Override public void start(Stage stage) { JFXListView<Label> list = new JFXListView<>(); for (int i = 0; i < 100; i++) { list.getItems().add(new Label("Item " + i)); list.getStyleClass().add("mylistview"); list.setMaxHeight(3400);
((JFXListView<?>) getListView()).addSublist((JFXListView<?>) newNode, this.getIndex()); this.getStyleClass().add("sublist-item"); groupNode.getChildren().setAll(((JFXListView<?>) newNode).getGroupnode(), dropIcon); if (isJFXListView && ((JFXListView<?>) getListView()).isShowTooltip()) { if (item instanceof Label) { setTooltip(new Tooltip(((Label) item).getText()));
/** * 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); } }
@Override public void start(Stage primaryStage) throws Exception { JFXHamburger show = new JFXHamburger(); show.setPadding(new Insets(10, 5, 10, 5)); JFXRippler rippler = new JFXRippler(show, RipplerMask.CIRCLE, RipplerPos.BACK); JFXListView<Label> list = new JFXListView<>(); for (int i = 1; i < 5; i++) { list.getItems().add(new Label("Item " + i)); } AnchorPane container = new AnchorPane(); container.getChildren().add(rippler); AnchorPane.setLeftAnchor(rippler, 200.0); AnchorPane.setTopAnchor(rippler, 210.0); StackPane main = new StackPane(); main.getChildren().add(container); JFXPopup popup = new JFXPopup(list); rippler.setOnMouseClicked(e -> popup.show(rippler, PopupVPosition.TOP, PopupHPosition.LEFT)); final Scene scene = new Scene(main, 800, 800); scene.getStylesheets().add(PopupDemo.class.getResource("/css/jfoenix-components.css").toExternalForm()); primaryStage.setTitle("JFX Popup Demo"); primaryStage.setScene(scene); primaryStage.setResizable(false); primaryStage.show(); }
@FXML private void submit() { if (toolbarPopupList.getSelectionModel().getSelectedIndex() == 1) { Platform.exit(); } } }
/** * Create a {@link JFXListView} for the templates. * * @param listView * the {@link JFXListView} * @param imageProfile * the {@link Image} profile * @param index * the {@link Integer} index */ // CHECKSTYLE:OFF AH DI MI TOCCA FARE COSI public static void addVectorToListView(final JFXListView<BorderPane> listView, final Image imageProfile, final int index) { final BorderPane pane = new BorderPane(); final Label label = new Label(" " + index); final ImageView imageView = new ImageView(imageProfile); JFXDepthManager.setDepth(pane, 1); label.setId("player-listView-label"); pane.setId("player-listView-border"); imageView.setFitHeight(150); imageView.setFitWidth(200); BorderPane.setAlignment(imageView, Pos.CENTER); BorderPane.setAlignment(label, Pos.CENTER_LEFT); pane.setCenter(imageView); pane.setLeft(label); listView.getItems().add(pane); listView.scrollTo(index); } // CHECKSTYLE:ON
Objects.requireNonNull(context, "context"); FlowHandler contentFlowHandler = (FlowHandler) context.getRegisteredObject("ContentFlowHandler"); sideList.propagateMouseEventsToParent(); sideList.getSelectionModel().selectedItemProperty().addListener((o, oldVal, newVal) -> { new Thread(()->{ Platform.runLater(()->{
public JFXListViewSkin(final JFXListView<T> listView) { super(listView); JFXDepthManager.setDepth(flow, listView.depthProperty().get()); listView.depthProperty().addListener((o, oldVal, newVal) -> JFXDepthManager.setDepth(flow, newVal)); }
@Override public StyleableBooleanProperty getStyleableProperty(JFXListView<?> control) { return control.expandedProperty(); } };
((JFXListView<?>) getListView()).addSublist((JFXListView<?>) newNode, this.getIndex()); this.getStyleClass().add("sublist-item"); groupNode.getChildren().setAll(((JFXListView<?>) newNode).getGroupnode(), dropIcon); if (isJFXListView && ((JFXListView<?>) getListView()).isShowTooltip()) { if (item instanceof Label) { setTooltip(new Tooltip(((Label) item).getText()));
@Deprecated void addSublist(JFXListView<?> subList, int index) { if (!sublistsProperty.get().contains(subList)) { sublistsProperty.get().add(subList); sublistsIndices.put(index, subList); subList.getSelectionModel().selectedIndexProperty().addListener((o, oldVal, newVal) -> { if (newVal.intValue() != -1) { updateOverAllSelectedIndex(); } }); } }
/** * propagate mouse events to the parent node ( e.g. to allow dragging while clicking on the list) */ public void propagateMouseEventsToParent() { this.addEventHandler(MouseEvent.ANY, e -> { e.consume(); this.getParent().fireEvent(e); }); }
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; } }
public JFXListViewSkin(final JFXListView<T> listView) { super(listView); flow = (VirtualFlow<ListCell<T>>) getChildren().get(0); JFXDepthManager.setDepth(flow, listView.depthProperty().get()); listView.depthProperty().addListener((o, oldVal, newVal) -> JFXDepthManager.setDepth(flow, newVal)); }