Search in sources :

Example 1 with AjaxTabbedPanel

use of com.evolveum.midpoint.web.component.AjaxTabbedPanel in project midpoint by Evolveum.

the class PageResource method createTabsPanel.

private AjaxTabbedPanel<ITab> createTabsPanel() {
    List<ITab> tabs = new ArrayList<ITab>();
    tabs.add(new PanelTab(createStringResource("PageResource.tab.details")) {

        private static final long serialVersionUID = 1L;

        @Override
        public WebMarkupContainer createPanel(String panelId) {
            return new ResourceDetailsTabPanel(panelId, resourceModel, PageResource.this);
        }
    });
    tabs.add(new PanelTab(createStringResource("PageResource.tab.content.tasks")) {

        private static final long serialVersionUID = 1L;

        @Override
        public WebMarkupContainer createPanel(String panelId) {
            return new ResourceTasksPanel(panelId, true, resourceModel, PageResource.this);
        }
    });
    tabs.add(new PanelTab(createStringResource("PageResource.tab.content.account")) {

        private static final long serialVersionUID = 1L;

        @Override
        public WebMarkupContainer createPanel(String panelId) {
            return new ResourceContentTabPanel(panelId, ShadowKindType.ACCOUNT, resourceModel, PageResource.this);
        }
    });
    tabs.add(new PanelTab(createStringResource("PageResource.tab.content.entitlement")) {

        private static final long serialVersionUID = 1L;

        @Override
        public WebMarkupContainer createPanel(String panelId) {
            return new ResourceContentTabPanel(panelId, ShadowKindType.ENTITLEMENT, resourceModel, PageResource.this);
        }
    });
    tabs.add(new PanelTab(createStringResource("PageResource.tab.content.generic")) {

        private static final long serialVersionUID = 1L;

        @Override
        public WebMarkupContainer createPanel(String panelId) {
            return new ResourceContentTabPanel(panelId, ShadowKindType.GENERIC, resourceModel, PageResource.this);
        }
    });
    tabs.add(new PanelTab(createStringResource("PageResource.tab.content.others")) {

        private static final long serialVersionUID = 1L;

        @Override
        public WebMarkupContainer createPanel(String panelId) {
            return new ResourceContentTabPanel(panelId, null, resourceModel, PageResource.this);
        }
    });
    tabs.add(new PanelTab(createStringResource("PageResource.tab.connector")) {

        private static final long serialVersionUID = 1L;

        @Override
        public WebMarkupContainer createPanel(String panelId) {
            return new ResourceConnectorPanel(panelId, null, resourceModel, PageResource.this);
        }
    });
    AjaxTabbedPanel<ITab> resourceTabs = new AjaxTabbedPanel<ITab>(ID_TAB_PANEL, tabs) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onTabChange(int index) {
            updateBreadcrumbParameters(PARAMETER_SELECTED_TAB, index);
        }
    };
    resourceTabs.setOutputMarkupId(true);
    return resourceTabs;
}
Also used : PanelTab(com.evolveum.midpoint.gui.api.component.tabs.PanelTab) ArrayList(java.util.ArrayList) ITab(org.apache.wicket.extensions.markup.html.tabs.ITab) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AjaxTabbedPanel(com.evolveum.midpoint.web.component.AjaxTabbedPanel)

Example 2 with AjaxTabbedPanel

use of com.evolveum.midpoint.web.component.AjaxTabbedPanel in project midpoint by Evolveum.

the class AbstractOrgTabPanel method initLayout.

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

        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 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) {
                                SessionStorage storage = getPageBase().getSessionStorage();
                                storage.getUsers().setSelectedTabId(tabId);
                            }
                        });
                        Panel panel = createTreePanel(panelId, new Model(oid), getPageBase());
                        panel.setOutputMarkupId(true);
                        return panel;
                    }
                });
            }
            LOGGER.debug("Tab count is {}", new Object[] { tabs.size() });
            return tabs;
        }
    };
    final SessionStorage storage = getPageBase().getSessionStorage();
    int selectedTab = storage.getUsers().getSelectedTabId() == -1 ? 0 : storage.getUsers().getSelectedTabId();
    List<ITab> tabsList = tabModel.getObject();
    if (tabsList == null || (selectedTab > tabsList.size() - 1)) {
        storage.getUsers().setSelectedTabId(0);
        selectedTab = 0;
    }
    AjaxTabbedPanel<ITab> tabbedPanel = new AjaxTabbedPanel<ITab>(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) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) Model(org.apache.wicket.model.Model) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel) AbstractTab(org.apache.wicket.extensions.markup.html.tabs.AbstractTab) ArrayList(java.util.ArrayList) List(java.util.List) SessionStorage(com.evolveum.midpoint.web.session.SessionStorage)

Example 3 with AjaxTabbedPanel

use of com.evolveum.midpoint.web.component.AjaxTabbedPanel in project midpoint by Evolveum.

the class PageResource method onConfigure.

@Override
protected void onConfigure() {
    super.onConfigure();
    AjaxTabbedPanel tabbedPanel = (AjaxTabbedPanel) get(ID_TAB_PANEL);
    WebComponentUtil.setSelectedTabFromPageParameters(tabbedPanel, getPageParameters(), PARAMETER_SELECTED_TAB);
}
Also used : AjaxTabbedPanel(com.evolveum.midpoint.web.component.AjaxTabbedPanel)

Aggregations

AjaxTabbedPanel (com.evolveum.midpoint.web.component.AjaxTabbedPanel)3 ArrayList (java.util.ArrayList)2 ITab (org.apache.wicket.extensions.markup.html.tabs.ITab)2 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)2 BasePanel (com.evolveum.midpoint.gui.api.component.BasePanel)1 PanelTab (com.evolveum.midpoint.gui.api.component.tabs.PanelTab)1 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)1 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)1 TabbedPanel (com.evolveum.midpoint.web.component.TabbedPanel)1 SessionStorage (com.evolveum.midpoint.web.session.SessionStorage)1 OrgType (com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType)1 List (java.util.List)1 AjaxEventBehavior (org.apache.wicket.ajax.AjaxEventBehavior)1 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)1 AbstractTab (org.apache.wicket.extensions.markup.html.tabs.AbstractTab)1 Panel (org.apache.wicket.markup.html.panel.Panel)1 AbstractReadOnlyModel (org.apache.wicket.model.AbstractReadOnlyModel)1 IModel (org.apache.wicket.model.IModel)1 Model (org.apache.wicket.model.Model)1