use of com.vaadin.server.SerializablePredicate in project catma by forTEXT.
the class TagsView method initActions.
private void initActions() {
tagsetGrid.addColumn(tagsetTreeItem -> tagsetTreeItem.getColor(), new HtmlRenderer()).setCaption("Tagsets").setSortable(false).setWidth(200);
tagsetGrid.setHierarchyColumn(tagsetGrid.addColumn(tagsetTreeItem -> tagsetTreeItem.getName()).setCaption("Tags").setSortable(false).setWidth(300));
ButtonRenderer<TagsetTreeItem> propertySummaryRenderer = new ButtonRenderer<>(rendererClickEvent -> handlePropertySummaryClickEvent(rendererClickEvent));
propertySummaryRenderer.setHtmlContentAllowed(true);
tagsetGrid.addColumn(tagsetTreeItem -> tagsetTreeItem.getPropertySummary(), propertySummaryRenderer).setCaption("Properties").setSortable(false).setHidable(true).setWidth(300);
tagsetGrid.addColumn(tagsetTreeItem -> tagsetTreeItem.getPropertyValue()).setCaption("Values").setSortable(false).setHidable(true).setWidth(300);
ButtonRenderer<TagsetTreeItem> btRemovalRenderer = new ButtonRenderer<>(rendererClickEvent -> handleTagsetTreeItemRemovalRequest(rendererClickEvent));
btRemovalRenderer.setHtmlContentAllowed(true);
tagsetGrid.addColumn(tagsetTreeItem -> tagsetTreeItem.getRemoveIcon()).setRenderer(btRemovalRenderer).setSortable(false).setHidable(false).setExpandRatio(1);
tagsetGrid.setStyleGenerator(new StyleGenerator<TagsetTreeItem>() {
@Override
public String apply(TagsetTreeItem item) {
return item.generateStyle();
}
});
tagsetGridComponent.setSearchFilterProvider(new SearchFilterProvider<TagsetTreeItem>() {
@Override
public SerializablePredicate<TagsetTreeItem> createSearchFilter(String searchInput) {
return new TagsetSearchFilterProvider(searchInput, tagsetData);
}
});
tagsetGrid.addExpandListener(expandEvent -> handleExpandCollapseTagset(expandEvent.getExpandedItem(), true));
tagsetGrid.addCollapseListener(collapseEvent -> handleExpandCollapseTagset(collapseEvent.getCollapsedItem(), false));
ContextMenu addContextMenu = tagsetGridComponent.getActionGridBar().getBtnAddContextMenu();
addContextMenu.addItem("Add Tagset", clickEvent -> handleAddTagsetRequest());
addContextMenu.addItem("Add Tag", clickEvent -> handleAddTagRequest());
addContextMenu.addItem("Add Subtag", clickEvent -> handleAddSubtagRequest());
addContextMenu.addItem("Add Property", clickEvent -> handleAddPropertyRequest());
ContextMenu moreOptionsContextMenu = tagsetGridComponent.getActionGridBar().getBtnMoreOptionsContextMenu();
moreOptionsContextMenu.addItem("Edit Tag", clickEvent -> handleEditTagRequest());
moreOptionsContextMenu.addItem("Delete Tag", clickEvent -> handleDeleteTagRequest());
moreOptionsContextMenu.addItem("Edit/Delete Properties", clickEvent -> handleEditPropertiesRequest());
moreOptionsContextMenu.addItem("Edit Tagset", clickEvent -> handleEditTagsetRequest());
moreOptionsContextMenu.addItem("Delete Tagset", clickEvent -> handleDeleteTagsetRequest());
resourcePanel.setTagsetSelectionListener(selectedTagsets -> {
tagsets.clear();
tagsets.addAll(selectedTagsets);
initData();
});
}
use of com.vaadin.server.SerializablePredicate in project catma by forTEXT.
the class KwicPanel method initActions.
private void initActions(EventBus eventBus) {
ContextMenu moreOptionsMenu = kwicGridComponent.getActionGridBar().getBtnMoreOptionsContextMenu();
moreOptionsMenu.addItem("Annotate selected rows", mi -> handleAnnotateSelectedRequest(eventBus));
ActionGridBar actionBar = kwicGridComponent.getActionGridBar();
actionBar.addButtonAfterSearchField(btnClearSelectedRows);
btnClearSelectedRows.addClickListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
handleRemoveRowRequest();
}
});
miRemoveAnnotations = moreOptionsMenu.addItem("Remove selected Annotations", mi -> handleRemoveAnnotationsRequest(eventBus));
miRemoveAnnotations.setEnabled(false);
MenuItem miExport = moreOptionsMenu.addItem("Export");
MenuItem miCSVFlatExport = miExport.addItem("Export as CSV");
StreamResource csvFlatExportResource = new StreamResource(new CSVExportFlatStreamSource(() -> getFilteredQueryResult(), project, kwicItemHandler.getKwicProviderCache(), ((BackgroundServiceProvider) UI.getCurrent())), "CATMA-KWIC_Export-" + LocalDateTime.now().format(DateTimeFormatter.ISO_DATE_TIME) + ".csv");
csvFlatExportResource.setCacheTime(0);
csvFlatExportResource.setMIMEType("text/comma-separated-values");
FileDownloader csvFlatExportFileDownloader = new FileDownloader(csvFlatExportResource);
csvFlatExportFileDownloader.extend(miCSVFlatExport);
kwicGridComponent.setSearchFilterProvider(new SearchFilterProvider<QueryResultRow>() {
@Override
public SerializablePredicate<QueryResultRow> createSearchFilter(String searchInput) {
return (row) -> kwicItemHandler.containsSearchInput(row, searchInput);
}
});
btExpandCompress.addClickListener(clickEvent -> handleMaxMinRequest());
defaultDoubleClickRegistration = kwicGrid.addItemClickListener(clickEvent -> handleKwicItemClick(clickEvent, eventBus));
}
use of com.vaadin.server.SerializablePredicate in project catma by forTEXT.
the class TagSelectionPanel method initActions.
private void initActions() {
tagsetGrid.addColumn(tagsetTreeItem -> tagsetTreeItem.getColor(), new HtmlRenderer()).setCaption("Tagsets").setSortable(false).setWidth(200);
tagsetGrid.setHierarchyColumn(tagsetGrid.addColumn(tagsetTreeItem -> tagsetTreeItem.getName()).setCaption("Tags").setSortable(false).setExpandRatio(1));
tagsetGridComponent.setSearchFilterProvider(new SearchFilterProvider<TagsetTreeItem>() {
@Override
public SerializablePredicate<TagsetTreeItem> createSearchFilter(String searchInput) {
return new TagsetSearchFilterProvider(searchInput, tagsetData);
}
});
ContextMenu addContextMenu = tagsetGridComponent.getActionGridBar().getBtnAddContextMenu();
addContextMenu.addItem("Add Tagset", clickEvent -> handleAddTagsetRequest());
addContextMenu.addItem("Add Tag", clickEvent -> handleAddTagRequest());
addContextMenu.addItem("Add Subtag", clickEvent -> handleAddSubtagRequest());
tagsetGrid.addExpandListener(expandEvent -> expandEvent.getExpandedItem().setTagsetExpanded(true));
tagsetGrid.addCollapseListener(collapseEvent -> collapseEvent.getCollapsedItem().setTagsetExpanded(false));
}
use of com.vaadin.server.SerializablePredicate in project catma by forTEXT.
the class AnnotationPanel method initActions.
private void initActions(Consumer<AnnotationCollection> collectionSelectionListener, Consumer<TagDefinition> tagSelectionListener) {
tagsetGrid.addColumn(tagsetTreeItem -> tagsetTreeItem.getColor(), new HtmlRenderer()).setCaption("Tagsets").setSortable(false).setWidth(100);
tagsetGrid.setHierarchyColumn(tagsetGrid.addColumn(tagsetTreeItem -> tagsetTreeItem.getName()).setCaption("Tags").setSortable(false).setWidth(200));
ButtonRenderer<TagsetTreeItem> propertySummaryRenderer = new ButtonRenderer<>(rendererClickEvent -> handlePropertySummaryClickEvent(rendererClickEvent));
propertySummaryRenderer.setHtmlContentAllowed(true);
tagsetGrid.addColumn(tagsetTreeItem -> tagsetTreeItem.getPropertySummary(), propertySummaryRenderer).setCaption("Properties").setSortable(false).setHidable(true).setWidth(100);
tagsetGrid.addColumn(tagsetTreeItem -> tagsetTreeItem.getPropertyValue()).setCaption("Values").setSortable(false).setHidable(true).setWidth(100);
ButtonRenderer<TagsetTreeItem> visibilityRenderer = new ButtonRenderer<TagsetTreeItem>(rendererClickEvent -> handleVisibilityClickEvent(rendererClickEvent));
visibilityRenderer.setHtmlContentAllowed(true);
tagsetGrid.addColumn(tagsetTreeItem -> tagsetTreeItem.getVisibilityIcon(), visibilityRenderer).setWidth(80).setSortable(false);
tagsetGrid.setStyleGenerator(new StyleGenerator<TagsetTreeItem>() {
@Override
public String apply(TagsetTreeItem item) {
return item.generateStyle();
}
});
tagsetGridComponent.setSearchFilterProvider(new SearchFilterProvider<TagsetTreeItem>() {
@Override
public SerializablePredicate<TagsetTreeItem> createSearchFilter(String searchInput) {
return new SerializablePredicate<TagsetTreeItem>() {
@Override
public boolean test(TagsetTreeItem t) {
return testWithChildren(t);
}
private boolean testTagsetTreeItem(TagsetTreeItem t) {
String strValue = t.toString();
if (strValue != null && strValue.toLowerCase().contains(searchInput.toLowerCase())) {
return true;
}
return false;
}
public boolean testWithChildren(TagsetTreeItem t) {
if (t == null) {
return false;
}
if (testTagsetTreeItem(t)) {
return true;
}
for (TagsetTreeItem child : tagsetData.getChildren(t)) {
if (testWithChildren(child)) {
return true;
}
}
return false;
}
};
}
});
tagsetGrid.addItemClickListener(clickEvent -> handleTagSelection(clickEvent, tagSelectionListener));
tagsetGrid.addCollapseListener(event -> event.getCollapsedItem().setTagsetExpanded(false));
tagsetGrid.addExpandListener(event -> event.getExpandedItem().setTagsetExpanded(true));
ContextMenu addContextMenu = tagsetGridComponent.getActionGridBar().getBtnAddContextMenu();
addContextMenu.addItem("Add Tag", clickEvent -> handleAddTagRequest());
addContextMenu.addItem("Add Subtag", clickEvent -> handleAddSubtagRequest());
addContextMenu.addItem("Add Property", clickEvent -> handleAddPropertyRequest());
ContextMenu moreOptionsContextMenu = tagsetGridComponent.getActionGridBar().getBtnMoreOptionsContextMenu();
moreOptionsContextMenu.addItem("Edit Tag", clickEvent -> handleEditTagRequest());
moreOptionsContextMenu.addItem("Edit/Delete Properties", clickEvent -> handleEditPropertiesRequest());
currentEditableCollectionBox.addValueChangeListener(event -> collectionSelectionListener.accept(event.getValue()));
annotationDetailsPanel.addMinimizeButtonClickListener(clickEvent -> setAnnotationDetailsPanelVisible(false));
btMaximizeAnnotationDetailsRibbon.addClickListener(ClickEvent -> setAnnotationDetailsPanelVisible(true));
btAddCollection.addClickListener(clickEvent -> handelAddCollectionRequest());
}
Aggregations