Search in sources :

Example 1 with NavigationTabs

use of org.csstudio.display.builder.representation.javafx.widgets.NavigationTabs in project org.csstudio.display.builder by kasemir.

the class NavigationTabsDemo method start.

@Override
public void start(final Stage stage) {
    final NavigationTabs nav_tabs = new NavigationTabs();
    final List<String> tabs = IntStream.range(1, 10).mapToObj(i -> "Step" + i).collect(Collectors.toList());
    nav_tabs.setTabs(tabs);
    nav_tabs.setTabSize(80, 40);
    nav_tabs.setTabSpacing(5);
    nav_tabs.getBodyPane().getChildren().setAll(new Label("     Go on, select something!"));
    nav_tabs.addListener(index -> {
        System.out.println("User selected tab " + index);
        final Label label = new Label("You selected tab " + (index + 1));
        label.setLayoutX(index * 10);
        label.setLayoutY(index * 15);
        nav_tabs.getBodyPane().getChildren().setAll(label);
    });
    nav_tabs.selectTab(2);
    final Button direction = new Button("Change direction");
    direction.setOnAction(e -> nav_tabs.setDirection(Direction.values()[1 - nav_tabs.getDirection().ordinal()]));
    final BorderPane layout = new BorderPane();
    layout.setCenter(nav_tabs);
    layout.setBottom(direction);
    final Scene scene = new Scene(layout);
    // Enable scene debugging?
    // ScenicView.show(scene);
    JFXRepresentation.setSceneStyle(scene);
    stage.setTitle("Navigation Tab Demo");
    stage.setScene(scene);
    stage.setWidth(800);
    stage.setHeight(600);
    stage.show();
}
Also used : IntStream(java.util.stream.IntStream) Application(javafx.application.Application) Button(javafx.scene.control.Button) Direction(org.csstudio.display.builder.model.properties.Direction) JFXRepresentation(org.csstudio.display.builder.representation.javafx.JFXRepresentation) Scene(javafx.scene.Scene) List(java.util.List) Label(javafx.scene.control.Label) Stage(javafx.stage.Stage) NavigationTabs(org.csstudio.display.builder.representation.javafx.widgets.NavigationTabs) BorderPane(javafx.scene.layout.BorderPane) Collectors(java.util.stream.Collectors) BorderPane(javafx.scene.layout.BorderPane) Button(javafx.scene.control.Button) Label(javafx.scene.control.Label) NavigationTabs(org.csstudio.display.builder.representation.javafx.widgets.NavigationTabs) Scene(javafx.scene.Scene)

Aggregations

List (java.util.List)1 Collectors (java.util.stream.Collectors)1 IntStream (java.util.stream.IntStream)1 Application (javafx.application.Application)1 Scene (javafx.scene.Scene)1 Button (javafx.scene.control.Button)1 Label (javafx.scene.control.Label)1 BorderPane (javafx.scene.layout.BorderPane)1 Stage (javafx.stage.Stage)1 Direction (org.csstudio.display.builder.model.properties.Direction)1 JFXRepresentation (org.csstudio.display.builder.representation.javafx.JFXRepresentation)1 NavigationTabs (org.csstudio.display.builder.representation.javafx.widgets.NavigationTabs)1