Search in sources :

Example 1 with ColorParameterValue

use of au.gov.asd.tac.constellation.plugins.parameters.types.ColorParameterType.ColorParameterValue in project constellation by constellation-app.

the class CreateVertexTypePlugin method createParameters.

@Override
public PluginParameters createParameters() {
    final PluginParameters params = new PluginParameters();
    final PluginParameter<StringParameterValue> nameParam = StringParameterType.build(NAME_PARAMETER_ID);
    nameParam.setName("Name");
    nameParam.setDescription("The name of the new vertex type");
    nameParam.setStringValue(null);
    params.addParameter(nameParam);
    final PluginParameter<StringParameterValue> descriptionParam = StringParameterType.build(DESCRIPTION_PARAMETER_ID);
    descriptionParam.setName("Description");
    descriptionParam.setDescription("The description of the new vertex type");
    descriptionParam.setStringValue(null);
    params.addParameter(descriptionParam);
    final PluginParameter<ColorParameterValue> colorParam = ColorParameterType.build(COLOR_PARAMETER_ID);
    colorParam.setName("Color");
    colorParam.setDescription("The color of the new vertex type");
    colorParam.setStringValue(ConstellationColor.GREY.getName());
    params.addParameter(colorParam);
    final PluginParameter<StringParameterValue> fgIconParam = StringParameterType.build(FG_ICON_PARAMETER_ID);
    fgIconParam.setName("Foreground Icon");
    fgIconParam.setDescription("The name of the foreground icon of the new vertex type");
    fgIconParam.setStringValue(CharacterIconProvider.CHAR_003F.getExtendedName());
    params.addParameter(fgIconParam);
    final PluginParameter<StringParameterValue> bgIconParam = StringParameterType.build(BG_ICON_PARAMETER_ID);
    bgIconParam.setName("Background Icon");
    bgIconParam.setDescription("The name of the background icon of the new vertex type");
    bgIconParam.setStringValue(DefaultIconProvider.FLAT_SQUARE.getExtendedName());
    params.addParameter(bgIconParam);
    final PluginParameter<StringParameterValue> detectionRegexParam = StringParameterType.build(DETECTION_REGEX_PARAMETER_ID);
    detectionRegexParam.setName("Detection Regular Expression");
    detectionRegexParam.setDescription("The detection regular expression (case of the new vertex type");
    detectionRegexParam.setStringValue(null);
    params.addParameter(detectionRegexParam);
    final PluginParameter<StringParameterValue> validationRegexParam = StringParameterType.build(VALIDATION_REGEX_PARAMETER_ID);
    validationRegexParam.setName("Validation Regular Expression");
    validationRegexParam.setDescription("The detection regular expression of the new vertex type");
    validationRegexParam.setStringValue(null);
    params.addParameter(validationRegexParam);
    final PluginParameter<StringParameterValue> superTypeParam = StringParameterType.build(SUPER_TYPE_PARAMETER_ID);
    superTypeParam.setName("Super Type");
    superTypeParam.setDescription("The name of the super type of the new vertex type");
    superTypeParam.setStringValue(null);
    params.addParameter(superTypeParam);
    final PluginParameter<StringParameterValue> overriddenTypeParam = StringParameterType.build(OVERRIDDEN_TYPE_PARAMETER_ID);
    overriddenTypeParam.setName("Overridden Type");
    overriddenTypeParam.setDescription("The name of the overridden type of the new vertex type");
    overriddenTypeParam.setStringValue(null);
    params.addParameter(overriddenTypeParam);
    final PluginParameter<BooleanParameterValue> incompleteParam = BooleanParameterType.build(INCOMPLETE_PARAMETER_ID);
    incompleteParam.setName("Incomplete");
    incompleteParam.setDescription("Is the new vertex type incomplete?");
    incompleteParam.setBooleanValue(false);
    params.addParameter(incompleteParam);
    return params;
}
Also used : BooleanParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.BooleanParameterType.BooleanParameterValue) StringParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.StringParameterValue) ColorParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.ColorParameterType.ColorParameterValue) PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters)

Example 2 with ColorParameterValue

use of au.gov.asd.tac.constellation.plugins.parameters.types.ColorParameterType.ColorParameterValue in project constellation by constellation-app.

the class TestParametersPlugin method createParameters.

@Override
public PluginParameters createParameters() {
    final PluginParameters params = new PluginParameters();
    final String css = TestParametersPlugin.class.getResource("resources/test.css").toExternalForm();
    final BooleanParameterValue selectedpv = new BooleanParameterValue(true);
    selectedpv.setGuiInit(control -> {
        final CheckBox field = (CheckBox) control;
        field.getStylesheets().add(css);
    });
    final PluginParameter<BooleanParameterValue> selected = BooleanParameterType.build(SELECTED_PARAMETER_ID, selectedpv);
    selected.setName("Use selected");
    selected.setDescription("Only use selected elements");
    params.addParameter(selected);
    final PluginParameter<StringParameterValue> queryName = CoreGlobalParameters.QUERY_NAME_PARAMETER;
    params.addParameter(queryName);
    final PluginParameter<DateTimeRangeParameterValue> dt = CoreGlobalParameters.DATETIME_RANGE_PARAMETER;
    params.addParameter(dt);
    final PluginParameter<StringParameterValue> string1 = StringParameterType.build(TEST1_PARAMETER_ID);
    string1.setName("Test1");
    string1.setDescription("A test string");
    string1.setStringValue("Plugh.");
    params.addParameter(string1);
    final StringParameterValue string2pv = new StringParameterValue();
    string2pv.setGuiInit(control -> {
        final TextArea field = (TextArea) control;
        field.getStylesheets().add(css);
    });
    final PluginParameter<StringParameterValue> string2 = StringParameterType.build(TEST2_PARAMETER_ID, string2pv);
    string2.setName("Test2");
    string2.setDescription("A two line test string");
    StringParameterType.setLines(string2, 2);
    params.addParameter(string2);
    final PluginParameter<PasswordParameterValue> passwd = PasswordParameterType.build(PASSWORD_PARAMETER_ID);
    passwd.setName("Password");
    passwd.setDescription("Everyone needs a password");
    params.addParameter(passwd);
    final PluginParameter<LocalDateParameterValue> date = LocalDateParameterType.build(LOCAL_DATE_PARAMETER_ID);
    date.setName("Date");
    date.setDescription("Pick a day");
    date.setLocalDateValue(LocalDate.of(2001, Month.JANUARY, 1));
    params.addParameter(date);
    final List<GraphElementTypeParameterValue> elementTypeOptions = new ArrayList<>();
    for (final GraphElementType elementType : GraphElementType.values()) {
        elementTypeOptions.add(new GraphElementTypeParameterValue(elementType));
    }
    final PluginParameter<SingleChoiceParameterValue> elementType = SingleChoiceParameterType.build(ELEMENT_TYPE_PARAMETER_ID, GraphElementTypeParameterValue.class);
    elementType.setName("Graph element type");
    elementType.setDescription("Graph element type");
    SingleChoiceParameterType.setOptionsData(elementType, elementTypeOptions);
    params.addParameter(elementType);
    // A single choice list with a subtype of String.
    final SingleChoiceParameterValue robotpv = new SingleChoiceParameterValue(StringParameterValue.class);
    robotpv.setGuiInit(control -> {
        // control will be of type ComboBox<ParameterValue> which extends from Region
        @SuppressWarnings("unchecked") final ComboBox<ParameterValue> field = (ComboBox<ParameterValue>) control;
        final Image img = new Image(ALIEN_ICON);
        field.setCellFactory((ListView<ParameterValue> param) -> new ListCell<ParameterValue>() {

            @Override
            protected void updateItem(final ParameterValue item, final boolean empty) {
                super.updateItem(item, empty);
                this.setText(empty ? "" : item.toString());
                final float f = empty ? 0 : item.toString().length() / 11F;
                final Color c = Color.color(1 - f / 2F, 0, 0);
                setTextFill(c);
                setGraphic(new ImageView(img));
            }
        });
    });
    final PluginParameter<SingleChoiceParameterValue> robotOptions = SingleChoiceParameterType.build(ROBOT_PARAMETER_ID, robotpv);
    robotOptions.setName("Robot options");
    robotOptions.setDescription("A list of robots to choose from");
    // Use the helper method to add string options.
    SingleChoiceParameterType.setOptions(robotOptions, Arrays.asList("Bender", "Gort", "Maximillian", "Robbie", "Tom Servo"));
    // Create a ParameterValue of the underlying type (in this case, String) to set the default choice.
    final StringParameterValue robotChoice = new StringParameterValue("Gort");
    SingleChoiceParameterType.setChoiceData(robotOptions, robotChoice);
    params.addParameter(robotOptions);
    final PluginParameter<ParameterValue> buttonParam = ActionParameterType.build(REFRESH_PARAMETER_ID);
    buttonParam.setName("Refresh");
    buttonParam.setDescription("Update the available robots");
    params.addParameter(buttonParam);
    final PluginParameter<MultiChoiceParameterValue> planetOptions = MultiChoiceParameterType.build(PLANETS_PARAMETER_ID);
    planetOptions.setName("Planets");
    planetOptions.setDescription("Some planets");
    MultiChoiceParameterType.setOptions(planetOptions, Arrays.asList("Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune", "Coruscant"));
    final List<String> checked = new ArrayList<>();
    checked.add("Earth");
    MultiChoiceParameterType.setChoices(planetOptions, checked);
    params.addParameter(planetOptions);
    final PluginParameter<IntegerParameterValue> diceOptions = IntegerParameterType.build(DICE_PARAMETER_ID);
    diceOptions.setName("Dice");
    diceOptions.setDescription("2d6");
    IntegerParameterType.setMinimum(diceOptions, 2);
    IntegerParameterType.setMaximum(diceOptions, 12);
    diceOptions.setIntegerValue(7);
    params.addParameter(diceOptions);
    final PluginParameter<FloatParameterValue> probability = FloatParameterType.build(PROBABILITY_PARAMETER_ID);
    probability.setName("Probability");
    probability.setDescription("0 <= p <= 1");
    FloatParameterType.setMinimum(probability, 0F);
    FloatParameterType.setMaximum(probability, 1F);
    FloatParameterType.setStep(probability, 0.1F);
    probability.setFloatValue(1F);
    params.addParameter(probability);
    final PluginParameter<FileParameterValue> openFileParam = FileParameterType.build(INPUT_FILE_PARAMETER_ID);
    openFileParam.setName("Input file");
    openFileParam.setDescription("A file to read stuff from");
    params.addParameter(openFileParam);
    final PluginParameter<FileParameterValue> saveFileParam = FileParameterType.build(OUTPUT_FILE_PARAMETER_ID);
    saveFileParam.setName("Output file");
    saveFileParam.setDescription("A file to write stuff to");
    FileParameterType.setKind(saveFileParam, FileParameterType.FileParameterKind.SAVE);
    FileParameterType.setFileFilters(saveFileParam, new FileChooser.ExtensionFilter("Text files", "*.txt"));
    params.addParameter(saveFileParam);
    final PluginParameter<ColorParameterValue> color = ColorParameterType.build(COLOR_PARAMETER_ID);
    color.setName("Color");
    color.setDescription("Your favourite colour");
    color.setColorValue(ConstellationColor.BLUE);
    params.addParameter(color);
    final PluginParameter<BooleanParameterValue> crash = BooleanParameterType.build(CRASH_PARAMETER_ID);
    crash.setName("Crash");
    crash.setDescription("Simulate plugin failure");
    params.addParameter(crash);
    final PluginParameter<SingleChoiceParameterValue> interactionOptions = SingleChoiceParameterType.build(INTERACTION_PARAMETER_ID);
    interactionOptions.setName("Interaction level");
    interactionOptions.setDescription("Interaction level for some interaction with the user");
    SingleChoiceParameterType.setOptions(interactionOptions, Arrays.asList(NONE, DEBUG, INFO, WARNING, ERROR, FATAL));
    params.addParameter(interactionOptions);
    final PluginParameter<SingleChoiceParameterValue> levelOptions = SingleChoiceParameterType.build(LEVEL_PARAMETER_ID);
    levelOptions.setName("PluginException level");
    levelOptions.setDescription("PluginException level to throw an exception at");
    levelOptions.setHelpID("not.actually.helpful");
    SingleChoiceParameterType.setOptions(levelOptions, Arrays.asList(NONE, DEBUG, INFO, WARNING, ERROR, FATAL));
    params.addParameter(levelOptions);
    final PluginParameter<IntegerParameterValue> sleepParam = IntegerParameterType.build(SLEEP_PARAMETER_ID);
    sleepParam.setName("Sleep");
    sleepParam.setDescription("Seconds");
    IntegerParameterType.setMinimum(sleepParam, 0);
    IntegerParameterType.setMaximum(sleepParam, 20);
    sleepParam.setIntegerValue(0);
    params.addParameter(sleepParam);
    params.addController(SELECTED_PARAMETER_ID, (final PluginParameter<?> master, final Map<String, PluginParameter<?>> parameters, final ParameterChange change) -> {
        if (change == ParameterChange.VALUE) {
            final boolean masterBoolean = master.getBooleanValue();
            // TEST1_PARAMETER will always be of type StringParameter
            @SuppressWarnings("unchecked") final PluginParameter<StringParameterValue> t1 = (PluginParameter<StringParameterValue>) parameters.get(TEST1_PARAMETER_ID);
            t1.setEnabled(masterBoolean);
            // TEST1_PARAMETER will always be of type StringParameter
            @SuppressWarnings("unchecked") final PluginParameter<StringParameterValue> t2 = (PluginParameter<StringParameterValue>) parameters.get(TEST2_PARAMETER_ID);
            t2.setEnabled(masterBoolean);
            // PLANETS_PARAMETER will always be of type MultiChoiceParameter
            @SuppressWarnings("unchecked") final PluginParameter<MultiChoiceParameterValue> p = (PluginParameter<MultiChoiceParameterValue>) parameters.get(PLANETS_PARAMETER_ID);
            p.setEnabled(masterBoolean);
            // DICE_PARAMETER will always be of type IntegerParameter
            @SuppressWarnings("unchecked") final PluginParameter<IntegerParameterValue> d = (PluginParameter<IntegerParameterValue>) parameters.get(DICE_PARAMETER_ID);
            d.setEnabled(masterBoolean);
            // COLOR_PARAMETER will always be of type ColorParameter
            @SuppressWarnings("unchecked") final PluginParameter<ColorParameterValue> c = (PluginParameter<ColorParameterValue>) parameters.get(COLOR_PARAMETER_ID);
            c.setVisible(masterBoolean);
        }
    });
    params.addController(REFRESH_PARAMETER_ID, (final PluginParameter<?> master, final Map<String, PluginParameter<?>> parameters, final ParameterChange change) -> {
        if (change == ParameterChange.NO_CHANGE) {
            // button pressed
            // ROBOT_PARAMETER will always be of type SingleChoiceParameter
            @SuppressWarnings("unchecked") final PluginParameter<SingleChoiceParameterValue> robot = (PluginParameter<SingleChoiceParameterValue>) parameters.get(ROBOT_PARAMETER_ID);
            final int n = (int) (System.currentTimeMillis() % 100);
            SingleChoiceParameterType.setOptions(robot, Arrays.asList("Kryton " + n, "C-3PO " + n, "R2-D2 " + n));
            SingleChoiceParameterType.setChoice(robot, "C-3PO " + n);
        }
    });
    return params;
}
Also used : TextArea(javafx.scene.control.TextArea) ArrayList(java.util.ArrayList) PasswordParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.PasswordParameterValue) Image(javafx.scene.image.Image) GraphElementType(au.gov.asd.tac.constellation.graph.GraphElementType) ListView(javafx.scene.control.ListView) BooleanParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.BooleanParameterType.BooleanParameterValue) FileChooser(javafx.stage.FileChooser) PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) ImageView(javafx.scene.image.ImageView) ParameterChange(au.gov.asd.tac.constellation.plugins.parameters.ParameterChange) MultiChoiceParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.MultiChoiceParameterType.MultiChoiceParameterValue) ColorParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.ColorParameterType.ColorParameterValue) LocalDateParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.LocalDateParameterType.LocalDateParameterValue) StringParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.StringParameterValue) BooleanParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.BooleanParameterType.BooleanParameterValue) ParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.ParameterValue) IntegerParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.IntegerParameterType.IntegerParameterValue) FloatParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.FloatParameterType.FloatParameterValue) PasswordParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.PasswordParameterValue) FileParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.FileParameterType.FileParameterValue) SingleChoiceParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.SingleChoiceParameterType.SingleChoiceParameterValue) DateTimeRangeParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.DateTimeRangeParameterType.DateTimeRangeParameterValue) ComboBox(javafx.scene.control.ComboBox) Color(javafx.scene.paint.Color) ConstellationColor(au.gov.asd.tac.constellation.utilities.color.ConstellationColor) ColorParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.ColorParameterType.ColorParameterValue) CheckBox(javafx.scene.control.CheckBox) Map(java.util.Map) SingleChoiceParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.SingleChoiceParameterType.SingleChoiceParameterValue) MultiChoiceParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.MultiChoiceParameterType.MultiChoiceParameterValue) StringParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.StringParameterValue) DateTimeRangeParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.DateTimeRangeParameterType.DateTimeRangeParameterValue) IntegerParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.IntegerParameterType.IntegerParameterValue) PluginParameter(au.gov.asd.tac.constellation.plugins.parameters.PluginParameter) LocalDateParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.LocalDateParameterType.LocalDateParameterValue) FloatParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.FloatParameterType.FloatParameterValue) FileParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.FileParameterType.FileParameterValue)

Example 3 with ColorParameterValue

use of au.gov.asd.tac.constellation.plugins.parameters.types.ColorParameterType.ColorParameterValue in project constellation by constellation-app.

the class AddCustomBlazePlugin method createParameters.

@Override
public PluginParameters createParameters() {
    final PluginParameters parameters = new PluginParameters();
    final PluginParameter<IntegerParameterValue> vertexIdParam = IntegerParameterType.build(VERTEX_ID_PARAMETER_ID);
    vertexIdParam.setName("Vertex Id");
    vertexIdParam.setDescription("The vertex id to add a colour blaze");
    vertexIdParam.setIntegerValue(Graph.NOT_FOUND);
    parameters.addParameter(vertexIdParam);
    final PluginParameter<ObjectParameterValue> vertexIdsParam = ObjectParameterType.build(VERTEX_IDS_PARAMETER_ID);
    vertexIdsParam.setName("Vertex Ids");
    vertexIdsParam.setDescription("The list of vertex ids to add a colour blaze (in bulk)");
    vertexIdsParam.setObjectValue(null);
    parameters.addParameter(vertexIdsParam);
    final PluginParameter<ColorParameterValue> colorParam = ColorParameterType.build(COLOR_PARAMETER_ID);
    colorParam.setName("Color");
    colorParam.setDescription("The colour value");
    parameters.addParameter(colorParam);
    return parameters;
}
Also used : IntegerParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.IntegerParameterType.IntegerParameterValue) ColorParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.ColorParameterType.ColorParameterValue) PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) ObjectParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.ObjectParameterType.ObjectParameterValue)

Example 4 with ColorParameterValue

use of au.gov.asd.tac.constellation.plugins.parameters.types.ColorParameterType.ColorParameterValue in project constellation by constellation-app.

the class BlazeUtilities method colorDialog.

/**
 * Display a dialog box to select a color. Option to save color as a preset
 * is represented by a checkbox. The preset will be saved in the first
 * instance of a free position, otherwise the last index of the presets will
 * be used and overridden.
 *
 * @param blazeColor The initial value of the color.
 *
 * @return a pair containing 1) if the user pressed OK and 2) the selected
 * blaze color.
 */
public static Pair<Boolean, ConstellationColor> colorDialog(final ConstellationColor blazeColor) {
    final PluginParameters dlgParams = new PluginParameters();
    final PluginParameter<ColorParameterValue> colorParam = ColorParameterType.build(COLOR_PARAMETER_ID);
    colorParam.setName("Color");
    colorParam.setDescription(BLAZE_COLOR_PARAMETER_ID);
    dlgParams.addParameter(colorParam);
    final PluginParameter<BooleanParameterValue> presetParam = BooleanParameterType.build(PRESET_PARAMETER_ID);
    presetParam.setName("Preset");
    presetParam.setDescription("Save as Preset");
    presetParam.setBooleanValue(false);
    dlgParams.addParameter(presetParam);
    final PluginParametersSwingDialog dialog = new PluginParametersSwingDialog(BLAZE_COLOR_PARAMETER_ID, dlgParams);
    dialog.showAndWait();
    final boolean isOk = PluginParametersDialog.OK.equals(dialog.getResult());
    ConstellationColor colorResult = blazeColor;
    if (isOk) {
        colorResult = dlgParams.getColorValue(COLOR_PARAMETER_ID);
        if (dlgParams.getBooleanValue(PRESET_PARAMETER_ID)) {
            savePreset(colorResult.getJavaColor());
        }
    }
    return new Pair<>(isOk, colorResult);
}
Also used : ConstellationColor(au.gov.asd.tac.constellation.utilities.color.ConstellationColor) PluginParametersSwingDialog(au.gov.asd.tac.constellation.plugins.gui.PluginParametersSwingDialog) BooleanParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.BooleanParameterType.BooleanParameterValue) ColorParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.ColorParameterType.ColorParameterValue) PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) Pair(javafx.util.Pair)

Example 5 with ColorParameterValue

use of au.gov.asd.tac.constellation.plugins.parameters.types.ColorParameterType.ColorParameterValue in project constellation by constellation-app.

the class CompareGraphPlugin method createParameters.

@Override
public PluginParameters createParameters() {
    final PluginParameters parameters = new PluginParameters();
    final PluginParameter<SingleChoiceParameterValue> originalGraph = SingleChoiceParameterType.build(ORIGINAL_GRAPH_PARAMETER_ID);
    originalGraph.setName("Original Graph");
    originalGraph.setDescription("The graph used as the starting point for the comparison");
    parameters.addParameter(originalGraph);
    // Controller listens for value change so that the compare graph cannot be compared against itself
    parameters.addController(ORIGINAL_GRAPH_PARAMETER_ID, (PluginParameter<?> master, Map<String, PluginParameter<?>> params, ParameterChange change) -> {
        // When value has changed, remove choice from the comparison graph dialog
        if (change == ParameterChange.VALUE) {
            final String originalGraphName = params.get(ORIGINAL_GRAPH_PARAMETER_ID).getStringValue();
            if (originalGraphName != null) {
                final List<String> graphNames = new ArrayList<>();
                final Map<String, Graph> allGraphs = GraphNode.getAllGraphs();
                if (allGraphs != null) {
                    for (final String graphId : allGraphs.keySet()) {
                        graphNames.add(GraphNode.getGraphNode(graphId).getDisplayName());
                    }
                }
                // remove the current original graph selection from the list of graphs allowed to compare with
                graphNames.remove(originalGraphName);
                // sort drop down list
                graphNames.sort(String::compareTo);
                // COMPARE_GRAPH_PARAMETER_ID will always be of type SingleChoiceParameterValue
                @SuppressWarnings("unchecked") final PluginParameter<SingleChoiceParameterValue> compareParamter = (PluginParameter<SingleChoiceParameterValue>) params.get(COMPARE_GRAPH_PARAMETER_ID);
                SingleChoiceParameterType.setOptions(compareParamter, graphNames);
            }
        }
    });
    final PluginParameter<SingleChoiceParameterValue> compareGraph = SingleChoiceParameterType.build(COMPARE_GRAPH_PARAMETER_ID);
    compareGraph.setName("Compare With Graph");
    compareGraph.setDescription("The graph used to compare against the original graph");
    parameters.addParameter(compareGraph);
    final PluginParameter<MultiChoiceParameterValue> ignoreVertexAttributes = MultiChoiceParameterType.build(IGNORE_VERTEX_ATTRIBUTES_PARAMETER_ID);
    ignoreVertexAttributes.setName("Ignore Node Attributes");
    ignoreVertexAttributes.setDescription("Ignore these attributes when comparing nodes");
    parameters.addParameter(ignoreVertexAttributes);
    final PluginParameter<MultiChoiceParameterValue> ignoreTransactionAttributes = MultiChoiceParameterType.build(IGNORE_TRANSACTION_ATTRIBUTES_PARAMETER_ID);
    ignoreTransactionAttributes.setName("Ignore Transaction Attributes");
    ignoreTransactionAttributes.setDescription("Ignore these attributes when comparing transactions");
    parameters.addParameter(ignoreTransactionAttributes);
    final PluginParameter<ColorParameterValue> addedColour = ColorParameterType.build(ADDED_COLOUR_PARAMETER_ID);
    addedColour.setName("Added Color");
    addedColour.setDescription("The colour to indicate a node/transaction addition");
    addedColour.setColorValue(ConstellationColor.GREEN);
    parameters.addParameter(addedColour);
    final PluginParameter<ColorParameterValue> removedColour = ColorParameterType.build(REMOVED_COLOUR_PARAMETER_ID);
    removedColour.setName("Removed Color");
    removedColour.setDescription("The colour to indicate a node/transaction removal");
    removedColour.setColorValue(ConstellationColor.RED);
    parameters.addParameter(removedColour);
    final PluginParameter<ColorParameterValue> changedColour = ColorParameterType.build(CHANGED_COLOUR_PARAMETER_ID);
    changedColour.setName("Changed Color");
    changedColour.setDescription("The colour to indicate a node/transaction change");
    changedColour.setColorValue(ConstellationColor.YELLOW);
    parameters.addParameter(changedColour);
    final PluginParameter<ColorParameterValue> unchangedColour = ColorParameterType.build(UNCHANGED_COLOUR_PARAMETER_ID);
    unchangedColour.setName("Unchanged Color");
    unchangedColour.setDescription("The colour to indicate no node/transaction change");
    unchangedColour.setColorValue(ConstellationColor.GREY);
    parameters.addParameter(unchangedColour);
    return parameters;
}
Also used : ParameterChange(au.gov.asd.tac.constellation.plugins.parameters.ParameterChange) MultiChoiceParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.MultiChoiceParameterType.MultiChoiceParameterValue) ArrayList(java.util.ArrayList) ColorParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.ColorParameterType.ColorParameterValue) WritableGraph(au.gov.asd.tac.constellation.graph.WritableGraph) ReadableGraph(au.gov.asd.tac.constellation.graph.ReadableGraph) Graph(au.gov.asd.tac.constellation.graph.Graph) PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) PluginParameter(au.gov.asd.tac.constellation.plugins.parameters.PluginParameter) HashMap(java.util.HashMap) Map(java.util.Map) SingleChoiceParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.SingleChoiceParameterType.SingleChoiceParameterValue)

Aggregations

PluginParameters (au.gov.asd.tac.constellation.plugins.parameters.PluginParameters)6 ColorParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.ColorParameterType.ColorParameterValue)6 BooleanParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.BooleanParameterType.BooleanParameterValue)3 ConstellationColor (au.gov.asd.tac.constellation.utilities.color.ConstellationColor)3 PluginParametersSwingDialog (au.gov.asd.tac.constellation.plugins.gui.PluginParametersSwingDialog)2 ParameterChange (au.gov.asd.tac.constellation.plugins.parameters.ParameterChange)2 PluginParameter (au.gov.asd.tac.constellation.plugins.parameters.PluginParameter)2 FileParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.FileParameterType.FileParameterValue)2 IntegerParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.IntegerParameterType.IntegerParameterValue)2 MultiChoiceParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.MultiChoiceParameterType.MultiChoiceParameterValue)2 SingleChoiceParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.SingleChoiceParameterType.SingleChoiceParameterValue)2 StringParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.StringParameterValue)2 ArrayList (java.util.ArrayList)2 Map (java.util.Map)2 Graph (au.gov.asd.tac.constellation.graph.Graph)1 GraphElementType (au.gov.asd.tac.constellation.graph.GraphElementType)1 ReadableGraph (au.gov.asd.tac.constellation.graph.ReadableGraph)1 WritableGraph (au.gov.asd.tac.constellation.graph.WritableGraph)1 DateTimeRangeParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.DateTimeRangeParameterType.DateTimeRangeParameterValue)1 FloatParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.FloatParameterType.FloatParameterValue)1