Search in sources :

Example 1 with ValueOutOfBoundsException

use of com.vaadin.ui.Slider.ValueOutOfBoundsException in project catma by forTEXT.

the class TaggerView method initData.

private void initData(final AfterDocumentLoadedOperation afterDocumentLoadedOperation) {
    if (sourceDocument != null) {
        // loading of the Document is done in an extra step,
        // because of a client side rendering racing condition which prevents the first page to be displayed
        final UI ui = UI.getCurrent();
        ((CatmaApplication) ui).submit("Load Document", new DefaultProgressCallable<Void>() {

            @Override
            public Void call() throws Exception {
                ui.accessSynchronously(() -> {
                    try {
                        linesPerPageSlider.setEnabled(true);
                        btAnalyze.setEnabled(project instanceof IndexedProject);
                        pagerComponent.setEnabled(true);
                        TaggerView.this.comments.clear();
                        TaggerView.this.comments.addAll(TaggerView.this.project.getComments(sourceDocument.getUuid()));
                        tagger.setText(sourceDocument.getContent(), TaggerView.this.comments);
                        totalLineCount = pager.getTotalLineCount();
                        try {
                            linesPerPageSlider.setValue((100.0 / totalLineCount) * maxPageLengthInLines);
                        } catch (ValueOutOfBoundsException toBeIgnored) {
                        }
                        List<AnnotationCollectionReference> collectionReferences = resourcePanel.getSelectedAnnotationCollectionReferences();
                        userMarkupCollectionManager.clear();
                        for (AnnotationCollectionReference collectionRef : collectionReferences) {
                            AnnotationCollection collection = project.getUserMarkupCollection(collectionRef);
                            userMarkupCollectionManager.add(collection);
                        }
                        Collection<TagsetDefinition> tagsets = new HashSet<>(resourcePanel.getSelectedTagsets());
                        annotationPanel.setData(sourceDocument, tagsets, new ArrayList<>(userMarkupCollectionManager.getUserMarkupCollections()));
                        if (taggerContextMenu != null) {
                            taggerContextMenu.setTagsets(tagsets);
                        }
                        if (afterDocumentLoadedOperation != null) {
                            afterDocumentLoadedOperation.afterDocumentLoaded(TaggerView.this);
                        }
                        ui.push();
                    } catch (IOException e) {
                        errorHandler.showAndLogError("Error showing the Document!", e);
                    }
                });
                return null;
            }
        }, new ExecutionListener<Void>() {

            @Override
            public void done(Void result) {
            /*noop*/
            }

            @Override
            public void error(Throwable t) {
                errorHandler.showAndLogError("Error showing the Document!", t);
            }
        });
    } else {
        linesPerPageSlider.setEnabled(false);
        btAnalyze.setEnabled(false);
        pagerComponent.setEnabled(false);
    }
}
Also used : AnnotationCollection(de.catma.document.annotation.AnnotationCollection) ArrayList(java.util.ArrayList) AnnotationCollectionReference(de.catma.document.annotation.AnnotationCollectionReference) IOException(java.io.IOException) ValueOutOfBoundsException(com.vaadin.ui.Slider.ValueOutOfBoundsException) IOException(java.io.IOException) URISyntaxException(java.net.URISyntaxException) CatmaApplication(de.catma.ui.CatmaApplication) UI(com.vaadin.ui.UI) ValueOutOfBoundsException(com.vaadin.ui.Slider.ValueOutOfBoundsException) AnnotationCollection(de.catma.document.annotation.AnnotationCollection) Collection(java.util.Collection) ArrayList(java.util.ArrayList) List(java.util.List) IndexedProject(de.catma.indexer.IndexedProject)

Aggregations

ValueOutOfBoundsException (com.vaadin.ui.Slider.ValueOutOfBoundsException)1 UI (com.vaadin.ui.UI)1 AnnotationCollection (de.catma.document.annotation.AnnotationCollection)1 AnnotationCollectionReference (de.catma.document.annotation.AnnotationCollectionReference)1 IndexedProject (de.catma.indexer.IndexedProject)1 CatmaApplication (de.catma.ui.CatmaApplication)1 IOException (java.io.IOException)1 URISyntaxException (java.net.URISyntaxException)1 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 List (java.util.List)1