use of de.catma.ui.module.annotate.annotationpanel.EditPropertyTab in project catma by forTEXT.
the class PropertySelectionStep method setTag.
public void setTag(TagDefinition tag) {
propertyTabSheet.removeAllComponents();
for (PropertyDefinition propertyDef : tag.getUserDefinedPropertyDefinitions()) {
Property property = new Property(propertyDef.getUuid(), Collections.emptySet());
EditPropertyTab editPropertyTab = new EditPropertyTab(property, propertyDef.getPossibleValueList());
editPropertyTab.addSelectionListener(event -> handleSelection());
propertyTabSheet.addTab(editPropertyTab, propertyDef.getName());
}
}
use of de.catma.ui.module.annotate.annotationpanel.EditPropertyTab in project catma by forTEXT.
the class PropertySelectionStep method exit.
@Override
public void exit(boolean back) {
if (back) {
context.put(AnnotationWizardContextKey.PROPERTIES, Collections.emptyList());
} else {
List<Property> result = new ArrayList<>();
Iterator<Component> componentIterator = propertyTabSheet.iterator();
while (componentIterator.hasNext()) {
EditPropertyTab tab = (EditPropertyTab) componentIterator.next();
if (tab.isChanged()) {
Property property = tab.getProperty();
property.setPropertyValueList(tab.getPropertyValues());
result.add(property);
}
}
context.put(AnnotationWizardContextKey.PROPERTIES, result);
if (result.isEmpty()) {
progressStep.setCompleted("no values");
}
}
}
use of de.catma.ui.module.annotate.annotationpanel.EditPropertyTab in project catma by forTEXT.
the class PropertySelectionStep method handleSelection.
private void handleSelection() {
int propCount = 0;
int valueCount = 0;
Iterator<Component> componentIterator = propertyTabSheet.iterator();
while (componentIterator.hasNext()) {
EditPropertyTab tab = (EditPropertyTab) componentIterator.next();
propCount++;
valueCount += tab.getPropertyValues().size();
}
String propertyCaption = propCount > 1 ? "Properties" : "Property";
String valueCaption = valueCount > 1 ? "values" : "value";
progressStep.setCompleted(String.format("%1$d %2$s on %3$d %4$s ", valueCount, valueCaption, propCount, propertyCaption));
}
Aggregations