Search in sources :

Example 1 with AttributeValueEditOperation

use of au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.AttributeValueEditOperation in project constellation by constellation-app.

the class AttributeEditorPanel method getEditValueHandler.

private void getEditValueHandler(final AttributeData attributeData, final AttributeValueEditorFactory editorFactory, final Object[] values) {
    final Object value = values.length == 1 ? values[0] : null;
    final AbstractAttributeInteraction<?> interaction = AbstractAttributeInteraction.getInteraction(attributeData.getDataType());
    final String editType = editorFactory.getAttributeType();
    final AttributeValueTranslator fromTranslator = interaction.fromEditTranslator(editType);
    final AttributeValueTranslator toTranslator = interaction.toEditTranslator(editType);
    final ValueValidator<?> validator = interaction.fromEditValidator(editType);
    final EditOperation editOperation = new AttributeValueEditOperation(attributeData, completeWithSchemaItem.isSelected(), fromTranslator);
    final DefaultGetter<?> defaultGetter = attributeData::getDefaultValue;
    final AbstractEditor<?> editor = editorFactory.createEditor(editOperation, defaultGetter, validator, attributeData.getAttributeName(), toTranslator.translate(value));
    final AttributeEditorDialog dialog = new AttributeEditorDialog(true, editor);
    dialog.showDialog();
}
Also used : AttributeValueEditOperation(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.AttributeValueEditOperation) EditOperation(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.EditOperation) ModifyAttributeEditOperation(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.ModifyAttributeEditOperation) CreateAttributeEditOperation(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.CreateAttributeEditOperation) AttributeValueEditOperation(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.AttributeValueEditOperation) PrimaryKeyEditOperation(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.PrimaryKeyEditOperation) AttributeValueTranslator(au.gov.asd.tac.constellation.graph.attribute.interaction.AttributeValueTranslator)

Aggregations

AttributeValueTranslator (au.gov.asd.tac.constellation.graph.attribute.interaction.AttributeValueTranslator)1 AttributeValueEditOperation (au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.AttributeValueEditOperation)1 CreateAttributeEditOperation (au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.CreateAttributeEditOperation)1 EditOperation (au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.EditOperation)1 ModifyAttributeEditOperation (au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.ModifyAttributeEditOperation)1 PrimaryKeyEditOperation (au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.PrimaryKeyEditOperation)1