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;
}
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());
}
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;
}
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;
}
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);
}
}
Aggregations