Search in sources :

Example 91 with Region

use of javafx.scene.layout.Region in project TestFX by TestFX.

the class NodeMatchersTest method hasText_filters_nodes.

@Test
public void hasText_filters_nodes() throws Exception {
    // given:
    List<Node> nodes = FxToolkit.setupFixture(() -> {
        List<Node> temp = new ArrayList<>(3);
        temp.add(new Region());
        temp.add(new Button("foo"));
        temp.add(new TextField("bar"));
        return temp;
    });
    // then:
    NodeQuery query1 = from(nodes).match(LabeledMatchers.hasText("foo"));
    assertThat(query1.queryAll(), hasItems(nodes.get(1)));
    NodeQuery query2 = from(nodes).match(TextInputControlMatchers.hasText("bar"));
    assertThat(query2.queryAll(), hasItems(nodes.get(2)));
}
Also used : Button(javafx.scene.control.Button) Node(javafx.scene.Node) NodeQuery(org.testfx.service.query.NodeQuery) ArrayList(java.util.ArrayList) Region(javafx.scene.layout.Region) TextField(javafx.scene.control.TextField) Test(org.junit.Test)

Example 92 with Region

use of javafx.scene.layout.Region in project TestFX by TestFX.

the class NodeAssertTest method hasText_filters_nodes.

@Test
public void hasText_filters_nodes() throws Exception {
    // given:
    List<Node> nodes = FxToolkit.setupFixture(() -> {
        List<Node> temp = new ArrayList<>(3);
        temp.add(new Region());
        temp.add(new Button("foo"));
        temp.add(new TextField("bar"));
        return temp;
    });
    // then:
    NodeQuery query1 = from(nodes).match(LabeledMatchers.hasText("foo"));
    assertThat(query1.queryAll()).containsExactly(nodes.get(1));
    NodeQuery query2 = from(nodes).match(TextInputControlMatchers.hasText("bar"));
    assertThat(query2.queryAll()).containsExactly(nodes.get(2));
}
Also used : Button(javafx.scene.control.Button) Node(javafx.scene.Node) NodeQuery(org.testfx.service.query.NodeQuery) ArrayList(java.util.ArrayList) Region(javafx.scene.layout.Region) TextField(javafx.scene.control.TextField) Test(org.junit.Test)

Example 93 with Region

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

the class WinePrefixContainerInformationTab method populate.

private void populate() {
    final VBox informationPane = new VBox();
    final Text title = new TextWithStyle(tr("Information"), TITLE_CSS_CLASS);
    informationPane.getStyleClass().add(CONFIGURATION_PANE_CSS_CLASS);
    informationPane.getChildren().add(title);
    final GridPane informationContentPane = new GridPane();
    informationContentPane.getStyleClass().add("grid");
    informationContentPane.add(new TextWithStyle(tr("Name:"), CAPTION_TITLE_CSS_CLASS), 0, 0);
    Label name = new Label(container.getName());
    name.setWrapText(true);
    informationContentPane.add(name, 1, 0);
    informationContentPane.add(new TextWithStyle(tr("Path:"), CAPTION_TITLE_CSS_CLASS), 0, 1);
    Label path = new Label(container.getPath());
    path.setWrapText(true);
    informationContentPane.add(path, 1, 1);
    informationContentPane.add(new TextWithStyle(tr("Installed shortcuts:"), CAPTION_TITLE_CSS_CLASS), 0, 2);
    Label installedShortcuts = new Label(container.getInstalledShortcuts().stream().map(shortcutDTO -> shortcutDTO.getInfo().getName()).collect(Collectors.joining("; ")));
    installedShortcuts.setWrapText(true);
    informationContentPane.add(installedShortcuts, 1, 2);
    informationContentPane.add(new TextWithStyle(tr("Wine version:"), CAPTION_TITLE_CSS_CLASS), 0, 3);
    Label version = new Label(container.getVersion());
    version.setWrapText(true);
    informationContentPane.add(version, 1, 3);
    informationContentPane.add(new TextWithStyle(tr("Wine architecture:"), CAPTION_TITLE_CSS_CLASS), 0, 4);
    Label architecture = new Label(container.getArchitecture());
    architecture.setWrapText(true);
    informationContentPane.add(architecture, 1, 4);
    informationContentPane.add(new TextWithStyle(tr("Wine distribution:"), CAPTION_TITLE_CSS_CLASS), 0, 5);
    Label distribution = new Label(container.getDistribution());
    distribution.setWrapText(true);
    informationContentPane.add(distribution, 1, 5);
    Region spacer = new Region();
    spacer.setPrefHeight(20);
    VBox.setVgrow(spacer, Priority.NEVER);
    // changing engine does not work currently
    // disabled combobox to avoid confusion of users
    /*ComboBox<EngineVersionDTO> changeEngineComboBox = new ComboBox<EngineVersionDTO>(
                FXCollections.observableList(engineVersions));
        changeEngineComboBox.setConverter(new StringConverter<EngineVersionDTO>() {
            @Override
            public String toString(EngineVersionDTO object) {
                return object.getVersion();
            }
        
            @Override
            public EngineVersionDTO fromString(String string) {
                return engineVersions.stream().filter(engineVersion -> engineVersion.getVersion().equals(string))
                        .findFirst().get();
            }
        });
        changeEngineComboBox.getSelectionModel().select(engineVersions.stream()
                .filter(engineVersion -> engineVersion.getVersion().equals(container.getVersion())).findFirst().get());*/
    Button deleteButton = new Button(tr("Delete container"));
    deleteButton.setOnMouseClicked(event -> this.onDeletePrefix.accept(container));
    informationPane.getChildren().addAll(informationContentPane, spacer, /*changeEngineComboBox,*/
    deleteButton);
    this.setContent(informationPane);
}
Also used : TextWithStyle(org.phoenicis.javafx.views.common.TextWithStyle) GridPane(javafx.scene.layout.GridPane) Button(javafx.scene.control.Button) Label(javafx.scene.control.Label) Region(javafx.scene.layout.Region) Text(javafx.scene.text.Text) VBox(javafx.scene.layout.VBox)

Example 94 with Region

use of javafx.scene.layout.Region in project trex-stateless-gui by cisco-system-traffic-generator.

the class ConfigTreeItem method initTreeItemValue.

private void initTreeItemValue() {
    HBox itemContainer = new HBox();
    itemContainer.setSpacing(5d);
    itemContainer.getChildren().add(createLabel());
    Region spacing = new Region();
    spacing.setMaxHeight(0d);
    HBox.setHgrow(spacing, Priority.ALWAYS);
    itemContainer.getChildren().add(spacing);
    if (configNode.isRemovable()) {
        itemContainer.getChildren().add(createRemoveButton());
    }
    this.control = createControl();
    if (control != null) {
        itemContainer.getChildren().add(control);
    }
    setValue(itemContainer);
}
Also used : HBox(javafx.scene.layout.HBox) Region(javafx.scene.layout.Region)

Example 95 with Region

use of javafx.scene.layout.Region in project POL-POM-5 by PlayOnLinux.

the class ShortcutInformationPanelSkin method initialise.

/**
 * {@inheritDoc}
 */
@Override
public void initialise() {
    final GridPane controlButtons = createControlButtons();
    if (getControl().getJavaFxSettingsManager().isAdvancedMode()) {
        final Label descriptionLabel = new Label();
        descriptionLabel.textProperty().bind(description);
        descriptionLabel.setWrapText(true);
        final GridPane propertiesGrid = createPropertiesGrid();
        final Label environmentLabel = new Label(tr("Environment"));
        environmentLabel.getStyleClass().add("sectionTitle");
        environmentLabel.setWrapText(true);
        final KeyAttributeList environmentAttributeList = createKeyAttributeList();
        final Region spacer = new Region();
        spacer.getStyleClass().add("detailsButtonSpacer");
        final VBox container = new VBox(descriptionLabel, propertiesGrid, environmentLabel, environmentAttributeList, spacer, controlButtons);
        getChildren().setAll(container);
    } else {
        final VBox container = new VBox(controlButtons);
        getChildren().setAll(container);
    }
}
Also used : GridPane(javafx.scene.layout.GridPane) KeyAttributeList(org.phoenicis.javafx.components.common.control.KeyAttributeList) Label(javafx.scene.control.Label) Region(javafx.scene.layout.Region) VBox(javafx.scene.layout.VBox)

Aggregations

Region (javafx.scene.layout.Region)106 Text (javafx.scene.text.Text)25 VBox (javafx.scene.layout.VBox)22 Label (javafx.scene.control.Label)21 Pane (javafx.scene.layout.Pane)21 Button (javafx.scene.control.Button)18 InnerShadow (javafx.scene.effect.InnerShadow)17 Scene (javafx.scene.Scene)16 Node (javafx.scene.Node)15 Insets (javafx.geometry.Insets)14 HBox (javafx.scene.layout.HBox)14 DropShadow (javafx.scene.effect.DropShadow)13 ArrayList (java.util.ArrayList)12 StackPane (javafx.scene.layout.StackPane)12 Canvas (javafx.scene.canvas.Canvas)11 Color (javafx.scene.paint.Color)11 GridPane (javafx.scene.layout.GridPane)10 Group (javafx.scene.Group)9 Background (javafx.scene.layout.Background)8 BackgroundFill (javafx.scene.layout.BackgroundFill)8