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