use of au.gov.asd.tac.constellation.graph.attribute.interaction.AttributeValueTranslator 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();
}
Aggregations