Search in sources :

Example 1 with SingleChoiceParameterValue

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

the class DirectedShortestPathsPlugin method createParameters.

@Override
public PluginParameters createParameters() {
    final PluginParameters params = new PluginParameters();
    final PluginParameter<SingleChoiceParameterValue> sourceNode = SingleChoiceParameterType.build(SOURCE_NODE_PARAMETER_ID);
    sourceNode.setName("Source Node");
    sourceNode.setDescription("The source node is used to dictate the direction");
    params.addParameter(sourceNode);
    return params;
}
Also used : PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) SingleChoiceParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.SingleChoiceParameterType.SingleChoiceParameterValue)

Example 2 with SingleChoiceParameterValue

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

the class DirectedShortestPathsPluginNGTest method testUpdateParametersNullGraph.

/**
 * Test of updateParameters method, of class DirectedShortestPathsPlugin. Null Graph
 */
@Test
public void testUpdateParametersNullGraph() {
    System.out.println("updateParametersNullGraph");
    final DirectedShortestPathsPlugin instance = new DirectedShortestPathsPlugin();
    final PluginParameters params = instance.createParameters();
    final PluginParameter<SingleChoiceParameterValue> sourceNode = (PluginParameter<SingleChoiceParameterValue>) params.getParameters().get(SOURCE_NODE_PARAMETER_ID);
    assertTrue(SingleChoiceParameterType.getOptions(sourceNode).isEmpty());
    instance.updateParameters(null, params);
    assertTrue(SingleChoiceParameterType.getOptions(sourceNode).isEmpty());
}
Also used : PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) PluginParameter(au.gov.asd.tac.constellation.plugins.parameters.PluginParameter) SingleChoiceParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.SingleChoiceParameterType.SingleChoiceParameterValue) Test(org.testng.annotations.Test)

Example 3 with SingleChoiceParameterValue

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

the class ArrangeInGridGeneralPlugin method createParameters.

@Override
public PluginParameters createParameters() {
    final PluginParameters parameters = new PluginParameters();
    // Use the GridChoiceParameters defaults to set the plugin defaults.
    final GridChoiceParameters defaults = GridChoiceParameters.getDefaultParameters();
    final PluginParameter<SingleChoiceParameterValue> gridChoiceParam = SingleChoiceParameterType.build(GRID_CHOICE_PARAMETER_ID);
    gridChoiceParam.setName("Grid choice");
    gridChoiceParam.setDescription("The type of grid arrangement");
    SingleChoiceParameterType.setOptions(gridChoiceParam, GridChoice.getChoices());
    SingleChoiceParameterType.setChoice(gridChoiceParam, defaults.getGridChoice().toString());
    parameters.addParameter(gridChoiceParam);
    final PluginParameter<FloatParameterValue> sizeGainParam = FloatParameterType.build(SIZE_GAIN_PARAMETER_ID);
    sizeGainParam.setName("Size gain");
    sizeGainParam.setDescription("The size gain, the default is " + defaults.getSizeGain());
    sizeGainParam.setFloatValue(defaults.getSizeGain());
    parameters.addParameter(sizeGainParam);
    final PluginParameter<IntegerParameterValue> horizontalGapParam = IntegerParameterType.build(HORIZONTAL_GAP_PARAMETER_ID);
    horizontalGapParam.setName("Horizontal gap");
    horizontalGapParam.setDescription("The horizontal gap, the default is " + defaults.getHorizontalGap());
    horizontalGapParam.setIntegerValue(defaults.getHorizontalGap());
    parameters.addParameter(horizontalGapParam);
    final PluginParameter<IntegerParameterValue> verticalGapParam = IntegerParameterType.build(VERTICAL_GAP_PARAMETER_ID);
    verticalGapParam.setName("Vertical gap");
    verticalGapParam.setDescription("The verticle gap, the default is " + defaults.getVerticalGap());
    verticalGapParam.setIntegerValue(defaults.getVerticalGap());
    parameters.addParameter(verticalGapParam);
    final PluginParameter<BooleanParameterValue> offsetRowsParam = BooleanParameterType.build(OFFSET_ROWS_PARAMETER_ID);
    offsetRowsParam.setName("Offset even numbered rows");
    offsetRowsParam.setDescription("Offset even numbered rows, the default is " + defaults.hasRowOffsets());
    offsetRowsParam.setBooleanValue(defaults.hasRowOffsets());
    parameters.addParameter(offsetRowsParam);
    final PluginParameter<BooleanParameterValue> maintainMeanParam = BooleanParameterType.build(MAINTAIN_MEAN_PARAMETER_ID);
    maintainMeanParam.setName("Maintain Mean");
    maintainMeanParam.setDescription("Maintain Mean, default is True");
    maintainMeanParam.setBooleanValue(true);
    parameters.addParameter(maintainMeanParam);
    return parameters;
}
Also used : FloatParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.FloatParameterType.FloatParameterValue) 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) SingleChoiceParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.SingleChoiceParameterType.SingleChoiceParameterValue)

Example 4 with SingleChoiceParameterValue

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

the class LayerByTimePlugin method createParameters.

@Override
public PluginParameters createParameters() {
    final PluginParameters parameters = new PluginParameters();
    dtAttrParam = SingleChoiceParameterType.build(DATETIME_ATTRIBUTE_PARAMETER_ID);
    dtAttrParam.setName(DATETIME_PARAMETER_ID_NAME);
    dtAttrParam.setDescription(DATETIME_ATTRIBUTE_PARAMETER_ID_DESCRIPTION);
    parameters.addParameter(dtAttrParam);
    dateRangeParam = DateTimeRangeParameterType.build(DATE_RANGE_PARAMETER_ID);
    dateRangeParam.setName(DATE_RANGE_PARAMETER_ID_NAME);
    dateRangeParam.setDescription(DATE_RANGE_PARAM_DESCRIPTION);
    dateRangeParam.setDateTimeRangeValue(DATE_RANGE_PARAMETER_ID_DEFAULT);
    parameters.addParameter(dateRangeParam);
    final PluginParameter<SingleChoiceParameterValue> layerByParam = SingleChoiceParameterType.build(LAYER_BY_PARAMETER_ID);
    layerByParam.setName(LAYER_BY_PARAMETER_ID_NAME);
    layerByParam.setDescription(LAYER_BY_PARAMETER_ID_DESCRIPTION);
    SingleChoiceParameterType.setOptions(layerByParam, LAYER_BY_PARAM_VALUES);
    SingleChoiceParameterType.setChoice(layerByParam, LAYER_BY_PARAMETER_ID_DEFAULT);
    parameters.addParameter(layerByParam);
    final PluginParameter<IntegerParameterValue> amountParam = IntegerParameterType.build(AMOUNT_PARAMETER_ID);
    amountParam.setName(AMOUNT_PARAMETER_ID_NAME);
    amountParam.setDescription(AMOUNT_PARAMETER_ID_DESCRIPTION);
    amountParam.setIntegerValue(AMOUNT_PARAMETER_ID_DEFAULT);
    parameters.addParameter(amountParam);
    final PluginParameter<SingleChoiceParameterValue> unitParam = SingleChoiceParameterType.build(UNIT_PARAMETER_ID);
    unitParam.setName(UNIT_PARAMETER_ID_NAME);
    unitParam.setDescription(UNIT_PARAMETER_ID_DESCRIPTION);
    SingleChoiceParameterType.setOptions(unitParam, new ArrayList<>(LAYER_INTERVALS.keySet()));
    SingleChoiceParameterType.setChoice(unitParam, UNIT_PARAMETER_ID_DEFAULT);
    parameters.addParameter(unitParam);
    final PluginParameter<BooleanParameterValue> transactionParam = BooleanParameterType.build(TRANSACTION_AS_LAYER_PARAMETER_ID);
    transactionParam.setName(TRANSACTION_AS_LAYER_NAME);
    transactionParam.setDescription(TRANSACTION_AS_LAYER_DESCRIPTION);
    transactionParam.setBooleanValue(TRANSACTION_AS_LAYER_DEFAULT);
    parameters.addParameter(transactionParam);
    final PluginParameter<BooleanParameterValue> keepTxColorsParam = BooleanParameterType.build(KEEP_TX_COLORS_PARAMETER_ID);
    keepTxColorsParam.setName(KEEP_TX_COLORS_NAME);
    keepTxColorsParam.setDescription(KEEP_TX_COLORS_DESCRIPTION);
    keepTxColorsParam.setBooleanValue(KEEP_TX_COLORS_DEFAULT);
    parameters.addParameter(keepTxColorsParam);
    final PluginParameter<BooleanParameterValue> drawTxGuidesParam = BooleanParameterType.build(DRAW_TX_GUIDES_PARAMETER_ID);
    drawTxGuidesParam.setName(DRAW_TX_GUIDES_NAME);
    drawTxGuidesParam.setDescription(DRAW_TX_GUIDES_DESCRIPTION);
    drawTxGuidesParam.setBooleanValue(DRAW_TX_GUIDES_DEFAULT);
    parameters.addParameter(drawTxGuidesParam);
    parameters.addController(LAYER_BY_PARAMETER_ID, (masterId, paramMap, change) -> {
        if (change == ParameterChange.VALUE) {
            if (paramMap.get(LAYER_BY_PARAMETER_ID).getStringValue().equals(INTERVAL_METHOD)) {
                SingleChoiceParameterType.setOptions(unitParam, new ArrayList<>(LAYER_INTERVALS.keySet()));
                SingleChoiceParameterType.setChoice(unitParam, UNIT_PARAMETER_ID_INTERVAL_DEFAULT);
                parameters.getParameters().get(AMOUNT_PARAMETER_ID).setEnabled(true);
            } else if (paramMap.get(LAYER_BY_PARAMETER_ID).getStringValue().equals(BIN_METHOD)) {
                SingleChoiceParameterType.setOptions(unitParam, new ArrayList<>(BIN_CALENDAR_UNITS.keySet()));
                SingleChoiceParameterType.setChoice(unitParam, UNIT_PARAMETER_ID_BIN_DEFAULT);
                parameters.getParameters().get(AMOUNT_PARAMETER_ID).setEnabled(false);
            } else {
            // Do nothing
            }
        }
    });
    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) ArrayList(java.util.ArrayList) PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) SingleChoiceParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.SingleChoiceParameterType.SingleChoiceParameterValue)

Example 5 with SingleChoiceParameterValue

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

the class ArrangeInScatter3dGeneralPlugin method updateParameters.

@Override
public void updateParameters(final Graph graph, final PluginParameters parameters) {
    // Get the list of non-default attributes
    final ReadableGraph rg = graph.getReadableGraph();
    Map<String, Integer> vertexAttributes = null;
    try {
        vertexAttributes = AttributeUtilities.getVertexAttributes(rg, 0);
    } finally {
        rg.release();
    }
    if (vertexAttributes != null) {
        final List<String> keys = new ArrayList<>(vertexAttributes.keySet());
        final PluginParameter<SingleChoiceParameterValue> xAttribute = (PluginParameter<SingleChoiceParameterValue>) parameters.getParameters().get(SCATTER_3D_X_ATTRIBUTE);
        SingleChoiceParameterType.setOptions(xAttribute, keys);
        final PluginParameter<SingleChoiceParameterValue> yAttribute = (PluginParameter<SingleChoiceParameterValue>) parameters.getParameters().get(SCATTER_3D_Y_ATTRIBUTE);
        SingleChoiceParameterType.setOptions(yAttribute, keys);
        final PluginParameter<SingleChoiceParameterValue> zAttribute = (PluginParameter<SingleChoiceParameterValue>) parameters.getParameters().get(SCATTER_3D_Z_ATTRIBUTE);
        SingleChoiceParameterType.setOptions(zAttribute, keys);
    }
}
Also used : ReadableGraph(au.gov.asd.tac.constellation.graph.ReadableGraph) ArrayList(java.util.ArrayList) PluginParameter(au.gov.asd.tac.constellation.plugins.parameters.PluginParameter) SingleChoiceParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.SingleChoiceParameterType.SingleChoiceParameterValue)

Aggregations

SingleChoiceParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.SingleChoiceParameterType.SingleChoiceParameterValue)37 PluginParameters (au.gov.asd.tac.constellation.plugins.parameters.PluginParameters)29 ArrayList (java.util.ArrayList)21 PluginParameter (au.gov.asd.tac.constellation.plugins.parameters.PluginParameter)19 BooleanParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.BooleanParameterType.BooleanParameterValue)13 IntegerParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.IntegerParameterType.IntegerParameterValue)12 StringParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.StringParameterValue)9 ParameterChange (au.gov.asd.tac.constellation.plugins.parameters.ParameterChange)8 Map (java.util.Map)8 ReadableGraph (au.gov.asd.tac.constellation.graph.ReadableGraph)6 MultiChoiceParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.MultiChoiceParameterType.MultiChoiceParameterValue)6 LinkedHashMap (java.util.LinkedHashMap)5 Test (org.testng.annotations.Test)5 Graph (au.gov.asd.tac.constellation.graph.Graph)4 FloatParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.FloatParameterType.FloatParameterValue)4 DualGraph (au.gov.asd.tac.constellation.graph.locking.DualGraph)3 ParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.ParameterValue)3 GraphElementType (au.gov.asd.tac.constellation.graph.GraphElementType)2 WritableGraph (au.gov.asd.tac.constellation.graph.WritableGraph)2 SchemaTransactionType (au.gov.asd.tac.constellation.graph.schema.type.SchemaTransactionType)2