Search in sources :

Example 76 with PluginParameter

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

the class CompareGraphPlugin method updateParameters.

@Override
public void updateParameters(final Graph graph, final PluginParameters parameters) {
    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());
        }
    }
    // sort drop down list
    graphNames.sort(String::compareTo);
    // make a list of attributes that should be ignored.
    final ReadableGraph rg = graph.getReadableGraph();
    final Set<String> registeredVertexAttributes;
    final Set<String> registeredTransactionAttributes;
    try {
        registeredVertexAttributes = AttributeUtilities.getRegisteredAttributeIdsFromGraph(rg, GraphElementType.VERTEX).keySet();
        registeredTransactionAttributes = AttributeUtilities.getRegisteredAttributeIdsFromGraph(rg, GraphElementType.TRANSACTION).keySet();
    } finally {
        rg.release();
    }
    // ignore lowercase attributes
    final List<String> ignoredVertexAttributes = new ArrayList<>();
    for (final String attribute : registeredVertexAttributes) {
        if (attribute.substring(0, 1).matches("[a-z]")) {
            ignoredVertexAttributes.add(attribute);
        }
    }
    final List<String> ignoredTransactionAttributes = new ArrayList<>();
    for (final String attribute : registeredTransactionAttributes) {
        if (attribute.substring(0, 1).matches("[a-z]")) {
            ignoredTransactionAttributes.add(attribute);
        }
    }
    // ORIGINAL_GRAPH_PARAMETER will always be of type SingleChoiceParameter
    @SuppressWarnings("unchecked") final PluginParameter<SingleChoiceParameterValue> originalGraph = (PluginParameter<SingleChoiceParameterValue>) parameters.getParameters().get(ORIGINAL_GRAPH_PARAMETER_ID);
    SingleChoiceParameterType.setOptions(originalGraph, graphNames);
    SingleChoiceParameterType.setChoice(originalGraph, GraphNode.getGraphNode(graph.getId()).getDisplayName());
    // IGNORE_VERTEX_ATTRIBUTES_PARAMETER will always be of type MultiChoiceParameter
    @SuppressWarnings("unchecked") final PluginParameter<MultiChoiceParameterValue> ignoreVertexAttributes = (PluginParameter<MultiChoiceParameterValue>) parameters.getParameters().get(IGNORE_VERTEX_ATTRIBUTES_PARAMETER_ID);
    MultiChoiceParameterType.setOptions(ignoreVertexAttributes, new ArrayList<>(registeredVertexAttributes));
    MultiChoiceParameterType.setChoices(ignoreVertexAttributes, ignoredVertexAttributes);
    // IGNORE_TRANSACTION_ATTRIBUTES_PARAMETER will always be of type MultiChoiceParameter
    @SuppressWarnings("unchecked") final PluginParameter<MultiChoiceParameterValue> ignoreTransactionAttributes = (PluginParameter<MultiChoiceParameterValue>) parameters.getParameters().get(IGNORE_TRANSACTION_ATTRIBUTES_PARAMETER_ID);
    MultiChoiceParameterType.setOptions(ignoreTransactionAttributes, new ArrayList<>(registeredTransactionAttributes));
    MultiChoiceParameterType.setChoices(ignoreTransactionAttributes, ignoredTransactionAttributes);
}
Also used : ReadableGraph(au.gov.asd.tac.constellation.graph.ReadableGraph) MultiChoiceParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.MultiChoiceParameterType.MultiChoiceParameterValue) ArrayList(java.util.ArrayList) WritableGraph(au.gov.asd.tac.constellation.graph.WritableGraph) ReadableGraph(au.gov.asd.tac.constellation.graph.ReadableGraph) Graph(au.gov.asd.tac.constellation.graph.Graph) PluginParameter(au.gov.asd.tac.constellation.plugins.parameters.PluginParameter) SingleChoiceParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.SingleChoiceParameterType.SingleChoiceParameterValue)

Example 77 with PluginParameter

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

the class PluginsNodeProvider method setContent.

@Override
public void setContent(final Tab tab) {
    final Map<String, String> pluginNames = new TreeMap<>();
    final Map<String, ObservableList<PluginParameter<?>>> pluginParameters = new HashMap<>();
    final Map<String, String> dataAccessTypes = new HashMap<>();
    // Get plugins in order of description.
    PluginRegistry.getPluginClassNames().stream().forEach(pluginClassName -> {
        boolean isEnabled = true;
        final Plugin plugin = PluginRegistry.get(pluginClassName);
        final String pluginName = plugin.getName();
        if (plugin instanceof DataAccessPlugin) {
            final DataAccessPlugin dataAccessPlugin = (DataAccessPlugin) plugin;
            final String dataAccessType = dataAccessPlugin.getType();
            isEnabled = dataAccessPlugin.isEnabled();
            if (isEnabled && !dataAccessType.equals(DataAccessPluginCoreType.EXPERIMENTAL) && !dataAccessType.equals(DataAccessPluginCoreType.DEVELOPER)) {
                dataAccessTypes.put(pluginName != null ? pluginName : pluginClassName, dataAccessType);
            }
        }
        if (isEnabled) {
            if (pluginName == null) {
                LOGGER.log(Level.WARNING, "null name for plugin %s{0}", pluginClassName);
            } else if (pluginNames.containsKey(pluginName)) {
                LOGGER.log(Level.WARNING, "duplicate name {0} for plugins {1}, {2}", new Object[] { pluginName, pluginClassName, pluginNames.get(pluginName) });
            } else {
            // Do nothing
            }
            pluginNames.put(pluginName != null ? pluginName : pluginClassName, pluginClassName);
            try {
                final PluginParameters parameters = plugin.createParameters();
                if (parameters != null) {
                    final ObservableList<PluginParameter<?>> parameterList = FXCollections.observableArrayList();
                    parameters.getParameters().entrySet().stream().forEach(entry -> {
                        final PluginParameter<?> parameter = entry.getValue();
                        parameterList.add(parameter);
                    });
                    Collections.sort(parameterList, (a, b) -> a.getId().compareToIgnoreCase(b.getId()));
                    pluginParameters.put(pluginName != null ? pluginName : pluginClassName, parameterList);
                }
            } catch (final Exception ex) {
                LOGGER.log(Level.SEVERE, "plugin " + pluginClassName + " created an exception", ex);
            }
        }
    });
    final Accordion pluginList = new Accordion();
    pluginNames.entrySet().stream().forEach(entry -> {
        final String pluginName = entry.getKey();
        final String pluginClassName = entry.getValue();
        final GridPane grid = new GridPane();
        grid.setPadding(new Insets(0, 0, 0, 5));
        grid.setHgap(5);
        grid.setVgap(10);
        grid.add(boldLabel("Name"), 0, 0);
        grid.add(new Label(pluginClassName), 1, 0);
        grid.add(boldLabel("Alias"), 0, 1);
        grid.add(new Label(PluginRegistry.getAlias(pluginClassName)), 1, 1);
        if (PluginRegistry.get(pluginClassName).getDescription() != null) {
            grid.add(boldLabel("Description"), 0, 2);
            final Label description = new Label(PluginRegistry.get(pluginClassName).getDescription());
            description.setPrefHeight(Region.USE_PREF_SIZE);
            description.setWrapText(true);
            grid.add(description, 1, 2);
        }
        final VBox pluginContent = new VBox();
        if (pluginParameters.containsKey(pluginName)) {
            grid.add(boldLabel("Parameters"), 0, 3);
            final TableColumn<PluginParameter<?>, String> colName = new TableColumn<>("Name");
            colName.setCellValueFactory(p -> new SimpleStringProperty(p.getValue().getId()));
            final TableColumn<PluginParameter<?>, String> colType = new TableColumn<>("Type");
            colType.setCellValueFactory(p -> new SimpleStringProperty(p.getValue().getType().getId()));
            final TableColumn<PluginParameter<?>, String> colLabel = new TableColumn<>("Label");
            colLabel.setCellValueFactory(p -> new SimpleStringProperty(p.getValue().getName()));
            final TableColumn<PluginParameter<?>, String> colDescr = new TableColumn<>("Description");
            colDescr.setCellValueFactory(p -> new SimpleStringProperty(p.getValue().getDescription()));
            final TableColumn<PluginParameter<?>, String> colDefault = new TableColumn<>("Default Value");
            colDefault.setCellValueFactory(p -> new SimpleStringProperty(p.getValue().getStringValue()));
            final TableView<PluginParameter<?>> parameterTable = new TableView<>(pluginParameters.get(pluginName));
            parameterTable.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
            parameterTable.getColumns().addAll(colName, colType, colLabel, colDescr, colDefault);
            parameterTable.setFixedCellSize(25);
            parameterTable.prefHeightProperty().bind(parameterTable.fixedCellSizeProperty().multiply(Bindings.size(parameterTable.getItems()).add(1.01)));
            parameterTable.minHeightProperty().bind(parameterTable.prefHeightProperty());
            parameterTable.maxHeightProperty().bind(parameterTable.prefHeightProperty());
            pluginContent.getChildren().add(grid);
            pluginContent.getChildren().add(parameterTable);
        } else {
            pluginContent.getChildren().add(grid);
        }
        final TitledPane pluginPane = new TitledPane(pluginName, pluginContent);
        if (dataAccessTypes.containsKey(pluginName)) {
            final ImageView iv = new ImageView(UserInterfaceIconProvider.VISIBLE.buildImage(16, ConstellationColor.CLOUDS.getJavaColor()));
            final Label l = new Label(String.format("(%s)", dataAccessTypes.get(pluginName)));
            final HBox box = new HBox(iv, l);
            pluginPane.setGraphic(box);
            pluginPane.setGraphicTextGap(20);
            pluginPane.setContentDisplay(ContentDisplay.RIGHT);
        }
        pluginList.getPanes().add(pluginPane);
    });
    final Button exportPluginsButton = new Button();
    exportPluginsButton.setTooltip(new Tooltip("Export Plugin Details to CSV"));
    exportPluginsButton.setGraphic(new ImageView(UserInterfaceIconProvider.DOWNLOAD.buildImage(16, ConstellationColor.CLOUDS.getJavaColor())));
    exportPluginsButton.setOnAction(action -> exportPluginsToCsv(tab.getContent().getScene().getWindow()));
    Platform.runLater(() -> {
        pane.setAlignment(Pos.TOP_RIGHT);
        final ScrollPane scrollPane = new ScrollPane();
        scrollPane.setContent(pluginList);
        scrollPane.setFitToWidth(true);
        pane.getChildren().add(exportPluginsButton);
        pane.getChildren().add(scrollPane);
        tab.setContent(pane);
    });
}
Also used : HBox(javafx.scene.layout.HBox) Insets(javafx.geometry.Insets) HashMap(java.util.HashMap) Label(javafx.scene.control.Label) Button(javafx.scene.control.Button) DataAccessPlugin(au.gov.asd.tac.constellation.views.dataaccess.plugins.DataAccessPlugin) PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) ImageView(javafx.scene.image.ImageView) PluginParameter(au.gov.asd.tac.constellation.plugins.parameters.PluginParameter) TableView(javafx.scene.control.TableView) TitledPane(javafx.scene.control.TitledPane) GridPane(javafx.scene.layout.GridPane) Tooltip(javafx.scene.control.Tooltip) SimpleStringProperty(javafx.beans.property.SimpleStringProperty) TreeMap(java.util.TreeMap) TableColumn(javafx.scene.control.TableColumn) IOException(java.io.IOException) Accordion(javafx.scene.control.Accordion) ObservableList(javafx.collections.ObservableList) ScrollPane(javafx.scene.control.ScrollPane) VBox(javafx.scene.layout.VBox) DataAccessPlugin(au.gov.asd.tac.constellation.views.dataaccess.plugins.DataAccessPlugin) Plugin(au.gov.asd.tac.constellation.plugins.Plugin)

Example 78 with PluginParameter

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

the class DatetimeAttributeTranslator method createParameters.

@Override
public PluginParameters createParameters() {
    final PluginParameters parameters = new PluginParameters();
    final PluginParameter<SingleChoiceParameterValue> formatParam = SingleChoiceParameterType.build(FORMAT_PARAMETER_ID);
    formatParam.setName("Datetime Format");
    formatParam.setDescription("The datetime format");
    final List<String> datetimeLabels = new ArrayList<>(DATETIME_FORMATS.keySet());
    SingleChoiceParameterType.setOptions(formatParam, datetimeLabels);
    SingleChoiceParameterType.setChoice(formatParam, datetimeLabels.get(0));
    parameters.addParameter(formatParam);
    final PluginParameter<StringParameterValue> customParam = StringParameterType.build(CUSTOM_PARAMETER_ID);
    customParam.setName("Custom Format");
    customParam.setDescription("A custom datetime format");
    // customParam should be enabled and editable if "CUSTOM" format has been specified.
    customParam.setEnabled(formatParam.getStringValue().equals(CUSTOM));
    customParam.setStringValue("");
    parameters.addParameter(customParam);
    parameters.addController(FORMAT_PARAMETER_ID, (final PluginParameter<?> master, final Map<String, PluginParameter<?>> params, final ParameterChange change) -> {
        if (change == ParameterChange.VALUE) {
            final PluginParameter<?> slave = params.get(CUSTOM_PARAMETER_ID);
            slave.setEnabled(master.getStringValue().equals(CUSTOM));
        }
    });
    return parameters;
}
Also used : ParameterChange(au.gov.asd.tac.constellation.plugins.parameters.ParameterChange) ArrayList(java.util.ArrayList) StringParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.StringParameterValue) 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 79 with PluginParameter

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

the class VisualGraphTopComponent method getActions.

@Override
public Action[] getActions() {
    // Add new actions above the default actions.
    final ArrayList<Action> actionList = new ArrayList<>();
    // An action that closes the topcomponent without saving the (possibly modified) graph.
    final Action discard = new AbstractAction(DISCARD) {

        @Override
        public void actionPerformed(final ActionEvent e) {
            savable.setModified(false);
            close();
        }
    };
    actionList.add(discard);
    // If this graph is in a nebula, add some nebula-related actions.
    final NebulaDataObject nebula = getGraphNode().getDataObject().getNebulaDataObject();
    if (nebula != null) {
        // Discard the nebula without saving.
        final Action discardNebula = new AbstractAction("Discard nebula") {

            @Override
            public void actionPerformed(final ActionEvent e) {
                TopComponent.getRegistry().getOpened().stream().filter(tc -> (tc instanceof VisualGraphTopComponent)).map(tc -> (VisualGraphTopComponent) tc).forEach(vtc -> {
                    final NebulaDataObject ndo = vtc.getGraphNode().getDataObject().getNebulaDataObject();
                    if (nebula.equalsPath(ndo)) {
                        vtc.savable.setModified(false);
                        vtc.close();
                    }
                });
            }
        };
        actionList.add(discardNebula);
        // Are there any graphs in this nebula (if it exists) that need saving?
        final List<Savable> savables = getNebulaSavables(nebula);
        if (!savables.isEmpty()) {
            // There's at least one graph in this nebula that needs saving...
            final Action saveNebula = new AbstractAction("Save nebula") {

                @Override
                public void actionPerformed(final ActionEvent e) {
                    try {
                        for (final Savable s : savables) {
                            s.save();
                        }
                    } catch (final IOException ex) {
                        LOGGER.log(Level.SEVERE, ex.getLocalizedMessage(), ex);
                    }
                }
            };
            actionList.add(saveNebula);
        } else {
            // No graphs in this nebula need saving, so offer to close the nebula.
            final Action closeNebula = new AbstractAction("Close nebula") {

                @Override
                public void actionPerformed(final ActionEvent e) {
                    TopComponent.getRegistry().getOpened().stream().filter(tc -> (tc instanceof VisualGraphTopComponent)).map(tc -> (VisualGraphTopComponent) tc).forEach(vtc -> {
                        final NebulaDataObject ndo = vtc.getGraphNode().getDataObject().getNebulaDataObject();
                        if (nebula.equalsPath(ndo)) {
                            vtc.close();
                        }
                    });
                }
            };
            actionList.add(closeNebula);
        }
    }
    // An action that renames the topcomponent without saving the (possibly modified) graph.
    final Action rename = new AbstractAction("Rename") {

        @Override
        public void actionPerformed(final ActionEvent e) {
            final PluginParameters parameters = new PluginParameters();
            final PluginParameter<StringParameterValue> newGraphNameParameter = StringParameterType.build(NEW_GRAPH_NAME_PARAMETER_ID);
            newGraphNameParameter.setName("New Graph Name");
            newGraphNameParameter.setStringValue(graphNode.getDisplayName());
            newGraphNameParameter.storeRecentValue();
            parameters.addParameter(newGraphNameParameter);
            final PluginParametersSwingDialog dialog = new PluginParametersSwingDialog("Rename Graph", parameters);
            dialog.showAndWait();
            if (PluginParametersSwingDialog.OK.equals(dialog.getResult())) {
                final String newGraphName = parameters.getStringValue(NEW_GRAPH_NAME_PARAMETER_ID);
                if (!newGraphName.isEmpty()) {
                    try {
                        // set the graph object name so the name is retained when you Save As
                        graphNode.getDataObject().rename(newGraphName);
                        // set the other graph name properties
                        graphNode.setName(newGraphName);
                        graphNode.setDisplayName(newGraphName);
                        // set the top component
                        setName(newGraphName);
                        setDisplayName(newGraphName);
                        // this changes the text on the tab
                        setHtmlDisplayName(newGraphName);
                    } catch (final IOException ex) {
                        throw new RuntimeException(String.format("The name %s already exists.", newGraphName), ex);
                    }
                    savable.setModified(true);
                }
            }
        }
    };
    actionList.add(rename);
    // Add the default actions.
    for (final Action action : super.getActions()) {
        actionList.add(action);
    }
    return actionList.toArray(new Action[actionList.size()]);
}
Also used : Color(java.awt.Color) DropTarget(java.awt.dnd.DropTarget) GZIPInputStream(java.util.zip.GZIPInputStream) GraphObjectUtilities(au.gov.asd.tac.constellation.graph.file.GraphObjectUtilities) PluginParametersSwingDialog(au.gov.asd.tac.constellation.plugins.gui.PluginParametersSwingDialog) StringParameterType(au.gov.asd.tac.constellation.plugins.parameters.types.StringParameterType) DrawLinksAction(au.gov.asd.tac.constellation.graph.interaction.plugins.display.DrawLinksAction) RecordStore(au.gov.asd.tac.constellation.graph.processing.RecordStore) HandleIoProgress(au.gov.asd.tac.constellation.utilities.gui.HandleIoProgress) DropTargetAdapter(java.awt.dnd.DropTargetAdapter) ActionReference(org.openide.awt.ActionReference) StringUtils(org.apache.commons.lang3.StringUtils) DataObject(org.openide.loaders.DataObject) SchemaFactoryUtilities(au.gov.asd.tac.constellation.graph.schema.SchemaFactoryUtilities) PasteFromClipboardAction(au.gov.asd.tac.constellation.graph.interaction.plugins.clipboard.PasteFromClipboardAction) Map(java.util.Map) DropTargetDropEvent(java.awt.dnd.DropTargetDropEvent) SwingWorker(javax.swing.SwingWorker) UserInterfaceIconProvider(au.gov.asd.tac.constellation.utilities.icon.UserInterfaceIconProvider) GraphManager(au.gov.asd.tac.constellation.graph.manager.GraphManager) KeyStroke(javax.swing.KeyStroke) JToolBar(javax.swing.JToolBar) DropTargetDragEvent(java.awt.dnd.DropTargetDragEvent) Component(java.awt.Component) GraphChangeEvent(au.gov.asd.tac.constellation.graph.monitor.GraphChangeEvent) AutosaveUtilities(au.gov.asd.tac.constellation.graph.file.save.AutosaveUtilities) PluginInfo(au.gov.asd.tac.constellation.plugins.PluginInfo) NotifyDescriptor(org.openide.NotifyDescriptor) GraphUpdateController(au.gov.asd.tac.constellation.plugins.update.GraphUpdateController) ToggleSelectionModeAction(au.gov.asd.tac.constellation.graph.interaction.plugins.draw.ToggleSelectionModeAction) AbstractAction(javax.swing.AbstractAction) GraphJsonWriter(au.gov.asd.tac.constellation.graph.file.io.GraphJsonWriter) UpdateController(au.gov.asd.tac.constellation.plugins.update.UpdateController) NbBundle(org.openide.util.NbBundle) NbPreferences(org.openide.util.NbPreferences) GraphWriteMethods(au.gov.asd.tac.constellation.graph.GraphWriteMethods) ContractAllCompositesAction(au.gov.asd.tac.constellation.graph.interaction.plugins.composite.ContractAllCompositesAction) UndoRedo(org.openide.awt.UndoRedo) DrawBlazesAction(au.gov.asd.tac.constellation.graph.interaction.plugins.display.DrawBlazesAction) DnDConstants(java.awt.dnd.DnDConstants) Action(javax.swing.Action) ImageUtilities(org.openide.util.ImageUtilities) BufferedOutputStream(java.io.BufferedOutputStream) ArrayList(java.util.ArrayList) Graph(au.gov.asd.tac.constellation.graph.Graph) DrawConnectionLabelsAction(au.gov.asd.tac.constellation.graph.interaction.plugins.display.DrawConnectionLabelsAction) AbstractLookup(org.openide.util.lookup.AbstractLookup) GraphReadMethods(au.gov.asd.tac.constellation.graph.GraphReadMethods) Schema(au.gov.asd.tac.constellation.graph.schema.Schema) PluginTags(au.gov.asd.tac.constellation.plugins.templates.PluginTags) DrawFlags(au.gov.asd.tac.constellation.utilities.visual.DrawFlags) GraphUpdateManager(au.gov.asd.tac.constellation.plugins.update.GraphUpdateManager) ToggleDrawDirectedAction(au.gov.asd.tac.constellation.graph.interaction.plugins.draw.ToggleDrawDirectedAction) SaveAsCapable(org.openide.loaders.SaveAsCapable) PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) MemoryManager(au.gov.asd.tac.constellation.utilities.memory.MemoryManager) ButtonGroup(javax.swing.ButtonGroup) GraphDataObject(au.gov.asd.tac.constellation.graph.file.GraphDataObject) Node(org.openide.nodes.Node) IOException(java.io.IOException) FileUtils(org.apache.commons.io.FileUtils) GraphRecordStoreUtilities(au.gov.asd.tac.constellation.graph.processing.GraphRecordStoreUtilities) PluginException(au.gov.asd.tac.constellation.plugins.PluginException) File(java.io.File) FileExtensionConstants(au.gov.asd.tac.constellation.utilities.file.FileExtensionConstants) ActionReferences(org.openide.awt.ActionReferences) SimplePlugin(au.gov.asd.tac.constellation.plugins.templates.SimplePlugin) Savable(org.netbeans.api.actions.Savable) ActionID(org.openide.awt.ActionID) ReadableGraph(au.gov.asd.tac.constellation.graph.ReadableGraph) SimpleEditPlugin(au.gov.asd.tac.constellation.plugins.templates.SimpleEditPlugin) PluginType(au.gov.asd.tac.constellation.plugins.PluginType) CopyToClipboardAction(au.gov.asd.tac.constellation.graph.interaction.plugins.clipboard.CopyToClipboardAction) DrawNodeLabelsAction(au.gov.asd.tac.constellation.graph.interaction.plugins.display.DrawNodeLabelsAction) VisualGraphDefaults(au.gov.asd.tac.constellation.graph.visual.framework.VisualGraphDefaults) CloseAction(au.gov.asd.tac.constellation.graph.interaction.plugins.io.CloseAction) HelpCtx(org.openide.util.HelpCtx) StringParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.StringParameterValue) PluginExecution(au.gov.asd.tac.constellation.plugins.PluginExecution) BorderLayout(java.awt.BorderLayout) InstanceContent(org.openide.util.lookup.InstanceContent) DrawNodesAction(au.gov.asd.tac.constellation.graph.interaction.plugins.display.DrawNodesAction) Lookup(org.openide.util.Lookup) SaveNotification(au.gov.asd.tac.constellation.graph.file.SaveNotification) UnsupportedFlavorException(java.awt.datatransfer.UnsupportedFlavorException) CutToClipboardAction(au.gov.asd.tac.constellation.graph.interaction.plugins.clipboard.CutToClipboardAction) Image(java.awt.Image) BufferedImage(java.awt.image.BufferedImage) Toggle3DAction(au.gov.asd.tac.constellation.graph.interaction.plugins.display.Toggle3DAction) Collection(java.util.Collection) SaveAsAction(au.gov.asd.tac.constellation.graph.interaction.plugins.io.SaveAsAction) Icon(javax.swing.Icon) Logger(java.util.logging.Logger) FileUtil(org.openide.filesystems.FileUtil) DrawConnectionsAction(au.gov.asd.tac.constellation.graph.interaction.plugins.display.DrawConnectionsAction) DrawTransactionsAction(au.gov.asd.tac.constellation.graph.interaction.plugins.display.DrawTransactionsAction) Dimension(java.awt.Dimension) List(java.util.List) RecordStoreUtilities(au.gov.asd.tac.constellation.graph.processing.RecordStoreUtilities) DeveloperPreferenceKeys(au.gov.asd.tac.constellation.preferences.DeveloperPreferenceKeys) Graphics(java.awt.Graphics) ApplicationPreferenceKeys(au.gov.asd.tac.constellation.preferences.ApplicationPreferenceKeys) VisualManager(au.gov.asd.tac.constellation.utilities.visual.VisualManager) CloneableTopComponent(org.openide.windows.CloneableTopComponent) ConnectionMode(au.gov.asd.tac.constellation.graph.schema.visual.attribute.objects.ConnectionMode) AbstractSavable(org.netbeans.spi.actions.AbstractSavable) StatusDisplayer(org.openide.awt.StatusDisplayer) GraphNodeFactory(au.gov.asd.tac.constellation.graph.node.GraphNodeFactory) TopComponent(org.openide.windows.TopComponent) DataFlavor(java.awt.datatransfer.DataFlavor) Transferable(java.awt.datatransfer.Transferable) UpdateComponent(au.gov.asd.tac.constellation.plugins.update.UpdateComponent) HashMap(java.util.HashMap) VisualConcept(au.gov.asd.tac.constellation.graph.schema.visual.concept.VisualConcept) SwingConstants(javax.swing.SwingConstants) Level(java.util.logging.Level) FileObject(org.openide.filesystems.FileObject) GraphChangeListener(au.gov.asd.tac.constellation.graph.monitor.GraphChangeListener) SwingUtilities(javax.swing.SwingUtilities) ToggleGraphVisibilityAction(au.gov.asd.tac.constellation.graph.interaction.plugins.display.ToggleGraphVisibilityAction) Graphics2D(java.awt.Graphics2D) PluginInteraction(au.gov.asd.tac.constellation.plugins.PluginInteraction) PluginParameter(au.gov.asd.tac.constellation.plugins.parameters.PluginParameter) DrawEdgesAction(au.gov.asd.tac.constellation.graph.interaction.plugins.display.DrawEdgesAction) NebulaDataObject(au.gov.asd.tac.constellation.graph.file.nebula.NebulaDataObject) OutputStream(java.io.OutputStream) FileInputStream(java.io.FileInputStream) DialogDisplayer(org.openide.DialogDisplayer) PluginGraphs(au.gov.asd.tac.constellation.plugins.PluginGraphs) ActionEvent(java.awt.event.ActionEvent) DualGraph(au.gov.asd.tac.constellation.graph.locking.DualGraph) GraphVisualManagerFactory(au.gov.asd.tac.constellation.graph.interaction.framework.GraphVisualManagerFactory) ExpandAllCompositesAction(au.gov.asd.tac.constellation.graph.interaction.plugins.composite.ExpandAllCompositesAction) ConstellationLoggerHelper(au.gov.asd.tac.constellation.plugins.logging.ConstellationLoggerHelper) GraphNode(au.gov.asd.tac.constellation.graph.node.GraphNode) InputMap(javax.swing.InputMap) ConstellationIcon(au.gov.asd.tac.constellation.utilities.icon.ConstellationIcon) RecentGraphScreenshotUtilities(au.gov.asd.tac.constellation.graph.interaction.plugins.io.screenshot.RecentGraphScreenshotUtilities) InputStream(java.io.InputStream) DrawLinksAction(au.gov.asd.tac.constellation.graph.interaction.plugins.display.DrawLinksAction) PasteFromClipboardAction(au.gov.asd.tac.constellation.graph.interaction.plugins.clipboard.PasteFromClipboardAction) ToggleSelectionModeAction(au.gov.asd.tac.constellation.graph.interaction.plugins.draw.ToggleSelectionModeAction) AbstractAction(javax.swing.AbstractAction) ContractAllCompositesAction(au.gov.asd.tac.constellation.graph.interaction.plugins.composite.ContractAllCompositesAction) DrawBlazesAction(au.gov.asd.tac.constellation.graph.interaction.plugins.display.DrawBlazesAction) Action(javax.swing.Action) DrawConnectionLabelsAction(au.gov.asd.tac.constellation.graph.interaction.plugins.display.DrawConnectionLabelsAction) ToggleDrawDirectedAction(au.gov.asd.tac.constellation.graph.interaction.plugins.draw.ToggleDrawDirectedAction) CopyToClipboardAction(au.gov.asd.tac.constellation.graph.interaction.plugins.clipboard.CopyToClipboardAction) DrawNodeLabelsAction(au.gov.asd.tac.constellation.graph.interaction.plugins.display.DrawNodeLabelsAction) CloseAction(au.gov.asd.tac.constellation.graph.interaction.plugins.io.CloseAction) DrawNodesAction(au.gov.asd.tac.constellation.graph.interaction.plugins.display.DrawNodesAction) CutToClipboardAction(au.gov.asd.tac.constellation.graph.interaction.plugins.clipboard.CutToClipboardAction) Toggle3DAction(au.gov.asd.tac.constellation.graph.interaction.plugins.display.Toggle3DAction) SaveAsAction(au.gov.asd.tac.constellation.graph.interaction.plugins.io.SaveAsAction) DrawConnectionsAction(au.gov.asd.tac.constellation.graph.interaction.plugins.display.DrawConnectionsAction) DrawTransactionsAction(au.gov.asd.tac.constellation.graph.interaction.plugins.display.DrawTransactionsAction) ToggleGraphVisibilityAction(au.gov.asd.tac.constellation.graph.interaction.plugins.display.ToggleGraphVisibilityAction) DrawEdgesAction(au.gov.asd.tac.constellation.graph.interaction.plugins.display.DrawEdgesAction) ExpandAllCompositesAction(au.gov.asd.tac.constellation.graph.interaction.plugins.composite.ExpandAllCompositesAction) ActionEvent(java.awt.event.ActionEvent) ArrayList(java.util.ArrayList) StringParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.StringParameterValue) IOException(java.io.IOException) PluginParametersSwingDialog(au.gov.asd.tac.constellation.plugins.gui.PluginParametersSwingDialog) Savable(org.netbeans.api.actions.Savable) AbstractSavable(org.netbeans.spi.actions.AbstractSavable) NebulaDataObject(au.gov.asd.tac.constellation.graph.file.nebula.NebulaDataObject) PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) AbstractAction(javax.swing.AbstractAction)

Example 80 with PluginParameter

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

the class PasswordParameterTypeNGTest method testBuild_String_PasswordParameterValue.

/**
 * Test of build method, of class PasswordParameterType.
 */
@Test
public void testBuild_String_PasswordParameterValue() {
    System.out.println("build_string_parametertype");
    String id = "stringParameter";
    PasswordParameterValue parameterValue = new PasswordParameterValue();
    PluginParameter result = PasswordParameterType.build(id, parameterValue);
    assertEquals(result.getId(), id);
    assertTrue(result.getType() instanceof PasswordParameterType);
    assertEquals(result.getParameterValue(), parameterValue);
}
Also used : PluginParameter(au.gov.asd.tac.constellation.plugins.parameters.PluginParameter) Test(org.testng.annotations.Test)

Aggregations

PluginParameter (au.gov.asd.tac.constellation.plugins.parameters.PluginParameter)93 PluginParameters (au.gov.asd.tac.constellation.plugins.parameters.PluginParameters)53 Test (org.testng.annotations.Test)52 ArrayList (java.util.ArrayList)36 MultiChoiceParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.MultiChoiceParameterType.MultiChoiceParameterValue)25 SingleChoiceParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.SingleChoiceParameterType.SingleChoiceParameterValue)21 Map (java.util.Map)16 PluginInteraction (au.gov.asd.tac.constellation.plugins.PluginInteraction)15 IntegerParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.IntegerParameterType.IntegerParameterValue)13 ReadableGraph (au.gov.asd.tac.constellation.graph.ReadableGraph)12 SchemaTransactionType (au.gov.asd.tac.constellation.graph.schema.type.SchemaTransactionType)11 ParameterChange (au.gov.asd.tac.constellation.plugins.parameters.ParameterChange)11 Graph (au.gov.asd.tac.constellation.graph.Graph)10 Plugin (au.gov.asd.tac.constellation.plugins.Plugin)10 BooleanParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.BooleanParameterType.BooleanParameterValue)10 HashMap (java.util.HashMap)10 PluginException (au.gov.asd.tac.constellation.plugins.PluginException)9 List (java.util.List)9 GraphWriteMethods (au.gov.asd.tac.constellation.graph.GraphWriteMethods)8 StringParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.StringParameterValue)8