Search in sources :

Example 6 with TabbedPanel

use of com.evolveum.midpoint.web.component.TabbedPanel 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)

Example 7 with TabbedPanel

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

the class SchemaStep method initLayout.

private void initLayout() {
    List<ITab> tabs = new ArrayList<>();
    tabs.add(createSimpleSchemaView());
    tabs.add(createSchemaEditor());
    TabbedPanel<ITab> tabPanel = new TabbedPanel<>(ID_TAB_PANEL, tabs);
    tabPanel.setOutputMarkupId(true);
    add(tabPanel);
    AjaxButton reload = new AjaxButton(ID_RELOAD, createStringModel("SchemaStep.button.reload")) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            reloadPerformed(target);
        }
    };
    add(reload);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) ArrayList(java.util.ArrayList) TabbedPanel(com.evolveum.midpoint.web.component.TabbedPanel) ITab(org.apache.wicket.extensions.markup.html.tabs.ITab)

Example 8 with TabbedPanel

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

the class StageEditorPanel method nameClickPerformed.

private void nameClickPerformed(AjaxRequestTarget target) {
    TabbedPanel tabbedPanel = this.findParent(TabbedPanel.class);
    IModel<List<ITab>> tabsModel = tabbedPanel.getTabs();
    List<ITab> tabsList = tabsModel.getObject();
    PropertyModel<String> tabNameModel;
    if (getModel().getObject().getName() == null || getModel().getObject().getName().trim().equals("")) {
        tabNameModel = new PropertyModel<>(getModel(), StageDefinitionDto.F_NUMBER);
    } else {
        tabNameModel = new PropertyModel<>(getModel(), StageDefinitionDto.F_NAME);
    }
    for (ITab tab : tabsList) {
        if (tab.getTitle().getObject().equals(tabNameModel.getObject())) {
            int i = tabsList.indexOf(tab);
            tabbedPanel.setSelectedTab(i);
            target.add(tabbedPanel);
            return;
        }
    }
    tabsList.add(new AbstractTab(tabNameModel) {

        @Override
        public WebMarkupContainer getPanel(String panelId) {
            return new DefinitionStagePanel(panelId, getModel());
        }
    });
    tabbedPanel.setSelectedTab(tabsList.size() - 1);
    target.add(tabbedPanel);
}
Also used : TabbedPanel(com.evolveum.midpoint.web.component.TabbedPanel) ITab(org.apache.wicket.extensions.markup.html.tabs.ITab) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AbstractTab(org.apache.wicket.extensions.markup.html.tabs.AbstractTab) List(java.util.List)

Example 9 with TabbedPanel

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

the class PageAssignmentShoppingCart method onInitialize.

@Override
protected void onInitialize() {
    super.onInitialize();
    initModels();
    getRoleCatalogStorage().setAssignmentRequestLimit(AssignmentsUtil.loadAssignmentsLimit(new OperationResult(OPERATION_LOAD_ASSIGNMENTS_LIMIT), this));
    setOutputMarkupId(true);
    Form mainForm = new MidpointForm(ID_MAIN_FORM);
    add(mainForm);
    List<ITab> tabs = getTabsList();
    TabbedPanel tabbedPanel = new TabbedPanel<ITab>(ID_VIEWS_TAB_PANEL, tabs) {

        private static final long serialVersionUID = 1L;

        @Override
        public TabbedPanel<ITab> setSelectedTab(int index) {
            getRoleCatalogStorage().setDefaultTabIndex(index);
            return super.setSelectedTab(index);
        }
    };
    tabbedPanel.setOutputMarkupId(true);
    int defaultSelectedTabIndex = getDefaultViewTypeIndex();
    if (getRoleCatalogStorage().getDefaultTabIndex() > 0 && getRoleCatalogStorage().getDefaultTabIndex() < tabs.size()) {
        tabbedPanel.setSelectedTab(getRoleCatalogStorage().getDefaultTabIndex());
    } else if (defaultSelectedTabIndex < tabs.size()) {
        tabbedPanel.setSelectedTab(defaultSelectedTabIndex);
    }
    mainForm.add(tabbedPanel);
}
Also used : Form(org.apache.wicket.markup.html.form.Form) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) TabbedPanel(com.evolveum.midpoint.web.component.TabbedPanel) ITab(org.apache.wicket.extensions.markup.html.tabs.ITab)

Example 10 with TabbedPanel

use of com.evolveum.midpoint.web.component.TabbedPanel 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)

Aggregations

TabbedPanel (com.evolveum.midpoint.web.component.TabbedPanel)12 ITab (org.apache.wicket.extensions.markup.html.tabs.ITab)11 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)6 ArrayList (java.util.ArrayList)5 AbstractTab (org.apache.wicket.extensions.markup.html.tabs.AbstractTab)5 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)4 CountablePanelTab (com.evolveum.midpoint.gui.api.component.tabs.CountablePanelTab)2 AjaxButton (com.evolveum.midpoint.web.component.AjaxButton)2 List (java.util.List)2 PageParameters (org.apache.wicket.request.mapper.parameter.PageParameters)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 PageBase (com.evolveum.midpoint.gui.api.page.PageBase)1 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)1 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)1 AjaxTabbedPanel (com.evolveum.midpoint.web.component.AjaxTabbedPanel)1 Form (com.evolveum.midpoint.web.component.form.Form)1 MidpointForm (com.evolveum.midpoint.web.component.form.MidpointForm)1 AbstractObjectMainPanel (com.evolveum.midpoint.web.component.objectdetails.AbstractObjectMainPanel)1