Search in sources :

Example 21 with TagDefinition

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

the class Page method removeTagInstances.

public void removeTagInstances(Set<TagDefinition> tagDefinitions) {
    // page needs rebuild
    pageDiv = null;
    Set<String> tagDefUUIds = new HashSet<String>();
    for (TagDefinition td : tagDefinitions) {
        tagDefUUIds.add(td.getUuid());
    }
    Iterator<Map.Entry<String, ClientTagInstance>> iterator = relativeTagInstances.entrySet().iterator();
    while (iterator.hasNext()) {
        Map.Entry<String, ClientTagInstance> entry = iterator.next();
        if (tagDefUUIds.contains(entry.getValue().getTagDefinitionID())) {
            iterator.remove();
            removeRelativeTagInstanceFromLine(entry.getKey());
        }
    }
}
Also used : TagDefinition(de.catma.tag.TagDefinition) ClientTagInstance(de.catma.ui.client.ui.tagger.shared.ClientTagInstance) HashMap(java.util.HashMap) Map(java.util.Map) HashSet(java.util.HashSet)

Example 22 with TagDefinition

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

the class AnnotationPanel method showExpandedProperties.

private void showExpandedProperties(TagDataItem tagDataItem) {
    TagDefinition tag = tagDataItem.getTag();
    PropertyDataItem lastPropertyDataItem = null;
    for (PropertyDefinition propertyDefinition : tag.getUserDefinedPropertyDefinitions()) {
        lastPropertyDataItem = new PropertyDataItem(propertyDefinition);
        tagsetGrid.getTreeData().addItem(tagDataItem, lastPropertyDataItem);
    }
    List<TagsetTreeItem> children = tagsetData.getChildren(tagDataItem).stream().filter(tagsetTreeItem -> tagsetTreeItem instanceof TagDataItem).collect(Collectors.toList());
    for (int i = children.size() - 1; i >= 0; i--) {
        tagsetData.moveAfterSibling(children.get(i), lastPropertyDataItem);
    }
    tagsetGrid.expand(tagDataItem);
}
Also used : ArrayListMultimap(com.google.common.collect.ArrayListMultimap) BackgroundServiceProvider(de.catma.backgroundservice.BackgroundServiceProvider) VerticalSplitPanel(com.vaadin.ui.VerticalSplitPanel) Alignment(com.vaadin.ui.Alignment) UI(com.vaadin.ui.UI) XmlMarkupCollectionSerializationHandler(de.catma.serialization.intrinsic.xml.XmlMarkupCollectionSerializationHandler) SearchFilterProvider(de.catma.ui.component.actiongrid.SearchFilterProvider) ErrorHandler(de.catma.ui.module.main.ErrorHandler) TreeDataProvider(com.vaadin.data.provider.TreeDataProvider) VaadinIcons(com.vaadin.icons.VaadinIcons) IconButton(de.catma.ui.component.IconButton) Collection(java.util.Collection) Set(java.util.Set) TreeGrid(com.vaadin.ui.TreeGrid) Collectors(java.util.stream.Collectors) ItemClick(com.vaadin.ui.Grid.ItemClick) TagReference(de.catma.document.annotation.TagReference) Objects(java.util.Objects) List(java.util.List) Type(com.vaadin.ui.Notification.Type) RendererClickEvent(com.vaadin.ui.renderers.ClickableRenderer.RendererClickEvent) PropertyChangeListener(java.beans.PropertyChangeListener) TagDefinition(de.catma.tag.TagDefinition) Optional(java.util.Optional) SingleTextInputDialog(de.catma.ui.dialog.SingleTextInputDialog) CollectionChangeEvent(de.catma.project.event.CollectionChangeEvent) SelectionMode(com.vaadin.ui.Grid.SelectionMode) StyleGenerator(com.vaadin.ui.StyleGenerator) RBACPermission(de.catma.rbac.RBACPermission) PropertyDefinition(de.catma.tag.PropertyDefinition) VerticalLayout(com.vaadin.ui.VerticalLayout) AnnotationCollectionManager(de.catma.document.annotation.AnnotationCollectionManager) ComboBox(com.vaadin.ui.ComboBox) Multimap(com.google.common.collect.Multimap) ActionGridComponent(de.catma.ui.component.actiongrid.ActionGridComponent) Supplier(java.util.function.Supplier) ArrayList(java.util.ArrayList) EventBus(com.google.common.eventbus.EventBus) AddEditPropertyDialog(de.catma.ui.module.tags.AddEditPropertyDialog) MaterialTheme(com.github.appreciated.material.MaterialTheme) EditTagDialog(de.catma.ui.module.tags.EditTagDialog) Notification(com.vaadin.ui.Notification) Label(com.vaadin.ui.Label) TagsetDefinition(de.catma.tag.TagsetDefinition) Pair(de.catma.util.Pair) TreeGridFactory(de.catma.ui.component.TreeGridFactory) IDGenerator(de.catma.util.IDGenerator) Subscribe(com.google.common.eventbus.Subscribe) ButtonRenderer(com.vaadin.ui.renderers.ButtonRenderer) SaveCancelListener(de.catma.ui.dialog.SaveCancelListener) PropertyChangeEvent(java.beans.PropertyChangeEvent) ListDataProvider(com.vaadin.data.provider.ListDataProvider) TreeData(com.vaadin.data.TreeData) AnnotationCollectionReference(de.catma.document.annotation.AnnotationCollectionReference) Project(de.catma.project.Project) AddSubtagDialog(de.catma.ui.module.tags.AddSubtagDialog) IOException(java.io.IOException) AddParenttagDialog(de.catma.ui.module.tags.AddParenttagDialog) SourceDocument(de.catma.document.source.SourceDocument) AnnotationCollection(de.catma.document.annotation.AnnotationCollection) Annotation(de.catma.document.annotation.Annotation) TimeUnit(java.util.concurrent.TimeUnit) Consumer(java.util.function.Consumer) TagManagerEvent(de.catma.tag.TagManager.TagManagerEvent) ContextMenu(com.vaadin.contextmenu.ContextMenu) Button(com.vaadin.ui.Button) ChangeType(de.catma.project.event.ChangeType) HorizontalLayout(com.vaadin.ui.HorizontalLayout) SerializablePredicate(com.vaadin.server.SerializablePredicate) HtmlRenderer(com.vaadin.ui.renderers.HtmlRenderer) TagDefinition(de.catma.tag.TagDefinition) PropertyDefinition(de.catma.tag.PropertyDefinition)

Example 23 with TagDefinition

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

the class AnnotationPanel method expandTagsetDefinition.

private void expandTagsetDefinition(TagsetDefinition tagset) {
    for (TagDefinition tag : tagset) {
        TagDataItem item = new TagDataItem(tag);
        tagsetGrid.expand(item);
    }
}
Also used : TagDefinition(de.catma.tag.TagDefinition)

Example 24 with TagDefinition

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

the class AnnotationPanel method addTagSubTree.

private void addTagSubTree(TagsetDefinition tagset, TagDefinition tag, TagDataItem parentItem) {
    for (TagDefinition childDefinition : tagset.getDirectChildren(tag)) {
        TagDataItem childItem = new TagDataItem(childDefinition);
        tagsetData.addItem(parentItem, childItem);
        addTagSubTree(tagset, childDefinition, childItem);
    }
}
Also used : TagDefinition(de.catma.tag.TagDefinition)

Example 25 with TagDefinition

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

the class EditAnnotationPropertiesDialog method createComponents.

private void createComponents(Project project) {
    propertyTabSheet = new TabSheet();
    propertyTabSheet.setSizeFull();
    String tagId = annotation.getTagInstance().getTagDefinitionId();
    TagDefinition tag = project.getTagManager().getTagLibrary().getTagDefinition(tagId);
    for (PropertyDefinition propertyDef : tag.getUserDefinedPropertyDefinitions()) {
        Property property = annotation.getTagInstance().getUserDefinedPropetyByUuid(propertyDef.getUuid());
        if (property == null) {
            property = new Property(propertyDef.getUuid(), Collections.emptySet());
        }
        propertyTabSheet.addTab(new EditPropertyTab(property, propertyDef.getPossibleValueList()), propertyDef.getName());
    }
}
Also used : TagDefinition(de.catma.tag.TagDefinition) TabSheet(com.vaadin.ui.TabSheet) PropertyDefinition(de.catma.tag.PropertyDefinition) Property(de.catma.tag.Property)

Aggregations

TagDefinition (de.catma.tag.TagDefinition)72 ArrayList (java.util.ArrayList)31 PropertyDefinition (de.catma.tag.PropertyDefinition)28 TagsetDefinition (de.catma.tag.TagsetDefinition)28 List (java.util.List)23 IDGenerator (de.catma.util.IDGenerator)22 Pair (de.catma.util.Pair)22 UI (com.vaadin.ui.UI)19 Project (de.catma.project.Project)19 ErrorHandler (de.catma.ui.module.main.ErrorHandler)19 PropertyChangeEvent (java.beans.PropertyChangeEvent)19 PropertyChangeListener (java.beans.PropertyChangeListener)19 IOException (java.io.IOException)19 Collection (java.util.Collection)19 Collectors (java.util.stream.Collectors)19 Notification (com.vaadin.ui.Notification)17 Type (com.vaadin.ui.Notification.Type)17 Set (java.util.Set)17 TagManagerEvent (de.catma.tag.TagManager.TagManagerEvent)16 SaveCancelListener (de.catma.ui.dialog.SaveCancelListener)16