Search in sources :

Example 1 with PropertyDefinition

use of de.catma.tag.PropertyDefinition in project catma by forTEXT.

the class TeiUserMarkupCollectionDeserializer method addProperties.

private void addProperties(TagDefinition tagDefinition, AddPropertyHandler addPropertyHandler, Nodes propertyElements) {
    for (int i = 0; i < propertyElements.size(); i++) {
        try {
            TeiElement curPropertyElement = (TeiElement) propertyElements.get(i);
            PropertyDefinition propertyDefinition = tagDefinition.getPropertyDefinition(curPropertyElement.getAttributeValue(Attribute.f_name));
            if (curPropertyElement.getChildElements().size() == 0) {
                addPropertyHandler.addProperty(new Property(propertyDefinition.getUuid(), Collections.emptyList()));
            } else {
                TeiElement valueElement = (TeiElement) curPropertyElement.getChildElements().get(0);
                if (valueElement.is(TeiElementName.numeric)) {
                    addPropertyHandler.addProperty(new Property(propertyDefinition.getUuid(), new NumericPropertyValueFactory(curPropertyElement).getValueAsList()));
                } else if (valueElement.is(TeiElementName.string)) {
                    StringPropertyValueFactory stringPropFact = new StringPropertyValueFactory(curPropertyElement);
                    if (!stringPropFact.getValue().trim().isEmpty()) {
                        addPropertyHandler.addProperty(new Property(propertyDefinition.getUuid(), stringPropFact.getValueAsList()));
                    }
                } else if (valueElement.is(TeiElementName.vRange)) {
                    TeiElement vColl = (TeiElement) valueElement.getChildElements().get(0);
                    if (vColl.hasChildElements()) {
                        List<String> valueList = new ArrayList<String>();
                        for (int j = 0; j < vColl.getChildElements().size(); j++) {
                            valueList.add(new StringPropertyValueFactory(vColl, j).getValue());
                        }
                        addPropertyHandler.addProperty(new Property(propertyDefinition.getUuid(), valueList));
                    }
                } else {
                    throw new UnknownElementException(valueElement.getLocalName() + " is not supported!");
                }
            }
        } catch (UnknownElementException ue) {
            logger.log(Level.SEVERE, "error adding properties", ue);
        }
    }
}
Also used : ArrayList(java.util.ArrayList) PropertyDefinition(de.catma.tag.PropertyDefinition) Property(de.catma.tag.Property)

Example 2 with PropertyDefinition

use of de.catma.tag.PropertyDefinition in project catma by forTEXT.

the class XmlMarkupCollectionSerializationHandler method scanElements.

private void scanElements(StringBuilder contentBuilder, Element element, Stack<String> elementStack, TagManager tagManager, TagLibrary tagLibrary, Map<String, String> namespacePrefixToTagsetIdMap, AnnotationCollection userMarkupCollection, String docId, int docLength) throws Exception {
    int start = contentBuilder.length();
    StringBuilder pathBuilder = new StringBuilder();
    for (int j = 0; j < elementStack.size(); j++) {
        pathBuilder.append("/" + elementStack.get(j));
    }
    String parentPath = pathBuilder.toString();
    elementStack.push(element.getLocalName());
    String path = parentPath + "/" + elementStack.peek();
    String tagName = element.getLocalName();
    String prefix = element.getNamespacePrefix();
    String tagsetId = namespacePrefixToTagsetIdMap.get(prefix);
    if (tagsetId == null) {
        tagsetId = KnownTagsetDefinitionName.DEFAULT_INTRINSIC_XML.asTagsetId();
    }
    TagsetDefinition tagset = tagLibrary.getTagsetDefinition(tagsetId);
    String tagId = idGenerator.generate();
    TagDefinition tagDefinition = tagset.getTagDefinitionsByName(tagName).findFirst().orElse(null);
    String pathPropertyDefId = null;
    if (tagDefinition == null) {
        tagDefinition = new TagDefinition(tagId, elementStack.peek(), // no parent, hierarchy is collected in annotation property
        null, tagsetId);
        tagDefinition.addSystemPropertyDefinition(new PropertyDefinition(idGenerator.generate(PropertyDefinition.SystemPropertyName.catma_displaycolor.name()), PropertyDefinition.SystemPropertyName.catma_displaycolor.name(), Collections.singletonList(ColorConverter.toRGBIntAsString(ColorConverter.randomHex()))));
        tagDefinition.addSystemPropertyDefinition(new PropertyDefinition(idGenerator.generate(PropertyDefinition.SystemPropertyName.catma_markupauthor.name()), PropertyDefinition.SystemPropertyName.catma_markupauthor.name(), Collections.singletonList(author)));
        pathPropertyDefId = idGenerator.generate();
        PropertyDefinition pathDef = new PropertyDefinition(pathPropertyDefId, "path", Collections.emptyList());
        tagDefinition.addUserDefinedPropertyDefinition(pathDef);
        tagManager.addTagDefinition(tagset, tagDefinition);
    } else {
        pathPropertyDefId = tagDefinition.getPropertyDefinition("path").getUuid();
    }
    for (int idx = 0; idx < element.getChildCount(); idx++) {
        Node curChild = element.getChild(idx);
        if (curChild instanceof Text) {
            xmlContentHandler.addTextContent(contentBuilder, element, curChild.getValue());
        } else if (curChild instanceof Element) {
            // descent
            scanElements(contentBuilder, (Element) curChild, elementStack, tagManager, tagLibrary, namespacePrefixToTagsetIdMap, userMarkupCollection, docId, docLength);
        }
    }
    if (element.getChildCount() != 0) {
        xmlContentHandler.addBreak(contentBuilder, element);
    }
    int end = contentBuilder.length();
    Range range = new Range(start, end);
    if (range.isSinglePoint()) {
        int newStart = range.getStartPoint();
        if (newStart > 0) {
            newStart = newStart - 1;
        }
        int newEnd = range.getEndPoint();
        if (newEnd < docLength - 1) {
            newEnd = newEnd + 1;
        }
        range = new Range(newStart, newEnd);
    }
    TagInstance tagInstance = new TagInstance(idGenerator.generate(), tagDefinition.getUuid(), author, ZonedDateTime.now().format(DateTimeFormatter.ofPattern(Version.DATETIMEPATTERN)), tagDefinition.getUserDefinedPropertyDefinitions(), tagDefinition.getTagsetDefinitionUuid());
    for (int i = 0; i < element.getAttributeCount(); i++) {
        PropertyDefinition propertyDefinition = tagDefinition.getPropertyDefinition(element.getAttribute(i).getQualifiedName());
        if (propertyDefinition == null) {
            propertyDefinition = new PropertyDefinition(idGenerator.generate(), element.getAttribute(i).getQualifiedName(), Collections.singleton(element.getAttribute(i).getValue()));
            tagManager.addUserDefinedPropertyDefinition(tagDefinition, propertyDefinition);
        } else if (!propertyDefinition.getPossibleValueList().contains(element.getAttribute(i).getValue())) {
            List<String> newValueList = new ArrayList<>();
            newValueList.addAll(propertyDefinition.getPossibleValueList());
            newValueList.add(element.getAttribute(i).getValue());
            propertyDefinition.setPossibleValueList(newValueList);
        }
        Property property = new Property(propertyDefinition.getUuid(), Collections.singleton(element.getAttribute(i).getValue()));
        tagInstance.addUserDefinedProperty(property);
    }
    Property pathProperty = new Property(pathPropertyDefId, Collections.singletonList(path));
    tagInstance.addUserDefinedProperty(pathProperty);
    TagReference tagReference = new TagReference(tagInstance, docId, range, userMarkupCollection.getId());
    userMarkupCollection.addTagReference(tagReference);
    elementStack.pop();
}
Also used : TagDefinition(de.catma.tag.TagDefinition) Node(nu.xom.Node) Element(nu.xom.Element) Text(nu.xom.Text) Range(de.catma.document.Range) PropertyDefinition(de.catma.tag.PropertyDefinition) TagsetDefinition(de.catma.tag.TagsetDefinition) TagInstance(de.catma.tag.TagInstance) ArrayList(java.util.ArrayList) List(java.util.List) TagReference(de.catma.document.annotation.TagReference) Property(de.catma.tag.Property)

Example 3 with PropertyDefinition

use of de.catma.tag.PropertyDefinition in project catma by forTEXT.

the class TagsView method initListeners.

private void initListeners() {
    tagChangedListener = new PropertyChangeListener() {

        @SuppressWarnings("unchecked")
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            Object newValue = evt.getNewValue();
            Object oldValue = evt.getOldValue();
            if (oldValue == null) {
                // created
                Pair<TagsetDefinition, TagDefinition> value = (Pair<TagsetDefinition, TagDefinition>) newValue;
                TagsetDefinition tagset = value.getFirst();
                TagDefinition tag = value.getSecond();
                if (tag.getParentUuid().isEmpty()) {
                    tagsetData.getRootItems().stream().map(tagsetTreeItem -> (TagsetDataItem) tagsetTreeItem).filter(tagsetDataItem -> tagsetDataItem.getTagset().getUuid().equals(tagset.getUuid())).findFirst().ifPresent(tagsetDataItem -> {
                        TagDataItem tagDataItem = new TagDataItem(tag, tagsetDataItem.isEditable());
                        if (!tagsetData.contains(tagDataItem)) {
                            tagsetData.addItem(tagsetDataItem, tagDataItem);
                            tagsetDataProvider.refreshAll();
                            tagsetGrid.expand(tagsetDataItem);
                        }
                    });
                } else {
                    tagsetData.getRootItems().stream().map(tagsetTreeItem -> (TagsetDataItem) tagsetTreeItem).filter(tagsetDataItem -> tagsetDataItem.getTagset().getUuid().equals(tagset.getUuid())).findFirst().ifPresent(tagsetDataItem -> {
                        TagDataItem tagDataItem = new TagDataItem(tag, tagsetDataItem.isEditable());
                        if (!tagsetData.contains(tagDataItem)) {
                            TagDefinition parentTag = project.getTagManager().getTagLibrary().getTagDefinition(tag.getParentUuid());
                            TagsetTreeItem parentTagItem = new TagDataItem(parentTag, tagsetDataItem.isEditable());
                            tagsetData.addItem(parentTagItem, tagDataItem);
                            tagsetDataProvider.refreshAll();
                            tagsetGrid.expand(parentTagItem);
                        }
                    });
                }
            } else if (newValue == null) {
                // removed
                Pair<TagsetDefinition, TagDefinition> deleted = (Pair<TagsetDefinition, TagDefinition>) oldValue;
                TagDefinition deletedTag = deleted.getSecond();
                tagsetData.removeItem(new TagDataItem(deletedTag, true));
                tagsetDataProvider.refreshAll();
                tagsetGrid.deselectAll();
            } else {
                // update
                TagDefinition tag = (TagDefinition) newValue;
                TagsetDefinition tagset = (TagsetDefinition) oldValue;
                tagsetData.getRootItems().stream().map(tagsetTreeItem -> (TagsetDataItem) tagsetTreeItem).filter(tagsetDataItem -> tagsetDataItem.getTagset().getUuid().equals(tagset.getUuid())).findFirst().ifPresent(tagsetDataItem -> {
                    TagDataItem oldItem = new TagDataItem(tag, tagsetDataItem.isEditable());
                    String parentTagId = tag.getParentUuid();
                    TagsetTreeItem parent = tagsetDataItem;
                    if (!parentTagId.isEmpty()) {
                        parent = new TagDataItem(tagset.getTagDefinition(parentTagId), tagsetDataItem.isEditable());
                    }
                    tagsetData.removeItem(oldItem);
                    TagDataItem tagDataItem = new TagDataItem(tag, tagsetDataItem.isEditable());
                    tagDataItem.setPropertiesExpanded(true);
                    tagsetData.addItem(parent, tagDataItem);
                    addTagSubTree(tagset, tag, tagDataItem);
                    // TODO: sort
                    tagsetDataProvider.refreshAll();
                    showExpandedProperties(tagDataItem);
                });
            }
        }
    };
    project.getTagManager().addPropertyChangeListener(TagManagerEvent.tagDefinitionChanged, tagChangedListener);
    propertyDefinitionChangedListener = new PropertyChangeListener() {

        @SuppressWarnings("unchecked")
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            Object newValue = evt.getNewValue();
            Object oldValue = evt.getOldValue();
            TagDefinition tag = null;
            if (oldValue == null) {
                // created
                Pair<PropertyDefinition, TagDefinition> newData = (Pair<PropertyDefinition, TagDefinition>) newValue;
                tag = newData.getSecond();
            } else if (newValue == null) {
                // removed
                Pair<PropertyDefinition, Pair<TagDefinition, TagsetDefinition>> oldData = (Pair<PropertyDefinition, Pair<TagDefinition, TagsetDefinition>>) oldValue;
                tag = oldData.getSecond().getFirst();
            } else {
                // update
                tag = (TagDefinition) oldValue;
            }
            TagsetTreeItem parentItem = null;
            if (tag.getParentUuid().isEmpty()) {
                parentItem = new TagsetDataItem(project.getTagManager().getTagLibrary().getTagsetDefinition(tag.getTagsetDefinitionUuid()));
            } else {
                parentItem = new TagDataItem(project.getTagManager().getTagLibrary().getTagDefinition(tag.getParentUuid()));
            }
            final String tagId = tag.getUuid();
            tagsetData.getChildren(parentItem).stream().map(tagsetTreeItem -> (TagDataItem) tagsetTreeItem).filter(tagDataItem -> tagDataItem.getTag().getUuid().equals(tagId)).findFirst().ifPresent(tagDataItem -> {
                tagDataItem.setPropertiesExpanded(false);
                hideExpandedProperties(tagDataItem);
                tagDataItem.setPropertiesExpanded(true);
                showExpandedProperties(tagDataItem);
            });
            tagsetDataProvider.refreshAll();
            tagsetGrid.deselectAll();
        }
    };
    project.getTagManager().addPropertyChangeListener(TagManagerEvent.userPropertyDefinitionChanged, propertyDefinitionChangedListener);
}
Also used : ArrayListMultimap(com.google.common.collect.ArrayListMultimap) PropertyDefinition(de.catma.tag.PropertyDefinition) UI(com.vaadin.ui.UI) ConfirmDialog(org.vaadin.dialogs.ConfirmDialog) Multimap(com.google.common.collect.Multimap) ActionGridComponent(de.catma.ui.component.actiongrid.ActionGridComponent) SearchFilterProvider(de.catma.ui.component.actiongrid.SearchFilterProvider) ArrayList(java.util.ArrayList) EventBus(com.google.common.eventbus.EventBus) MaterialTheme(com.github.appreciated.material.MaterialTheme) Notification(com.vaadin.ui.Notification) ErrorHandler(de.catma.ui.module.main.ErrorHandler) Label(com.vaadin.ui.Label) TagsetDefinition(de.catma.tag.TagsetDefinition) SliderPanel(org.vaadin.sliderpanel.SliderPanel) TreeDataProvider(com.vaadin.data.provider.TreeDataProvider) Pair(de.catma.util.Pair) Version(de.catma.tag.Version) TreeGridFactory(de.catma.ui.component.TreeGridFactory) IDGenerator(de.catma.util.IDGenerator) ButtonRenderer(com.vaadin.ui.renderers.ButtonRenderer) SaveCancelListener(de.catma.ui.dialog.SaveCancelListener) PropertyChangeEvent(java.beans.PropertyChangeEvent) TreeData(com.vaadin.data.TreeData) Project(de.catma.project.Project) Collection(java.util.Collection) Set(java.util.Set) IOException(java.io.IOException) TreeGrid(com.vaadin.ui.TreeGrid) Collectors(java.util.stream.Collectors) TagManagerEvent(de.catma.tag.TagManager.TagManagerEvent) ContextMenu(com.vaadin.contextmenu.ContextMenu) List(java.util.List) Type(com.vaadin.ui.Notification.Type) RendererClickEvent(com.vaadin.ui.renderers.ClickableRenderer.RendererClickEvent) PropertyChangeListener(java.beans.PropertyChangeListener) HorizontalLayout(com.vaadin.ui.HorizontalLayout) TagDefinition(de.catma.tag.TagDefinition) SerializablePredicate(com.vaadin.server.SerializablePredicate) Optional(java.util.Optional) HtmlRenderer(com.vaadin.ui.renderers.HtmlRenderer) SingleTextInputDialog(de.catma.ui.dialog.SingleTextInputDialog) SliderPanelBuilder(org.vaadin.sliderpanel.SliderPanelBuilder) SelectionMode(com.vaadin.ui.Grid.SelectionMode) StyleGenerator(com.vaadin.ui.StyleGenerator) RBACPermission(de.catma.rbac.RBACPermission) SliderMode(org.vaadin.sliderpanel.client.SliderMode) HugeCard(de.catma.ui.component.hugecard.HugeCard) TagDefinition(de.catma.tag.TagDefinition) PropertyChangeEvent(java.beans.PropertyChangeEvent) PropertyChangeListener(java.beans.PropertyChangeListener) PropertyDefinition(de.catma.tag.PropertyDefinition) TagsetDefinition(de.catma.tag.TagsetDefinition) Pair(de.catma.util.Pair)

Example 4 with PropertyDefinition

use of de.catma.tag.PropertyDefinition in project catma by forTEXT.

the class TagsView method handleAddPropertyRequest.

private void handleAddPropertyRequest() {
    final List<TagDefinition> targetTags = new ArrayList<>();
    if (tagsetGrid.getSelectedItems().size() == 1) {
        TagsetTreeItem selectedItem = tagsetGrid.getSelectedItems().iterator().next();
        while (!(selectedItem instanceof TagDataItem) && (selectedItem != null)) {
            selectedItem = tagsetData.getParent(selectedItem);
        }
        if (selectedItem != null) {
            targetTags.add(((TagDataItem) selectedItem).getTag());
        }
    } else {
        targetTags.addAll(tagsetGrid.getSelectedItems().stream().filter(tagsetTreeItem -> tagsetTreeItem instanceof TagDataItem).map(tagsetTreeItem -> ((TagDataItem) tagsetTreeItem).getTag()).collect(Collectors.toList()));
    }
    if (targetTags.isEmpty()) {
        Notification.show("Info", "Please select one ore more Tags first!", Type.TRAY_NOTIFICATION);
    } else {
        for (TagDefinition targetTag : targetTags) {
            if (!project.hasPermission(project.getRoleForTagset(targetTag.getTagsetDefinitionUuid()), RBACPermission.TAGSET_WRITE)) {
                Notification.show("Info", String.format("You do not have the permission to make changes to the Tagset of Tag %1$s, " + "Please contact the Project maintainer!", targetTag.getName()), Type.HUMANIZED_MESSAGE);
                return;
            }
        }
        Multimap<String, PropertyDefinition> propertiesByName = ArrayListMultimap.create();
        for (TagDefinition tag : targetTags) {
            for (PropertyDefinition propertyDef : tag.getUserDefinedPropertyDefinitions()) {
                if (!propertiesByName.containsKey(propertyDef.getName()) || propertiesByName.get(propertyDef.getName()).iterator().next().getPossibleValueList().equals(propertyDef.getPossibleValueList())) {
                    propertiesByName.put(propertyDef.getName(), propertyDef);
                }
            }
        }
        List<PropertyDefinition> commonProperties = propertiesByName.asMap().entrySet().stream().filter(entry -> entry.getValue().size() == targetTags.size()).map(entry -> new PropertyDefinition(entry.getValue().iterator().next())).collect(Collectors.toList());
        // just a single tag's properties or is it a bulk(>1) edit?
        final boolean bulkEdit = targetTags.size() > 1;
        AddEditPropertyDialog addPropertyDialog = new AddEditPropertyDialog(bulkEdit, commonProperties, new SaveCancelListener<List<PropertyDefinition>>() {

            @Override
            public void savePressed(List<PropertyDefinition> result) {
                if (bulkEdit) {
                    handleBulkEditProperties(result, commonProperties, targetTags);
                } else {
                    handleSingleEditProperties(result, targetTags.iterator().next());
                }
            }
        });
        addPropertyDialog.show();
    }
}
Also used : ArrayListMultimap(com.google.common.collect.ArrayListMultimap) PropertyDefinition(de.catma.tag.PropertyDefinition) UI(com.vaadin.ui.UI) ConfirmDialog(org.vaadin.dialogs.ConfirmDialog) Multimap(com.google.common.collect.Multimap) ActionGridComponent(de.catma.ui.component.actiongrid.ActionGridComponent) SearchFilterProvider(de.catma.ui.component.actiongrid.SearchFilterProvider) ArrayList(java.util.ArrayList) EventBus(com.google.common.eventbus.EventBus) MaterialTheme(com.github.appreciated.material.MaterialTheme) Notification(com.vaadin.ui.Notification) ErrorHandler(de.catma.ui.module.main.ErrorHandler) Label(com.vaadin.ui.Label) TagsetDefinition(de.catma.tag.TagsetDefinition) SliderPanel(org.vaadin.sliderpanel.SliderPanel) TreeDataProvider(com.vaadin.data.provider.TreeDataProvider) Pair(de.catma.util.Pair) Version(de.catma.tag.Version) TreeGridFactory(de.catma.ui.component.TreeGridFactory) IDGenerator(de.catma.util.IDGenerator) ButtonRenderer(com.vaadin.ui.renderers.ButtonRenderer) SaveCancelListener(de.catma.ui.dialog.SaveCancelListener) PropertyChangeEvent(java.beans.PropertyChangeEvent) TreeData(com.vaadin.data.TreeData) Project(de.catma.project.Project) Collection(java.util.Collection) Set(java.util.Set) IOException(java.io.IOException) TreeGrid(com.vaadin.ui.TreeGrid) Collectors(java.util.stream.Collectors) TagManagerEvent(de.catma.tag.TagManager.TagManagerEvent) ContextMenu(com.vaadin.contextmenu.ContextMenu) List(java.util.List) Type(com.vaadin.ui.Notification.Type) RendererClickEvent(com.vaadin.ui.renderers.ClickableRenderer.RendererClickEvent) PropertyChangeListener(java.beans.PropertyChangeListener) HorizontalLayout(com.vaadin.ui.HorizontalLayout) TagDefinition(de.catma.tag.TagDefinition) SerializablePredicate(com.vaadin.server.SerializablePredicate) Optional(java.util.Optional) HtmlRenderer(com.vaadin.ui.renderers.HtmlRenderer) SingleTextInputDialog(de.catma.ui.dialog.SingleTextInputDialog) SliderPanelBuilder(org.vaadin.sliderpanel.SliderPanelBuilder) SelectionMode(com.vaadin.ui.Grid.SelectionMode) StyleGenerator(com.vaadin.ui.StyleGenerator) RBACPermission(de.catma.rbac.RBACPermission) SliderMode(org.vaadin.sliderpanel.client.SliderMode) HugeCard(de.catma.ui.component.hugecard.HugeCard) TagDefinition(de.catma.tag.TagDefinition) ArrayList(java.util.ArrayList) PropertyDefinition(de.catma.tag.PropertyDefinition) ArrayList(java.util.ArrayList) List(java.util.List)

Example 5 with PropertyDefinition

use of de.catma.tag.PropertyDefinition in project catma by forTEXT.

the class TagsView method handleBulkEditProperties.

private void handleBulkEditProperties(List<PropertyDefinition> editedProperties, List<PropertyDefinition> commonProperties, List<TagDefinition> targetTags) {
    final Set<String> availableCommonPropertyNames = editedProperties.stream().map(propertyDef -> propertyDef.getName()).collect(Collectors.toSet());
    final Set<String> deletedCommonProperyNames = commonProperties.stream().map(propertyDef -> propertyDef.getName()).filter(name -> !availableCommonPropertyNames.contains(name)).collect(Collectors.toSet());
    for (TagDefinition tag : targetTags) {
        TagsetDefinition tagset = project.getTagManager().getTagLibrary().getTagsetDefinition(tag);
        for (PropertyDefinition existingPropertyDef : new ArrayList<>(tag.getUserDefinedPropertyDefinitions())) {
            // handle deleted PropertyDefs
            if (deletedCommonProperyNames.contains(existingPropertyDef.getName())) {
                project.getTagManager().removeUserDefinedPropertyDefinition(existingPropertyDef, tag, tagset);
            } else // handle updated PropertyDefs
            if (availableCommonPropertyNames.contains(existingPropertyDef.getName())) {
                editedProperties.stream().filter(possiblyChangedPd -> possiblyChangedPd.getName().equals(existingPropertyDef.getName())).findFirst().ifPresent(possiblyChangedPd -> existingPropertyDef.setPossibleValueList(possiblyChangedPd.getPossibleValueList()));
                project.getTagManager().updateUserDefinedPropertyDefinition(tag, existingPropertyDef);
            }
        }
        // handle created PropertyDefs
        for (PropertyDefinition pd : editedProperties) {
            if (tag.getPropertyDefinition(pd.getName()) == null) {
                PropertyDefinition createdPropertyDefinition = new PropertyDefinition(pd);
                pd.setUuid(idGenerator.generate());
                project.getTagManager().addUserDefinedPropertyDefinition(tag, createdPropertyDefinition);
            }
        }
    }
}
Also used : ArrayListMultimap(com.google.common.collect.ArrayListMultimap) PropertyDefinition(de.catma.tag.PropertyDefinition) UI(com.vaadin.ui.UI) ConfirmDialog(org.vaadin.dialogs.ConfirmDialog) Multimap(com.google.common.collect.Multimap) ActionGridComponent(de.catma.ui.component.actiongrid.ActionGridComponent) SearchFilterProvider(de.catma.ui.component.actiongrid.SearchFilterProvider) ArrayList(java.util.ArrayList) EventBus(com.google.common.eventbus.EventBus) MaterialTheme(com.github.appreciated.material.MaterialTheme) Notification(com.vaadin.ui.Notification) ErrorHandler(de.catma.ui.module.main.ErrorHandler) Label(com.vaadin.ui.Label) TagsetDefinition(de.catma.tag.TagsetDefinition) SliderPanel(org.vaadin.sliderpanel.SliderPanel) TreeDataProvider(com.vaadin.data.provider.TreeDataProvider) Pair(de.catma.util.Pair) Version(de.catma.tag.Version) TreeGridFactory(de.catma.ui.component.TreeGridFactory) IDGenerator(de.catma.util.IDGenerator) ButtonRenderer(com.vaadin.ui.renderers.ButtonRenderer) SaveCancelListener(de.catma.ui.dialog.SaveCancelListener) PropertyChangeEvent(java.beans.PropertyChangeEvent) TreeData(com.vaadin.data.TreeData) Project(de.catma.project.Project) Collection(java.util.Collection) Set(java.util.Set) IOException(java.io.IOException) TreeGrid(com.vaadin.ui.TreeGrid) Collectors(java.util.stream.Collectors) TagManagerEvent(de.catma.tag.TagManager.TagManagerEvent) ContextMenu(com.vaadin.contextmenu.ContextMenu) List(java.util.List) Type(com.vaadin.ui.Notification.Type) RendererClickEvent(com.vaadin.ui.renderers.ClickableRenderer.RendererClickEvent) PropertyChangeListener(java.beans.PropertyChangeListener) HorizontalLayout(com.vaadin.ui.HorizontalLayout) TagDefinition(de.catma.tag.TagDefinition) SerializablePredicate(com.vaadin.server.SerializablePredicate) Optional(java.util.Optional) HtmlRenderer(com.vaadin.ui.renderers.HtmlRenderer) SingleTextInputDialog(de.catma.ui.dialog.SingleTextInputDialog) SliderPanelBuilder(org.vaadin.sliderpanel.SliderPanelBuilder) SelectionMode(com.vaadin.ui.Grid.SelectionMode) StyleGenerator(com.vaadin.ui.StyleGenerator) RBACPermission(de.catma.rbac.RBACPermission) SliderMode(org.vaadin.sliderpanel.client.SliderMode) HugeCard(de.catma.ui.component.hugecard.HugeCard) TagDefinition(de.catma.tag.TagDefinition) TagsetDefinition(de.catma.tag.TagsetDefinition) ArrayList(java.util.ArrayList) PropertyDefinition(de.catma.tag.PropertyDefinition)

Aggregations

PropertyDefinition (de.catma.tag.PropertyDefinition)40 TagDefinition (de.catma.tag.TagDefinition)24 ArrayList (java.util.ArrayList)20 TagsetDefinition (de.catma.tag.TagsetDefinition)18 Pair (de.catma.util.Pair)14 IDGenerator (de.catma.util.IDGenerator)13 UI (com.vaadin.ui.UI)12 Property (de.catma.tag.Property)12 IOException (java.io.IOException)12 Collection (java.util.Collection)12 List (java.util.List)12 ArrayListMultimap (com.google.common.collect.ArrayListMultimap)11 Multimap (com.google.common.collect.Multimap)11 TreeData (com.vaadin.data.TreeData)11 TreeDataProvider (com.vaadin.data.provider.TreeDataProvider)11 Project (de.catma.project.Project)11 ErrorHandler (de.catma.ui.module.main.ErrorHandler)11 PropertyChangeEvent (java.beans.PropertyChangeEvent)11 PropertyChangeListener (java.beans.PropertyChangeListener)11 Set (java.util.Set)11