Search in sources :

Example 1 with EditPropertyTab

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());
    }
}
Also used : EditPropertyTab(de.catma.ui.module.annotate.annotationpanel.EditPropertyTab) PropertyDefinition(de.catma.tag.PropertyDefinition) Property(de.catma.tag.Property)

Example 2 with EditPropertyTab

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");
        }
    }
}
Also used : EditPropertyTab(de.catma.ui.module.annotate.annotationpanel.EditPropertyTab) ArrayList(java.util.ArrayList) Component(com.vaadin.ui.Component) Property(de.catma.tag.Property)

Example 3 with EditPropertyTab

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));
}
Also used : EditPropertyTab(de.catma.ui.module.annotate.annotationpanel.EditPropertyTab) Component(com.vaadin.ui.Component)

Aggregations

EditPropertyTab (de.catma.ui.module.annotate.annotationpanel.EditPropertyTab)3 Component (com.vaadin.ui.Component)2 Property (de.catma.tag.Property)2 PropertyDefinition (de.catma.tag.PropertyDefinition)1 ArrayList (java.util.ArrayList)1