Search in sources :

Example 26 with Property

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

the class AnnotationDetailsPanel method handleEditAnnotationRequest.

private void handleEditAnnotationRequest(RendererClickEvent<AnnotationTreeItem> clickEvent) {
    AnnotationDataItem item = (AnnotationDataItem) clickEvent.getItem();
    final Annotation annotation = item.getAnnotation();
    if (project.hasPermission(project.getRoleForCollection(annotation.getUserMarkupCollection().getUuid()), RBACPermission.COLLECTION_WRITE)) {
        String tagId = annotation.getTagInstance().getTagDefinitionId();
        TagDefinition tag = project.getTagManager().getTagLibrary().getTagDefinition(tagId);
        if (tag.getUserDefinedPropertyDefinitions().isEmpty()) {
            Notification.show("Info", "There are no Properties defined for the Tag of this Annotation!", Type.HUMANIZED_MESSAGE);
        } else {
            EditAnnotationPropertiesDialog editAnnotationPropertiesDialog = new EditAnnotationPropertiesDialog(project, annotation, new SaveCancelListener<List<Property>>() {

                @Override
                public void savePressed(List<Property> result) {
                    try {
                        collectionManager.updateProperty(annotation.getUserMarkupCollection(), annotation.getTagInstance(), result);
                    } catch (IOException e) {
                        ((ErrorHandler) UI.getCurrent()).showAndLogError("error updating Annotation Properties", e);
                    }
                }
            });
            editAnnotationPropertiesDialog.show();
        }
    } else {
        Notification.show("Info", "You do not have the permission to make changes to the Collection of this Annotation, " + "please contact the Project maintainer!", Type.HUMANIZED_MESSAGE);
    }
}
Also used : TagDefinition(de.catma.tag.TagDefinition) ErrorHandler(de.catma.ui.module.main.ErrorHandler) List(java.util.List) ArrayList(java.util.ArrayList) IOException(java.io.IOException) Property(de.catma.tag.Property) Annotation(de.catma.document.annotation.Annotation)

Example 27 with Property

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

the class AnnotationConflictView method initComponents.

private void initComponents() {
    setMargin(true);
    setSpacing(true);
    setSizeFull();
    HorizontalLayout resourceInfoPanel = new HorizontalLayout();
    resourceInfoPanel.setWidth("100%");
    addComponent(resourceInfoPanel);
    this.documentNameField = new TextField("Document");
    this.documentNameField.setReadOnly(true);
    this.documentNameField.setWidth("100%");
    this.documentNameField.addStyleName("annotation-conflict-view-resource-field");
    resourceInfoPanel.addComponent(documentNameField);
    this.collectionNameField = new TextField("Collection");
    this.collectionNameField.setReadOnly(true);
    this.collectionNameField.setWidth("100%");
    this.collectionNameField.addStyleName("annotation-conflict-view-resource-field");
    resourceInfoPanel.addComponent(collectionNameField);
    this.annotatedKwic = new Label();
    this.annotatedKwic.setWidth("100%");
    this.annotatedKwic.setContentMode(ContentMode.HTML);
    addComponent(this.annotatedKwic);
    HorizontalLayout comparisonPanel = new HorizontalLayout();
    comparisonPanel.setSizeFull();
    leftPropertyGrid = TreeGridFactory.createDefaultTreeGrid();
    leftPropertyGrid.setSizeFull();
    leftPropertyGrid.addStyleNames("flat-undecorated-icon-buttonrenderer");
    leftPropertyGrid.addColumn(propertyTreeItem -> propertyTreeItem.getName()).setCaption("Property");
    leftPropertyGrid.addColumn(propertyTreeItem -> propertyTreeItem.getValue()).setCaption("Value");
    comparisonPanel.addComponent(leftPropertyGrid);
    leftIsDeletedLabel = new Label("My Annotation is DELETED.");
    leftIsDeletedLabel.setVisible(false);
    comparisonPanel.addComponent(leftIsDeletedLabel);
    rightPropertyGrid = TreeGridFactory.createDefaultTreeGrid();
    rightPropertyGrid.setSizeFull();
    rightPropertyGrid.addStyleNames("flat-undecorated-icon-buttonrenderer");
    rightPropertyGrid.addColumn(propertyTreeItem -> propertyTreeItem.getName()).setCaption("Property");
    rightPropertyGrid.addColumn(propertyTreeItem -> propertyTreeItem.getValue()).setCaption("Value");
    comparisonPanel.addComponent(rightPropertyGrid);
    rightIsDeletedLabel = new Label("Their Annotation is DELETED.");
    rightIsDeletedLabel.setVisible(false);
    comparisonPanel.addComponent(rightIsDeletedLabel);
    addComponent(comparisonPanel);
    setExpandRatio(comparisonPanel, 1f);
    HorizontalLayout buttonPanel = new HorizontalLayout();
    buttonPanel.setWidth("100%");
    btMine = new Button("Take mine");
    buttonPanel.addComponent(btMine);
    buttonPanel.setComponentAlignment(btMine, Alignment.BOTTOM_CENTER);
    btBoth = new Button("Take both");
    buttonPanel.addComponent(btBoth);
    buttonPanel.setComponentAlignment(btBoth, Alignment.BOTTOM_CENTER);
    btTheirs = new Button("Take theirs");
    buttonPanel.addComponent(btTheirs);
    buttonPanel.setComponentAlignment(btTheirs, Alignment.BOTTOM_CENTER);
    addComponent(buttonPanel);
}
Also used : ContentMode(com.vaadin.shared.ui.ContentMode) AnnotationConflict(de.catma.project.conflict.AnnotationConflict) TextField(com.vaadin.ui.TextField) PropertyDefinition(de.catma.tag.PropertyDefinition) TagManager(de.catma.tag.TagManager) Property(de.catma.tag.Property) TreeData(com.vaadin.data.TreeData) VerticalLayout(com.vaadin.ui.VerticalLayout) Alignment(com.vaadin.ui.Alignment) TagInstance(de.catma.tag.TagInstance) TreeGrid(com.vaadin.ui.TreeGrid) AnnotatedTextProvider(de.catma.ui.module.annotate.annotationpanel.AnnotatedTextProvider) KwicProvider(de.catma.indexer.KwicProvider) Button(com.vaadin.ui.Button) CollectionConflict(de.catma.project.conflict.CollectionConflict) HorizontalLayout(com.vaadin.ui.HorizontalLayout) TagDefinition(de.catma.tag.TagDefinition) Label(com.vaadin.ui.Label) Resolution(de.catma.project.conflict.Resolution) TreeDataProvider(com.vaadin.data.provider.TreeDataProvider) TreeGridFactory(de.catma.ui.component.TreeGridFactory) Button(com.vaadin.ui.Button) Label(com.vaadin.ui.Label) TextField(com.vaadin.ui.TextField) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Aggregations

Property (de.catma.tag.Property)27 TagDefinition (de.catma.tag.TagDefinition)16 TagInstance (de.catma.tag.TagInstance)16 PropertyDefinition (de.catma.tag.PropertyDefinition)14 ArrayList (java.util.ArrayList)14 TagReference (de.catma.document.annotation.TagReference)10 List (java.util.List)9 Range (de.catma.document.Range)7 AnnotationCollection (de.catma.document.annotation.AnnotationCollection)6 TagsetDefinition (de.catma.tag.TagsetDefinition)6 IDGenerator (de.catma.util.IDGenerator)6 AnnotationCollectionReference (de.catma.document.annotation.AnnotationCollectionReference)5 SourceDocument (de.catma.document.source.SourceDocument)5 ArrayListMultimap (com.google.common.collect.ArrayListMultimap)4 TagManager (de.catma.tag.TagManager)4 File (java.io.File)4 HashSet (java.util.HashSet)4 Multimap (com.google.common.collect.Multimap)3 EventBus (com.google.common.eventbus.EventBus)3 TreeData (com.vaadin.data.TreeData)3