Search in sources :

Example 26 with StringParameterValue

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

the class ExtractTypesFromTextPlugin method createParameters.

@Override
public PluginParameters createParameters() {
    final PluginParameters params = new PluginParameters();
    final PluginParameter<StringParameterValue> text = StringParameterType.build(TEXT_PARAMETER_ID);
    StringParameterType.setLines(text, 15);
    text.setName("Text");
    text.setDescription("Text to extract from");
    text.setStringValue(null);
    params.addParameter(text);
    return params;
}
Also used : StringParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.StringParameterValue) PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters)

Example 27 with StringParameterValue

use of au.gov.asd.tac.constellation.plugins.parameters.types.StringParameterValue 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 28 with StringParameterValue

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

the class OpenInBrowserPlugin method createParameters.

@Override
public PluginParameters createParameters() {
    final PluginParameters parameters = new PluginParameters();
    final PluginParameter<StringParameterValue> applicationParameter = StringParameterType.build(APPLICATION_PARAMETER_ID);
    applicationParameter.setName("Application");
    applicationParameter.setDescription("The name of the application being opened (optional)");
    parameters.addParameter(applicationParameter);
    final PluginParameter<StringParameterValue> urlParameter = StringParameterType.build(URL_PARAMETER_ID);
    urlParameter.setName("URL");
    urlParameter.setDescription("The url to open in the browser");
    parameters.addParameter(urlParameter);
    return parameters;
}
Also used : StringParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.StringParameterValue) PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters)

Example 29 with StringParameterValue

use of au.gov.asd.tac.constellation.plugins.parameters.types.StringParameterValue 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)

Example 30 with StringParameterValue

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

the class ResetViewPlugin method createParameters.

@Override
public PluginParameters createParameters() {
    final PluginParameters parameters = new PluginParameters();
    final PluginParameter<StringParameterValue> axisParam = StringParameterType.build(AXIS_PARAMETER_ID);
    axisParam.setName("Axis");
    axisParam.setDescription("The x,y or z axis to focus on");
    axisParam.setStringValue("z");
    parameters.addParameter(axisParam);
    final PluginParameter<BooleanParameterValue> negativeParam = BooleanParameterType.build(NEGATIVE_PARAMETER_ID);
    negativeParam.setName("Negative");
    negativeParam.setDescription("True to reverse direction, default is False");
    negativeParam.setBooleanValue(false);
    parameters.addParameter(negativeParam);
    final PluginParameter<BooleanParameterValue> significantParam = BooleanParameterType.build(SIGNIFICANT_PARAMETER_ID);
    significantParam.setName("Significant");
    significantParam.setDescription("Significant animations will make significant edits on the graph, meaning that their results can be undone/redone atomically. Default is False.");
    significantParam.setBooleanValue(false);
    parameters.addParameter(significantParam);
    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)

Aggregations

PluginParameters (au.gov.asd.tac.constellation.plugins.parameters.PluginParameters)50 StringParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.StringParameterValue)50 BooleanParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.BooleanParameterType.BooleanParameterValue)13 SingleChoiceParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.SingleChoiceParameterType.SingleChoiceParameterValue)9 PluginParameter (au.gov.asd.tac.constellation.plugins.parameters.PluginParameter)6 ObjectParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.ObjectParameterType.ObjectParameterValue)5 ArrayList (java.util.ArrayList)5 Map (java.util.Map)5 ParameterChange (au.gov.asd.tac.constellation.plugins.parameters.ParameterChange)3 IntegerParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.IntegerParameterType.IntegerParameterValue)3 Graph (au.gov.asd.tac.constellation.graph.Graph)2 ColorParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.ColorParameterType.ColorParameterValue)2 NbPreferences (org.openide.util.NbPreferences)2 GraphElementType (au.gov.asd.tac.constellation.graph.GraphElementType)1 GraphReadMethods (au.gov.asd.tac.constellation.graph.GraphReadMethods)1 GraphWriteMethods (au.gov.asd.tac.constellation.graph.GraphWriteMethods)1 ReadableGraph (au.gov.asd.tac.constellation.graph.ReadableGraph)1 StoreGraph (au.gov.asd.tac.constellation.graph.StoreGraph)1 GraphDataObject (au.gov.asd.tac.constellation.graph.file.GraphDataObject)1 GraphObjectUtilities (au.gov.asd.tac.constellation.graph.file.GraphObjectUtilities)1