Search in sources :

Example 1 with ExposedDescriptorDescriptor

use of com.helospark.tactview.core.timeline.subtimeline.ExposedDescriptorDescriptor in project tactview by helospark.

the class SubtimelineSelectWindow method open.

public Set<ExposedDescriptorDescriptor> open() {
    Stage stage = new Stage();
    BorderPane mainBorderPane = new BorderPane();
    mainBorderPane.getStyleClass().add("dialog-root");
    VBox vbox = new VBox();
    vbox.getStyleClass().add("subtimeline-descriptor-properties-box");
    for (var channel : timelineManagerAccessor.getChannels()) {
        for (var clip : channel.getAllClips()) {
            GridPane gridPane = new GridPane();
            gridPane.getStyleClass().add("subtimeline-descriptor-properties-grid");
            BorderPane borderPane = new BorderPane();
            borderPane.setTop(new Label(nameToIdRepository.getNameForId(clip.getId()) + " properties"));
            borderPane.setCenter(gridPane);
            int index = 0;
            for (var descriptor : clip.getDescriptors()) {
                String descriptorId = descriptor.getKeyframeableEffect().getId();
                ExposedDescriptorDescriptor descritporDescriptor = ExposedDescriptorDescriptor.builder().withId(descriptorId).withName(descriptor.getName()).withGroup(descriptor.getGroup().orElse(null)).build();
                CheckBox checkBox = new CheckBox("");
                checkBox.setSelected(false);
                checkBox.selectedProperty().addListener((value, oldVal, newVal) -> {
                    if (newVal) {
                        descriptorDescriptors.put(descriptorId, descritporDescriptor);
                    } else {
                        descriptorDescriptors.remove(descriptorId);
                    }
                });
                Label label = new Label(descriptor.getName());
                gridPane.add(checkBox, 0, index);
                gridPane.add(label, 1, index);
                ++index;
            }
            vbox.getChildren().add(borderPane);
        }
    }
    ScrollPane scrollPane = new ScrollPane(vbox);
    mainBorderPane.setCenter(scrollPane);
    mainBorderPane.setBottom(createButtonBar(stage));
    Scene scene = new Scene(mainBorderPane);
    stage.setWidth(700);
    stage.setHeight(500);
    stage.setScene(scene);
    stage.setTitle("Select which properties are exposed");
    stylesheetAdderService.setDefaultStyleSheetForDialog(stage, mainBorderPane);
    stage.showAndWait();
    return descriptorDescriptors.values().stream().collect(Collectors.toSet());
}
Also used : ExposedDescriptorDescriptor(com.helospark.tactview.core.timeline.subtimeline.ExposedDescriptorDescriptor) BorderPane(javafx.scene.layout.BorderPane) GridPane(javafx.scene.layout.GridPane) CheckBox(javafx.scene.control.CheckBox) ScrollPane(javafx.scene.control.ScrollPane) Label(javafx.scene.control.Label) Stage(javafx.stage.Stage) Scene(javafx.scene.Scene) VBox(javafx.scene.layout.VBox)

Aggregations

ExposedDescriptorDescriptor (com.helospark.tactview.core.timeline.subtimeline.ExposedDescriptorDescriptor)1 Scene (javafx.scene.Scene)1 CheckBox (javafx.scene.control.CheckBox)1 Label (javafx.scene.control.Label)1 ScrollPane (javafx.scene.control.ScrollPane)1 BorderPane (javafx.scene.layout.BorderPane)1 GridPane (javafx.scene.layout.GridPane)1 VBox (javafx.scene.layout.VBox)1 Stage (javafx.stage.Stage)1