Search in sources :

Example 91 with Attribute

use of au.gov.asd.tac.constellation.graph.Attribute in project constellation by constellation-app.

the class ActiveTableReferenceNGTest method updateVisibleColumnsReplace.

@Test
public void updateVisibleColumnsReplace() {
    try (MockedStatic<PluginExecution> pluginExecutionMockedStatic = Mockito.mockStatic(PluginExecution.class)) {
        final Graph graph = mock(Graph.class);
        final Attribute attribute = mock(Attribute.class);
        final PluginExecution pluginExecution = mock(PluginExecution.class);
        final List<Tuple<String, Attribute>> paramColumnAttributes = List.of(Tuple.create("paramAttr", attribute));
        final List<Tuple<String, Attribute>> stateColumnAttributes = List.of(Tuple.create("stateAttr1", attribute), Tuple.create("stateAttr2", attribute));
        final TableViewState tableViewState = new TableViewState();
        tableViewState.setColumnAttributes(stateColumnAttributes);
        pluginExecutionMockedStatic.when(() -> PluginExecution.withPlugin(any(Plugin.class))).thenAnswer(executeUpdateStatePlugin(pluginExecution, tableViewState, List.of(Tuple.create("paramAttr", attribute))));
        activeTableReference.updateVisibleColumns(graph, tableViewState, paramColumnAttributes, UpdateMethod.REPLACE);
        verify(pluginExecution).executeLater(graph);
    }
}
Also used : PluginExecution(au.gov.asd.tac.constellation.plugins.PluginExecution) Graph(au.gov.asd.tac.constellation.graph.Graph) Attribute(au.gov.asd.tac.constellation.graph.Attribute) TableViewState(au.gov.asd.tac.constellation.views.tableview.state.TableViewState) Tuple(au.gov.asd.tac.constellation.utilities.datastructure.Tuple) Plugin(au.gov.asd.tac.constellation.plugins.Plugin) UpdateStatePlugin(au.gov.asd.tac.constellation.views.tableview.plugins.UpdateStatePlugin) Test(org.testng.annotations.Test)

Example 92 with Attribute

use of au.gov.asd.tac.constellation.graph.Attribute in project constellation by constellation-app.

the class PermanentMergePanel method populateTableRow.

/**
 * populate table row with attributes for the specified row
 *
 * @param vxId node id
 */
private Object[] populateTableRow(final ReadableGraph graph, final int vxId) {
    Object[] row = new Object[nodeAttrbiutes.size() + 1];
    row[0] = true;
    row[1] = Integer.toString(vxId);
    for (int i = 2; i < nodeAttrbiutes.size(); i++) {
        Attribute attr = nodeAttrbiutes.get(i);
        if (!attr.getName().equalsIgnoreCase(SELECTED_COLUMN)) {
            row[i] = graph.getStringValue(attr.getId(), vxId);
        }
    }
    return row;
}
Also used : GraphAttribute(au.gov.asd.tac.constellation.graph.GraphAttribute) Attribute(au.gov.asd.tac.constellation.graph.Attribute)

Example 93 with Attribute

use of au.gov.asd.tac.constellation.graph.Attribute in project constellation by constellation-app.

the class AttributeList method createDefinition.

/**
 * Create an {@code ImportDefinition} from attributes modified on the
 * attribute list
 *
 * @param importDefinition the {@link ImportDefinition} that will hold the
 * new {@link ImportAttributeDefinition}s.
 */
public void createDefinition(final ImportDefinition importDefinition) {
    attributeNodes.values().stream().filter(attributeNode -> (attributeNode.getColumn() == null)).forEachOrdered(attributeNode -> {
        final String defaultValue = attributeNode.getDefaultValue();
        final AttributeTranslator translator = attributeNode.getTranslator();
        if (defaultValue != null || (translator != null && !(translator instanceof DefaultAttributeTranslator))) {
            final ImportAttributeDefinition attributeDefinition = new ImportAttributeDefinition(defaultValue, attributeNode.getAttribute(), attributeNode.getTranslator(), attributeNode.getTranslatorParameters());
            importDefinition.addDefinition(attributeType, attributeDefinition);
        }
    });
}
Also used : Pos(javafx.geometry.Pos) DefaultAttributeTranslator(au.gov.asd.tac.constellation.plugins.importexport.translator.DefaultAttributeTranslator) Iterator(java.util.Iterator) Node(javafx.scene.Node) MouseEvent(javafx.scene.input.MouseEvent) Set(java.util.Set) AttributeTranslator(au.gov.asd.tac.constellation.plugins.importexport.translator.AttributeTranslator) HashMap(java.util.HashMap) VBox(javafx.scene.layout.VBox) HashSet(java.util.HashSet) Insets(javafx.geometry.Insets) Map(java.util.Map) Entry(java.util.Map.Entry) Point2D(javafx.geometry.Point2D) Attribute(au.gov.asd.tac.constellation.graph.Attribute) ObservableList(javafx.collections.ObservableList) DefaultAttributeTranslator(au.gov.asd.tac.constellation.plugins.importexport.translator.DefaultAttributeTranslator) AttributeTranslator(au.gov.asd.tac.constellation.plugins.importexport.translator.AttributeTranslator) DefaultAttributeTranslator(au.gov.asd.tac.constellation.plugins.importexport.translator.DefaultAttributeTranslator)

Example 94 with Attribute

use of au.gov.asd.tac.constellation.graph.Attribute in project constellation by constellation-app.

the class ConfigurationPane method getAllocatedAttributes.

/**
 * Returns a combined collection of all attributes that have been allocated
 * to a column in any run.
 *
 * @return a combined collection of all attributes that have been allocated
 * to a column in any run.
 */
public Collection<Attribute> getAllocatedAttributes() {
    final List<Attribute> allocatedAttributes = new ArrayList<>();
    for (final Tab tab : tabPane.getTabs()) {
        final RunPane runPane = (RunPane) tab.getContent();
        allocatedAttributes.addAll(runPane.getAllocatedAttributes());
    }
    return allocatedAttributes;
}
Also used : Tab(javafx.scene.control.Tab) Attribute(au.gov.asd.tac.constellation.graph.Attribute) ArrayList(java.util.ArrayList)

Aggregations

Attribute (au.gov.asd.tac.constellation.graph.Attribute)94 GraphAttribute (au.gov.asd.tac.constellation.graph.GraphAttribute)55 ArrayList (java.util.ArrayList)30 Test (org.testng.annotations.Test)23 GraphElementType (au.gov.asd.tac.constellation.graph.GraphElementType)18 ReadableGraph (au.gov.asd.tac.constellation.graph.ReadableGraph)15 TableViewState (au.gov.asd.tac.constellation.views.tableview.state.TableViewState)13 Graph (au.gov.asd.tac.constellation.graph.Graph)12 BasicFindReplaceParameters (au.gov.asd.tac.constellation.views.find2.utilities.BasicFindReplaceParameters)9 JsonNode (com.fasterxml.jackson.databind.JsonNode)8 ObservableList (javafx.collections.ObservableList)8 GraphWriteMethods (au.gov.asd.tac.constellation.graph.GraphWriteMethods)7 Column (au.gov.asd.tac.constellation.views.tableview.api.Column)7 TableColumn (javafx.scene.control.TableColumn)7 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)6 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)6 WritableGraph (au.gov.asd.tac.constellation.graph.WritableGraph)5 GraphManager (au.gov.asd.tac.constellation.graph.manager.GraphManager)5 Tuple (au.gov.asd.tac.constellation.utilities.datastructure.Tuple)5 JsonFactory (com.fasterxml.jackson.core.JsonFactory)5