use of de.tudarmstadt.ukp.clarin.webanno.api.annotation.actionbar.open.OpenDocumentDialog in project webanno by webanno.
the class DefaultDocumentNavigatorActionBarExtension method onInitialize.
@Override
public void onInitialize(AnnotationPageBase aPage) {
ActionBarExtension.super.onInitialize(aPage);
aPage.getFooterItems().getObject().stream().anyMatch(component -> component instanceof OpenDocumentDialog);
// Open the dialog if no document has been selected.
aPage.add(new AutoOpenDialogBehavior());
// We put the dialog into the page footer since this is presently the only place where we
// can dynamically add stuff to the page. We cannot add simply to the action bar (i.e.
// DocumentNavigator) because the action bar only shows *after* a document has been
// selected. In order to allow the dialog to be rendered *before* a document has been
// selected (i.e. when the action bar is still not on screen), we need to attach it to the
// page. The same for the AutoOpenDialogBehavior we add below.
OpenDocumentDialog openDocumentsModal = createOpenDocumentsDialog("item", aPage);
aPage.addToFooter(openDocumentsModal);
}
use of de.tudarmstadt.ukp.clarin.webanno.api.annotation.actionbar.open.OpenDocumentDialog in project webanno by webanno.
the class AutoOpenDialogBehavior method respond.
@Override
protected void respond(AjaxRequestTarget aTarget) {
AnnotationPageBase page = (AnnotationPageBase) getComponent().getPage();
// trying to open it.
if (page.getModelObject().getDocument() != null) {
return;
}
page.getModelObject().getSelection().clear();
page.getFooterItems().getObject().stream().filter(component -> component instanceof OpenDocumentDialog).map(component -> (OpenDocumentDialog) component).findFirst().ifPresent(dialog -> dialog.show(aTarget));
}
Aggregations