use of com.vaadin.ui.TreeGrid 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 com.vaadin.ui.TreeGrid 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 com.vaadin.ui.TreeGrid in project catma by forTEXT.
the class AddAnnotationCollectionsStep method initComponents.
private void initComponents() {
setSizeFull();
this.collectionNamePatternInput = new TextField("Enter a pattern for the generation of Collection names:");
this.collectionNamePatternInput.setValueChangeMode(ValueChangeMode.LAZY);
this.collectionNamePatternInput.setWidth("400px");
addComponent(collectionNamePatternInput);
this.entryGrid = new TreeGrid<AddAnnotationCollectionsStep.EntryNameProvider>(this.entryDataProvider);
entryGrid.addColumn(entry -> entry.getName()).setCaption("Name");
entryGrid.setSizeFull();
addComponent(entryGrid);
setExpandRatio(entryGrid, 1.0f);
}
use of com.vaadin.ui.TreeGrid 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);
}
use of com.vaadin.ui.TreeGrid in project catma by forTEXT.
the class AnnotationPanel method initComponents.
private void initComponents(Consumer<String> annotationSelectionListener) {
setSizeFull();
setSpacing(true);
currentEditableCollectionBox = new ComboBox<>("Collection currently being edited");
currentEditableCollectionBox.setWidth("100%");
currentEditableCollectionBox.setPlaceholder("Please select a Document first!");
btAddCollection = new IconButton(VaadinIcons.PLUS);
btAddCollection.setVisible(project.isAuthorizedOnProject(RBACPermission.COLLECTION_CREATE));
HorizontalLayout editableCollectionPanel = new HorizontalLayout(currentEditableCollectionBox, btAddCollection);
editableCollectionPanel.addStyleName("annotate-right-padding");
editableCollectionPanel.setWidth("100%");
editableCollectionPanel.setExpandRatio(currentEditableCollectionBox, 1.0f);
editableCollectionPanel.setComponentAlignment(btAddCollection, Alignment.BOTTOM_CENTER);
addComponent(editableCollectionPanel);
Label tagsetsLabel = new Label("Tagsets");
tagsetGrid = TreeGridFactory.createDefaultTreeGrid();
tagsetGrid.addStyleNames("flat-undecorated-icon-buttonrenderer");
tagsetGrid.setSizeFull();
tagsetGrid.setSelectionMode(SelectionMode.SINGLE);
tagsetGrid.addStyleName(MaterialTheme.GRID_BORDERLESS);
tagsetGridComponent = new ActionGridComponent<TreeGrid<TagsetTreeItem>>(tagsetsLabel, tagsetGrid);
tagsetGridComponent.setMargin(false);
rightSplitPanel = new VerticalSplitPanel();
rightSplitPanel.setSizeFull();
rightSplitPanel.setSplitPosition(90);
rightSplitPanel.setLocked(true);
addComponent(rightSplitPanel);
setExpandRatio(rightSplitPanel, 1.0f);
rightSplitPanel.addComponent(tagsetGridComponent);
btMaximizeAnnotationDetailsRibbon = new IconButton(VaadinIcons.ANGLE_DOUBLE_UP);
btMaximizeAnnotationDetailsRibbon.addStyleName("annotation-panel-button-right-align");
rightSplitPanel.addComponent(btMaximizeAnnotationDetailsRibbon);
annotationDetailsPanel = new AnnotationDetailsPanel(project, collectionManager, annotationSelectionListener, collectionId -> currentEditableCollectionBox.getValue() != null && currentEditableCollectionBox.getValue().getUuid().contentEquals(collectionId), collectionId -> handleCollectionChangeRequest(collectionId));
}
Aggregations