Search in sources :

Example 1 with ProjectSettingsPanelDecl

use of de.tudarmstadt.ukp.clarin.webanno.ui.core.settings.ProjectSettingsPanelRegistryService.ProjectSettingsPanelDecl in project webanno by webanno.

the class ProjectPage method makeTabs.

private List<ITab> makeTabs() {
    List<ITab> tabs = new ArrayList<>();
    tabs.add(new AbstractTab(Model.of("Details")) {

        private static final long serialVersionUID = 6703144434578403272L;

        @Override
        public Panel getPanel(String panelId) {
            return new ProjectDetailPanel(panelId, selectedProject);
        }

        @Override
        public boolean isVisible() {
            return selectedProject.getObject() != null;
        }
    });
    // Add the project settings panels from the registry
    for (ProjectSettingsPanelDecl psp : projectSettingsPanelRegistryService.getPanels()) {
        AbstractTab tab = new AbstractTab(Model.of(psp.label)) {

            private static final long serialVersionUID = -1503555976570640065L;

            @Override
            public Panel getPanel(String aPanelId) {
                try {
                    return ConstructorUtils.invokeConstructor(psp.panel, aPanelId, selectedProject);
                } catch (Exception e) {
                    throw new RuntimeException(e);
                }
            }

            @Override
            public boolean isVisible() {
                return selectedProject.getObject() != null && selectedProject.getObject().getId() != null && psp.condition.applies(selectedProject.getObject());
            }
        };
        tabs.add(tab);
    }
    return tabs;
}
Also used : AjaxTabbedPanel(org.apache.wicket.extensions.ajax.markup.html.tabs.AjaxTabbedPanel) ProjectTagSetsPanel(de.tudarmstadt.ukp.clarin.webanno.ui.project.tagsets.ProjectTagSetsPanel) AnnotationGuideLinePanel(de.tudarmstadt.ukp.clarin.webanno.ui.project.guidelines.AnnotationGuideLinePanel) Panel(org.apache.wicket.markup.html.panel.Panel) BootstrapAjaxTabbedPanel(de.tudarmstadt.ukp.clarin.webanno.support.bootstrap.BootstrapAjaxTabbedPanel) ProjectDetailPanel(de.tudarmstadt.ukp.clarin.webanno.ui.project.detail.ProjectDetailPanel) ProjectUsersPanel(de.tudarmstadt.ukp.clarin.webanno.ui.project.users.ProjectUsersPanel) ProjectDetailPanel(de.tudarmstadt.ukp.clarin.webanno.ui.project.detail.ProjectDetailPanel) ArrayList(java.util.ArrayList) AbstractTab(org.apache.wicket.extensions.markup.html.tabs.AbstractTab) ProjectSettingsPanelDecl(de.tudarmstadt.ukp.clarin.webanno.ui.core.settings.ProjectSettingsPanelRegistryService.ProjectSettingsPanelDecl) ITab(org.apache.wicket.extensions.markup.html.tabs.ITab)

Aggregations

BootstrapAjaxTabbedPanel (de.tudarmstadt.ukp.clarin.webanno.support.bootstrap.BootstrapAjaxTabbedPanel)1 ProjectSettingsPanelDecl (de.tudarmstadt.ukp.clarin.webanno.ui.core.settings.ProjectSettingsPanelRegistryService.ProjectSettingsPanelDecl)1 ProjectDetailPanel (de.tudarmstadt.ukp.clarin.webanno.ui.project.detail.ProjectDetailPanel)1 AnnotationGuideLinePanel (de.tudarmstadt.ukp.clarin.webanno.ui.project.guidelines.AnnotationGuideLinePanel)1 ProjectTagSetsPanel (de.tudarmstadt.ukp.clarin.webanno.ui.project.tagsets.ProjectTagSetsPanel)1 ProjectUsersPanel (de.tudarmstadt.ukp.clarin.webanno.ui.project.users.ProjectUsersPanel)1 ArrayList (java.util.ArrayList)1 AjaxTabbedPanel (org.apache.wicket.extensions.ajax.markup.html.tabs.AjaxTabbedPanel)1 AbstractTab (org.apache.wicket.extensions.markup.html.tabs.AbstractTab)1 ITab (org.apache.wicket.extensions.markup.html.tabs.ITab)1 Panel (org.apache.wicket.markup.html.panel.Panel)1