use of de.catma.ui.dialog.SingleTextInputDialog in project catma by forTEXT.
the class AddMetadataStep method initActions.
private void initActions() {
fileActionGridComponent.getActionGridBar().getBtnMoreOptionsContextMenu().addItem("Set author", menuItem -> {
if (fileGrid.getSelectedItems().isEmpty()) {
Notification.show("Info", "Please select one or more entries first!", Type.HUMANIZED_MESSAGE);
} else {
SingleTextInputDialog authorInputDialog = new SingleTextInputDialog("Set the author", "Author", result -> {
fileGrid.getSelectedItems().forEach(uploadFile -> uploadFile.setAuthor(result));
fileDataProvider.refreshAll();
});
authorInputDialog.show();
}
});
fileActionGridComponent.getActionGridBar().getBtnMoreOptionsContextMenu().addItem("Set author", menuItem -> {
if (fileGrid.getSelectedItems().isEmpty()) {
Notification.show("Info", "Please select one or more entries first!", Type.HUMANIZED_MESSAGE);
} else {
SingleTextInputDialog publisherInputDialog = new SingleTextInputDialog("Set the publisher", "Publisher", result -> {
fileGrid.getSelectedItems().forEach(uploadFile -> uploadFile.setPublisher(result));
fileDataProvider.refreshAll();
});
publisherInputDialog.show();
}
});
fileActionGridComponent.getActionGridBar().getBtnMoreOptionsContextMenu().addItem("Set description", menuItem -> {
if (fileGrid.getSelectedItems().isEmpty()) {
Notification.show("Info", "Please select one or more entries first!", Type.HUMANIZED_MESSAGE);
} else {
SingleTextInputDialog descriptionInputDialog = new SingleTextInputDialog("Set the description", "Description", result -> {
fileGrid.getSelectedItems().forEach(uploadFile -> uploadFile.setDescription(result));
fileDataProvider.refreshAll();
});
descriptionInputDialog.show();
}
});
}
use of de.catma.ui.dialog.SingleTextInputDialog in project catma by forTEXT.
the class AnnotationPanel method handelAddCollectionRequest.
private void handelAddCollectionRequest() {
final SourceDocument document = currentDocumentProvider.get();
if (document != null) {
SingleTextInputDialog collectionNameDlg = new SingleTextInputDialog("Add Annotation Collection", "Please enter the Collection name:", new SaveCancelListener<String>() {
@Override
public void savePressed(String result) {
project.createUserMarkupCollection(result, document);
}
});
collectionNameDlg.show();
} else {
Notification.show("Info", "Please select a Document first!", Type.HUMANIZED_MESSAGE);
}
}
use of de.catma.ui.dialog.SingleTextInputDialog in project catma by forTEXT.
the class AnnotateResourcePanel method handleAddCollectionRequest.
private void handleAddCollectionRequest() {
Set<DocumentTreeItem> selectedItems = documentTree.getSelectedItems();
Set<SourceDocument> selectedDocuments = new HashSet<>();
for (DocumentTreeItem resource : selectedItems) {
DocumentTreeItem root = documentData.getParent(resource);
if (root == null) {
root = resource;
}
DocumentDataItem documentDataItem = (DocumentDataItem) root;
selectedDocuments.add(documentDataItem.getDocument());
}
if (selectedDocuments.isEmpty()) {
SourceDocument document = getSelectedDocument();
if (document != null) {
selectedDocuments.add(document);
}
}
if (selectedDocuments.isEmpty()) {
Notification.show("Info", "Please select at least one Document first!", Type.HUMANIZED_MESSAGE);
} else {
SingleTextInputDialog collectionNameDlg = new SingleTextInputDialog("Add Annotation Collection", "Please enter the Collection name:", new SaveCancelListener<String>() {
@Override
public void savePressed(String result) {
for (SourceDocument document : selectedDocuments) {
project.createUserMarkupCollection(result, document);
}
}
});
collectionNameDlg.show();
}
}
use of de.catma.ui.dialog.SingleTextInputDialog in project catma by forTEXT.
the class CollectionSelectionStep method handleAddCollectionRequest.
private void handleAddCollectionRequest() {
try {
if (!project.hasPermission(project.getRoleOnProject(), RBACPermission.COLLECTION_CREATE)) {
Notification.show("Info", "You do not have the permission to create Collections, please contact a Project maintainer!", Type.HUMANIZED_MESSAGE);
return;
}
@SuppressWarnings("unchecked") TreeDataProvider<Resource> resourceDataProvider = (TreeDataProvider<Resource>) documentGrid.getDataProvider();
Set<Resource> selectedResources = documentGrid.getSelectedItems();
Set<SourceDocument> selectedDocuments = new HashSet<>();
for (Resource resource : selectedResources) {
Resource root = resourceDataProvider.getTreeData().getParent(resource);
if (root == null) {
root = resource;
}
DocumentResource documentResource = (DocumentResource) root;
selectedDocuments.add(documentResource.getDocument());
}
if (!selectedDocuments.isEmpty()) {
SingleTextInputDialog collectionNameDlg = new SingleTextInputDialog("Add Annotation Collection(s)", "Please enter the Collection name:", new SaveCancelListener<String>() {
@Override
public void savePressed(String result) {
for (SourceDocument document : selectedDocuments) {
project.createUserMarkupCollection(result, document);
}
}
});
collectionNameDlg.show();
} else {
Notification.show("Info", "Please select one or more Documents first!", Type.HUMANIZED_MESSAGE);
}
} catch (Exception e) {
((ErrorHandler) UI.getCurrent()).showAndLogError("error adding a Collection", e);
}
}
use of de.catma.ui.dialog.SingleTextInputDialog in project catma by forTEXT.
the class ProjectView method handleAddTagsetRequest.
private void handleAddTagsetRequest() {
SingleTextInputDialog collectionNameDlg = new SingleTextInputDialog("Add Tagset", "Please enter the Tagset name:", new SaveCancelListener<String>() {
@Override
public void savePressed(String result) {
IDGenerator idGenerator = new IDGenerator();
project.getTagManager().addTagsetDefinition(new TagsetDefinition(idGenerator.generateTagsetId(), result, new Version()));
}
});
collectionNameDlg.show();
}
Aggregations