use of de.catma.ui.component.actiongrid.ActionGridComponent in project catma by forTEXT.
the class ProjectView method initResourceContent.
/**
* initialize the resource part
* @return
*/
private Component initResourceContent() {
HorizontalFlexLayout resourceContent = new HorizontalFlexLayout();
documentGrid = TreeGridFactory.createDefaultTreeGrid();
documentGrid.addStyleNames(// $NON-NLS-1$
"flat-undecorated-icon-buttonrenderer");
documentGrid.setHeaderVisible(false);
documentGrid.setRowHeight(45);
documentGrid.addColumn(resource -> resource.getIcon(), new HtmlRenderer()).setWidth(100);
Function<Resource, String> buildNameFunction = (resource) -> {
StringBuilder sb = new StringBuilder().append(// $NON-NLS-1$
"<div class='documentsgrid__doc'> ").append(// $NON-NLS-1$
"<div class='documentsgrid__doc__title'> ").append(resource.getName()).append(// $NON-NLS-1$
"</div>");
if (resource.hasDetail()) {
sb.append(// $NON-NLS-1$
"<span class='documentsgrid__doc__author'> ").append(resource.getDetail()).append(// $NON-NLS-1$
"</span>");
}
// $NON-NLS-1$
sb.append("</div>");
return sb.toString();
};
documentGrid.addColumn(resource -> buildNameFunction.apply(resource), new HtmlRenderer()).setCaption("Name").setId(DocumentGridColumn.NAME.name()).setWidth(300);
documentGrid.addColumn(res -> res.getPermissionIcon(), new HtmlRenderer()).setCaption("Permission").setExpandRatio(1);
Label documentsAnnotations = new Label("Documents & Annotations");
documentGridComponent = new ActionGridComponent<TreeGrid<Resource>>(documentsAnnotations, documentGrid);
// $NON-NLS-1$
documentGridComponent.addStyleName("project-view-action-grid");
resourceContent.addComponent(documentGridComponent);
tagsetGrid = new Grid<>();
tagsetGrid.setHeaderVisible(false);
// $NON-NLS-1$
tagsetGrid.setWidth("400px");
tagsetGrid.addColumn(tagset -> VaadinIcons.TAGS.getHtml(), new HtmlRenderer()).setWidth(100);
tagsetGrid.addColumn(tagset -> tagset.getName()).setId(TagsetGridColumn.NAME.name()).setCaption("Name").setWidth(300);
Label tagsetsAnnotations = new Label("Tagsets");
tagsetGridComponent = new ActionGridComponent<Grid<TagsetDefinition>>(tagsetsAnnotations, tagsetGrid);
// $NON-NLS-1$
tagsetGridComponent.addStyleName("project-view-action-grid");
resourceContent.addComponent(tagsetGridComponent);
return resourceContent;
}
use of de.catma.ui.component.actiongrid.ActionGridComponent in project catma by forTEXT.
the class CorpusImportDialog method addContent.
@Override
protected void addContent(ComponentContainer content) {
HorizontalLayout credentialPanel = new HorizontalLayout();
content.addComponent(credentialPanel);
nameField = new TextField("Username");
credentialPanel.addComponent(nameField);
passField = new PasswordField("Password");
credentialPanel.addComponent(passField);
btListCorpora = new Button("List Corpora");
btListCorpora.addClickListener(event -> handleListCorpora());
credentialPanel.addComponent(btListCorpora);
corporaGrid = new Grid<CorpusImportMetadata>(corpusMetadataProvider);
corporaGrid.setSizeFull();
corporaGrid.addColumn(cm -> cm.getID()).setCaption("ID").setExpandRatio(1);
corporaGrid.addColumn(cm -> cm.getName()).setCaption("Name").setExpandRatio(2);
ActionGridComponent<Grid<CorpusImportMetadata>> corporaActionGridComponent = new ActionGridComponent<Grid<CorpusImportMetadata>>(new Label("Available Corpora"), corporaGrid);
corporaActionGridComponent.setMargin(false);
corporaActionGridComponent.getActionGridBar().setAddBtnVisible(false);
corporaActionGridComponent.getActionGridBar().setMoreOptionsBtnVisible(false);
corporaActionGridComponent.setSelectionModeFixed(SelectionMode.SINGLE);
corporaActionGridComponent.getActionGridBar().setMargin(new MarginInfo(false, true, false, true));
content.addComponent(corporaActionGridComponent);
((AbstractOrderedLayout) content).setExpandRatio(corporaActionGridComponent, 0.6f);
this.progressBar = new ProgressBar();
progressBar.setVisible(false);
content.addComponent(progressBar);
}
use of de.catma.ui.component.actiongrid.ActionGridComponent in project catma by forTEXT.
the class TagResourcePanel method initComponents.
private void initComponents() {
setWidth("400px");
setHeight("100%");
Label tagsetLabel = new Label("Tagsets");
tagsetGrid = new Grid<>();
tagsetGrid.addStyleNames("resource-grid", "flat-undecorated-icon-buttonrenderer", "no-focused-before-border");
tagsetGrid.setSelectionMode(SelectionMode.MULTI);
tagsetGrid.setSizeFull();
tagsetGrid.addColumn(tagset -> tagset.getName()).setCaption("Name").setWidth(150);
tagsetGrid.addColumn(tagset -> project.hasPermission(project.getRoleForTagset(tagset.getUuid()), RBACPermission.TAGSET_WRITE) ? VaadinIcons.UNLOCK.getHtml() : VaadinIcons.LOCK.getHtml(), new HtmlRenderer()).setWidth(50);
tagsetGrid.addColumn(tagset -> VaadinIcons.TAGS.getHtml(), new HtmlRenderer()).setExpandRatio(1);
tagsetActionGridComponent = new ActionGridComponent<Grid<TagsetDefinition>>(tagsetLabel, tagsetGrid);
tagsetActionGridComponent.setSelectionModeFixed(SelectionMode.MULTI);
tagsetActionGridComponent.getActionGridBar().setMargin(new MarginInfo(false, false, false, true));
addComponent(tagsetActionGridComponent);
}
use of de.catma.ui.component.actiongrid.ActionGridComponent in project catma by forTEXT.
the class AnnotateResourcePanel method initComponents.
private void initComponents() {
addStyleName("annotate-resource-panel");
Label documentTreeLabel = new Label("Documents & Annotations");
documentTree = TreeGridFactory.createDefaultTreeGrid();
documentTree.addStyleNames("resource-grid", "flat-undecorated-icon-buttonrenderer");
ButtonRenderer<DocumentTreeItem> documentSelectionRenderer = new ButtonRenderer<DocumentTreeItem>(documentSelectionClick -> handleVisibilityClickEvent(documentSelectionClick));
documentSelectionRenderer.setHtmlContentAllowed(true);
Column<DocumentTreeItem, String> selectionColumn = documentTree.addColumn(documentTreeItem -> documentTreeItem.getSelectionIcon(), documentSelectionRenderer).setWidth(100);
documentTree.setHierarchyColumn(selectionColumn);
documentTree.addColumn(documentTreeItem -> documentTreeItem.getName()).setCaption("Name").setWidth(150);
documentTree.setHeight("250px");
documentTree.addColumn(documentTreeItem -> documentTreeItem.getPermissionIcon(), new HtmlRenderer()).setWidth(50);
documentTree.addColumn(documentTreeItem -> documentTreeItem.getIcon(), new HtmlRenderer()).setExpandRatio(1);
documentActionGridComponent = new ActionGridComponent<TreeGrid<DocumentTreeItem>>(documentTreeLabel, documentTree);
documentActionGridComponent.getActionGridBar().setMoreOptionsBtnVisible(false);
addComponent(documentActionGridComponent);
Label tagsetLabel = new Label("Tagsets");
tagsetGrid = new Grid<>();
tagsetGrid.addStyleNames("resource-grid", "flat-undecorated-icon-buttonrenderer", "no-focused-before-border");
tagsetGrid.setHeight("250px");
tagsetGrid.addColumn(tagset -> tagset.getName()).setCaption("Name").setWidth(150);
tagsetGrid.addColumn(tagset -> project.hasPermission(project.getRoleForTagset(tagset.getUuid()), RBACPermission.TAGSET_WRITE) ? VaadinIcons.UNLOCK.getHtml() : VaadinIcons.LOCK.getHtml(), new HtmlRenderer()).setWidth(50);
tagsetGrid.addColumn(tagset -> VaadinIcons.TAGS.getHtml(), new HtmlRenderer()).setExpandRatio(1);
tagsetActionGridComponent = new ActionGridComponent<Grid<TagsetDefinition>>(tagsetLabel, tagsetGrid);
tagsetActionGridComponent.setSelectionModeFixed(SelectionMode.MULTI);
tagsetActionGridComponent.getActionGridBar().setMoreOptionsBtnVisible(false);
tagsetActionGridComponent.getActionGridBar().setMargin(new MarginInfo(false, false, false, true));
addComponent(tagsetActionGridComponent);
}
use of de.catma.ui.component.actiongrid.ActionGridComponent in project catma by forTEXT.
the class KwicPanel method initComponents.
private void initComponents() {
setSizeFull();
setMargin(false);
setSpacing(false);
btExpandCompress = new IconButton(expandResource);
btExpandCompress.setVisible(false);
kwicDataProvider = new ListDataProvider<>(new HashSet<>());
kwicGrid = new Grid<QueryResultRow>(kwicDataProvider);
kwicGrid.setSizeFull();
kwicGrid.addColumn(row -> kwicItemHandler.getDocumentName(row)).setCaption("Document").setWidth(200).setHidable(true);
kwicGrid.addColumn(row -> kwicItemHandler.getCollectionName(row)).setCaption("Collection").setWidth(200).setId(ColumnId.COLLECION_NAME.name()).setHidable(true).setHidden(true);
Column<QueryResultRow, ?> backwardCtxColumn = kwicGrid.addColumn(row -> kwicItemHandler.getBackwardContext(row)).setCaption("Left Context").setStyleGenerator(row -> kwicItemHandler.getBackwardContextStyle(row)).setWidth(200);
Column<QueryResultRow, ?> keywordColumn = kwicGrid.addColumn(row -> kwicItemHandler.getKeyword(row)).setCaption("Keyword").setWidth(200).setRenderer(new HtmlRenderer()).setStyleGenerator(row -> kwicItemHandler.getKeywordStyle(row)).setDescriptionGenerator(row -> kwicItemHandler.getKeywordDescription(row), ContentMode.HTML);
kwicGrid.addColumn(row -> kwicItemHandler.getForwardContext(row)).setCaption("Right Context").setStyleGenerator(row -> kwicItemHandler.getForwardContextStyle(row)).setWidth(200);
kwicGrid.addColumn(row -> row.getRange().getStartPoint()).setCaption("Start Point").setWidth(100).setId(ColumnId.START_POS.name()).setHidable(true);
kwicGrid.addColumn(row -> row.getRange().getEndPoint()).setCaption("End Point").setWidth(100).setHidable(true);
kwicGrid.addColumn(row -> kwicItemHandler.getTagPath(row)).setCaption("Tag").setHidable(true).setHidden(true).setId(ColumnId.TAG.name()).setWidth(200);
kwicGrid.addColumn(row -> kwicItemHandler.getPropertyName(row)).setCaption("Property").setHidable(true).setHidden(true).setId(ColumnId.PROPERTY_NAME.name()).setWidth(200);
kwicGrid.addColumn(row -> kwicItemHandler.getPropertyValue(row)).setCaption("Value").setHidable(true).setHidden(true).setId(ColumnId.PROPERTY_VALUE.name()).setWidth(200);
kwicGrid.sort(keywordColumn);
kwicGrid.getDefaultHeaderRow().getCell(keywordColumn).setStyleName("kwic-panel-keyword-header");
kwicGrid.getDefaultHeaderRow().getCell(backwardCtxColumn).setStyleName("kwic-panel-backwardctx-header");
kwicGridComponent = new ActionGridComponent<>(new Label("Keyword in context"), kwicGrid);
kwicGridComponent.getActionGridBar().setAddBtnVisible(false);
kwicGridComponent.getActionGridBar().addButtonRight(btExpandCompress);
kwicGridComponent.setMargin(new MarginInfo(false, false, false, true));
addComponent(kwicGridComponent);
setExpandRatio(kwicGridComponent, 1f);
btnClearSelectedRows = new IconButton(VaadinIcons.ERASER);
btnClearSelectedRows.setVisible(false);
btnClearSelectedRows.setDescription("Remove the selected rows from this list");
}
Aggregations