Search in sources :

Example 21 with AbstractTab

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

the class Relationships method getViewFragment.

private Fragment getViewFragment() {
    final Map<String, List<RelationshipTO>> relationships = new HashMap<>();
    addRelationship(relationships, getCurrentRelationships().toArray(new RelationshipTO[] {}));
    final Fragment viewFragment = new Fragment("relationships", "viewFragment", this);
    viewFragment.setOutputMarkupId(true);
    viewFragment.add(new Accordion("relationships", relationships.keySet().stream().map(relationship -> {
        return new AbstractTab(new ResourceModel("relationship", relationship)) {

            private static final long serialVersionUID = 1037272333056449378L;

            @Override
            public Panel getPanel(final String panelId) {
                return new ListViewPanel.Builder<>(RelationshipTO.class, pageRef).setItems(relationships.get(relationship)).includes("otherEndType", "otherEndKey").addAction(new ActionLink<RelationshipTO>() {

                    private static final long serialVersionUID = -6847033126124401556L;

                    @Override
                    public void onClick(final AjaxRequestTarget target, final RelationshipTO modelObject) {
                        removeRelationships(relationships, modelObject);
                        send(Relationships.this, Broadcast.DEPTH, new ListViewReload<>(target));
                    }
                }, ActionType.DELETE, AnyEntitlement.UPDATE.getFor(anyTO.getType()), true).build(panelId);
            }
        };
    }).collect(Collectors.toList())) {

        private static final long serialVersionUID = 1037272333056449379L;

        @Override
        public void renderHead(final IHeaderResponse response) {
            super.renderHead(response);
            if (relationships.isEmpty()) {
                response.render(OnDomReadyHeaderItem.forScript(String.format("$('#emptyPlaceholder').append(\"%s\")", getString("relationships.empty.list"))));
            }
        }
    });
    final ActionsPanel<RelationshipTO> panel = new ActionsPanel<>("actions", null);
    viewFragment.add(panel);
    panel.add(new ActionLink<RelationshipTO>() {

        private static final long serialVersionUID = 3257738274365467945L;

        @Override
        public void onClick(final AjaxRequestTarget target, final RelationshipTO ignore) {
            Fragment addFragment = new Fragment("relationships", "addFragment", Relationships.this);
            addOrReplace(addFragment);
            addFragment.add(new Specification().setRenderBodyOnly(true));
            target.add(Relationships.this);
        }
    }, ActionType.CREATE, AnyEntitlement.UPDATE.getFor(anyTO.getType())).hideLabel();
    return viewFragment;
}
Also used : Arrays(java.util.Arrays) SearchClausePanel(org.apache.syncope.client.console.panels.search.SearchClausePanel) StringUtils(org.apache.commons.lang3.StringUtils) AjaxDropDownChoicePanel(org.apache.syncope.client.console.wicket.markup.html.form.AjaxDropDownChoicePanel) AnyTypeKind(org.apache.syncope.common.lib.types.AnyTypeKind) EntityTO(org.apache.syncope.common.lib.to.EntityTO) ICondition(org.apache.wicket.extensions.wizard.WizardModel.ICondition) Map(java.util.Map) ListUtils(org.apache.commons.collections4.ListUtils) AnyEntitlement(org.apache.syncope.common.lib.types.AnyEntitlement) IndicatorAjaxFormComponentUpdatingBehavior(org.apache.syncope.client.console.wicket.ajax.form.IndicatorAjaxFormComponentUpdatingBehavior) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) GroupableRelatableTO(org.apache.syncope.common.lib.to.GroupableRelatableTO) IModel(org.apache.wicket.model.IModel) Label(org.apache.wicket.markup.html.basic.Label) IChoiceRenderer(org.apache.wicket.markup.html.form.IChoiceRenderer) ListModel(org.apache.wicket.model.util.ListModel) Component(org.apache.wicket.Component) ListViewReload(org.apache.syncope.client.console.panels.ListViewPanel.ListViewReload) PageReference(org.apache.wicket.PageReference) SearchUtils(org.apache.syncope.client.console.panels.search.SearchUtils) IHeaderResponse(org.apache.wicket.markup.head.IHeaderResponse) Collectors(java.util.stream.Collectors) LabelInfo(org.apache.syncope.client.console.wicket.ajax.markup.html.LabelInfo) List(java.util.List) AnyDirectoryPanel(org.apache.syncope.client.console.panels.AnyDirectoryPanel) PropertyModel(org.apache.wicket.model.PropertyModel) AnySelectionDirectoryPanel(org.apache.syncope.client.console.panels.search.AnySelectionDirectoryPanel) ListViewPanel(org.apache.syncope.client.console.panels.ListViewPanel) AnyObjectSelectionDirectoryPanel(org.apache.syncope.client.console.panels.search.AnyObjectSelectionDirectoryPanel) ResourceModel(org.apache.wicket.model.ResourceModel) Broadcast(org.apache.wicket.event.Broadcast) ActionLink(org.apache.syncope.client.console.wicket.markup.html.form.ActionLink) WizardStep(org.apache.wicket.extensions.wizard.WizardStep) Constants(org.apache.syncope.client.console.commons.Constants) ActionType(org.apache.syncope.client.console.wicket.markup.html.form.ActionLink.ActionType) AnyTO(org.apache.syncope.common.lib.to.AnyTO) HashMap(java.util.HashMap) AnyObjectSearchPanel(org.apache.syncope.client.console.panels.search.AnyObjectSearchPanel) ArrayList(java.util.ArrayList) AnyTypeClassRestClient(org.apache.syncope.client.console.rest.AnyTypeClassRestClient) IWizard(org.apache.wicket.extensions.wizard.IWizard) Fragment(org.apache.wicket.markup.html.panel.Fragment) ActionsPanel(org.apache.syncope.client.console.wicket.markup.html.form.ActionsPanel) Accordion(org.apache.syncope.client.console.wicket.markup.html.bootstrap.tabs.Accordion) AbstractTab(org.apache.wicket.extensions.markup.html.tabs.AbstractTab) RelationshipTypeRestClient(org.apache.syncope.client.console.rest.RelationshipTypeRestClient) Panel(org.apache.wicket.markup.html.panel.Panel) AnyTypeTO(org.apache.syncope.common.lib.to.AnyTypeTO) WizardMgtPanel(org.apache.syncope.client.console.wizards.WizardMgtPanel) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) RelationshipTO(org.apache.syncope.common.lib.to.RelationshipTO) OnDomReadyHeaderItem(org.apache.wicket.markup.head.OnDomReadyHeaderItem) SyncopeClient(org.apache.syncope.client.lib.SyncopeClient) Collections(java.util.Collections) IEvent(org.apache.wicket.event.IEvent) AnyTypeRestClient(org.apache.syncope.client.console.rest.AnyTypeRestClient) AnyObjectTO(org.apache.syncope.common.lib.to.AnyObjectTO) ActionsPanel(org.apache.syncope.client.console.wicket.markup.html.form.ActionsPanel) HashMap(java.util.HashMap) Fragment(org.apache.wicket.markup.html.panel.Fragment) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) SearchClausePanel(org.apache.syncope.client.console.panels.search.SearchClausePanel) AjaxDropDownChoicePanel(org.apache.syncope.client.console.wicket.markup.html.form.AjaxDropDownChoicePanel) AnyDirectoryPanel(org.apache.syncope.client.console.panels.AnyDirectoryPanel) AnySelectionDirectoryPanel(org.apache.syncope.client.console.panels.search.AnySelectionDirectoryPanel) ListViewPanel(org.apache.syncope.client.console.panels.ListViewPanel) AnyObjectSelectionDirectoryPanel(org.apache.syncope.client.console.panels.search.AnyObjectSelectionDirectoryPanel) AnyObjectSearchPanel(org.apache.syncope.client.console.panels.search.AnyObjectSearchPanel) ActionsPanel(org.apache.syncope.client.console.wicket.markup.html.form.ActionsPanel) Panel(org.apache.wicket.markup.html.panel.Panel) WizardMgtPanel(org.apache.syncope.client.console.wizards.WizardMgtPanel) ListViewReload(org.apache.syncope.client.console.panels.ListViewPanel.ListViewReload) Accordion(org.apache.syncope.client.console.wicket.markup.html.bootstrap.tabs.Accordion) RelationshipTO(org.apache.syncope.common.lib.to.RelationshipTO) AbstractTab(org.apache.wicket.extensions.markup.html.tabs.AbstractTab) ResourceModel(org.apache.wicket.model.ResourceModel) List(java.util.List) ArrayList(java.util.ArrayList) IHeaderResponse(org.apache.wicket.markup.head.IHeaderResponse) ListViewPanel(org.apache.syncope.client.console.panels.ListViewPanel) ActionLink(org.apache.syncope.client.console.wicket.markup.html.form.ActionLink)

Example 22 with AbstractTab

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

the class ReconciliationWidget method buildExecFragment.

private Fragment buildExecFragment() {
    Fragment execFragment = new Fragment("reportResult", "execFragment", this);
    execFragment.setOutputMarkupId(true);
    Pair<List<ProgressBean>, ReconciliationReport> execResult;
    try {
        execResult = parseReconciliationReportExec();
    } catch (Exception e) {
        LOG.error("Could not parse the reconciliation report result", e);
        execResult = Pair.of(Collections.<ProgressBean>emptyList(), new ReconciliationReport(new Date()));
    }
    final List<ProgressBean> progressBeans = execResult.getLeft();
    final ReconciliationReport report = execResult.getRight();
    List<ITab> tabs = new ArrayList<>();
    tabs.add(new AbstractTab(new ResourceModel("summary")) {

        private static final long serialVersionUID = -6815067322125799251L;

        @Override
        public Panel getPanel(final String panelId) {
            return new ProgressesPanel(panelId, report.getRun(), progressBeans);
        }
    });
    tabs.add(new AbstractTab(Model.of(AnyTypeKind.USER.name())) {

        private static final long serialVersionUID = -6815067322125799251L;

        @Override
        public Panel getPanel(final String panelId) {
            return new AnysReconciliationPanel(panelId, report.getUsers(), pageRef);
        }
    });
    tabs.add(new AbstractTab(Model.of(AnyTypeKind.GROUP.name())) {

        private static final long serialVersionUID = -6815067322125799251L;

        @Override
        public Panel getPanel(final String panelId) {
            return new AnysReconciliationPanel(panelId, report.getGroups(), pageRef);
        }
    });
    for (final Anys anys : report.getAnyObjects()) {
        tabs.add(new AbstractTab(Model.of(anys.getAnyType())) {

            private static final long serialVersionUID = -6815067322125799251L;

            @Override
            public Panel getPanel(final String panelId) {
                return new AnysReconciliationPanel(panelId, anys, pageRef);
            }
        });
    }
    execFragment.add(new AjaxBootstrapTabbedPanel<>("execResult", tabs));
    return execFragment;
}
Also used : ArrayList(java.util.ArrayList) Fragment(org.apache.wicket.markup.html.panel.Fragment) IOException(java.io.IOException) Date(java.util.Date) ITab(org.apache.wicket.extensions.markup.html.tabs.ITab) AjaxBootstrapTabbedPanel(de.agilecoders.wicket.core.markup.html.bootstrap.tabs.AjaxBootstrapTabbedPanel) ActionPanel(org.apache.syncope.client.console.wicket.markup.html.form.ActionPanel) DirectoryPanel(org.apache.syncope.client.console.panels.DirectoryPanel) Panel(org.apache.wicket.markup.html.panel.Panel) WizardMgtPanel(org.apache.syncope.client.console.wizards.WizardMgtPanel) ReconciliationReport(org.apache.syncope.client.console.widgets.reconciliation.ReconciliationReport) Anys(org.apache.syncope.client.console.widgets.reconciliation.Anys) AbstractTab(org.apache.wicket.extensions.markup.html.tabs.AbstractTab) ResourceModel(org.apache.wicket.model.ResourceModel) List(java.util.List) ArrayList(java.util.ArrayList)

Example 23 with AbstractTab

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

the class JobWidget method buildTabList.

private List<ITab> buildTabList(final PageReference pageRef) {
    final List<ITab> tabs = new ArrayList<>();
    tabs.add(new AbstractTab(new ResourceModel("available")) {

        private static final long serialVersionUID = -6815067322125799251L;

        @Override
        public Panel getPanel(final String panelId) {
            availableJobsPanel = new AvailableJobsPanel(panelId, pageRef);
            availableJobsPanel.setOutputMarkupId(true);
            return availableJobsPanel;
        }
    });
    tabs.add(new AbstractTab(new ResourceModel("recent")) {

        private static final long serialVersionUID = -6815067322125799251L;

        @Override
        public Panel getPanel(final String panelId) {
            recentExecPanel = new RecentExecPanel(panelId, pageRef);
            recentExecPanel.setOutputMarkupId(true);
            return recentExecPanel;
        }
    });
    return tabs;
}
Also used : ReportletDirectoryPanel(org.apache.syncope.client.console.reports.ReportletDirectoryPanel) AjaxBootstrapTabbedPanel(de.agilecoders.wicket.core.markup.html.bootstrap.tabs.AjaxBootstrapTabbedPanel) ActionLinksTogglePanel(org.apache.syncope.client.console.wicket.markup.html.form.ActionLinksTogglePanel) DirectoryPanel(org.apache.syncope.client.console.panels.DirectoryPanel) ActionsPanel(org.apache.syncope.client.console.wicket.markup.html.form.ActionsPanel) Panel(org.apache.wicket.markup.html.panel.Panel) WizardMgtPanel(org.apache.syncope.client.console.wizards.WizardMgtPanel) ArrayList(java.util.ArrayList) AbstractTab(org.apache.wicket.extensions.markup.html.tabs.AbstractTab) ResourceModel(org.apache.wicket.model.ResourceModel) StringResourceModel(org.apache.wicket.model.StringResourceModel) ITab(org.apache.wicket.extensions.markup.html.tabs.ITab)

Example 24 with AbstractTab

use of org.apache.wicket.extensions.markup.html.tabs.AbstractTab 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 25 with AbstractTab

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

the class PageInternals method initLayout.

private void initLayout() {
    List<ITab> tabs = new ArrayList<>();
    tabs.add(new AbstractTab(createStringResource("PageInternals.tab.clock")) {

        private static final long serialVersionUID = 1L;

        @Override
        public WebMarkupContainer getPanel(String panelId) {
            return createClockPanel(panelId);
        }
    });
    tabs.add(new AbstractTab(createStringResource("PageInternals.tab.debugUtil")) {

        private static final long serialVersionUID = 1L;

        @Override
        public WebMarkupContainer getPanel(String panelId) {
            return initDebugUtilForm(panelId);
        }
    });
    tabs.add(new AbstractTab(createStringResource("PageInternals.tab.internalConfig")) {

        private static final long serialVersionUID = 1L;

        @Override
        public WebMarkupContainer getPanel(String panelId) {
            return initInternalsConfigForm(panelId);
        }
    });
    tabs.add(new AbstractTab(createStringResource("PageInternals.tab.traces")) {

        private static final long serialVersionUID = 1L;

        @Override
        public WebMarkupContainer getPanel(String panelId) {
            return initTraces(panelId);
        }
    });
    tabs.add(new AbstractTab(createStringResource("PageInternals.tab.counters")) {

        private static final long serialVersionUID = 1L;

        @Override
        public WebMarkupContainer getPanel(String panelId) {
            return initCounters(panelId);
        }
    });
    tabs.add(new AbstractTab(createStringResource("PageInternals.tab.cache")) {

        private static final long serialVersionUID = 1L;

        @Override
        public WebMarkupContainer getPanel(String panelId) {
            return initCachePanel(panelId);
        }
    });
    // TODO show only if experimental features are enabled?
    tabs.add(new AbstractTab(createStringResource("PageInternals.tab.memory")) {

        private static final long serialVersionUID = 1L;

        @Override
        public WebMarkupContainer getPanel(String panelId) {
            return initMemoryPanel(panelId);
        }
    });
    tabs.add(new AbstractTab(createStringResource("PageInternals.tab.threads")) {

        private static final long serialVersionUID = 1L;

        @Override
        public WebMarkupContainer getPanel(String panelId) {
            return initThreadsPanel(panelId);
        }
    });
    tabs.add(new AbstractTab(createStringResource("PageInternals.tab.performance")) {

        private static final long serialVersionUID = 1L;

        @Override
        public WebMarkupContainer getPanel(String panelId) {
            return initPerformancePanel(panelId);
        }
    });
    tabs.add(new AbstractTab(createStringResource("PageInternals.tab.loggedUsers")) {

        private static final long serialVersionUID = 1L;

        @Override
        public WebMarkupContainer getPanel(String panelId) {
            return initLoggedUsersPanel(panelId);
        }
    });
    add(new TabbedPanel<>(ID_TAB_PANEL, tabs));
}
Also used : ArrayList(java.util.ArrayList) AbstractTab(org.apache.wicket.extensions.markup.html.tabs.AbstractTab) 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