Search in sources :

Example 46 with GridPane

use of javafx.scene.layout.GridPane in project phoenicis by PhoenicisOrg.

the class WinePrefixContainerDisplayTab method populate.

private void populate() {
    final VBox displayPane = new VBox();
    final Text title = new TextWithStyle(tr("Display settings"), TITLE_CSS_CLASS);
    displayPane.getStyleClass().add(CONFIGURATION_PANE_CSS_CLASS);
    displayPane.getChildren().add(title);
    final GridPane displayContentPane = new GridPane();
    displayContentPane.getStyleClass().add("grid");
    final ComboBox<UseGLSL> glslComboBox = new ComboBox<>();
    glslComboBox.setMaxWidth(Double.MAX_VALUE);
    glslComboBox.setValue(container.getUseGlslValue());
    glslComboBox.valueProperty().addListener((observable, oldValue, newValue) -> this.changeSettings(newValue));
    addItems(glslComboBox, UseGLSL.class);
    displayContentPane.add(new TextWithStyle(tr("GLSL support"), CAPTION_TITLE_CSS_CLASS), 0, 0);
    displayContentPane.add(glslComboBox, 1, 0);
    final ComboBox<DirectDrawRenderer> directDrawRendererComboBox = new ComboBox<>();
    directDrawRendererComboBox.setMaxWidth(Double.MAX_VALUE);
    directDrawRendererComboBox.setValue(container.getDirectDrawRenderer());
    directDrawRendererComboBox.valueProperty().addListener((observable, oldValue, newValue) -> this.changeSettings(newValue));
    addItems(directDrawRendererComboBox, DirectDrawRenderer.class);
    displayContentPane.add(new TextWithStyle(tr("Direct Draw Renderer"), CAPTION_TITLE_CSS_CLASS), 0, 1);
    displayContentPane.add(directDrawRendererComboBox, 1, 1);
    final ComboBox<VideoMemorySize> videoMemorySizeComboBox = new ComboBox<>();
    videoMemorySizeComboBox.setMaxWidth(Double.MAX_VALUE);
    videoMemorySizeComboBox.setValue(container.getVideoMemorySize());
    videoMemorySizeComboBox.valueProperty().addListener((observable, oldValue, newValue) -> this.changeSettings(newValue));
    addItemsVideoMemorySize(videoMemorySizeComboBox);
    displayContentPane.add(new TextWithStyle(tr("Video memory size"), CAPTION_TITLE_CSS_CLASS), 0, 2);
    displayContentPane.add(videoMemorySizeComboBox, 1, 2);
    final ComboBox<OffscreenRenderingMode> offscreenRenderingModeComboBox = new ComboBox<>();
    offscreenRenderingModeComboBox.setMaxWidth(Double.MAX_VALUE);
    offscreenRenderingModeComboBox.setValue(container.getOffscreenRenderingMode());
    offscreenRenderingModeComboBox.valueProperty().addListener((observable, oldValue, newValue) -> this.changeSettings(newValue));
    addItems(offscreenRenderingModeComboBox, OffscreenRenderingMode.class);
    displayContentPane.add(new TextWithStyle(tr("Offscreen rendering mode"), CAPTION_TITLE_CSS_CLASS), 0, 3);
    displayContentPane.add(offscreenRenderingModeComboBox, 1, 3);
    final ComboBox<RenderTargetModeLock> renderTargetModeLockComboBox = new ComboBox<>();
    renderTargetModeLockComboBox.setMaxWidth(Double.MAX_VALUE);
    renderTargetModeLockComboBox.setValue(container.getRenderTargetModeLock());
    renderTargetModeLockComboBox.valueProperty().addListener((observable, oldValue, newValue) -> this.changeSettings(newValue));
    addItems(renderTargetModeLockComboBox, RenderTargetModeLock.class);
    displayContentPane.add(new TextWithStyle(tr("Render target lock mode"), CAPTION_TITLE_CSS_CLASS), 0, 4);
    displayContentPane.add(renderTargetModeLockComboBox, 1, 4);
    final ComboBox<Multisampling> multisamplingComboBox = new ComboBox<>();
    multisamplingComboBox.setMaxWidth(Double.MAX_VALUE);
    multisamplingComboBox.setValue(container.getMultisampling());
    multisamplingComboBox.valueProperty().addListener((observable, oldValue, newValue) -> this.changeSettings(newValue));
    addItems(multisamplingComboBox, Multisampling.class);
    displayContentPane.add(new TextWithStyle(tr("Multisampling"), CAPTION_TITLE_CSS_CLASS), 0, 5);
    displayContentPane.add(multisamplingComboBox, 1, 5);
    final ComboBox<StrictDrawOrdering> strictDrawOrderingComboBox = new ComboBox<>();
    strictDrawOrderingComboBox.setMaxWidth(Double.MAX_VALUE);
    strictDrawOrderingComboBox.setValue(container.getStrictDrawOrdering());
    strictDrawOrderingComboBox.valueProperty().addListener((observable, oldValue, newValue) -> this.changeSettings(newValue));
    addItems(strictDrawOrderingComboBox, StrictDrawOrdering.class);
    displayContentPane.add(new TextWithStyle(tr("Strict Draw Ordering"), CAPTION_TITLE_CSS_CLASS), 0, 6);
    displayContentPane.add(strictDrawOrderingComboBox, 1, 6);
    final ComboBox<AlwaysOffscreen> alwaysOffscreenComboBox = new ComboBox<>();
    alwaysOffscreenComboBox.setMaxWidth(Double.MAX_VALUE);
    alwaysOffscreenComboBox.setValue(container.getAlwaysOffscreen());
    alwaysOffscreenComboBox.valueProperty().addListener((observable, oldValue, newValue) -> this.changeSettings(newValue));
    addItems(alwaysOffscreenComboBox, AlwaysOffscreen.class);
    displayContentPane.add(new TextWithStyle(tr("Always Offscreen"), CAPTION_TITLE_CSS_CLASS), 0, 7);
    displayContentPane.add(alwaysOffscreenComboBox, 1, 7);
    Region spacer = new Region();
    GridPane.setHgrow(spacer, Priority.ALWAYS);
    displayContentPane.add(spacer, 2, 0);
    displayPane.getChildren().addAll(displayContentPane);
    this.setContent(displayPane);
    lockableElements.addAll(Arrays.asList(glslComboBox, directDrawRendererComboBox, offscreenRenderingModeComboBox, renderTargetModeLockComboBox, multisamplingComboBox, strictDrawOrderingComboBox, alwaysOffscreenComboBox, videoMemorySizeComboBox));
}
Also used : TextWithStyle(org.phoenicis.javafx.views.common.TextWithStyle) GridPane(javafx.scene.layout.GridPane) ComboBox(javafx.scene.control.ComboBox) Text(javafx.scene.text.Text) Region(javafx.scene.layout.Region) VBox(javafx.scene.layout.VBox)

Example 47 with GridPane

use of javafx.scene.layout.GridPane in project phoenicis by PhoenicisOrg.

the class WinePrefixContainerInputTab method populate.

private void populate() {
    final VBox inputPane = new VBox();
    final Text title = new TextWithStyle(tr("Input settings"), TITLE_CSS_CLASS);
    inputPane.getStyleClass().add(CONFIGURATION_PANE_CSS_CLASS);
    inputPane.getChildren().add(title);
    final GridPane inputContentPane = new GridPane();
    inputContentPane.getStyleClass().add("grid");
    final ComboBox<MouseWarpOverride> mouseWarpOverrideComboBox = new ComboBox<>();
    mouseWarpOverrideComboBox.setValue(container.getMouseWarpOverride());
    addItems(mouseWarpOverrideComboBox, MouseWarpOverride.class);
    inputContentPane.add(new TextWithStyle(tr("Mouse Warp Override"), CAPTION_TITLE_CSS_CLASS), 0, 0);
    inputContentPane.add(mouseWarpOverrideComboBox, 1, 0);
    inputContentPane.getColumnConstraints().addAll(new ColumnConstraintsWithPercentage(30), new ColumnConstraintsWithPercentage(70));
    inputPane.getChildren().addAll(inputContentPane);
    this.setContent(inputPane);
    lockableElements.add(mouseWarpOverrideComboBox);
}
Also used : TextWithStyle(org.phoenicis.javafx.views.common.TextWithStyle) ColumnConstraintsWithPercentage(org.phoenicis.javafx.views.common.ColumnConstraintsWithPercentage) GridPane(javafx.scene.layout.GridPane) MouseWarpOverride(org.phoenicis.containers.wine.parameters.MouseWarpOverride) ComboBox(javafx.scene.control.ComboBox) Text(javafx.scene.text.Text) VBox(javafx.scene.layout.VBox)

Example 48 with GridPane

use of javafx.scene.layout.GridPane in project uPMT by coco35700.

the class MainViewController method initialize.

@Override
public void initialize(URL arg0, ResourceBundle arg1) {
    Image image = ResourceLoader.loadImage("momentIcon.png");
    this.ajoutMomentButton.setImage(image);
    if (!main.getCurrentProject().getInterviews().isEmpty()) {
        main.setCurrentDescription(main.getCurrentProject().getInterviews().getFirst());
    }
    treeViewSchema.setEditable(true);
    treeViewInterview.setEditable(true);
    treeViewSchema.setCellFactory((TreeView<TypeController> t) -> new TypeTreeView(main));
    treeViewInterview.setCellFactory((TreeView<DescriptionInterview> t) -> new InterviewTreeView(main));
    TreeItem<TypeController> Schemaroot;
    TreeItem<DescriptionInterview> Interviewroot;
    Schemaroot = new TreeItem<TypeController>();
    Interviewroot = new TreeItem<DescriptionInterview>();
    Schemaroot.getChildren().add(SchemaTransformations.SchemaToTreeView(main.getCurrentProject().getSchema()));
    Interviewroot.getChildren().add(SchemaTransformations.EntretienToTreeView(main.getCurrentProject().getInterviews()));
    treeViewSchema.setRoot(Schemaroot);
    treeViewSchema.setShowRoot(false);
    treeViewInterview.setRoot(Interviewroot);
    treeViewInterview.setShowRoot(false);
    main.setTreeViewSchema(treeViewSchema);
    main.setTreeViewInterview(treeViewInterview);
    if (main.getCurrentDescription() != null) {
        // Give time to end initializing the scheme on the left
        Platform.runLater(new Runnable() {

            @Override
            public void run() {
                for (DescriptionInterview d : main.getCurrentProject().getInterviews()) {
                    GridPane gp = new GridPane();
                    gp.setMinHeight(200);
                    gp.setPadding(new Insets(100, 0, 0, 0));
                    addLinesToGrid(gp);
                    main.setGrid(gp);
                    MainViewTransformations.loadGridData(gp, main, d);
                    interviewsPane.put(d, gp);
                }
                updateGrid();
            }
        });
    }
    ajoutMomentButton.setOnDragDetected(new EventHandler<MouseEvent>() {

        @Override
        public void handle(MouseEvent event) {
            // TODO Auto-generated method stub
            if (main.getCurrentDescription() != null) {
                Dragboard db = ajoutMomentButton.startDragAndDrop(TransferMode.ANY);
                ClipboardContent content = new ClipboardContent();
                content.putString("ajoutMoment");
                content.putRtf("Moment Vide");
                db.setContent(content);
            }
        }
    });
    if (main.getCurrentDescription() != null)
        setDroppableText(main.getCurrentDescription().getDescripteme().getTexte().trim());
    paneDragText = new Pane();
    paneDragText.setStyle("-fx-background-color:#f4f4f4;");
    paneDragText.setCursor(Cursor.MOVE);
    paneDragText.setOpacity(0.2);
    // Quand on selectionne du texte, on met un panel devant le text pour pouvoir le dragger
    droppableText.addEventFilter(MouseEvent.MOUSE_RELEASED, new EventHandler<MouseEvent>() {

        @Override
        public void handle(MouseEvent mouseEvent) {
            if (!droppableText.getSelectedText().equals("") && !droppableText.getSelectedText().equals(" ") && !droppableText.getSelectedText().equals("\n"))
                stackForDragDrop.getChildren().add(paneDragText);
        }
    });
    // Quand on clique sur la panel qui s'est mit par dessus le texte, on l'enleve pour � nouveau rendre le texte selectionnable
    paneDragText.setOnMouseClicked(new EventHandler<MouseEvent>() {

        @Override
        public void handle(MouseEvent arg0) {
            droppableText.deselect();
            stackForDragDrop.getChildren().clear();
            stackForDragDrop.getChildren().add(droppableText);
        }
    });
    // Quand on drag le panel qui s'est mit par dessus le text
    paneDragText.setOnDragDetected(new EventHandler<MouseEvent>() {

        @Override
        public void handle(MouseEvent event) {
            // TODO Auto-generated method stub
            if (main.getCurrentDescription() != null) {
                Dragboard db = ajoutMomentButton.startDragAndDrop(TransferMode.ANY);
                ClipboardContent content = new ClipboardContent();
                content.putString("ajoutMoment");
                content.put(DataFormat.HTML, droppableText.getSelectedText());
                db.setContent(content);
            }
        }
    });
    buttonTextInterview.setOnMouseClicked(new EventHandler<MouseEvent>() {

        @Override
        public void handle(MouseEvent arg0) {
            if (droppableText.isDisabled()) {
                buttonTextInterview.setImage(ResourceLoader.loadImage("closeMenuBlack.png"));
                droppableText.setDisable(false);
                mainSplitPane.setDividerPosition(1, splitPos);
                stackForDragDrop.getChildren().add(droppableText);
                topBarContainerTextInterview.setCenter(textInterviewTitle);
                paneOfTextArea.setMaxWidth(paneOfTextArea.USE_COMPUTED_SIZE);
            } else {
                buttonTextInterview.setImage(ResourceLoader.loadImage("openMenuBlack.png"));
                droppableText.deselect();
                droppableText.setDisable(true);
                splitPos = mainSplitPane.getDividers().get(1).getPosition();
                mainSplitPane.setDividerPosition(1, 1);
                stackForDragDrop.getChildren().clear();
                topBarContainerTextInterview.setCenter(null);
                paneOfTextArea.setMaxWidth(buttonTextInterview.getFitWidth());
            }
        }
    });
}
Also used : MomentAddTypeController(controller.controller.MomentAddTypeController) TypeController(controller.controller.TypeController) MomentRemoveTypeController(controller.controller.MomentRemoveTypeController) TypeTreeView(controller.typeTreeView.TypeTreeView) GridPane(javafx.scene.layout.GridPane) Insets(javafx.geometry.Insets) MouseEvent(javafx.scene.input.MouseEvent) ClipboardContent(javafx.scene.input.ClipboardContent) DescriptionInterview(model.DescriptionInterview) Image(javafx.scene.image.Image) StackPane(javafx.scene.layout.StackPane) ScrollPane(javafx.scene.control.ScrollPane) Pane(javafx.scene.layout.Pane) SplitPane(javafx.scene.control.SplitPane) FlowPane(javafx.scene.layout.FlowPane) BorderPane(javafx.scene.layout.BorderPane) GridPane(javafx.scene.layout.GridPane) InterviewTreeView(controller.interviewTreeView.InterviewTreeView) InterviewTreeView(controller.interviewTreeView.InterviewTreeView) TreeView(javafx.scene.control.TreeView) TypeTreeView(controller.typeTreeView.TypeTreeView) Dragboard(javafx.scene.input.Dragboard)

Example 49 with GridPane

use of javafx.scene.layout.GridPane in project StegMeister by GaleForce89.

the class StegMeister method showErrorDialog.

private static void showErrorDialog(Throwable e) {
    Alert alert = new Alert(Alert.AlertType.ERROR);
    alert.setTitle("Exception Dialog");
    alert.setHeaderText("Something went horribly wrong...");
    alert.setContentText("Click the button to view");
    alert.setResizable(true);
    alert.initOwner(getPrimaryStage());
    // Create expandable Exception.
    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    e.printStackTrace(pw);
    String exceptionText = sw.toString();
    Label label = new Label("The exception stacktrace was:");
    TextArea textArea = new TextArea(exceptionText);
    textArea.setEditable(false);
    textArea.setWrapText(true);
    textArea.setMaxWidth(Double.MAX_VALUE);
    textArea.setMaxHeight(Double.MAX_VALUE);
    GridPane.setVgrow(textArea, Priority.ALWAYS);
    GridPane.setHgrow(textArea, Priority.ALWAYS);
    GridPane expContent = new GridPane();
    expContent.setMaxWidth(Double.MAX_VALUE);
    expContent.setMaxHeight(Double.MAX_VALUE);
    expContent.add(label, 0, 0);
    expContent.add(textArea, 0, 1);
    // Set expandable Exception into the dialog pane.
    alert.getDialogPane().setExpandableContent(expContent);
    alert.getDialogPane().setPrefWidth(600);
    alert.showAndWait();
}
Also used : GridPane(javafx.scene.layout.GridPane) StringWriter(java.io.StringWriter) TextArea(javafx.scene.control.TextArea) Label(javafx.scene.control.Label) Alert(javafx.scene.control.Alert) PrintWriter(java.io.PrintWriter)

Example 50 with GridPane

use of javafx.scene.layout.GridPane in project JavaFXLibrary by eficode.

the class TestWindowManagementController method addEmployeeButtonListener.

public void addEmployeeButtonListener() {
    Dialog<Employee> dialog = new Dialog<>();
    dialog.setTitle("Add employee information");
    dialog.setHeaderText("New employee");
    Label nameLabel = new Label("Name: ");
    Label phoneLabel = new Label("Phone: ");
    TextField nameField = new TextField();
    TextField phoneField = new TextField();
    nameField.setId("nameField");
    phoneField.setId("phoneField");
    GridPane grid = new GridPane();
    grid.add(nameLabel, 1, 1);
    grid.add(nameField, 2, 1);
    grid.add(phoneLabel, 1, 2);
    grid.add(phoneField, 2, 2);
    dialog.getDialogPane().setContent(grid);
    ButtonType buttonTypeOk = new ButtonType("Add", ButtonBar.ButtonData.OK_DONE);
    dialog.getDialogPane().getButtonTypes().add(buttonTypeOk);
    dialog.setResultConverter((b) -> {
        if (b == buttonTypeOk)
            return new Employee(nameField.getText(), phoneField.getText());
        return null;
    });
    Optional<Employee> result = dialog.showAndWait();
    if (result.isPresent()) {
        Employee employee = result.get();
        Label nameCell = new Label(employee.getName());
        Label phoneCell = new Label(employee.getPhoneNumber());
        nameCell.getStyleClass().add("employeeDataCell");
        phoneCell.getStyleClass().add("employeeDataCell");
        HBox dataRow = new HBox(nameCell, phoneCell);
        dataRow.getStyleClass().add("employeeDataRow");
        employeeDataContainer.getChildren().add(dataRow);
    }
}
Also used : HBox(javafx.scene.layout.HBox) GridPane(javafx.scene.layout.GridPane)

Aggregations

GridPane (javafx.scene.layout.GridPane)147 Label (javafx.scene.control.Label)83 Insets (javafx.geometry.Insets)67 Button (javafx.scene.control.Button)46 TextField (javafx.scene.control.TextField)42 VBox (javafx.scene.layout.VBox)37 Scene (javafx.scene.Scene)36 HBox (javafx.scene.layout.HBox)26 ButtonType (javafx.scene.control.ButtonType)25 Text (javafx.scene.text.Text)24 Node (javafx.scene.Node)23 Dialog (javafx.scene.control.Dialog)23 ColumnConstraints (javafx.scene.layout.ColumnConstraints)18 Stage (javafx.stage.Stage)18 TextWithStyle (org.phoenicis.javafx.views.common.TextWithStyle)17 List (java.util.List)16 CheckBox (javafx.scene.control.CheckBox)16 ImageView (javafx.scene.image.ImageView)14 ActionEvent (javafx.event.ActionEvent)13 ComboBox (javafx.scene.control.ComboBox)13