/** * propagate any mouse events on the tab pane to its parent */ public void propagateMouseEventsToParent() { this.addEventHandler(MouseEvent.ANY, e -> { e.consume(); this.getParent().fireEvent(e); }); }
@Override public StyleableBooleanProperty getStyleableProperty(JFXTabPane control) { return control.disableAnimationProperty(); } };
@Override public List<CssMetaData<? extends Styleable, ?>> getControlCssMetaData() { if (STYLEABLES == null) { final List<CssMetaData<? extends Styleable, ?>> styleables = new ArrayList<>( Control.getClassCssMetaData()); styleables.addAll(getClassCssMetaData()); styleables.addAll(TabPane.getClassCssMetaData()); STYLEABLES = Collections.unmodifiableList(styleables); } return STYLEABLES; }
private void initialize() { this.getStyleClass().setAll(DEFAULT_STYLE_CLASS); this.setTabClosingPolicy(TabClosingPolicy.UNAVAILABLE); }
JFXTabPane tabs = new JFXTabPane(); tabs.getTabs().add(rgbTab); tabs.getTabs().add(hsbTab); tabs.getTabs().add(hexTab); Region tabsHeader = (Region) tabs.lookup(".tab-header-background"); pane.backgroundProperty().unbind(); tabsHeader.backgroundProperty().unbind(); .getRed() > 0.5 ? Color.valueOf( "rgba(40, 40, 40, 0.87)") : Color.valueOf("rgba(255, 255, 255, 0.87)"); for (Node tabNode : tabs.lookupAll(".tab")) { for (Node node : tabNode.lookupAll(".tab-label")) { ((Label) node).setTextFill(fontColor); ((Pane) tabs.lookup(".tab-selected-line")).setBackground(new Background(new BackgroundFill(fontColor,CornerRadii.EMPTY,Insets.EMPTY))); pickerDecorator.lookupAll(".jfx-decorator-button").forEach(button -> { ((JFXButton) button).setRipplerFill(fontColor); CornerRadii.EMPTY, Insets.EMPTY))); ((Region) tabs.lookup(".tab-header-background")).setBackground(new Background(new BackgroundFill( curvedColorPicker.getColor(curvedColorPicker.getSelectedIndex()), CornerRadii.EMPTY, Insets.EMPTY))); Region tabsHeader = (Region) tabs.lookup(".tab-header-background"); pane.backgroundProperty().unbind(); tabsHeader.backgroundProperty().unbind();
primaryStage.setTitle("Tabs"); JFXTabPane tabPane = new JFXTabPane(); tab.setContent(new Label(TAB_0)); tabPane.getTabs().add(tab); tabPane.setPrefSize(300, 200); Tab tab1 = new Tab(); tab1.setText(TAB_01); tab1.setContent(new Label(TAB_01)); tabPane.getTabs().add(tab1); SingleSelectionModel<Tab> selectionModel = tabPane.getSelectionModel(); selectionModel.select(1); button.setOnMouseClicked((o) -> { Tab temp = new Tab(); int count = tabPane.getTabs().size(); temp.setText(msg + count); temp.setContent(new Label(TAB_0 + count)); tabPane.getTabs().add(temp); }); tabPane.setMaxWidth(500);
for (Tab tab : getSkinnable().getTabs()) { addTabContentHolder(tab); clip = new Rectangle(tabPane.getWidth(), tabPane.getHeight()); getSkinnable().setClip(clip); if (getSkinnable().getTabs().size() == 0) { header.setVisible(false); selectedTab = getSkinnable().getSelectionModel().getSelectedItem(); if (selectedTab == null && getSkinnable().getSelectionModel().getSelectedIndex() != -1) { getSkinnable().getSelectionModel().select(getSkinnable().getSelectionModel().getSelectedIndex()); selectedTab = getSkinnable().getSelectionModel().getSelectedItem(); getSkinnable().getSelectionModel().selectFirst(); selectedTab = getSkinnable().getSelectionModel().getSelectedItem(); getSkinnable().addEventHandler(MouseEvent.MOUSE_PRESSED, me -> { dragStart = (isHorizontal() ? me.getSceneX() : me .getSceneY()); offsetStart = header.scrollOffset; getSkinnable().getTabs().addListener((ListChangeListener<Tab>) change -> { List<Tab> tabsToBeRemoved = new ArrayList<>(); List<Tab> tabsToBeAdded = new ArrayList<>(); while (change.next()) { if (change.wasPermutated()) { Tab selectedTab = getSkinnable().getSelectionModel().getSelectedItem(); List<Tab> permutatedTabs = new ArrayList<>(change.getTo() - change.getFrom());
@Override protected void layoutChildren(final double x, final double y, final double w, final double h) { final double headerHeight = snapSize(header.prefHeight(-1)); final Side side = getSkinnable().getSide(); double tabsX = side == Side.RIGHT ? x + w - headerHeight : x; double tabsY = side == Side.BOTTOM ? y + h - headerHeight : y; int index = getSkinnable().getTabs().indexOf(selectedTab); if (index != i) { tabsContainer.setTranslateX(-contentWidth * i); if (isSelectingTab && !((JFXTabPane) getSkinnable()).isDisableAnimation()) { new CachedTransition(tabsContainer, new Timeline(new KeyFrame(Duration.millis(1000),
private void removeTabs(List<? extends Tab> removedTabs) { for (Tab tab : removedTabs) { TabHeaderContainer tabHeaderContainer = header.getTabHeaderContainer(tab); if (tabHeaderContainer != null) { tabHeaderContainer.isClosing = true; removeTab(tab); // if tabs list is empty hide the header container if (getSkinnable().getTabs().isEmpty()) { header.setVisible(false); } } } this.removedTabs = !removedTabs.isEmpty(); }
public HeaderContainer() { getSkinnable().sideProperty().addListener(observable -> updateDirection()); updateDirection(); for (Tab tab : getSkinnable().getTabs()) { addTab(tab, i++, true);
/** * {@inheritDoc} */ public JFXTabPane() { initialize(); }
if (isSelectingTab && !((JFXTabPane) getSkinnable()).isDisableAnimation()) { new CachedTransition(tabsContainer, new Timeline(new KeyFrame(Duration.millis(1000),
JFXTabPane tabs = new JFXTabPane(); tabs.getTabs().add(rgbTab); tabs.getTabs().add(hsbTab); tabs.getTabs().add(hexTab); Region tabsHeader = (Region) tabs.lookup(".tab-header-background"); pane.backgroundProperty().unbind(); tabsHeader.backgroundProperty().unbind(); .getRed() > 0.5 ? Color.valueOf( "rgba(40, 40, 40, 0.87)") : Color.valueOf("rgba(255, 255, 255, 0.87)"); for (Node tabNode : tabs.lookupAll(".tab")) { for (Node node : tabNode.lookupAll(".tab-label")) { ((Label) node).setTextFill(fontColor); ((Pane) tabs.lookup(".tab-selected-line")).setBackground(new Background(new BackgroundFill(fontColor,CornerRadii.EMPTY,Insets.EMPTY))); pickerDecorator.lookupAll(".jfx-decorator-button").forEach(button -> { ((JFXButton) button).setRipplerFill(fontColor); CornerRadii.EMPTY, Insets.EMPTY))); ((Region) tabs.lookup(".tab-header-background")).setBackground(new Background(new BackgroundFill( curvedColorPicker.getColor(curvedColorPicker.getSelectedIndex()), CornerRadii.EMPTY, Insets.EMPTY))); Region tabsHeader = (Region) tabs.lookup(".tab-header-background"); pane.backgroundProperty().unbind(); tabsHeader.backgroundProperty().unbind();
private void initialize() { this.getStyleClass().setAll(DEFAULT_STYLE_CLASS); this.setTabClosingPolicy(TabClosingPolicy.UNAVAILABLE); }
private void initGraphic() { this.tabPane.getTabs().get(0).setGraphic(ViewUtilities.iconSetter(Material.PERSON, IconDim.MEDIUM)); this.tabPane.getTabs().get(1).setGraphic(ViewUtilities.iconSetter(Material.BLUR_ON, IconDim.MEDIUM)); this.tabPane.getTabs().get(2).setGraphic(ViewUtilities.iconSetter(Material.MULTILINE_CHART, IconDim.MEDIUM)); this.tabPane.getTabs().get(3).setGraphic(ViewUtilities.iconSetter(Material.SETTINGS, IconDim.MEDIUM)); this.startButton.setGraphic(ViewUtilities.iconSetter(Material.VISIBILITY, IconDim.MEDIUM)); }
/** * {@inheritDoc} */ public JFXTabPane() { initialize(); }
/** * propagate any mouse events on the tab pane to its parent */ public void propagateMouseEventsToParent() { this.addEventHandler(MouseEvent.ANY, e -> { e.consume(); this.getParent().fireEvent(e); }); }
public final void setDisableAnimation(final Boolean disabled) { this.disableAnimationProperty().set(disabled); }
@Override public List<CssMetaData<? extends Styleable, ?>> getControlCssMetaData() { if (STYLEABLES == null) { final List<CssMetaData<? extends Styleable, ?>> styleables = new ArrayList<>( Control.getClassCssMetaData()); styleables.addAll(getClassCssMetaData()); styleables.addAll(TabPane.getClassCssMetaData()); STYLEABLES = Collections.unmodifiableList(styleables); } return STYLEABLES; }
public final Boolean isDisableAnimation() { return disableAnimation != null && this.disableAnimationProperty().get(); }