From 6bc2353619196953171a99d76fc04856259b0d1a Mon Sep 17 00:00:00 2001 From: Richard Eckart de Castilho Date: Thu, 5 Oct 2023 21:48:24 +0200 Subject: [PATCH 1/9] #4229 - Better project template selection - First steps towards a better template selection --- inception/inception-dependencies/pom.xml | 10 - .../basic/BasicProjectInitializer.java | 19 ++ .../project/initializers/basic/thumbnail.svg | 173 ++++++++++++++++++ ...sicDocumentLabelingProjectInitializer.java | 7 + .../SentenceLabelingProjectInitializer.java | 7 + .../EntityLinkingProjectInitializer.java | 7 + .../initializers/QuickProjectInitializer.java | 14 ++ .../empty/EmptyProjectInitializer.java | 9 +- inception/inception-tutorial/pom.xml | 4 - .../webanno/ui/core/login/LoginPage.css | 7 +- .../webanno/ui/core/login/LoginPage.html | 2 +- .../webanno/ui/core/login/LoginPage.java | 4 - inception/inception-ui-dashboard/pom.xml | 5 - .../ui/core/dashboard/DashboardMenu.java | 12 -- .../ProjectTemplateSelectionDialogPanel.html | 63 +++++++ .../ProjectTemplateSelectionDialogPanel.java | 144 +++++++++++++++ .../projectlist/ProjectsOverviewPage.html | 2 +- .../projectlist/ProjectsOverviewPage.java | 21 +-- .../ProjectsOverviewPage.properties | 2 + .../dashboard/projectlist/no-thumbnail.svg | 72 ++++++++ pom.xml | 2 - 21 files changed, 533 insertions(+), 53 deletions(-) create mode 100644 inception/inception-project-initializers-basic/src/main/resources/de/tudarmstadt/ukp/inception/project/initializers/basic/thumbnail.svg create mode 100644 inception/inception-ui-dashboard/src/main/java/de/tudarmstadt/ukp/inception/ui/core/dashboard/projectlist/ProjectTemplateSelectionDialogPanel.html create mode 100644 inception/inception-ui-dashboard/src/main/java/de/tudarmstadt/ukp/inception/ui/core/dashboard/projectlist/ProjectTemplateSelectionDialogPanel.java create mode 100644 inception/inception-ui-dashboard/src/main/java/de/tudarmstadt/ukp/inception/ui/core/dashboard/projectlist/no-thumbnail.svg diff --git a/inception/inception-dependencies/pom.xml b/inception/inception-dependencies/pom.xml index c0bfae1dc51..7a2bec87a49 100644 --- a/inception/inception-dependencies/pom.xml +++ b/inception/inception-dependencies/pom.xml @@ -369,16 +369,6 @@ - - org.webjars.bower - hover - ${hover.version} - - - org.webjars - animate.css - ${animate-css.version} - org.sharegov mjson diff --git a/inception/inception-project-initializers-basic/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/basic/BasicProjectInitializer.java b/inception/inception-project-initializers-basic/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/basic/BasicProjectInitializer.java index b438bf5e5df..773c9293b56 100644 --- a/inception/inception-project-initializers-basic/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/basic/BasicProjectInitializer.java +++ b/inception/inception-project-initializers-basic/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/basic/BasicProjectInitializer.java @@ -18,9 +18,13 @@ package de.tudarmstadt.ukp.inception.project.initializers.basic; import java.io.IOException; +import java.lang.invoke.MethodHandles; import java.util.ArrayList; import java.util.List; +import java.util.Optional; +import org.apache.wicket.request.resource.PackageResourceReference; +import org.apache.wicket.request.resource.ResourceReference; import org.springframework.context.ApplicationContext; import de.tudarmstadt.ukp.clarin.webanno.api.project.ProjectInitializer; @@ -37,6 +41,9 @@ public class BasicProjectInitializer implements QuickProjectInitializer { + private static final PackageResourceReference THUMBNAIL = new PackageResourceReference( + MethodHandles.lookup().lookupClass(), "thumbnail.svg"); + private final ApplicationContext context; public BasicProjectInitializer(ApplicationContext aContext) @@ -50,6 +57,18 @@ public String getName() return "Basic annotation (span/relation)"; } + @Override + public Optional getDescription() + { + return Optional.of("Create annotations on words and connect them using relations."); + } + + @Override + public Optional getThumbnail() + { + return Optional.of(THUMBNAIL); + } + @Override public boolean alreadyApplied(Project aProject) { diff --git a/inception/inception-project-initializers-basic/src/main/resources/de/tudarmstadt/ukp/inception/project/initializers/basic/thumbnail.svg b/inception/inception-project-initializers-basic/src/main/resources/de/tudarmstadt/ukp/inception/project/initializers/basic/thumbnail.svg new file mode 100644 index 00000000000..b04af56b2b2 --- /dev/null +++ b/inception/inception-project-initializers-basic/src/main/resources/de/tudarmstadt/ukp/inception/project/initializers/basic/thumbnail.svg @@ -0,0 +1,173 @@ + + + + + + + + + + + + + + + + I + like + Actor + Target + INCEpTION + + + + + diff --git a/inception/inception-project-initializers-doclabeling/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/doclabeling/BasicDocumentLabelingProjectInitializer.java b/inception/inception-project-initializers-doclabeling/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/doclabeling/BasicDocumentLabelingProjectInitializer.java index e731d5964d7..03f7137bd14 100644 --- a/inception/inception-project-initializers-doclabeling/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/doclabeling/BasicDocumentLabelingProjectInitializer.java +++ b/inception/inception-project-initializers-doclabeling/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/doclabeling/BasicDocumentLabelingProjectInitializer.java @@ -22,6 +22,7 @@ import java.io.IOException; import java.util.List; +import java.util.Optional; import de.tudarmstadt.ukp.clarin.webanno.api.project.ProjectInitializer; import de.tudarmstadt.ukp.clarin.webanno.model.Project; @@ -114,4 +115,10 @@ public void configure(Project aProject) throws IOException matrixWorkloadExtension.writeTraits(traits, aProject); workloadManagementService.saveConfiguration(manager); } + + @Override + public Optional getDescription() + { + return Optional.of("Create document-classification annotations."); + } } diff --git a/inception/inception-project-initializers-sentencelabeling/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/sentencelabeling/SentenceLabelingProjectInitializer.java b/inception/inception-project-initializers-sentencelabeling/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/sentencelabeling/SentenceLabelingProjectInitializer.java index ce2feaa114b..e21c61e7a95 100644 --- a/inception/inception-project-initializers-sentencelabeling/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/sentencelabeling/SentenceLabelingProjectInitializer.java +++ b/inception/inception-project-initializers-sentencelabeling/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/sentencelabeling/SentenceLabelingProjectInitializer.java @@ -23,6 +23,7 @@ import java.io.IOException; import java.net.URL; import java.util.List; +import java.util.Optional; import org.apache.commons.io.IOUtils; @@ -72,4 +73,10 @@ public void configure(Project aProject) throws IOException // project overview "\n" + IOUtils.toString(descriptionUrl, UTF_8)); } + + @Override + public Optional getDescription() + { + return Optional.of("Annotate documents at the sentence level."); + } } diff --git a/inception/inception-project-initializers-wikidatalinking/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/wikidatalinking/EntityLinkingProjectInitializer.java b/inception/inception-project-initializers-wikidatalinking/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/wikidatalinking/EntityLinkingProjectInitializer.java index 7e568cc07d9..26bd1593ab3 100644 --- a/inception/inception-project-initializers-wikidatalinking/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/wikidatalinking/EntityLinkingProjectInitializer.java +++ b/inception/inception-project-initializers-wikidatalinking/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/wikidatalinking/EntityLinkingProjectInitializer.java @@ -20,6 +20,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; +import java.util.Optional; import org.springframework.context.ApplicationContext; @@ -90,4 +91,10 @@ public void configure(Project aProject) throws IOException valueFeature.setEnabled(false); annotationService.createFeature(valueFeature); } + + @Override + public Optional getDescription() + { + return Optional.of("Link entity mentions to WikiData."); + } } diff --git a/inception/inception-project-initializers/src/main/java/de/tudarmstadt/ukp/clarin/webanno/project/initializers/QuickProjectInitializer.java b/inception/inception-project-initializers/src/main/java/de/tudarmstadt/ukp/clarin/webanno/project/initializers/QuickProjectInitializer.java index 16e6deb4923..e283bec5cb1 100644 --- a/inception/inception-project-initializers/src/main/java/de/tudarmstadt/ukp/clarin/webanno/project/initializers/QuickProjectInitializer.java +++ b/inception/inception-project-initializers/src/main/java/de/tudarmstadt/ukp/clarin/webanno/project/initializers/QuickProjectInitializer.java @@ -17,6 +17,10 @@ */ package de.tudarmstadt.ukp.clarin.webanno.project.initializers; +import java.util.Optional; + +import org.apache.wicket.request.resource.ResourceReference; + import de.tudarmstadt.ukp.clarin.webanno.api.project.ProjectInitializer; public interface QuickProjectInitializer @@ -27,4 +31,14 @@ default boolean applyByDefault() { return false; } + + default Optional getDescription() + { + return Optional.empty(); + } + + default Optional getThumbnail() + { + return Optional.empty(); + } } diff --git a/inception/inception-project-initializers/src/main/java/de/tudarmstadt/ukp/clarin/webanno/project/initializers/empty/EmptyProjectInitializer.java b/inception/inception-project-initializers/src/main/java/de/tudarmstadt/ukp/clarin/webanno/project/initializers/empty/EmptyProjectInitializer.java index 9b114352d71..9271405f971 100644 --- a/inception/inception-project-initializers/src/main/java/de/tudarmstadt/ukp/clarin/webanno/project/initializers/empty/EmptyProjectInitializer.java +++ b/inception/inception-project-initializers/src/main/java/de/tudarmstadt/ukp/clarin/webanno/project/initializers/empty/EmptyProjectInitializer.java @@ -21,6 +21,7 @@ import java.io.IOException; import java.util.List; +import java.util.Optional; import de.tudarmstadt.ukp.clarin.webanno.api.project.ProjectInitializer; import de.tudarmstadt.ukp.clarin.webanno.model.Project; @@ -67,7 +68,13 @@ public List> getDependencies() @Override public void configure(Project aProject) throws IOException { - aProject.setDescription("This project has no pre-defined layers. You will only be able to " + aProject.setDescription(getDescription().get()); + } + + @Override + public Optional getDescription() + { + return Optional.of("This project has no pre-defined layers. You will only be able to " + "annotate after you have defined annotation layers in the project settings."); } } diff --git a/inception/inception-tutorial/pom.xml b/inception/inception-tutorial/pom.xml index 5155be9cae2..66235dbb9b3 100644 --- a/inception/inception-tutorial/pom.xml +++ b/inception/inception-tutorial/pom.xml @@ -61,10 +61,6 @@ wicket-webjars - - org.webjars.bower - hover - org.webjars.bowergithub.xbsoftware enjoyhint diff --git a/inception/inception-ui-core/src/main/java/de/tudarmstadt/ukp/clarin/webanno/ui/core/login/LoginPage.css b/inception/inception-ui-core/src/main/java/de/tudarmstadt/ukp/clarin/webanno/ui/core/login/LoginPage.css index d789c1de1cb..c24f4517379 100644 --- a/inception/inception-ui-core/src/main/java/de/tudarmstadt/ukp/clarin/webanno/ui/core/login/LoginPage.css +++ b/inception/inception-ui-core/src/main/java/de/tudarmstadt/ukp/clarin/webanno/ui/core/login/LoginPage.css @@ -23,6 +23,11 @@ .login-form { min-width: 440px; max-width: 30%; + transition: box-shadow .3s; +} + +.login-form:hover { + box-shadow: 0 0 10px var(--bs-tertiary-color); } .login-form input[type=text],input[type=password] { @@ -39,4 +44,4 @@ .form-floating > .form-control:not(:placeholder-shown) ~ label::after { background-color: unset !important; -} \ No newline at end of file +} diff --git a/inception/inception-ui-core/src/main/java/de/tudarmstadt/ukp/clarin/webanno/ui/core/login/LoginPage.html b/inception/inception-ui-core/src/main/java/de/tudarmstadt/ukp/clarin/webanno/ui/core/login/LoginPage.html index 29543eade0e..a46de32ba17 100644 --- a/inception/inception-ui-core/src/main/java/de/tudarmstadt/ukp/clarin/webanno/ui/core/login/LoginPage.html +++ b/inception/inception-ui-core/src/main/java/de/tudarmstadt/ukp/clarin/webanno/ui/core/login/LoginPage.html @@ -21,7 +21,7 @@
- -
+
diff --git a/inception/inception-ui-dashboard/src/main/java/de/tudarmstadt/ukp/inception/ui/core/dashboard/projectlist/ProjectsOverviewPage.java b/inception/inception-ui-dashboard/src/main/java/de/tudarmstadt/ukp/inception/ui/core/dashboard/projectlist/ProjectsOverviewPage.java index 3c31ff06338..2470be20dda 100644 --- a/inception/inception-ui-dashboard/src/main/java/de/tudarmstadt/ukp/inception/ui/core/dashboard/projectlist/ProjectsOverviewPage.java +++ b/inception/inception-ui-dashboard/src/main/java/de/tudarmstadt/ukp/inception/ui/core/dashboard/projectlist/ProjectsOverviewPage.java @@ -27,8 +27,6 @@ import static de.tudarmstadt.ukp.clarin.webanno.support.lambda.HtmlElementEvents.KEYDOWN_EVENT; import static de.tudarmstadt.ukp.clarin.webanno.support.lambda.KeyCodes.ENTER; import static de.tudarmstadt.ukp.clarin.webanno.support.lambda.LambdaBehavior.visibleWhen; -import static de.tudarmstadt.ukp.clarin.webanno.ui.core.page.ProjectPageBase.PAGE_PARAM_PROJECT; -import static de.tudarmstadt.ukp.clarin.webanno.ui.project.ProjectSettingsPage.NEW_PROJECT_ID; import static java.lang.String.join; import static java.lang.invoke.MethodHandles.lookup; import static java.time.Duration.ofMillis; @@ -97,7 +95,6 @@ import de.tudarmstadt.ukp.clarin.webanno.ui.core.page.ProjectPageBase; import de.tudarmstadt.ukp.clarin.webanno.ui.project.AjaxProjectImportedEvent; import de.tudarmstadt.ukp.clarin.webanno.ui.project.ProjectImportPanel; -import de.tudarmstadt.ukp.clarin.webanno.ui.project.ProjectSettingsPage; import de.tudarmstadt.ukp.inception.annotation.filters.ProjectRoleFilterPanel; import de.tudarmstadt.ukp.inception.annotation.filters.ProjectRoleFilterStateChanged; import de.tudarmstadt.ukp.inception.preferences.Key; @@ -127,7 +124,7 @@ public class ProjectsOverviewPage private static final String MID_IMPORT_PROJECT_PANEL = "importProjectPanel"; private static final String MID_NEW_PROJECT = "newProject"; private static final String MID_LEAVE_PROJECT = "leaveProject"; - private static final String MID_CONFIRM_LEAVE = "confirmLeave"; + private static final String MID_DIALOG = "dialog"; private static final String MID_EMPTY_LIST_LABEL = "emptyListLabel"; private static final String MID_START_TUTORIAL = "startTutorial"; private static final String MID_IMPORT_PROJECT_BUTTON = "importProjectBtn"; @@ -150,7 +147,7 @@ public class ProjectsOverviewPage private WebMarkupContainer projectListContainer; private DataView projectList; private PagingNavigator navigator; - private BootstrapModalDialog confirmationDialog; + private BootstrapModalDialog dialog; private Label noProjectsNotice; private TextField nameFilter; @@ -219,9 +216,9 @@ public ProjectsOverviewPage() nameFilter.add(visibleWhen(() -> !allAccessibleProjects.getObject().isEmpty())); queue(nameFilter); - confirmationDialog = new BootstrapModalDialog(MID_CONFIRM_LEAVE); - confirmationDialog.trapFocus(); - queue(confirmationDialog); + dialog = new BootstrapModalDialog(MID_DIALOG); + dialog.trapFocus(); + queue(dialog); } @Override @@ -502,7 +499,7 @@ private void actionConfirmLeaveProject(AjaxRequestTarget aTarget, Project aProje success("You are no longer a member of project [" + aProject.getName() + "]"); }); - confirmationDialog.open(dialogContent, aTarget); + dialog.open(dialogContent, aTarget); } private ListView createRoleBadges(ProjectEntry aProjectEntry) @@ -524,9 +521,9 @@ protected void populateItem(ListItem aItem) private void actionCreateProject(AjaxRequestTarget aTarget) { - PageParameters params = new PageParameters(); - params.set(PAGE_PARAM_PROJECT, NEW_PROJECT_ID); - setResponsePage(ProjectSettingsPage.class, params); + var dialogContent = new ProjectTemplateSelectionDialogPanel( + BootstrapModalDialog.CONTENT_ID); + dialog.open(dialogContent, aTarget); } private void actionCreateProject(AjaxRequestTarget aTarget, ProjectInitializer aInitializer) diff --git a/inception/inception-ui-dashboard/src/main/java/de/tudarmstadt/ukp/inception/ui/core/dashboard/projectlist/ProjectsOverviewPage.properties b/inception/inception-ui-dashboard/src/main/java/de/tudarmstadt/ukp/inception/ui/core/dashboard/projectlist/ProjectsOverviewPage.properties index 3e48916d9d4..461f3388af4 100644 --- a/inception/inception-ui-dashboard/src/main/java/de/tudarmstadt/ukp/inception/ui/core/dashboard/projectlist/ProjectsOverviewPage.properties +++ b/inception/inception-ui-dashboard/src/main/java/de/tudarmstadt/ukp/inception/ui/core/dashboard/projectlist/ProjectsOverviewPage.properties @@ -31,3 +31,5 @@ nameFilter.placeholder=Filter by name... ProjectListSortStrategy.CREATED_OLDEST=oldest first ProjectListSortStrategy.CREATED_NEWEST=newest first ProjectListSortStrategy.NAME=name + +createProjectDialogTitle=Create new project... diff --git a/inception/inception-ui-dashboard/src/main/java/de/tudarmstadt/ukp/inception/ui/core/dashboard/projectlist/no-thumbnail.svg b/inception/inception-ui-dashboard/src/main/java/de/tudarmstadt/ukp/inception/ui/core/dashboard/projectlist/no-thumbnail.svg new file mode 100644 index 00000000000..5664aa407d5 --- /dev/null +++ b/inception/inception-ui-dashboard/src/main/java/de/tudarmstadt/ukp/inception/ui/core/dashboard/projectlist/no-thumbnail.svg @@ -0,0 +1,72 @@ + + + + + + + + + + + + + diff --git a/pom.xml b/pom.xml index 35f024c3c7f..e1f271ee170 100644 --- a/pom.xml +++ b/pom.xml @@ -150,7 +150,6 @@ 18.14.2 0.2.0 - 3.2.6 5.3.2 ^4.3.6 ^7.0.3 @@ -170,7 +169,6 @@ ^4.0.0 ^3.3.0 ^3.1.1 - 2.0.2 ^4.3.1 ^10.1.0 ^20.0.0 From ac4bfa8446fa26cc2a468387b828def83f7f0f76 Mon Sep 17 00:00:00 2001 From: Richard Eckart de Castilho Date: Sun, 8 Oct 2023 01:06:44 +0200 Subject: [PATCH 2/9] #4229 - Better project template selection - Remove dropdown part of the "new project" button - Introduce a dialog that appears when pressing the "new project" button which gives a better overview over the available templates - Add hint to import documents if no documents are in a project yet - Add new project template focussing on universal dependencies --- .../clarin/webanno/api/DocumentService.java | 9 + inception/inception-app-webapp/pom.xml | 4 + inception/inception-bom/pom.xml | 5 + .../documents/DocumentServiceImpl.java | 16 ++ ...sicDocumentLabelingProjectInitializer.java | 2 +- .../SentenceLabelingProjectInitializer.java | 2 +- .../LICENSE.txt | 202 ++++++++++++++++++ .../inception-project-initializers-ud/pom.xml | 85 ++++++++ ...iversalDependenciesProjectInitializer.java | 87 ++++++++ ...ProjectInitializersAutoConfiguration.java} | 33 +-- .../main/resources/META-INF/spring.factories | 2 + .../StandardProjectInitializer.java | 9 +- .../empty/EmptyProjectInitializer.java | 2 +- .../support/svelte/SvelteBehavior.java | 37 +++- .../webanno/ui/core/login/LoginPage.html | 121 +++++++---- .../webanno/ui/core/login/LoginPage.java | 3 - .../activity/ActivitiesDashlet.html} | 42 +--- .../dashboard/activity/ActivitiesDashlet.java | 6 +- .../activity/ActivitiesDashletExtension.java | 10 +- .../src/main/ts/src/ActivitiesDashlet.svelte | 2 +- .../dashlet/DocumentHintDashlet.html | 40 ++++ .../dashlet/DocumentHintDashlet.java | 60 ++++++ .../dashlet/DocumentHintDashletExtension.java | 53 +++++ .../project/ProjectDashboardPage.html | 6 +- .../projectlist/ProjectsOverviewPage.html | 11 - .../projectlist/ProjectsOverviewPage.java | 62 ------ inception/pom.xml | 1 + 27 files changed, 718 insertions(+), 194 deletions(-) create mode 100644 inception/inception-project-initializers-ud/LICENSE.txt create mode 100644 inception/inception-project-initializers-ud/pom.xml create mode 100644 inception/inception-project-initializers-ud/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/ud/UniversalDependenciesProjectInitializer.java rename inception/{inception-ui-core/src/main/java/de/tudarmstadt/ukp/clarin/webanno/ui/core/login/LoginPageCssResourceReference.java => inception-project-initializers-ud/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/ud/config/UniversalDependenciesProjectInitializersAutoConfiguration.java} (52%) create mode 100644 inception/inception-project-initializers-ud/src/main/resources/META-INF/spring.factories rename inception/{inception-ui-core/src/main/java/de/tudarmstadt/ukp/clarin/webanno/ui/core/login/LoginPage.css => inception-ui-dashboard-activity/src/main/java/de/tudarmstadt/ukp/inception/ui/core/dashboard/activity/ActivitiesDashlet.html} (54%) create mode 100644 inception/inception-ui-dashboard/src/main/java/de/tudarmstadt/ukp/inception/ui/core/dashboard/dashlet/DocumentHintDashlet.html create mode 100644 inception/inception-ui-dashboard/src/main/java/de/tudarmstadt/ukp/inception/ui/core/dashboard/dashlet/DocumentHintDashlet.java create mode 100644 inception/inception-ui-dashboard/src/main/java/de/tudarmstadt/ukp/inception/ui/core/dashboard/dashlet/DocumentHintDashletExtension.java diff --git a/inception/inception-api/src/main/java/de/tudarmstadt/ukp/clarin/webanno/api/DocumentService.java b/inception/inception-api/src/main/java/de/tudarmstadt/ukp/clarin/webanno/api/DocumentService.java index 397bb881811..7059908b3fa 100644 --- a/inception/inception-api/src/main/java/de/tudarmstadt/ukp/clarin/webanno/api/DocumentService.java +++ b/inception/inception-api/src/main/java/de/tudarmstadt/ukp/clarin/webanno/api/DocumentService.java @@ -75,6 +75,15 @@ public interface DocumentService @PreAuthorize("hasAnyRole('ROLE_ADMIN','ROLE_USER','ROLE_REMOTE')") SourceDocument createSourceDocument(SourceDocument document); + /** + * Check if any source document exist in the project. + * + * @param project + * the project. + * @return if any source document exists. + */ + boolean existsSourceDocument(Project project); + /** * Check if a Source document with this same name exist in the project. The caller method then * can decide to override or throw an exception/message to the client diff --git a/inception/inception-app-webapp/pom.xml b/inception/inception-app-webapp/pom.xml index 2d98caf7d46..9534a6406a4 100644 --- a/inception/inception-app-webapp/pom.xml +++ b/inception/inception-app-webapp/pom.xml @@ -124,6 +124,10 @@ de.tudarmstadt.ukp.inception.app inception-project-initializers-sentencelabeling
+ + de.tudarmstadt.ukp.inception.app + inception-project-initializers-ud + de.tudarmstadt.ukp.inception.app inception-project-initializers-wikidatalinking diff --git a/inception/inception-bom/pom.xml b/inception/inception-bom/pom.xml index 7c69053b404..20290df21f3 100644 --- a/inception/inception-bom/pom.xml +++ b/inception/inception-bom/pom.xml @@ -518,6 +518,11 @@ inception-project-initializers-sentencelabeling 30.0-SNAPSHOT + + de.tudarmstadt.ukp.inception.app + inception-project-initializers-ud + 30.0-SNAPSHOT + de.tudarmstadt.ukp.inception.app inception-project-initializers-wikidatalinking diff --git a/inception/inception-documents/src/main/java/de/tudarmstadt/ukp/inception/documents/DocumentServiceImpl.java b/inception/inception-documents/src/main/java/de/tudarmstadt/ukp/inception/documents/DocumentServiceImpl.java index dd7db5bda00..391652812af 100644 --- a/inception/inception-documents/src/main/java/de/tudarmstadt/ukp/inception/documents/DocumentServiceImpl.java +++ b/inception/inception-documents/src/main/java/de/tudarmstadt/ukp/inception/documents/DocumentServiceImpl.java @@ -125,6 +125,7 @@ import de.tudarmstadt.ukp.clarin.webanno.model.SourceDocument; import de.tudarmstadt.ukp.clarin.webanno.model.SourceDocumentState; import de.tudarmstadt.ukp.clarin.webanno.model.SourceDocumentStateTransition; +import de.tudarmstadt.ukp.clarin.webanno.model.SourceDocument_; import de.tudarmstadt.ukp.clarin.webanno.security.model.User; import de.tudarmstadt.ukp.clarin.webanno.support.logging.BaseLoggers; import de.tudarmstadt.ukp.inception.annotation.storage.CasStorageSession; @@ -322,6 +323,21 @@ public boolean existsCas(AnnotationDocument aAnnotationDocument) throws IOExcept return existsCas(aAnnotationDocument.getDocument(), aAnnotationDocument.getUser()); } + @Override + @Transactional + public boolean existsSourceDocument(Project aProject) + { + Validate.notNull(aProject, "Project must be specified"); + + var cb = entityManager.getCriteriaBuilder(); + var query = cb.createQuery(Long.class); + var doc = query.from(SourceDocument.class); + + query.select(cb.count(doc)).where(cb.equal(doc.get(SourceDocument_.project), aProject)); + + return entityManager.createQuery(query).getSingleResult() > 0; + } + @Override @Transactional public boolean existsSourceDocument(Project aProject, String aFileName) diff --git a/inception/inception-project-initializers-doclabeling/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/doclabeling/BasicDocumentLabelingProjectInitializer.java b/inception/inception-project-initializers-doclabeling/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/doclabeling/BasicDocumentLabelingProjectInitializer.java index 03f7137bd14..7bb54619f53 100644 --- a/inception/inception-project-initializers-doclabeling/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/doclabeling/BasicDocumentLabelingProjectInitializer.java +++ b/inception/inception-project-initializers-doclabeling/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/doclabeling/BasicDocumentLabelingProjectInitializer.java @@ -65,7 +65,7 @@ public BasicDocumentLabelingProjectInitializer(PreferencesService aPreferencesSe @Override public String getName() { - return "Basic document labeling"; + return "Document classification"; } @Override diff --git a/inception/inception-project-initializers-sentencelabeling/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/sentencelabeling/SentenceLabelingProjectInitializer.java b/inception/inception-project-initializers-sentencelabeling/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/sentencelabeling/SentenceLabelingProjectInitializer.java index e21c61e7a95..f74e58b0721 100644 --- a/inception/inception-project-initializers-sentencelabeling/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/sentencelabeling/SentenceLabelingProjectInitializer.java +++ b/inception/inception-project-initializers-sentencelabeling/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/sentencelabeling/SentenceLabelingProjectInitializer.java @@ -45,7 +45,7 @@ public class SentenceLabelingProjectInitializer @Override public String getName() { - return "Basic sentence labeling"; + return "Sentence classification"; } @Override diff --git a/inception/inception-project-initializers-ud/LICENSE.txt b/inception/inception-project-initializers-ud/LICENSE.txt new file mode 100644 index 00000000000..d6456956733 --- /dev/null +++ b/inception/inception-project-initializers-ud/LICENSE.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/inception/inception-project-initializers-ud/pom.xml b/inception/inception-project-initializers-ud/pom.xml new file mode 100644 index 00000000000..daf1a3e9c5f --- /dev/null +++ b/inception/inception-project-initializers-ud/pom.xml @@ -0,0 +1,85 @@ + + + 4.0.0 + + de.tudarmstadt.ukp.inception.app + inception-app + 30.0-SNAPSHOT + + inception-project-initializers-ud + INCEpTION - Core - Project initializers - Universal Dependencies + + + de.tudarmstadt.ukp.inception.app + inception-model + + + de.tudarmstadt.ukp.inception.app + inception-api + + + de.tudarmstadt.ukp.inception.app + inception-api-schema + + + de.tudarmstadt.ukp.inception.app + inception-project-initializers + + + de.tudarmstadt.ukp.inception.app + inception-recommendation + + + de.tudarmstadt.ukp.inception.app + inception-imls-stringmatch + + + de.tudarmstadt.ukp.inception.app + inception-kb + + + de.tudarmstadt.ukp.inception.app + inception-ui-kb + + + de.tudarmstadt.ukp.inception.app + inception-recommendation-api + + + + + org.springframework + spring-context + + + org.springframework.boot + spring-boot-autoconfigure + + + + org.eclipse.rdf4j + rdf4j-repository-api + + + + org.dkpro.core + dkpro-core-api-ner-asl + + + diff --git a/inception/inception-project-initializers-ud/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/ud/UniversalDependenciesProjectInitializer.java b/inception/inception-project-initializers-ud/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/ud/UniversalDependenciesProjectInitializer.java new file mode 100644 index 00000000000..03e9f6524e5 --- /dev/null +++ b/inception/inception-project-initializers-ud/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/ud/UniversalDependenciesProjectInitializer.java @@ -0,0 +1,87 @@ +/* + * Licensed to the Technische Universität Darmstadt under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The Technische Universität Darmstadt + * licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package de.tudarmstadt.ukp.inception.project.initializers.ud; + +import static java.util.Arrays.asList; + +import java.io.IOException; +import java.util.List; +import java.util.Optional; + +import de.tudarmstadt.ukp.clarin.webanno.api.project.ProjectInitializer; +import de.tudarmstadt.ukp.clarin.webanno.model.Project; +import de.tudarmstadt.ukp.clarin.webanno.project.initializers.DependencyLayerInitializer; +import de.tudarmstadt.ukp.clarin.webanno.project.initializers.LemmaLayerInitializer; +import de.tudarmstadt.ukp.clarin.webanno.project.initializers.MorphologicalFeaturesLayerInitializer; +import de.tudarmstadt.ukp.clarin.webanno.project.initializers.PartOfSpeechLayerInitializer; +import de.tudarmstadt.ukp.clarin.webanno.project.initializers.QuickProjectInitializer; +import de.tudarmstadt.ukp.clarin.webanno.project.initializers.SurfaceFormLayerInitializer; +import de.tudarmstadt.ukp.clarin.webanno.project.initializers.TokenLayerInitializer; +import de.tudarmstadt.ukp.clarin.webanno.project.initializers.config.ProjectInitializersAutoConfiguration; + +/** + *

+ * This class is exposed as a Spring Component via + * {@link ProjectInitializersAutoConfiguration#standardProjectInitializer}. + *

+ */ +public class UniversalDependenciesProjectInitializer + implements QuickProjectInitializer +{ + @Override + public String getName() + { + return "Universal Dependencies"; + } + + @Override + public boolean alreadyApplied(Project aProject) + { + return false; + } + + @Override + public List> getDependencies() + { + return asList( + // Because all projects should have a Token layer + TokenLayerInitializer.class, // + LemmaLayerInitializer.class, // + PartOfSpeechLayerInitializer.class, // + MorphologicalFeaturesLayerInitializer.class, // + DependencyLayerInitializer.class, // + SurfaceFormLayerInitializer.class); + } + + @Override + public void configure(Project aProject) throws IOException + { + // Nothing to do - all initialization is already done by the dependencies + } + + @Override + public Optional getDescription() + { + return Optional + .of(""" + Comes pre-configured for linguistic annotation tasks according to the Universal Dependencies + guidelines. These include part-of-speech tagging, dependency parsing, morphological features, + lemmas, and surface forms. Importing and exporting these layers in the CoNLL-U format is + possible."""); + } +} diff --git a/inception/inception-ui-core/src/main/java/de/tudarmstadt/ukp/clarin/webanno/ui/core/login/LoginPageCssResourceReference.java b/inception/inception-project-initializers-ud/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/ud/config/UniversalDependenciesProjectInitializersAutoConfiguration.java similarity index 52% rename from inception/inception-ui-core/src/main/java/de/tudarmstadt/ukp/clarin/webanno/ui/core/login/LoginPageCssResourceReference.java rename to inception/inception-project-initializers-ud/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/ud/config/UniversalDependenciesProjectInitializersAutoConfiguration.java index 31fb099891f..03fcb7b8f79 100644 --- a/inception/inception-ui-core/src/main/java/de/tudarmstadt/ukp/clarin/webanno/ui/core/login/LoginPageCssResourceReference.java +++ b/inception/inception-project-initializers-ud/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/ud/config/UniversalDependenciesProjectInitializersAutoConfiguration.java @@ -15,32 +15,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package de.tudarmstadt.ukp.clarin.webanno.ui.core.login; +package de.tudarmstadt.ukp.inception.project.initializers.ud.config; -import org.apache.wicket.request.resource.CssResourceReference; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; -public class LoginPageCssResourceReference - extends CssResourceReference -{ - private static final long serialVersionUID = 1L; - - private static final LoginPageCssResourceReference INSTANCE = new LoginPageCssResourceReference(); - - /** - * Gets the instance of the resource reference - * - * @return the single instance of the resource reference - */ - public static LoginPageCssResourceReference get() - { - return INSTANCE; - } +import de.tudarmstadt.ukp.inception.project.initializers.ud.UniversalDependenciesProjectInitializer; - /** - * Private constructor - */ - private LoginPageCssResourceReference() +@Configuration +public class UniversalDependenciesProjectInitializersAutoConfiguration +{ + @Bean + public UniversalDependenciesProjectInitializer universalDependenciesProjectInitializer() { - super(LoginPageCssResourceReference.class, "LoginPage.css"); + return new UniversalDependenciesProjectInitializer(); } } diff --git a/inception/inception-project-initializers-ud/src/main/resources/META-INF/spring.factories b/inception/inception-project-initializers-ud/src/main/resources/META-INF/spring.factories new file mode 100644 index 00000000000..15adaffec16 --- /dev/null +++ b/inception/inception-project-initializers-ud/src/main/resources/META-INF/spring.factories @@ -0,0 +1,2 @@ +org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ +de.tudarmstadt.ukp.inception.project.initializers.ud.config.UniversalDependenciesProjectInitializersAutoConfiguration diff --git a/inception/inception-project-initializers/src/main/java/de/tudarmstadt/ukp/clarin/webanno/project/initializers/StandardProjectInitializer.java b/inception/inception-project-initializers/src/main/java/de/tudarmstadt/ukp/clarin/webanno/project/initializers/StandardProjectInitializer.java index ca47879dbbb..666c592ad35 100644 --- a/inception/inception-project-initializers/src/main/java/de/tudarmstadt/ukp/clarin/webanno/project/initializers/StandardProjectInitializer.java +++ b/inception/inception-project-initializers/src/main/java/de/tudarmstadt/ukp/clarin/webanno/project/initializers/StandardProjectInitializer.java @@ -19,6 +19,7 @@ import java.io.IOException; import java.util.List; +import java.util.Optional; import java.util.stream.Collectors; import org.springframework.beans.factory.annotation.Autowired; @@ -49,7 +50,7 @@ public StandardProjectInitializer(@Lazy ProjectService aProjectService) @Override public String getName() { - return "Standard project"; + return "Everything but the kitchen sink"; } @Override @@ -73,4 +74,10 @@ public void configure(Project aProject) throws IOException { // Nothing to do - all initialization is already done by the dependencies } + + @Override + public Optional getDescription() + { + return Optional.of("Comes pre-configured for many linguistic annotation tasks."); + } } diff --git a/inception/inception-project-initializers/src/main/java/de/tudarmstadt/ukp/clarin/webanno/project/initializers/empty/EmptyProjectInitializer.java b/inception/inception-project-initializers/src/main/java/de/tudarmstadt/ukp/clarin/webanno/project/initializers/empty/EmptyProjectInitializer.java index 9271405f971..c5d387798ab 100644 --- a/inception/inception-project-initializers/src/main/java/de/tudarmstadt/ukp/clarin/webanno/project/initializers/empty/EmptyProjectInitializer.java +++ b/inception/inception-project-initializers/src/main/java/de/tudarmstadt/ukp/clarin/webanno/project/initializers/empty/EmptyProjectInitializer.java @@ -42,7 +42,7 @@ public class EmptyProjectInitializer @Override public String getName() { - return "Empty project (no layers)"; + return "Blank project (no layers)"; } @Override diff --git a/inception/inception-support/src/main/java/de/tudarmstadt/ukp/inception/support/svelte/SvelteBehavior.java b/inception/inception-support/src/main/java/de/tudarmstadt/ukp/inception/support/svelte/SvelteBehavior.java index 790ff139f6e..a6689880e35 100644 --- a/inception/inception-support/src/main/java/de/tudarmstadt/ukp/inception/support/svelte/SvelteBehavior.java +++ b/inception/inception-support/src/main/java/de/tudarmstadt/ukp/inception/support/svelte/SvelteBehavior.java @@ -52,37 +52,56 @@ public class SvelteBehavior private ResourceReference jsRef; private ResourceReference cssRef; + private Component markupHost; private Component host; public SvelteBehavior() { - this(null); + this(null, null); } - public SvelteBehavior(ResourceReference aRef) + public SvelteBehavior(Component aHost) { - jsRef = aRef; + host = aHost; + host.setOutputMarkupId(true); + var componentClass = host.getClass(); + jsRef = new PackageResourceReference(componentClass, + componentClass.getSimpleName() + ".min.js"); + cssRef = new PackageResourceReference(componentClass, + componentClass.getSimpleName() + ".min.css"); + } + + public SvelteBehavior(ResourceReference aJsRef, ResourceReference aCssRef) + { + jsRef = aJsRef; + cssRef = aCssRef; } @Override public void bind(Component aComponent) { - if (host != null && host != aComponent) { + if (markupHost != null && markupHost != aComponent) { throw new IllegalStateException("Behavior already bound to another component"); } - host = aComponent; + markupHost = aComponent; - aComponent.setOutputMarkupId(true); + if (host != null) { + return; + } + + host = aComponent; + host.setOutputMarkupId(true); - var componentClass = aComponent.getClass(); + var componentClass = host.getClass(); if (jsRef == null) { jsRef = new PackageResourceReference(componentClass, componentClass.getSimpleName() + ".min.js"); } - if (componentClass.getResource(componentClass.getSimpleName() + ".min.css") != null) { + if (cssRef == null + & componentClass.getResource(componentClass.getSimpleName() + ".min.css") != null) { cssRef = new PackageResourceReference(componentClass, componentClass.getSimpleName() + ".min.css"); } @@ -115,7 +134,7 @@ private CharSequence initScript(Component aComponent) IRequestHandler handler = new ResourceReferenceRequestHandler(jsRef); String url = RequestCycle.get().urlFor(handler).toString(); - Object model = aComponent.getDefaultModelObject(); + Object model = host.getDefaultModelObject(); String propsJson; try { propsJson = model != null ? toInterpretableJsonString(model) : "{}"; diff --git a/inception/inception-ui-core/src/main/java/de/tudarmstadt/ukp/clarin/webanno/ui/core/login/LoginPage.html b/inception/inception-ui-core/src/main/java/de/tudarmstadt/ukp/clarin/webanno/ui/core/login/LoginPage.html index a46de32ba17..27d1a71dca1 100644 --- a/inception/inception-ui-core/src/main/java/de/tudarmstadt/ukp/clarin/webanno/ui/core/login/LoginPage.html +++ b/inception/inception-ui-core/src/main/java/de/tudarmstadt/ukp/clarin/webanno/ui/core/login/LoginPage.html @@ -17,48 +17,85 @@ limitations under the License. --> - - -
-
-