use of de.catma.ui.dialog.SingleTextInputDialog in project catma by forTEXT.
the class ProjectView method handleEditTagsetRequest.
private void handleEditTagsetRequest() {
final Set<TagsetDefinition> tagsets = tagsetGrid.getSelectedItems();
if (!tagsets.isEmpty()) {
final TagsetDefinition tagset = tagsets.iterator().next();
SingleTextInputDialog tagsetNameDlg = new SingleTextInputDialog("Edit Tagset", "Please enter the new Tagset name:", tagset.getName(), new SaveCancelListener<String>() {
@Override
public void savePressed(String result) {
project.getTagManager().setTagsetDefinitionName(tagset, result);
}
});
tagsetNameDlg.show();
} else {
Notification.show("Info", "Please select a Tagset first!", Type.HUMANIZED_MESSAGE);
}
}
use of de.catma.ui.dialog.SingleTextInputDialog in project catma by forTEXT.
the class ProjectView method handleAddCollectionRequest.
private void handleAddCollectionRequest() {
Set<SourceDocument> selectedDocuments = getSelectedDocuments();
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);
}
}
use of de.catma.ui.dialog.SingleTextInputDialog in project catma by forTEXT.
the class ProjectView method handleCorpusImport.
private void handleCorpusImport() {
try {
if (project.hasUncommittedChanges()) {
SingleTextInputDialog dlg = new SingleTextInputDialog("Commit all changes", "You have changes, that need to be committed first, please enter a short description for this commit:", commitMsg -> {
try {
project.commitChanges(commitMsg);
importCollection();
} catch (Exception e) {
setEnabled(true);
((ErrorHandler) UI.getCurrent()).showAndLogError("error committing changes", e);
}
});
dlg.show();
} else {
CorpusImportDialog corpusImportDialog = new CorpusImportDialog(new SaveCancelListener<Pair<File, List<CorpusImportDocumentMetadata>>>() {
@Override
public void savePressed(Pair<File, List<CorpusImportDocumentMetadata>> result) {
importCorpus(result.getFirst(), result.getSecond());
}
});
corpusImportDialog.show();
}
} catch (Exception e) {
errorHandler.showAndLogError("Error accessing Project!", e);
}
}
use of de.catma.ui.dialog.SingleTextInputDialog in project catma by forTEXT.
the class ProjectView method handleEditResources.
private void handleEditResources() {
final Set<Resource> selectedResources = documentGrid.getSelectedItems();
if (selectedResources.isEmpty()) {
Notification.show("Info", "Please select a resource first!", Type.HUMANIZED_MESSAGE);
} else {
final Resource resource = selectedResources.iterator().next();
if (selectedResources.size() > 1) {
documentGridComponent.setSelectionMode(SelectionMode.SINGLE);
}
if (resource.isCollection()) {
final AnnotationCollectionReference collectionRef = ((CollectionResource) selectedResources.iterator().next()).getCollectionReference();
SingleTextInputDialog collectionNameDlg = new SingleTextInputDialog("Edit Collection", "Please enter the new collection name:", new SaveCancelListener<String>() {
@Override
public void savePressed(String result) {
collectionRef.getContentInfoSet().setTitle(result);
try {
project.update(collectionRef, collectionRef.getContentInfoSet());
documentGrid.getDataProvider().refreshItem(resource);
} catch (Exception e) {
errorHandler.showAndLogError("Error updating collection", e);
}
}
});
collectionNameDlg.show();
} else {
final SourceDocument document = ((DocumentResource) selectedResources.iterator().next()).getDocument();
SingleTextInputDialog collectionNameDlg = new SingleTextInputDialog("Edit Document", "Please enter the new document name:", new SaveCancelListener<String>() {
@Override
public void savePressed(String result) {
document.getSourceContentHandler().getSourceDocumentInfo().getContentInfoSet().setTitle(result);
try {
project.update(document, document.getSourceContentHandler().getSourceDocumentInfo().getContentInfoSet());
} catch (Exception e) {
errorHandler.showAndLogError("Error updating document", e);
}
}
});
collectionNameDlg.show();
}
}
}
use of de.catma.ui.dialog.SingleTextInputDialog in project catma by forTEXT.
the class TagsView method handleEditTagsetRequest.
private void handleEditTagsetRequest() {
if (project.isAuthorizedOnProject(RBACPermission.TAGSET_DELETE_OR_EDIT)) {
Collection<TagsetDefinition> selectedTagsets = tagsetGrid.getSelectedItems().stream().filter(tagsetTreeItem -> tagsetTreeItem instanceof TagsetDataItem).map(tagsetDataItem -> ((TagsetDataItem) tagsetDataItem).getTagset()).collect(Collectors.toList());
if (!selectedTagsets.isEmpty()) {
final TagsetDefinition tagset = selectedTagsets.iterator().next();
SingleTextInputDialog tagsetNameDlg = new SingleTextInputDialog("Edit Tagset", "Please enter the new Tagset name:", tagset.getName(), new SaveCancelListener<String>() {
@Override
public void savePressed(String result) {
project.getTagManager().setTagsetDefinitionName(tagset, result);
}
});
tagsetNameDlg.show();
} else {
Notification.show("Info", "Please select a Tagset first!", Type.HUMANIZED_MESSAGE);
}
} else {
Notification.show("Info", "You do not have the permission to edit Tagsets! " + "Please contact the Project maintainer for changes!", Type.HUMANIZED_MESSAGE);
}
}
Aggregations