Search in sources :

Example 51 with BooleanParameterValue

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

the class ArrangeInBubbleTreePlugin method createParameters.

@Override
public PluginParameters createParameters() {
    final PluginParameters parameters = new PluginParameters();
    final PluginParameter<ObjectParameterValue> roots = ObjectParameterType.build(ROOTS_PARAMETER_ID);
    roots.setName("Roots");
    roots.setDescription("A set of root vertex ids");
    parameters.addParameter(roots);
    final PluginParameter<BooleanParameterValue> isMinimal = BooleanParameterType.build(IS_MINIMAL_PARAMETER_ID);
    isMinimal.setName("Is Minimal");
    isMinimal.setDescription("True for a minimal spanning tree, False for a maximal spanning tree");
    parameters.addParameter(isMinimal);
    return parameters;
}
Also used : BooleanParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.BooleanParameterType.BooleanParameterValue) PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) ObjectParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.ObjectParameterType.ObjectParameterValue)

Example 52 with BooleanParameterValue

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

the class UncollidePlugin method createParameters.

@Override
public PluginParameters createParameters() {
    final PluginParameters parameters = new PluginParameters();
    final PluginParameter<IntegerParameterValue> dimensionsParam = IntegerParameterType.build(DIMENSION_PARAMETER_ID);
    dimensionsParam.setName("Dimensions");
    dimensionsParam.setDescription("The dimention being 2D or 3D. The default is 2 for 2D.");
    dimensionsParam.setIntegerValue(2);
    parameters.addParameter(dimensionsParam);
    final PluginParameter<BooleanParameterValue> set2Param = BooleanParameterType.build(SET_XYZ2_PARAMETER_ID);
    set2Param.setName("Set XYZ 2");
    set2Param.setDescription("If True, set X2, Y2, Z2. The default is False.");
    set2Param.setBooleanValue(false);
    parameters.addParameter(set2Param);
    return parameters;
}
Also used : BooleanParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.BooleanParameterType.BooleanParameterValue) IntegerParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.IntegerParameterType.IntegerParameterValue) PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters)

Example 53 with BooleanParameterValue

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

the class ExtractWordsFromTextPlugin method createParameters.

@Override
public PluginParameters createParameters() {
    final PluginParameters params = new PluginParameters();
    final PluginParameter<SingleChoiceParameterValue> attributeType = SingleChoiceParameterType.build(ATTRIBUTE_PARAMETER_ID);
    attributeType.setName("Content Attribute");
    attributeType.setDescription("Set the attribute from which to extract words");
    params.addParameter(attributeType);
    final PluginParameter<StringParameterValue> text = StringParameterType.build(WORDS_PARAMETER_ID);
    StringParameterType.setLines(text, 15);
    text.setName("Words to Extract");
    text.setDescription("Whitelist of words to extract from content (new line delimited, extract all words if empty)");
    text.setStringValue(null);
    params.addParameter(text);
    final PluginParameter<BooleanParameterValue> useRegex = BooleanParameterType.build(USE_REGEX_PARAMETER_ID);
    useRegex.setName("Use Regular Expressions");
    useRegex.setDescription("Words to Extract will be treated as regex patterns");
    useRegex.setBooleanValue(false);
    useRegex.setEnabled(false);
    params.addParameter(useRegex);
    final PluginParameter<BooleanParameterValue> wholeWordsOnly = BooleanParameterType.build(WHOLE_WORDS_ONLY_PARAMETER_ID);
    wholeWordsOnly.setName("Whole Words Only");
    wholeWordsOnly.setDescription("Words to Extract will be treated as whole words only");
    wholeWordsOnly.setBooleanValue(false);
    wholeWordsOnly.setEnabled(false);
    params.addParameter(wholeWordsOnly);
    final PluginParameter<IntegerParameterValue> minWordLength = IntegerParameterType.build(MIN_WORD_LENGTH_PARAMETER_ID);
    minWordLength.setName("Minimum Word Length");
    minWordLength.setDescription("Only extract words of length equal to or greater than this");
    minWordLength.setIntegerValue(3);
    IntegerParameterType.setMinimum(minWordLength, 1);
    params.addParameter(minWordLength);
    final PluginParameter<BooleanParameterValue> removeSpecialChars = BooleanParameterType.build(REMOVE_SPECIAL_CHARS_PARAMETER_ID);
    removeSpecialChars.setName("Remove Special Characters");
    removeSpecialChars.setDescription("Removes special characters from words before extraction");
    removeSpecialChars.setBooleanValue(true);
    params.addParameter(removeSpecialChars);
    final PluginParameter<BooleanParameterValue> caseInsensitive = BooleanParameterType.build(LOWER_CASE_PARAMETER_ID);
    caseInsensitive.setName("Lower Case");
    caseInsensitive.setDescription("Results are lower-cased");
    caseInsensitive.setBooleanValue(true);
    params.addParameter(caseInsensitive);
    final PluginParameter<BooleanParameterValue> types = BooleanParameterType.build(SCHEMA_TYPES_PARAMETER_ID);
    types.setName("Extract Schema Types");
    types.setDescription("Extract schema types");
    types.setBooleanValue(true);
    params.addParameter(types);
    final PluginParameter<SingleChoiceParameterValue> inOrOutParam = SingleChoiceParameterType.build(IN_OR_OUT_PARAMETER_ID);
    inOrOutParam.setName("Transactions");
    inOrOutParam.setDescription("Link nodes to outgoing or incoming words: 'outgoing' or 'incoming'");
    SingleChoiceParameterType.setOptions(inOrOutParam, List.of(OUTGOING, INCOMING));
    inOrOutParam.setStringValue(OUTGOING);
    params.addParameter(inOrOutParam);
    final PluginParameter<BooleanParameterValue> selected = BooleanParameterType.build(SELECTED_ONLY_PARAMETER_ID);
    selected.setName("Selected Transactions Only");
    selected.setDescription("Only extract words from selected transactions only");
    selected.setBooleanValue(false);
    params.addParameter(selected);
    final PluginParameter<BooleanParameterValue> regexOnlyParam = BooleanParameterType.build(REGEX_ONLY_PARAMETER_ID);
    regexOnlyParam.setName("Regular Expression Only");
    regexOnlyParam.setDescription("The regexes control everything");
    regexOnlyParam.setBooleanValue(false);
    params.addParameter(regexOnlyParam);
    params.addController(WORDS_PARAMETER_ID, (master, parameters, change) -> {
        if (change == ParameterChange.VALUE) {
            final String words = master.getStringValue();
            if (StringUtils.isBlank(words)) {
                parameters.get(USE_REGEX_PARAMETER_ID).setEnabled(false);
                parameters.get(WHOLE_WORDS_ONLY_PARAMETER_ID).setEnabled(false);
                parameters.get(MIN_WORD_LENGTH_PARAMETER_ID).setEnabled(true);
                parameters.get(REMOVE_SPECIAL_CHARS_PARAMETER_ID).setEnabled(true);
            } else {
                parameters.get(USE_REGEX_PARAMETER_ID).setEnabled(true);
                parameters.get(WHOLE_WORDS_ONLY_PARAMETER_ID).setEnabled(true);
                parameters.get(MIN_WORD_LENGTH_PARAMETER_ID).setEnabled(false);
                parameters.get(REMOVE_SPECIAL_CHARS_PARAMETER_ID).setEnabled(false);
            }
        }
    });
    // How well does this interact with the controller above?
    // 
    params.addController(REGEX_ONLY_PARAMETER_ID, (master, parameters, change) -> {
        if (change == ParameterChange.VALUE) {
            final boolean regexOnly = master.getBooleanValue();
            parameters.get(USE_REGEX_PARAMETER_ID).setEnabled(!regexOnly);
            parameters.get(WHOLE_WORDS_ONLY_PARAMETER_ID).setEnabled(!regexOnly);
            parameters.get(MIN_WORD_LENGTH_PARAMETER_ID).setEnabled(!regexOnly);
            parameters.get(REMOVE_SPECIAL_CHARS_PARAMETER_ID).setEnabled(!regexOnly);
            parameters.get(SCHEMA_TYPES_PARAMETER_ID).setEnabled(!regexOnly);
            if (!regexOnly) {
                // If the checkbox is being unchecked, trigger a WORDS_PARAMETER_ID
                // change to set the GUI state.
                // 
                parameters.get(WORDS_PARAMETER_ID).fireChangeEvent(ParameterChange.VALUE);
            }
        }
    });
    return params;
}
Also used : BooleanParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.BooleanParameterType.BooleanParameterValue) IntegerParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.IntegerParameterType.IntegerParameterValue) StringParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.StringParameterValue) PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) SingleChoiceParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.SingleChoiceParameterType.SingleChoiceParameterValue)

Example 54 with BooleanParameterValue

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

the class MergeTransactionsPlugin method createParameters.

@Override
public PluginParameters createParameters() {
    PluginParameters params = new PluginParameters();
    final PluginParameter<SingleChoiceParameterValue> mergeType = SingleChoiceParameterType.build(MERGE_TYPE_PARAMETER_ID);
    mergeType.setName("Merge By");
    mergeType.setDescription("Transactions will be merged based on this");
    List<String> mergeTypes = new ArrayList<>(MERGE_TYPES.keySet());
    SingleChoiceParameterType.setOptions(mergeType, mergeTypes);
    params.addParameter(mergeType);
    final PluginParameter<IntegerParameterValue> threshold = IntegerParameterType.build(THRESHOLD_PARAMETER_ID);
    threshold.setName("Threshold");
    threshold.setIntegerValue(0);
    IntegerParameterType.setMinimum(threshold, 0);
    threshold.setEnabled(false);
    params.addParameter(threshold);
    final PluginParameter<SingleChoiceParameterValue> mergingRule = SingleChoiceParameterType.build(MERGER_PARAMETER_ID);
    mergingRule.setName("Merging Rule");
    mergingRule.setDescription("The rule deciding how attributes are merged");
    List<String> mergerNames = new ArrayList<>(MERGERS.keySet());
    SingleChoiceParameterType.setOptions(mergingRule, mergerNames);
    SingleChoiceParameterType.setChoice(mergingRule, mergerNames.get(0));
    mergingRule.setEnabled(false);
    params.addParameter(mergingRule);
    final PluginParameter<SingleChoiceParameterValue> leadParam = SingleChoiceParameterType.build(LEAD_PARAMETER_ID);
    leadParam.setName("Lead Transaction");
    leadParam.setDescription("The rule deciding how to choose the lead transaction");
    List<String> leadTransactionChooserNames = new ArrayList<>(LEAD_TRANSACTION_CHOOSERS.keySet());
    SingleChoiceParameterType.setOptions(leadParam, leadTransactionChooserNames);
    SingleChoiceParameterType.setChoice(leadParam, leadTransactionChooserNames.get(0));
    leadParam.setEnabled(false);
    params.addParameter(leadParam);
    final PluginParameter<BooleanParameterValue> selectedParam = BooleanParameterType.build(SELECTED_PARAMETER_ID);
    selectedParam.setName("Selected Only");
    selectedParam.setDescription("Merge Only Selected Transactions");
    selectedParam.setBooleanValue(false);
    selectedParam.setEnabled(false);
    params.addParameter(selectedParam);
    params.addController(MERGE_TYPE_PARAMETER_ID, (final PluginParameter<?> master, final Map<String, PluginParameter<?>> parameters, final ParameterChange change) -> {
        if (change == ParameterChange.VALUE) {
            final String selectedMergeType = parameters.get(MERGE_TYPE_PARAMETER_ID).getStringValue();
            if (MERGE_TYPES.containsKey(selectedMergeType)) {
                final MergeTransactionType mergeTransactionTypeSelected = MERGE_TYPES.get(selectedMergeType);
                mergeTransactionTypeSelected.updateParameters(parameters);
            }
        }
    });
    return params;
}
Also used : ParameterChange(au.gov.asd.tac.constellation.plugins.parameters.ParameterChange) ArrayList(java.util.ArrayList) BooleanParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.BooleanParameterType.BooleanParameterValue) IntegerParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.IntegerParameterType.IntegerParameterValue) PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) PluginParameter(au.gov.asd.tac.constellation.plugins.parameters.PluginParameter) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) SingleChoiceParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.SingleChoiceParameterType.SingleChoiceParameterValue)

Example 55 with BooleanParameterValue

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

the class ScriptingExecutePlugin method createParameters.

@Override
public PluginParameters createParameters() {
    final PluginParameters parameters = new PluginParameters();
    final PluginParameter<StringParameterValue> scriptParam = StringParameterType.build(SCRIPT_PARAMETER_ID);
    scriptParam.setName("Script Text");
    scriptParam.setDescription("The text of the Python script");
    parameters.addParameter(scriptParam);
    final PluginParameter<BooleanParameterValue> showOutputParam = BooleanParameterType.build(NEW_OUTPUT_PARAMETER_ID);
    showOutputParam.setName("New Output");
    showOutputParam.setDescription("Show script output in output window");
    showOutputParam.setBooleanValue(false);
    parameters.addParameter(showOutputParam);
    final PluginParameter<StringParameterValue> nameParam = StringParameterType.build(GRAPH_NAME_PARAMETER_ID);
    nameParam.setName("Graph Name");
    nameParam.setDescription("The name of the graph");
    nameParam.setStringValue("");
    parameters.addParameter(nameParam);
    final PluginParameter<ObjectParameterValue> exceptionParam = ObjectParameterType.build(OUTPUT_EXCEPTION_PARAMETER_ID);
    exceptionParam.setName("Script Exception");
    exceptionParam.setDescription("If there is an exception when the script runs, this will hold a reference to the exception object");
    exceptionParam.setObjectValue(null);
    parameters.addParameter(exceptionParam);
    return parameters;
}
Also used : BooleanParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.BooleanParameterType.BooleanParameterValue) StringParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.StringParameterValue) PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) ObjectParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.ObjectParameterType.ObjectParameterValue)

Aggregations

BooleanParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.BooleanParameterType.BooleanParameterValue)65 PluginParameters (au.gov.asd.tac.constellation.plugins.parameters.PluginParameters)56 IntegerParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.IntegerParameterType.IntegerParameterValue)27 SingleChoiceParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.SingleChoiceParameterType.SingleChoiceParameterValue)14 StringParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.StringParameterValue)13 Test (org.testng.annotations.Test)11 FloatParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.FloatParameterType.FloatParameterValue)9 PluginParameter (au.gov.asd.tac.constellation.plugins.parameters.PluginParameter)7 ArrayList (java.util.ArrayList)7 MultiChoiceParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.MultiChoiceParameterType.MultiChoiceParameterValue)5 ObjectParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.ObjectParameterType.ObjectParameterValue)5 ParameterChange (au.gov.asd.tac.constellation.plugins.parameters.ParameterChange)4 Map (java.util.Map)4 ColorParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.ColorParameterType.ColorParameterValue)3 FileParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.FileParameterType.FileParameterValue)3 Graph (au.gov.asd.tac.constellation.graph.Graph)2 GraphElementType (au.gov.asd.tac.constellation.graph.GraphElementType)2 ParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.ParameterValue)2 ConstellationColor (au.gov.asd.tac.constellation.utilities.color.ConstellationColor)2 GraphAttribute (au.gov.asd.tac.constellation.graph.GraphAttribute)1