Search in sources :

Example 6 with ActionGridComponent

use of de.catma.ui.component.actiongrid.ActionGridComponent in project catma by forTEXT.

the class CollectionSelectionStep method initComponents.

private void initComponents() {
    setSizeFull();
    documentGrid = TreeGridFactory.createDefaultTreeGrid();
    documentGrid.setSizeFull();
    documentGrid.addStyleNames("flat-undecorated-icon-buttonrenderer");
    documentGrid.setRowHeight(45);
    documentGrid.setSelectionMode(SelectionMode.MULTI);
    documentGrid.addColumn(resource -> resource.getIcon(), new HtmlRenderer()).setWidth(100);
    Function<Resource, String> buildNameFunction = (resource) -> {
        StringBuilder sb = new StringBuilder().append("<div class='documentsgrid__doc'> ").append("<div class='documentsgrid__doc__title'> ").append(resource.getName()).append("</div>");
        if (resource.hasDetail()) {
            sb.append("<span class='documentsgrid__doc__author'> ").append(resource.getDetail()).append("</span>");
        }
        sb.append("</div>");
        return sb.toString();
    };
    documentGrid.addColumn(resource -> buildNameFunction.apply(resource), new HtmlRenderer()).setCaption("Name").setWidth(300);
    documentGrid.addColumn(res -> res.getPermissionIcon(), new HtmlRenderer()).setCaption("Permission").setExpandRatio(1);
    Label documentsAnnotations = new Label("Select one Collection per Document");
    documentGridComponent = new ActionGridComponent<TreeGrid<Resource>>(documentsAnnotations, documentGrid);
    documentGridComponent.setSizeFull();
    addComponent(documentGridComponent);
}
Also used : Resource(de.catma.ui.module.project.Resource) StepChangeListener(de.catma.ui.dialog.wizard.StepChangeListener) VerticalLayout(com.vaadin.ui.VerticalLayout) UI(com.vaadin.ui.UI) HashMap(java.util.HashMap) WizardContext(de.catma.ui.dialog.wizard.WizardContext) ActionGridComponent(de.catma.ui.component.actiongrid.ActionGridComponent) ProgressStep(de.catma.ui.dialog.wizard.ProgressStep) Function(java.util.function.Function) HashSet(java.util.HashSet) EventBus(com.google.common.eventbus.EventBus) CollectionResource(de.catma.ui.module.project.CollectionResource) Notification(com.vaadin.ui.Notification) ErrorHandler(de.catma.ui.module.main.ErrorHandler) Map(java.util.Map) Label(com.vaadin.ui.Label) TreeDataProvider(com.vaadin.data.provider.TreeDataProvider) TreeGridFactory(de.catma.ui.component.TreeGridFactory) Subscribe(com.google.common.eventbus.Subscribe) SaveCancelListener(de.catma.ui.dialog.SaveCancelListener) DocumentResource(de.catma.ui.module.project.DocumentResource) TreeData(com.vaadin.data.TreeData) AnnotationCollectionReference(de.catma.document.annotation.AnnotationCollectionReference) Project(de.catma.project.Project) Set(java.util.Set) ProgressStepFactory(de.catma.ui.dialog.wizard.ProgressStepFactory) TreeGrid(com.vaadin.ui.TreeGrid) SourceDocument(de.catma.document.source.SourceDocument) Collectors(java.util.stream.Collectors) ContextMenu(com.vaadin.contextmenu.ContextMenu) List(java.util.List) Type(com.vaadin.ui.Notification.Type) ChangeType(de.catma.project.event.ChangeType) SerializablePredicate(com.vaadin.server.SerializablePredicate) HierarchicalQuery(com.vaadin.data.provider.HierarchicalQuery) HtmlRenderer(com.vaadin.ui.renderers.HtmlRenderer) SingleTextInputDialog(de.catma.ui.dialog.SingleTextInputDialog) WizardStep(de.catma.ui.dialog.wizard.WizardStep) CollectionChangeEvent(de.catma.project.event.CollectionChangeEvent) SelectionMode(com.vaadin.ui.Grid.SelectionMode) Collections(java.util.Collections) RBACPermission(de.catma.rbac.RBACPermission) TreeGrid(com.vaadin.ui.TreeGrid) Resource(de.catma.ui.module.project.Resource) CollectionResource(de.catma.ui.module.project.CollectionResource) DocumentResource(de.catma.ui.module.project.DocumentResource) Label(com.vaadin.ui.Label) HtmlRenderer(com.vaadin.ui.renderers.HtmlRenderer)

Example 7 with ActionGridComponent

use of de.catma.ui.component.actiongrid.ActionGridComponent in project catma by forTEXT.

the class AnalyzeResourcePanel method initComponents.

private void initComponents() {
    Label documentTreeLabel = new Label("Documents & Annotations");
    documentTree = TreeGridFactory.createDefaultTreeGrid();
    documentTree.addStyleNames("resource-grid", "flat-undecorated-icon-buttonrenderer");
    documentTree.addColumn(documentTreeItem -> documentTreeItem.getName()).setCaption("Name").setWidth(150);
    documentTree.addColumn(documentTreeItem -> documentTreeItem.getPermissionIcon(), new HtmlRenderer()).setWidth(50);
    documentTree.addColumn(documentTreeItem -> documentTreeItem.getIcon(), new HtmlRenderer()).setExpandRatio(1);
    documentTree.setSizeFull();
    documentActionGridComponent = new ActionGridComponent<TreeGrid<DocumentTreeItem>>(documentTreeLabel, documentTree);
    documentActionGridComponent.setSelectionModeFixed(Grid.SelectionMode.MULTI);
    documentActionGridComponent.getActionGridBar().setMoreOptionsBtnVisible(false);
    documentActionGridComponent.getActionGridBar().setMargin(new MarginInfo(false, false, false, true));
    addComponent(documentActionGridComponent);
}
Also used : SelectionListener(com.vaadin.event.selection.SelectionListener) VerticalLayout(com.vaadin.ui.VerticalLayout) SelectionEvent(com.vaadin.event.selection.SelectionEvent) UI(com.vaadin.ui.UI) ActionGridComponent(de.catma.ui.component.actiongrid.ActionGridComponent) HashSet(java.util.HashSet) EventBus(com.google.common.eventbus.EventBus) Notification(com.vaadin.ui.Notification) ErrorHandler(de.catma.ui.module.main.ErrorHandler) Label(com.vaadin.ui.Label) TreeDataProvider(com.vaadin.data.provider.TreeDataProvider) DocumentChangeEvent(de.catma.project.event.DocumentChangeEvent) TreeGridFactory(de.catma.ui.component.TreeGridFactory) Subscribe(com.google.common.eventbus.Subscribe) SelectionModel(com.vaadin.data.SelectionModel) TreeData(com.vaadin.data.TreeData) AnnotationCollectionReference(de.catma.document.annotation.AnnotationCollectionReference) Project(de.catma.project.Project) Collection(java.util.Collection) Set(java.util.Set) TreeGrid(com.vaadin.ui.TreeGrid) SourceDocument(de.catma.document.source.SourceDocument) ProjectReadyEvent(de.catma.project.event.ProjectReadyEvent) Collectors(java.util.stream.Collectors) MarginInfo(com.vaadin.shared.ui.MarginInfo) ItemClick(com.vaadin.ui.Grid.ItemClick) List(java.util.List) Type(com.vaadin.ui.Notification.Type) ChangeType(de.catma.project.event.ChangeType) Corpus(de.catma.document.corpus.Corpus) Optional(java.util.Optional) HtmlRenderer(com.vaadin.ui.renderers.HtmlRenderer) CollectionChangeEvent(de.catma.project.event.CollectionChangeEvent) Collections(java.util.Collections) RBACPermission(de.catma.rbac.RBACPermission) Grid(com.vaadin.ui.Grid) MarginInfo(com.vaadin.shared.ui.MarginInfo) TreeGrid(com.vaadin.ui.TreeGrid) Label(com.vaadin.ui.Label) HtmlRenderer(com.vaadin.ui.renderers.HtmlRenderer)

Example 8 with ActionGridComponent

use of de.catma.ui.component.actiongrid.ActionGridComponent in project catma by forTEXT.

the class ImportIntrinsicMarkupStep method initComponents.

private void initComponents() {
    setSizeFull();
    progressBar = new ProgressBar();
    progressBar.setCaption("Inspecting Annotations...");
    progressBar.setVisible(false);
    progressBar.setIndeterminate(false);
    addComponent(progressBar);
    Label infoLabel = new Label("We found the following Tagsets in your intrinsic markup, you can change the action per Tagset using the options menu:");
    infoLabel.setContentMode(ContentMode.HTML);
    addComponent(infoLabel);
    contentPanel = new HorizontalLayout();
    contentPanel.setSizeFull();
    contentPanel.setMargin(false);
    addComponent(contentPanel);
    setExpandRatio(contentPanel, 1f);
    tagsetGrid = new Grid<TagsetImport>(tagsetDataProvider);
    tagsetGrid.setSizeFull();
    tagsetGrid.addColumn(tagsetImport -> VaadinIcons.TAGS.getHtml(), new HtmlRenderer());
    tagsetGrid.addColumn(tagsetImport -> tagsetImport.getNamespace()).setCaption("Namespace").setDescriptionGenerator(tagsetImport -> tagsetImport.getExtractedTagset().stream().limit(10).map(TagDefinition::getName).collect(Collectors.joining(", ")) + (tagsetImport.getExtractedTagset().size() > 10 ? " ..." : "")).setExpandRatio(2);
    tagsetGrid.addColumn(tagsetImport -> tagsetImport.getTargetName()).setCaption("Tagset").setExpandRatio(2);
    tagsetGrid.addColumn(tagsetImport -> tagsetImport.getImportState().toString()).setCaption("Action").setExpandRatio(1);
    tagsetGridComponent = new ActionGridComponent<Grid<TagsetImport>>(new Label("Intrinsic Tagsets"), tagsetGrid);
    tagsetGridComponent.setMargin(false);
    tagsetGridComponent.getActionGridBar().setAddBtnVisible(false);
    contentPanel.addComponent(tagsetGridComponent);
    contentPanel.setExpandRatio(tagsetGridComponent, 0.6f);
    fileGrid = new Grid<UploadFile>(fileDataProvider);
    fileGrid.setSizeFull();
    fileGrid.addColumn(tagset -> VaadinIcons.NOTEBOOK.getHtml(), new HtmlRenderer());
    fileGrid.addColumn(UploadFile::getTitle).setCaption("Title").setExpandRatio(2);
    fileActionGridComponent = new ActionGridComponent<Grid<UploadFile>>(new Label("Intrinsic Annotation Collections"), fileGrid);
    fileActionGridComponent.setMargin(false);
    fileActionGridComponent.getActionGridBar().setAddBtnVisible(false);
    fileActionGridComponent.getActionGridBar().setMoreOptionsBtnVisible(false);
    fileActionGridComponent.setSelectionModeFixed(SelectionMode.SINGLE);
    fileActionGridComponent.getActionGridBar().setMargin(new MarginInfo(false, true, false, true));
    contentPanel.addComponent(fileActionGridComponent);
    contentPanel.setExpandRatio(fileActionGridComponent, 0.4f);
}
Also used : BackgroundServiceProvider(de.catma.backgroundservice.BackgroundServiceProvider) DefaultProgressCallable(de.catma.backgroundservice.DefaultProgressCallable) StepChangeListener(de.catma.ui.dialog.wizard.StepChangeListener) TagManager(de.catma.tag.TagManager) VerticalLayout(com.vaadin.ui.VerticalLayout) UI(com.vaadin.ui.UI) XmlMarkupCollectionSerializationHandler(de.catma.serialization.intrinsic.xml.XmlMarkupCollectionSerializationHandler) WizardContext(de.catma.ui.dialog.wizard.WizardContext) ActionGridComponent(de.catma.ui.component.actiongrid.ActionGridComponent) ProgressStep(de.catma.ui.dialog.wizard.ProgressStep) TechInfoSet(de.catma.document.source.TechInfoSet) ArrayList(java.util.ArrayList) Level(java.util.logging.Level) Notification(com.vaadin.ui.Notification) ErrorHandler(de.catma.ui.module.main.ErrorHandler) Label(com.vaadin.ui.Label) TagsetDefinition(de.catma.tag.TagsetDefinition) VaadinIcons(com.vaadin.icons.VaadinIcons) IDGenerator(de.catma.util.IDGenerator) SaveCancelListener(de.catma.ui.dialog.SaveCancelListener) ProgressBar(com.vaadin.ui.ProgressBar) TagLibrary(de.catma.tag.TagLibrary) ListDataProvider(com.vaadin.data.provider.ListDataProvider) ContentMode(com.vaadin.shared.ui.ContentMode) XML2ContentHandler(de.catma.document.source.contenthandler.XML2ContentHandler) ExecutionListener(de.catma.backgroundservice.ExecutionListener) Project(de.catma.project.Project) Collection(java.util.Collection) Set(java.util.Set) ProgressStepFactory(de.catma.ui.dialog.wizard.ProgressStepFactory) FileInputStream(java.io.FileInputStream) SourceDocument(de.catma.document.source.SourceDocument) Logger(java.util.logging.Logger) AnnotationCollection(de.catma.document.annotation.AnnotationCollection) Collectors(java.util.stream.Collectors) File(java.io.File) MarginInfo(com.vaadin.shared.ui.MarginInfo) SourceDocumentInfo(de.catma.document.source.SourceDocumentInfo) List(java.util.List) Type(com.vaadin.ui.Notification.Type) HorizontalLayout(com.vaadin.ui.HorizontalLayout) TagDefinition(de.catma.tag.TagDefinition) HtmlRenderer(com.vaadin.ui.renderers.HtmlRenderer) FileType(de.catma.document.source.FileType) WizardStep(de.catma.ui.dialog.wizard.WizardStep) SelectionMode(com.vaadin.ui.Grid.SelectionMode) Grid(com.vaadin.ui.Grid) TagDefinition(de.catma.tag.TagDefinition) Grid(com.vaadin.ui.Grid) Label(com.vaadin.ui.Label) HorizontalLayout(com.vaadin.ui.HorizontalLayout) MarginInfo(com.vaadin.shared.ui.MarginInfo) HtmlRenderer(com.vaadin.ui.renderers.HtmlRenderer) ProgressBar(com.vaadin.ui.ProgressBar)

Example 9 with ActionGridComponent

use of de.catma.ui.component.actiongrid.ActionGridComponent in project catma by forTEXT.

the class ProjectView method initTeamContent.

private Component initTeamContent() {
    HorizontalFlexLayout teamContent = new HorizontalFlexLayout();
    teamGrid = new Grid<>();
    teamGrid.setHeaderVisible(false);
    // $NON-NLS-1$
    teamGrid.setWidth("402px");
    teamGrid.addColumn((user) -> VaadinIcons.USER.getHtml(), new HtmlRenderer());
    teamGrid.addColumn(User::getName).setWidth(200).setComparator((r1, r2) -> String.CASE_INSENSITIVE_ORDER.compare(r1.getName(), r2.getName())).setDescriptionGenerator(User::preciseName);
    teamGrid.addColumn(Member::getRole).setExpandRatio(1);
    Label membersAnnotations = new Label("Members");
    ActionGridComponent<Grid<Member>> membersGridComponent = new ActionGridComponent<>(membersAnnotations, teamGrid);
    // $NON-NLS-1$
    membersGridComponent.addStyleName("project-view-action-grid");
    ContextMenu addContextMenu = membersGridComponent.getActionGridBar().getBtnAddContextMenu();
    addContextMenu.addItem("Add Member", (click) -> new AddMemberDialog(project::assignOnProject, // $NON-NLS-1$
    (query) -> project.findUser(query.getFilter().isPresent() ? query.getFilter().get() : "", query.getOffset(), query.getLimit()), (evt) -> eventBus.post(new MembersChangedEvent())).show());
    ContextMenu moreOptionsContextMenu = membersGridComponent.getActionGridBar().getBtnMoreOptionsContextMenu();
    moreOptionsContextMenu.addItem("Edit Members", (click) -> handleEditMembers());
    moreOptionsContextMenu.addItem("Remove Members", (click) -> handleRemoveMembers());
    miInvite = moreOptionsContextMenu.addItem("Invite someone to the Project", click -> handleProjectInvitationRequest());
    MenuItem editResBtn = moreOptionsContextMenu.addItem("Resource permissions", click -> {
        @SuppressWarnings("unchecked") TreeDataProvider<Resource> resourceDataProvider = (TreeDataProvider<Resource>) documentGrid.getDataProvider();
        TreeData<Resource> resourceData = resourceDataProvider.getTreeData();
        if (!resourceData.getRootItems().isEmpty()) {
            new ResourcePermissionView(resourceData, tagsetData.getItems(), this.project).show();
        } else {
            Notification.show("Info", "You do not have any Documents yet, please add a Document first!", Type.HUMANIZED_MESSAGE);
        }
    });
    editResBtn.setEnabled(false);
    rbacEnforcer.register(RBACConstraint.ifAuthorized(role -> (project.hasPermission(role, RBACPermission.PROJECT_MEMBERS_EDIT)), () -> editResBtn.setEnabled(true)));
    teamContent.addComponent(membersGridComponent);
    return teamContent;
}
Also used : ArrayListMultimap(com.google.common.collect.ArrayListMultimap) BackgroundServiceProvider(de.catma.backgroundservice.BackgroundServiceProvider) HTMLNotification(de.catma.ui.component.HTMLNotification) Alignment(com.vaadin.ui.Alignment) IndexedProject(de.catma.indexer.IndexedProject) MembersChangedEvent(de.catma.ui.events.MembersChangedEvent) HeaderContextChangeEvent(de.catma.ui.events.HeaderContextChangeEvent) RouteToTagsEvent(de.catma.ui.events.routing.RouteToTagsEvent) TreeDataProvider(com.vaadin.data.provider.TreeDataProvider) TagsetImport(de.catma.ui.module.project.documentwizard.TagsetImport) DocumentChangeEvent(de.catma.project.event.DocumentChangeEvent) CorpusImporter(de.catma.ui.module.project.corpusimport.CorpusImporter) CommitInfo(de.catma.project.CommitInfo) ExecutionListener(de.catma.backgroundservice.ExecutionListener) MenuBar(com.vaadin.ui.MenuBar) VerticalFlexLayout(de.catma.ui.layout.VerticalFlexLayout) Set(java.util.Set) RBACConstraint(de.catma.rbac.RBACConstraint) TagInstance(de.catma.tag.TagInstance) CorpusImportDocumentMetadata(de.catma.ui.module.project.corpusimport.CorpusImportDocumentMetadata) ItemClick(com.vaadin.ui.Grid.ItemClick) Stream(java.util.stream.Stream) Type(com.vaadin.ui.Notification.Type) PropertyChangeListener(java.beans.PropertyChangeListener) SingleTextInputDialog(de.catma.ui.dialog.SingleTextInputDialog) CollectionChangeEvent(de.catma.project.event.CollectionChangeEvent) CanReloadAll(de.catma.ui.module.main.CanReloadAll) SelectionMode(com.vaadin.ui.Grid.SelectionMode) DocumentWizard(de.catma.ui.module.project.documentwizard.DocumentWizard) HugeCard(de.catma.ui.component.hugecard.HugeCard) ProjectChangedEvent(de.catma.ui.events.ProjectChangedEvent) DefaultProgressCallable(de.catma.backgroundservice.DefaultProgressCallable) TagManager(de.catma.tag.TagManager) com.vaadin.server(com.vaadin.server) LocalDateTime(java.time.LocalDateTime) WizardContext(de.catma.ui.dialog.wizard.WizardContext) ActionGridComponent(de.catma.ui.component.actiongrid.ActionGridComponent) ArrayList(java.util.ArrayList) Member(de.catma.user.Member) Pair(de.catma.util.Pair) TreeGridFactory(de.catma.ui.component.TreeGridFactory) SaveCancelListener(de.catma.ui.dialog.SaveCancelListener) Collator(java.text.Collator) ProgressListener(de.catma.backgroundservice.ProgressListener) XML2ContentHandler(de.catma.document.source.contenthandler.XML2ContentHandler) Property(de.catma.tag.Property) TreeData(com.vaadin.data.TreeData) IOException(java.io.IOException) SourceDocument(de.catma.document.source.SourceDocument) ProjectReadyEvent(de.catma.project.event.ProjectReadyEvent) AnnotationCollection(de.catma.document.annotation.AnnotationCollection) File(java.io.File) TagManagerEvent(de.catma.tag.TagManager.TagManagerEvent) Button(com.vaadin.ui.Button) ChangeType(de.catma.project.event.ChangeType) CRC32(java.util.zip.CRC32) HtmlRenderer(com.vaadin.ui.renderers.HtmlRenderer) Grid(com.vaadin.ui.Grid) MenuItem(com.vaadin.ui.MenuBar.MenuItem) GenericUploadDialog(de.catma.ui.dialog.GenericUploadDialog) URISyntaxException(java.net.URISyntaxException) UI(com.vaadin.ui.UI) FlexWrap(de.catma.ui.layout.FlexLayout.FlexWrap) ConfirmDialog(org.vaadin.dialogs.ConfirmDialog) SearchFilterProvider(de.catma.ui.component.actiongrid.SearchFilterProvider) RouteToAnalyzeEvent(de.catma.ui.events.routing.RouteToAnalyzeEvent) TikaContentHandler(de.catma.document.source.contenthandler.TikaContentHandler) ByteArrayInputStream(java.io.ByteArrayInputStream) HorizontalFlexLayout(de.catma.ui.layout.HorizontalFlexLayout) ErrorHandler(de.catma.ui.module.main.ErrorHandler) Locale(java.util.Locale) CatmaApplication(de.catma.ui.CatmaApplication) VaadinIcons(com.vaadin.icons.VaadinIcons) Version(de.catma.tag.Version) RouteToConflictedProjectEvent(de.catma.ui.events.routing.RouteToConflictedProjectEvent) ProgressBar(com.vaadin.ui.ProgressBar) IconButton(de.catma.ui.component.IconButton) CATMAPropertyKey(de.catma.properties.CATMAPropertyKey) Collection(java.util.Collection) TreeGrid(com.vaadin.ui.TreeGrid) Logger(java.util.logging.Logger) Collectors(java.util.stream.Collectors) SourceDocumentInfo(de.catma.document.source.SourceDocumentInfo) ProjectReference(de.catma.project.ProjectReference) TagReference(de.catma.document.annotation.TagReference) List(java.util.List) CloseSafe(de.catma.util.CloseSafe) Corpus(de.catma.document.corpus.Corpus) TagDefinition(de.catma.tag.TagDefinition) RBACConstraintEnforcer(de.catma.rbac.RBACConstraintEnforcer) RouteToAnnotateEvent(de.catma.ui.events.routing.RouteToAnnotateEvent) Optional(java.util.Optional) FileType(de.catma.document.source.FileType) RBACPermission(de.catma.rbac.RBACPermission) CorpusImportDialog(de.catma.ui.module.project.corpusimport.CorpusImportDialog) ProjectManager(de.catma.project.ProjectManager) PropertyDefinition(de.catma.tag.PropertyDefinition) UploadFile(de.catma.ui.module.project.documentwizard.UploadFile) RBACRole(de.catma.rbac.RBACRole) Multimap(com.google.common.collect.Multimap) Function(java.util.function.Function) User(de.catma.user.User) Level(java.util.logging.Level) HashSet(java.util.HashSet) EventBus(com.google.common.eventbus.EventBus) Charset(java.nio.charset.Charset) Notification(com.vaadin.ui.Notification) Label(com.vaadin.ui.Label) TagsetDefinition(de.catma.tag.TagsetDefinition) IDGenerator(de.catma.util.IDGenerator) Subscribe(com.google.common.eventbus.Subscribe) TagLibrary(de.catma.tag.TagLibrary) PropertyChangeEvent(java.beans.PropertyChangeEvent) OpenProjectListener(de.catma.project.OpenProjectListener) ListDataProvider(com.vaadin.data.provider.ListDataProvider) FileOSType(de.catma.document.source.FileOSType) ClickEvent(com.vaadin.ui.Button.ClickEvent) AnnotationCollectionReference(de.catma.document.annotation.AnnotationCollectionReference) Project(de.catma.project.Project) RepositoryChangeEvent(de.catma.project.Project.RepositoryChangeEvent) ConflictedProject(de.catma.project.conflict.ConflictedProject) TagsetDefinitionImportStatus(de.catma.serialization.TagsetDefinitionImportStatus) ContextMenu(com.vaadin.contextmenu.ContextMenu) SourceContentHandler(de.catma.document.source.contenthandler.SourceContentHandler) TagsetImportState(de.catma.ui.module.project.documentwizard.TagsetImportState) BOMFilterInputStream(de.catma.document.source.contenthandler.BOMFilterInputStream) DateTimeFormatter(java.time.format.DateTimeFormatter) HierarchicalQuery(com.vaadin.data.provider.HierarchicalQuery) Parameter(de.catma.ui.Parameter) Comparator(java.util.Comparator) Collections(java.util.Collections) BackgroundService(de.catma.backgroundservice.BackgroundService) InputStream(java.io.InputStream) Component(com.vaadin.ui.Component) User(de.catma.user.User) Grid(com.vaadin.ui.Grid) TreeGrid(com.vaadin.ui.TreeGrid) Label(com.vaadin.ui.Label) ContextMenu(com.vaadin.contextmenu.ContextMenu) MenuItem(com.vaadin.ui.MenuBar.MenuItem) TreeDataProvider(com.vaadin.data.provider.TreeDataProvider) HtmlRenderer(com.vaadin.ui.renderers.HtmlRenderer) ActionGridComponent(de.catma.ui.component.actiongrid.ActionGridComponent) HorizontalFlexLayout(de.catma.ui.layout.HorizontalFlexLayout) MembersChangedEvent(de.catma.ui.events.MembersChangedEvent)

Example 10 with ActionGridComponent

use of de.catma.ui.component.actiongrid.ActionGridComponent in project catma by forTEXT.

the class AnnotationDetailsPanel method initComponents.

private void initComponents() {
    setSpacing(true);
    setMargin(false);
    setSizeFull();
    addStyleName("annotation-details-panel");
    HorizontalLayout headerPanel = new HorizontalLayout();
    headerPanel.setWidth("100%");
    addComponent(headerPanel);
    btClearSelected = new IconButton(VaadinIcons.ERASER);
    btClearSelected.setDescription("Clear the list of selected Annotations");
    headerPanel.addComponent(btClearSelected);
    headerPanel.setComponentAlignment(btClearSelected, Alignment.TOP_RIGHT);
    headerPanel.setExpandRatio(btClearSelected, 1.0f);
    btMinimize = new IconButton(VaadinIcons.ANGLE_DOUBLE_DOWN);
    headerPanel.addComponent(btMinimize);
    headerPanel.setComponentAlignment(btMinimize, Alignment.TOP_RIGHT);
    annotationDetailData = new TreeData<>();
    annotationDetailsProvider = new TreeDataProvider<>(annotationDetailData);
    annotationDetailsTree = TreeGridFactory.createDefaultGrid(annotationDetailsProvider);
    annotationDetailsTree.setSizeFull();
    annotationDetailsTree.addStyleNames("annotation-details-panel-annotation-details-grid", "flat-undecorated-icon-buttonrenderer");
    annotationDetailsTree.addColumn(annotationTreeItem -> annotationTreeItem.getDetail(), new HtmlRenderer()).setCaption("Annotation").setWidth(200).setSortable(false);
    annotationDetailsTree.addColumn(annotationTreeItem -> annotationTreeItem.getTag()).setCaption("Tag").setSortable(false).setWidth(80);
    annotationDetailsTree.addColumn(annotationTreeItem -> annotationTreeItem.getAuthor()).setCaption("Author").setSortable(false).setWidth(60);
    annotationDetailsTree.addColumn(annotationTreeItem -> annotationTreeItem.getCollection()).setCaption("Collection").setSortable(false).setWidth(60);
    annotationDetailsTree.addColumn(annotationTreeItem -> annotationTreeItem.getTagset()).setCaption("Tagset").setSortable(false).setWidth(70);
    annotationDetailsTree.addColumn(annotationTreeItem -> annotationTreeItem.getAnnotationId()).setCaption("Annotation ID").setHidable(true).setHidden(true).setSortable(false).setWidth(100);
    ButtonRenderer<AnnotationTreeItem> editAnnotationRenderer = new ButtonRenderer<AnnotationTreeItem>(clickEvent -> handleEditAnnotationRequest(clickEvent));
    editAnnotationRenderer.setHtmlContentAllowed(true);
    annotationDetailsTree.addColumn(annotationTreeItem -> annotationTreeItem.getEditIcon(), editAnnotationRenderer).setWidth(50);
    ButtonRenderer<AnnotationTreeItem> deleteAnnotationRenderer = new ButtonRenderer<AnnotationTreeItem>(clickEvent -> handleDeleteAnnotationRequest(clickEvent));
    deleteAnnotationRenderer.setHtmlContentAllowed(true);
    annotationDetailsTree.addColumn(annotationTreeItem -> annotationTreeItem.getDeleteIcon(), deleteAnnotationRenderer).setExpandRatio(1);
    annotationDetailsTree.setDescriptionGenerator(new DescriptionGenerator<AnnotationTreeItem>() {

        @Override
        public String apply(AnnotationTreeItem annotationTreeItem) {
            return annotationTreeItem.getDescription();
        }
    }, ContentMode.HTML);
    ActionGridComponent<TreeGrid<AnnotationTreeItem>> annotationDetailsGridComponent = new ActionGridComponent<>(new Label("Selected Annotations"), annotationDetailsTree);
    annotationDetailsGridComponent.setMargin(false);
    addComponent(annotationDetailsGridComponent);
    setExpandRatio(annotationDetailsGridComponent, 1.0f);
}
Also used : SelectionEvent(com.vaadin.event.selection.SelectionEvent) Alignment(com.vaadin.ui.Alignment) UI(com.vaadin.ui.UI) ConfirmDialog(org.vaadin.dialogs.ConfirmDialog) KwicProvider(de.catma.indexer.KwicProvider) ErrorHandler(de.catma.ui.module.main.ErrorHandler) TreeDataProvider(com.vaadin.data.provider.TreeDataProvider) VaadinIcons(com.vaadin.icons.VaadinIcons) Objects(com.google.common.base.Objects) IconButton(de.catma.ui.component.IconButton) Collection(java.util.Collection) Set(java.util.Set) TagInstance(de.catma.tag.TagInstance) TreeGrid(com.vaadin.ui.TreeGrid) Collectors(java.util.stream.Collectors) 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) RBACPermission(de.catma.rbac.RBACPermission) PropertyDefinition(de.catma.tag.PropertyDefinition) ClickListener(com.vaadin.ui.Button.ClickListener) DescriptionGenerator(com.vaadin.ui.DescriptionGenerator) VerticalLayout(com.vaadin.ui.VerticalLayout) AnnotationCollectionManager(de.catma.document.annotation.AnnotationCollectionManager) ActionGridComponent(de.catma.ui.component.actiongrid.ActionGridComponent) Function(java.util.function.Function) ArrayList(java.util.ArrayList) Registration(com.vaadin.shared.Registration) Notification(com.vaadin.ui.Notification) Label(com.vaadin.ui.Label) TreeGridFactory(de.catma.ui.component.TreeGridFactory) ButtonRenderer(com.vaadin.ui.renderers.ButtonRenderer) SaveCancelListener(de.catma.ui.dialog.SaveCancelListener) PropertyChangeEvent(java.beans.PropertyChangeEvent) ContentMode(com.vaadin.shared.ui.ContentMode) Property(de.catma.tag.Property) TreeData(com.vaadin.data.TreeData) Project(de.catma.project.Project) RepositoryChangeEvent(de.catma.project.Project.RepositoryChangeEvent) IOException(java.io.IOException) SourceDocument(de.catma.document.source.SourceDocument) Annotation(de.catma.document.annotation.Annotation) Consumer(java.util.function.Consumer) TagManagerEvent(de.catma.tag.TagManager.TagManagerEvent) Button(com.vaadin.ui.Button) HorizontalLayout(com.vaadin.ui.HorizontalLayout) ScrollDestination(com.vaadin.shared.ui.grid.ScrollDestination) HtmlRenderer(com.vaadin.ui.renderers.HtmlRenderer) Label(com.vaadin.ui.Label) HorizontalLayout(com.vaadin.ui.HorizontalLayout) IconButton(de.catma.ui.component.IconButton) TreeGrid(com.vaadin.ui.TreeGrid) HtmlRenderer(com.vaadin.ui.renderers.HtmlRenderer) ActionGridComponent(de.catma.ui.component.actiongrid.ActionGridComponent) ButtonRenderer(com.vaadin.ui.renderers.ButtonRenderer)

Aggregations

Label (com.vaadin.ui.Label)11 ActionGridComponent (de.catma.ui.component.actiongrid.ActionGridComponent)11 UI (com.vaadin.ui.UI)10 HtmlRenderer (com.vaadin.ui.renderers.HtmlRenderer)10 Project (de.catma.project.Project)10 ErrorHandler (de.catma.ui.module.main.ErrorHandler)10 Notification (com.vaadin.ui.Notification)9 Type (com.vaadin.ui.Notification.Type)9 SourceDocument (de.catma.document.source.SourceDocument)9 RBACPermission (de.catma.rbac.RBACPermission)9 SaveCancelListener (de.catma.ui.dialog.SaveCancelListener)9 List (java.util.List)9 Set (java.util.Set)9 Collectors (java.util.stream.Collectors)9 VaadinIcons (com.vaadin.icons.VaadinIcons)8 SelectionMode (com.vaadin.ui.Grid.SelectionMode)8 VerticalLayout (com.vaadin.ui.VerticalLayout)8 Collection (java.util.Collection)8 TreeData (com.vaadin.data.TreeData)7 ListDataProvider (com.vaadin.data.provider.ListDataProvider)7