Search in sources :

Example 11 with SingleTextInputDialog

use of de.catma.ui.dialog.SingleTextInputDialog in project catma by forTEXT.

the class ProjectView method handleCommitRequest.

private void handleCommitRequest() {
    try {
        if (project.hasUncommittedChanges()) {
            SingleTextInputDialog dlg = new SingleTextInputDialog("Commit all changes", "Please enter a short description for this commit:", commitMsg -> {
                try {
                    project.commitChanges(commitMsg);
                    Notification.show("Info", "Your changes have been committed!", Type.HUMANIZED_MESSAGE);
                } catch (Exception e) {
                    errorHandler.showAndLogError("Error committing all changes!", e);
                }
            });
            dlg.show();
        } else {
            Notification.show("Info", "There are no uncommitted changes!", Type.HUMANIZED_MESSAGE);
        }
    } catch (Exception e) {
        errorHandler.showAndLogError("Error accessing Project!", e);
    }
}
Also used : SingleTextInputDialog(de.catma.ui.dialog.SingleTextInputDialog) IOException(java.io.IOException) URISyntaxException(java.net.URISyntaxException)

Example 12 with SingleTextInputDialog

use of de.catma.ui.dialog.SingleTextInputDialog in project catma by forTEXT.

the class ProjectView method handleImportCollectionRequest.

private void handleImportCollectionRequest() {
    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 {
            importCollection();
        }
    } catch (Exception e) {
        errorHandler.showAndLogError("Error accessing Project!", e);
    }
}
Also used : SingleTextInputDialog(de.catma.ui.dialog.SingleTextInputDialog) IOException(java.io.IOException) URISyntaxException(java.net.URISyntaxException)

Example 13 with SingleTextInputDialog

use of de.catma.ui.dialog.SingleTextInputDialog in project catma by forTEXT.

the class ProjectView method handleSynchronizeRequest.

private void handleSynchronizeRequest() {
    try {
        setEnabled(false);
        if (project.hasUncommittedChanges()) {
            SingleTextInputDialog dlg = new SingleTextInputDialog("Commit all changes", "You have uncommitted changes, please enter a short description for this commit:", commitMsg -> {
                try {
                    project.commitChanges(commitMsg);
                    synchronizeProject();
                } catch (Exception e) {
                    setEnabled(true);
                    ((ErrorHandler) UI.getCurrent()).showAndLogError("error committing changes", e);
                }
            });
            dlg.show();
        } else {
            synchronizeProject();
        }
    } catch (Exception e) {
        errorHandler.showAndLogError("error accessing project", e);
    }
}
Also used : SingleTextInputDialog(de.catma.ui.dialog.SingleTextInputDialog) IOException(java.io.IOException) URISyntaxException(java.net.URISyntaxException)

Example 14 with SingleTextInputDialog

use of de.catma.ui.dialog.SingleTextInputDialog in project catma by forTEXT.

the class TagSelectionPanel method handleAddTagsetRequest.

private void handleAddTagsetRequest() {
    SingleTextInputDialog tagsetNameDlg = 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()));
        }
    });
    tagsetNameDlg.show();
}
Also used : TagsetDefinition(de.catma.tag.TagsetDefinition) Version(de.catma.tag.Version) SingleTextInputDialog(de.catma.ui.dialog.SingleTextInputDialog) IDGenerator(de.catma.util.IDGenerator)

Example 15 with SingleTextInputDialog

use of de.catma.ui.dialog.SingleTextInputDialog in project catma by forTEXT.

the class TagsView method handleAddTagsetRequest.

private void handleAddTagsetRequest() {
    if (project.isAuthorizedOnProject(RBACPermission.TAGSET_CREATE_OR_UPLOAD)) {
        SingleTextInputDialog tagsetNameDlg = 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()));
            }
        });
        tagsetNameDlg.show();
    } else {
        Notification.show("Info", "You do not have the permission to create Tagsets! " + "Please contact the Project maintainer for changes!", Type.HUMANIZED_MESSAGE);
    }
}
Also used : TagsetDefinition(de.catma.tag.TagsetDefinition) Version(de.catma.tag.Version) SingleTextInputDialog(de.catma.ui.dialog.SingleTextInputDialog) IDGenerator(de.catma.util.IDGenerator)

Aggregations

SingleTextInputDialog (de.catma.ui.dialog.SingleTextInputDialog)17 TagsetDefinition (de.catma.tag.TagsetDefinition)7 Version (de.catma.tag.Version)6 IOException (java.io.IOException)6 SourceDocument (de.catma.document.source.SourceDocument)5 IDGenerator (de.catma.util.IDGenerator)5 URISyntaxException (java.net.URISyntaxException)5 TreeDataProvider (com.vaadin.data.provider.TreeDataProvider)2 Pair (de.catma.util.Pair)2 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)2 List (java.util.List)2 MaterialTheme (com.github.appreciated.material.MaterialTheme)1 ArrayListMultimap (com.google.common.collect.ArrayListMultimap)1 Multimap (com.google.common.collect.Multimap)1 EventBus (com.google.common.eventbus.EventBus)1 ContextMenu (com.vaadin.contextmenu.ContextMenu)1 TreeData (com.vaadin.data.TreeData)1 SerializablePredicate (com.vaadin.server.SerializablePredicate)1 SelectionMode (com.vaadin.ui.Grid.SelectionMode)1