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);
}
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);
}
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);
}
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;
}
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);
}
Aggregations