Search in sources :

Example 26 with AbstractTab

use of org.apache.wicket.extensions.markup.html.tabs.AbstractTab in project midpoint by Evolveum.

the class AbstractOrgTabPanel method initLayout.

private void initLayout() {
    final IModel<List<ITab>> tabModel = new LoadableModel<>(true) {

        private static final long serialVersionUID = 1L;

        @Override
        protected List<ITab> load() {
            LOGGER.debug("Loading org. roots for tabs for tabbed panel.");
            roots = loadOrgRoots();
            final List<ITab> tabs = new ArrayList<>();
            for (PrismObject<OrgType> root : roots) {
                final String oid = root.getOid();
                tabs.add(new AbstractTab(createTabTitle(root)) {

                    private static final long serialVersionUID = 1L;

                    private final int tabId = tabs.size();

                    @Override
                    public WebMarkupContainer getPanel(String panelId) {
                        add(new AjaxEventBehavior("load") {

                            private static final long serialVersionUID = 1L;

                            protected void onEvent(final AjaxRequestTarget target) {
                                OrgStructurePanelStorage usersStorage = getOrgStructurePanelStorage();
                                if (usersStorage != null) {
                                    usersStorage.setSelectedTabId(tabId);
                                }
                            }
                        });
                        Panel panel = createTreePanel(panelId, new Model<>(oid), getPageBase());
                        panel.setOutputMarkupId(true);
                        return panel;
                    }
                });
            }
            LOGGER.debug("Tab count is {}", tabs.size());
            return tabs;
        }
    };
    List<ITab> tabsList = tabModel.getObject();
    OrgStructurePanelStorage orgStructurePanelStorage = getOrgStructurePanelStorage();
    int selectedTab = 0;
    if (orgStructurePanelStorage != null) {
        selectedTab = orgStructurePanelStorage.getSelectedTabId() == -1 ? 0 : orgStructurePanelStorage.getSelectedTabId();
        if (tabsList == null || (selectedTab > tabsList.size() - 1)) {
            orgStructurePanelStorage.setSelectedTabId(0);
        }
    }
    AjaxTabbedPanel<ITab> tabbedPanel = new AjaxTabbedPanel<>(ID_TABS, tabModel.getObject(), new Model<>(selectedTab), null) {

        private static final long serialVersionUID = 1L;

        @Override
        public TabbedPanel<ITab> setSelectedTab(int index) {
            changeTabPerformed(index);
            return super.setSelectedTab(index);
        }
    };
    tabbedPanel.setOutputMarkupId(true);
    if (tabsList == null || tabsList.size() == 0) {
        tabbedPanel.setVisible(false);
    }
    add(tabbedPanel);
}
Also used : AjaxEventBehavior(org.apache.wicket.ajax.AjaxEventBehavior) ArrayList(java.util.ArrayList) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) ITab(org.apache.wicket.extensions.markup.html.tabs.ITab) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxTabbedPanel(com.evolveum.midpoint.web.component.AjaxTabbedPanel) Panel(org.apache.wicket.markup.html.panel.Panel) BasePanel(com.evolveum.midpoint.gui.api.component.BasePanel) TabbedPanel(com.evolveum.midpoint.web.component.TabbedPanel) AjaxTabbedPanel(com.evolveum.midpoint.web.component.AjaxTabbedPanel) OrgType(com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel) IModel(org.apache.wicket.model.IModel) Model(org.apache.wicket.model.Model) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel) AbstractTab(org.apache.wicket.extensions.markup.html.tabs.AbstractTab) OrgStructurePanelStorage(com.evolveum.midpoint.web.session.OrgStructurePanelStorage) ArrayList(java.util.ArrayList) List(java.util.List)

Example 27 with AbstractTab

use of org.apache.wicket.extensions.markup.html.tabs.AbstractTab in project midpoint by Evolveum.

the class ResourceConfigurationPanel method createConfigurationTabs.

private List<ITab> createConfigurationTabs() {
    List<ITab> tabs = new ArrayList<>();
    getObjectDetailsModels().getConfigurationModel().reset();
    PrismContainerWrapper<ConnectorConfigurationType> configuration = getObjectDetailsModels().getConfigurationModelObject();
    if (configuration == null) {
        return new ArrayList<>();
    }
    PrismContainerValueWrapper<ConnectorConfigurationType> configurationValue;
    try {
        configurationValue = configuration.getValue();
    } catch (SchemaException e) {
        LOGGER.error("Cannot get value for connector configuration, {}", e.getMessage(), e);
        getSession().error("A problem occurred while getting value for connector configuration, " + e.getMessage());
        return null;
    }
    for (final PrismContainerWrapper<?> wrapper : configurationValue.getContainers()) {
        String tabName = wrapper.getDisplayName();
        tabs.add(new AbstractTab(new Model<>(tabName)) {

            private static final long serialVersionUID = 1L;

            @Override
            public WebMarkupContainer getPanel(String panelId) {
                return new SingleContainerPanel<>(panelId, Model.of(wrapper), wrapper.getTypeName());
            }
        });
    }
    return tabs;
}
Also used : SchemaException(com.evolveum.midpoint.util.exception.SchemaException) ArrayList(java.util.ArrayList) ITab(org.apache.wicket.extensions.markup.html.tabs.ITab) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) ConnectorConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ConnectorConfigurationType) Model(org.apache.wicket.model.Model) ResourceDetailsModel(com.evolveum.midpoint.gui.impl.page.admin.resource.ResourceDetailsModel) AbstractTab(org.apache.wicket.extensions.markup.html.tabs.AbstractTab)

Example 28 with AbstractTab

use of org.apache.wicket.extensions.markup.html.tabs.AbstractTab in project midpoint by Evolveum.

the class ConfigurationStep method createConfigurationTabs.

private List<ITab> createConfigurationTabs() {
    List<ITab> tabs = new ArrayList<>();
    PrismContainerWrapper<ConnectorConfigurationType> configuration = configurationModel.getObject();
    if (configuration == null) {
        return new ArrayList<>();
    }
    PrismContainerValueWrapper<ConnectorConfigurationType> configurationValue;
    try {
        configurationValue = configuration.getValue();
    } catch (SchemaException e) {
        LOGGER.error("Cannot get value for conenctor configuration, {}", e.getMessage(), e);
        getSession().error("A problem occurred while getting value for connector configuration, " + e.getMessage());
        return null;
    }
    for (final PrismContainerWrapper<?> wrapper : configurationValue.getContainers()) {
        String tabName = wrapper.getDisplayName();
        tabs.add(new AbstractTab(new Model<>(tabName)) {

            private static final long serialVersionUID = 1L;

            @Override
            public WebMarkupContainer getPanel(String panelId) {
                return new SingleContainerPanel<>(panelId, Model.of(wrapper), wrapper.getTypeName());
            }
        });
    }
    return tabs;
}
Also used : SchemaException(com.evolveum.midpoint.util.exception.SchemaException) ArrayList(java.util.ArrayList) ITab(org.apache.wicket.extensions.markup.html.tabs.ITab) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) ConnectorConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ConnectorConfigurationType) Model(org.apache.wicket.model.Model) NonEmptyLoadableModel(com.evolveum.midpoint.gui.api.model.NonEmptyLoadableModel) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel) AbstractTab(org.apache.wicket.extensions.markup.html.tabs.AbstractTab)

Example 29 with AbstractTab

use of org.apache.wicket.extensions.markup.html.tabs.AbstractTab in project midpoint by Evolveum.

the class PageValuePolicy method initTabs.

private void initTabs(MidpointForm mainForm) {
    List<ITab> tabs = new ArrayList<>();
    PageBase baseParameter = this;
    tabs.add(new AbstractTab(createStringResource("PageValuePolicy.basic")) {

        @Override
        public WebMarkupContainer getPanel(String panelId) {
            return new ValuePolicyBasicPanel(panelId, valuePolicyModel);
        }
    });
    // tabs.add(new AbstractTab(createStringResource("PageValuePolicy.stringPolicy")) {
    // @Override
    // public WebMarkupContainer getPanel(String panelId) {
    // return new ValuePolicyStringPoliciesPanel(panelId,mainForm,valuePolicyModel,baseParameter);
    // }
    // });
    TabbedPanel tabPanel = WebComponentUtil.createTabPanel(ID_TAB_PANEL, this, tabs, null);
    mainForm.add(tabPanel);
}
Also used : ArrayList(java.util.ArrayList) ValuePolicyBasicPanel(com.evolveum.midpoint.web.page.admin.valuePolicy.component.ValuePolicyBasicPanel) AbstractTab(org.apache.wicket.extensions.markup.html.tabs.AbstractTab) TabbedPanel(com.evolveum.midpoint.web.component.TabbedPanel) PageBase(com.evolveum.midpoint.gui.api.page.PageBase) ITab(org.apache.wicket.extensions.markup.html.tabs.ITab) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

Aggregations

AbstractTab (org.apache.wicket.extensions.markup.html.tabs.AbstractTab)29 ArrayList (java.util.ArrayList)26 ITab (org.apache.wicket.extensions.markup.html.tabs.ITab)26 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)16 Panel (org.apache.wicket.markup.html.panel.Panel)14 AjaxBootstrapTabbedPanel (de.agilecoders.wicket.core.markup.html.bootstrap.tabs.AjaxBootstrapTabbedPanel)11 ResourceModel (org.apache.wicket.model.ResourceModel)9 Model (org.apache.wicket.model.Model)7 TabbedPanel (com.evolveum.midpoint.web.component.TabbedPanel)5 List (java.util.List)4 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)4 WizardMgtPanel (org.apache.syncope.client.console.wizards.WizardMgtPanel)3 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)2 NonEmptyLoadableModel (com.evolveum.midpoint.gui.api.model.NonEmptyLoadableModel)2 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)2 ChangePasswordPanel (com.evolveum.midpoint.web.page.self.component.ChangePasswordPanel)2 ConnectorConfigurationType (com.evolveum.midpoint.xml.ns._public.common.common_3.ConnectorConfigurationType)2 DirectoryPanel (org.apache.syncope.client.console.panels.DirectoryPanel)2 ActionsPanel (org.apache.syncope.client.console.wicket.markup.html.form.ActionsPanel)2 Fragment (org.apache.wicket.markup.html.panel.Fragment)2