Search in sources :

Example 16 with SchemaAttribute

use of au.gov.asd.tac.constellation.graph.schema.attribute.SchemaAttribute in project constellation by constellation-app.

the class VisualConceptNGTest method testVisualAttributesRegistered.

/**
 * Test whether all the attributes of VisualConcept are registered in the Visual Schema
 */
@Test
public void testVisualAttributesRegistered() {
    System.out.println("visualAttributesRegistered");
    final SchemaFactory schemaFactory = SchemaFactoryUtilities.getSchemaFactory(VisualSchemaFactory.VISUAL_SCHEMA_ID);
    final List<SchemaAttribute> registeredAttributes = new ArrayList<>();
    for (final Map<String, SchemaAttribute> graphElementAttributes : schemaFactory.getRegisteredAttributes().values()) {
        registeredAttributes.addAll(graphElementAttributes.values());
    }
    final VisualConcept instance = new VisualConcept();
    final Collection<SchemaAttribute> visualAttributes = instance.getSchemaAttributes();
    for (final SchemaAttribute visualAttribute : visualAttributes) {
        assertTrue(registeredAttributes.contains(visualAttribute));
    }
}
Also used : VisualSchemaFactory(au.gov.asd.tac.constellation.graph.schema.visual.VisualSchemaFactory) SchemaFactory(au.gov.asd.tac.constellation.graph.schema.SchemaFactory) ArrayList(java.util.ArrayList) SchemaAttribute(au.gov.asd.tac.constellation.graph.schema.attribute.SchemaAttribute) Test(org.testng.annotations.Test)

Example 17 with SchemaAttribute

use of au.gov.asd.tac.constellation.graph.schema.attribute.SchemaAttribute in project constellation by constellation-app.

the class MultiAttributeUpdateComponent method updateAttributes.

/**
 * Set the attributes of interest, thereby ensuring this component will
 * update in response to changes in the values of the attributes on the
 * current graph.
 *
 * @param attributes A list of the SchemaAttributes of interest
 * @param lock Whether or not to lock the update controller so that the
 * update cycle can't begin while the attributes are being set.
 */
public void updateAttributes(List<SchemaAttribute> attributes, boolean lock) {
    if (lock) {
        graphUpdateController.getUpdateController().lock();
    }
    try {
        int attributeCount = 0;
        for (SchemaAttribute attribute : attributes) {
            if (attributeUpdateComponents.size() <= attributeCount) {
                AttributeUpdateComponent attributeUpdateComponent = graphUpdateController.createAttributeUpdateComponent(attribute, false);
                attributeUpdateComponents.add(attributeUpdateComponent);
                dependOn(attributeUpdateComponent);
            } else {
                attributeUpdateComponents.get(attributeCount).setAttribute(attribute, false);
            }
            attributeCount++;
        }
        while (attributeCount < attributeUpdateComponents.size()) {
            attributeUpdateComponents.get(attributeCount++).disable(false);
        }
    } finally {
        if (lock) {
            graphUpdateController.getUpdateController().release();
        }
    }
}
Also used : AttributeUpdateComponent(au.gov.asd.tac.constellation.plugins.update.GraphUpdateController.AttributeUpdateComponent) SchemaAttribute(au.gov.asd.tac.constellation.graph.schema.attribute.SchemaAttribute)

Aggregations

SchemaAttribute (au.gov.asd.tac.constellation.graph.schema.attribute.SchemaAttribute)17 SchemaFactory (au.gov.asd.tac.constellation.graph.schema.SchemaFactory)9 GraphElementType (au.gov.asd.tac.constellation.graph.GraphElementType)7 ArrayList (java.util.ArrayList)6 Graph (au.gov.asd.tac.constellation.graph.Graph)5 List (java.util.List)5 ReadableGraph (au.gov.asd.tac.constellation.graph.ReadableGraph)3 StoreGraph (au.gov.asd.tac.constellation.graph.StoreGraph)3 SchemaFactoryUtilities (au.gov.asd.tac.constellation.graph.schema.SchemaFactoryUtilities)3 VisualConcept (au.gov.asd.tac.constellation.graph.schema.visual.concept.VisualConcept)3 Attribute (au.gov.asd.tac.constellation.graph.Attribute)2 GraphAttribute (au.gov.asd.tac.constellation.graph.GraphAttribute)2 GraphManager (au.gov.asd.tac.constellation.graph.manager.GraphManager)2 Schema (au.gov.asd.tac.constellation.graph.schema.Schema)2 AnalyticConcept (au.gov.asd.tac.constellation.graph.schema.analytic.concept.AnalyticConcept)2 SchemaConcept (au.gov.asd.tac.constellation.graph.schema.concept.SchemaConcept)2 SchemaTransactionType (au.gov.asd.tac.constellation.graph.schema.type.SchemaTransactionType)2 SchemaTransactionTypeUtilities (au.gov.asd.tac.constellation.graph.schema.type.SchemaTransactionTypeUtilities)2 VisualSchemaFactory (au.gov.asd.tac.constellation.graph.schema.visual.VisualSchemaFactory)2 SchemaUpdateProvider (au.gov.asd.tac.constellation.graph.versioning.SchemaUpdateProvider)2