Search in sources :

Example 1 with PluginParametersPane

use of au.gov.asd.tac.constellation.plugins.gui.PluginParametersPane in project constellation by constellation-app.

the class AnalyticConfigurationPane method populateParameterPane.

private void populateParameterPane(final PluginParameters pluginParameters) {
    final PluginParametersPane pluginParametersPane = PluginParametersPane.buildPane(pluginParameters, null);
    // The parameters should only be editable if we are looking at a category rather than a question.
    pluginParametersPane.setDisable(questionListPane.isExpanded());
    parametersTab.setContent(pluginParametersPane);
}
Also used : PluginParametersPane(au.gov.asd.tac.constellation.plugins.gui.PluginParametersPane)

Example 2 with PluginParametersPane

use of au.gov.asd.tac.constellation.plugins.gui.PluginParametersPane in project constellation by constellation-app.

the class DataSourceTitledPane method displayParameters.

/**
 * Build the pane if it should be in an expanded state, otherwise build it
 * with a dummy label in the content as a placeholder.
 *
 * @param isExpanded true if the TitledPane should be expanded immediately, false otherwise
 */
private void displayParameters(final boolean isExpanded) {
    assert Platform.isFxApplicationThread();
    // Couldn't be bothered keeping a reference to the progress indicator.
    // Find it and remove it. (But only one: if there are overlapping loads happening,
    // we don't want to remove someone else's indicator.)
    Node n = null;
    for (final Node node : ((HBox) getGraphic()).getChildren()) {
        if (node instanceof ProgressIndicator) {
            n = node;
            break;
        }
    }
    if (n != null) {
        ((HBox) getGraphic()).getChildren().remove(n);
    }
    if (parametersCreated) {
        enabled.setDisable(false);
        setCollapsible(true);
        if (hasNonGlobalParameters(dataSourceParameters)) {
            if (isExpanded) {
                isLoaded = true;
                final PluginParametersPane parametersPane = PluginParametersPane.buildPane(dataSourceParameters, this, globalParamLabels);
                setContent(parametersPane);
                setExpanded(true);
            } else {
                // We need some content, any content, otherwise the first time the
                // user attempts to expand the pane, the TitledPane will say to itself
                // "I have no content, therefore I won't bother to expand".
                setContent(DUMMY_LABEL);
            }
            expandedProperty().addListener((final ObservableValue<? extends Boolean> observable, final Boolean oldValue, final Boolean newValue) -> {
                DataAccessPreferenceUtilities.setExpanded(plugin.getName(), newValue);
                if (newValue && !isLoaded) {
                    isLoaded = true;
                    final PluginParametersPane parametersPane = PluginParametersPane.buildPane(dataSourceParameters, this, globalParamLabels);
                    setContent(parametersPane);
                }
            });
        } else {
            setCollapsible(false);
        }
        enabled.setOnAction(event -> {
            top.hierarchicalUpdate();
            if (enabled.isSelected()) {
                while (getStyleClass().contains(MATCHED_STYLE)) {
                    getStyleClass().remove(MATCHED_STYLE);
                }
                getStyleClass().add(SELECTED_STYLE);
            } else {
                while (getStyleClass().contains(SELECTED_STYLE)) {
                    getStyleClass().remove(SELECTED_STYLE);
                }
            }
        });
    } else {
        // Something went wrong, so disable this plugin's GUI.
        enabled.setDisable(true);
        enabled.setSelected(false);
        label.setDisable(true);
        final Label text = new Label("Unexpected error while creating parameters:\n" + paramFailureMsg);
        text.setPrefWidth(400);
        text.setWrapText(true);
        setContent(text);
        setAlignment(Pos.TOP_LEFT);
    }
}
Also used : HBox(javafx.scene.layout.HBox) PluginParametersPane(au.gov.asd.tac.constellation.plugins.gui.PluginParametersPane) ProgressIndicator(javafx.scene.control.ProgressIndicator) Node(javafx.scene.Node) ObservableValue(javafx.beans.value.ObservableValue) Label(javafx.scene.control.Label)

Example 3 with PluginParametersPane

use of au.gov.asd.tac.constellation.plugins.gui.PluginParametersPane in project constellation by constellation-app.

the class SourcePane method setParameters.

public void setParameters(final PluginParameters parameters) {
    parametersPane.getChildren().clear();
    if (parameters != null) {
        final PluginParametersPane pluginParametersPane = PluginParametersPane.buildPane(parameters, null);
        parametersPane.getChildren().add(pluginParametersPane);
    }
}
Also used : PluginParametersPane(au.gov.asd.tac.constellation.plugins.gui.PluginParametersPane)

Aggregations

PluginParametersPane (au.gov.asd.tac.constellation.plugins.gui.PluginParametersPane)3 ObservableValue (javafx.beans.value.ObservableValue)1 Node (javafx.scene.Node)1 Label (javafx.scene.control.Label)1 ProgressIndicator (javafx.scene.control.ProgressIndicator)1 HBox (javafx.scene.layout.HBox)1