Search in sources :

Example 1 with Accordion

use of org.apache.syncope.client.console.wicket.markup.html.bootstrap.tabs.Accordion 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)

Aggregations

ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 Collections (java.util.Collections)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Collectors (java.util.stream.Collectors)1 ListUtils (org.apache.commons.collections4.ListUtils)1 StringUtils (org.apache.commons.lang3.StringUtils)1 Constants (org.apache.syncope.client.console.commons.Constants)1 AnyDirectoryPanel (org.apache.syncope.client.console.panels.AnyDirectoryPanel)1 ListViewPanel (org.apache.syncope.client.console.panels.ListViewPanel)1 ListViewReload (org.apache.syncope.client.console.panels.ListViewPanel.ListViewReload)1 AnyObjectSearchPanel (org.apache.syncope.client.console.panels.search.AnyObjectSearchPanel)1 AnyObjectSelectionDirectoryPanel (org.apache.syncope.client.console.panels.search.AnyObjectSelectionDirectoryPanel)1 AnySelectionDirectoryPanel (org.apache.syncope.client.console.panels.search.AnySelectionDirectoryPanel)1 SearchClausePanel (org.apache.syncope.client.console.panels.search.SearchClausePanel)1 SearchUtils (org.apache.syncope.client.console.panels.search.SearchUtils)1 AnyTypeClassRestClient (org.apache.syncope.client.console.rest.AnyTypeClassRestClient)1 AnyTypeRestClient (org.apache.syncope.client.console.rest.AnyTypeRestClient)1