Search in sources :

Example 51 with Panel

use of org.apache.wicket.markup.html.panel.Panel in project syncope by apache.

the class Notifications method buildTabList.

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

        private static final long serialVersionUID = -6815067322125799251L;

        @Override
        public Panel getPanel(final String panelId) {
            return new NotificationDirectoryPanel(panelId, getPageReference());
        }
    });
    tabs.add(new AbstractTab(new ResourceModel("notification.templates")) {

        private static final long serialVersionUID = -6815067322125799251L;

        @Override
        public Panel getPanel(final String panelId) {
            return new MailTemplateDirectoryPanel(panelId, getPageReference());
        }
    });
    return tabs;
}
Also used : Panel(org.apache.wicket.markup.html.panel.Panel) NotificationDirectoryPanel(org.apache.syncope.client.console.notifications.NotificationDirectoryPanel) AjaxBootstrapTabbedPanel(de.agilecoders.wicket.core.markup.html.bootstrap.tabs.AjaxBootstrapTabbedPanel) MailTemplateDirectoryPanel(org.apache.syncope.client.console.notifications.MailTemplateDirectoryPanel) MailTemplateDirectoryPanel(org.apache.syncope.client.console.notifications.MailTemplateDirectoryPanel) ArrayList(java.util.ArrayList) AbstractTab(org.apache.wicket.extensions.markup.html.tabs.AbstractTab) ResourceModel(org.apache.wicket.model.ResourceModel) NotificationDirectoryPanel(org.apache.syncope.client.console.notifications.NotificationDirectoryPanel) ITab(org.apache.wicket.extensions.markup.html.tabs.ITab)

Example 52 with Panel

use of org.apache.wicket.markup.html.panel.Panel in project syncope by apache.

the class Dashboard method buildTabList.

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

        private static final long serialVersionUID = -6815067322125799251L;

        @Override
        public Panel getPanel(final String panelId) {
            return new DashboardOverviewPanel(panelId);
        }
    });
    tabs.add(new AbstractTab(new ResourceModel("accessTokens")) {

        private static final long serialVersionUID = -6815067322125799251L;

        @Override
        public Panel getPanel(final String panelId) {
            return new DashboardAccessTokensPanel(panelId, getPageReference());
        }
    });
    tabs.add(new AbstractTab(new ResourceModel("control")) {

        private static final long serialVersionUID = -6815067322125799251L;

        @Override
        public Panel getPanel(final String panelId) {
            return new DashboardControlPanel(panelId, getPageReference());
        }
    });
    ClassPathScanImplementationLookup classPathScanImplementationLookup = (ClassPathScanImplementationLookup) SyncopeConsoleApplication.get().getServletContext().getAttribute(ConsoleInitializer.CLASSPATH_LOOKUP);
    final List<Class<? extends BaseExtWidget>> extWidgetClasses = classPathScanImplementationLookup.getExtWidgetClasses();
    if (!extWidgetClasses.isEmpty()) {
        tabs.add(new AbstractTab(new ResourceModel("extensions")) {

            private static final long serialVersionUID = -6815067322125799251L;

            @Override
            public Panel getPanel(final String panelId) {
                return new DashboardExtensionsPanel(panelId, extWidgetClasses, getPageReference());
            }
        });
    }
    return tabs;
}
Also used : DashboardAccessTokensPanel(org.apache.syncope.client.console.panels.DashboardAccessTokensPanel) ArrayList(java.util.ArrayList) ITab(org.apache.wicket.extensions.markup.html.tabs.ITab) DashboardExtensionsPanel(org.apache.syncope.client.console.panels.DashboardExtensionsPanel) DashboardExtensionsPanel(org.apache.syncope.client.console.panels.DashboardExtensionsPanel) AjaxBootstrapTabbedPanel(de.agilecoders.wicket.core.markup.html.bootstrap.tabs.AjaxBootstrapTabbedPanel) Panel(org.apache.wicket.markup.html.panel.Panel) DashboardOverviewPanel(org.apache.syncope.client.console.panels.DashboardOverviewPanel) DashboardAccessTokensPanel(org.apache.syncope.client.console.panels.DashboardAccessTokensPanel) DashboardControlPanel(org.apache.syncope.client.console.panels.DashboardControlPanel) DashboardOverviewPanel(org.apache.syncope.client.console.panels.DashboardOverviewPanel) ClassPathScanImplementationLookup(org.apache.syncope.client.console.init.ClassPathScanImplementationLookup) DashboardControlPanel(org.apache.syncope.client.console.panels.DashboardControlPanel) AbstractTab(org.apache.wicket.extensions.markup.html.tabs.AbstractTab) ResourceModel(org.apache.wicket.model.ResourceModel) BaseExtWidget(org.apache.syncope.client.console.widgets.BaseExtWidget)

Example 53 with Panel

use of org.apache.wicket.markup.html.panel.Panel in project syncope by apache.

the class Logs method buildTabList.

private List<ITab> buildTabList() {
    final List<ITab> tabs = new ArrayList<>(2);
    tabs.add(new AbstractTab(new Model<>("Core")) {

        private static final long serialVersionUID = -6815067322125799251L;

        @Override
        public Panel getPanel(final String panelId) {
            return new CoreLogPanel(panelId, getPageReference());
        }
    });
    tabs.add(new AbstractTab(new Model<>("Console")) {

        private static final long serialVersionUID = -6815067322125799251L;

        @Override
        public Panel getPanel(final String panelId) {
            return new ConsoleLogPanel(panelId, getPageReference());
        }
    });
    return tabs;
}
Also used : Panel(org.apache.wicket.markup.html.panel.Panel) ConsoleLogPanel(org.apache.syncope.client.console.panels.ConsoleLogPanel) CoreLogPanel(org.apache.syncope.client.console.panels.CoreLogPanel) AjaxBootstrapTabbedPanel(de.agilecoders.wicket.core.markup.html.bootstrap.tabs.AjaxBootstrapTabbedPanel) ArrayList(java.util.ArrayList) Model(org.apache.wicket.model.Model) AbstractTab(org.apache.wicket.extensions.markup.html.tabs.AbstractTab) ConsoleLogPanel(org.apache.syncope.client.console.panels.ConsoleLogPanel) ITab(org.apache.wicket.extensions.markup.html.tabs.ITab) CoreLogPanel(org.apache.syncope.client.console.panels.CoreLogPanel)

Example 54 with Panel

use of org.apache.wicket.markup.html.panel.Panel in project syncope by apache.

the class RoleDirectoryPanel method getActions.

@Override
public ActionsPanel<RoleTO> getActions(final IModel<RoleTO> model) {
    final ActionsPanel<RoleTO> panel = super.getActions(model);
    panel.add(new ActionLink<RoleTO>() {

        private static final long serialVersionUID = -7978723352517770644L;

        @Override
        public void onClick(final AjaxRequestTarget target, final RoleTO ignore) {
            send(RoleDirectoryPanel.this, Broadcast.EXACT, new AjaxWizard.EditItemActionEvent<>(new RoleWrapper(new RoleRestClient().read(model.getObject().getKey())), target));
        }
    }, ActionLink.ActionType.EDIT, StandardEntitlement.ROLE_READ);
    panel.add(new ActionLink<RoleTO>() {

        private static final long serialVersionUID = -7978723352517770644L;

        @Override
        public void onClick(final AjaxRequestTarget target, final RoleTO ignore) {
            final RoleTO clone = SerializationUtils.clone(model.getObject());
            clone.setKey(null);
            send(RoleDirectoryPanel.this, Broadcast.EXACT, new AjaxWizard.NewItemActionEvent<>(new RoleWrapper(clone), target));
        }
    }, ActionLink.ActionType.CLONE, StandardEntitlement.ROLE_CREATE);
    panel.add(new ActionLink<RoleTO>() {

        private static final long serialVersionUID = -7978723352517770644L;

        @Override
        public void onClick(final AjaxRequestTarget target, final RoleTO ignore) {
            final String query = SyncopeClient.getUserSearchConditionBuilder().and(SyncopeClient.getUserSearchConditionBuilder().inRoles(model.getObject().getKey()), SyncopeClient.getUserSearchConditionBuilder().is("key").notNullValue()).query();
            final AnyTypeRestClient typeRestClient = new AnyTypeRestClient();
            final AnyTypeClassRestClient classRestClient = new AnyTypeClassRestClient();
            final AnyTypeTO anyTypeTO = typeRestClient.read(AnyTypeKind.USER.name());
            ModalPanel panel = new AnyPanel(BaseModal.CONTENT_ID, anyTypeTO, null, null, false, pageRef) {

                private static final long serialVersionUID = -7514498203393023415L;

                @Override
                protected Panel getDirectoryPanel(final String id) {
                    final Panel panel = new UserDirectoryPanel.Builder(classRestClient.list(anyTypeTO.getClasses()), anyTypeTO.getKey(), pageRef).setRealm("/").setFiltered(true).setFiql(query).disableCheckBoxes().addNewItemPanelBuilder(FormLayoutInfoUtils.instantiate(new UserTO(), anyTypeTO.getClasses(), FormLayoutInfoUtils.fetch(typeRestClient.list()).getLeft(), pageRef), false).setWizardInModal(false).build(id);
                    MetaDataRoleAuthorizationStrategy.authorize(panel, WebPage.RENDER, StandardEntitlement.USER_SEARCH);
                    return panel;
                }
            };
            membersModal.header(new StringResourceModel("role.members", RoleDirectoryPanel.this, model));
            membersModal.setContent(panel);
            membersModal.show(true);
            target.add(membersModal);
        }
    }, ActionLink.ActionType.MEMBERS, StandardEntitlement.USER_SEARCH);
    panel.add(new ActionLink<RoleTO>() {

        private static final long serialVersionUID = -7978723352517770644L;

        @Override
        public void onClick(final AjaxRequestTarget target, final RoleTO ignore) {
            final ConsoleLayoutInfo info = new ConsoleLayoutInfo(model.getObject().getKey());
            info.setContent(restClient.readConsoleLayoutInfo(model.getObject().getKey()));
            utilityModal.header(new ResourceModel("console.layout.info", "JSON Content"));
            utilityModal.setContent(new JsonEditorPanel(utilityModal, new PropertyModel<String>(info, "content"), false, pageRef) {

                private static final long serialVersionUID = -8927036362466990179L;

                @Override
                public void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
                    try {
                        restClient.setConsoleLayoutInfo(info.getKey(), info.getContent());
                        SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
                        modal.show(false);
                        modal.close(target);
                    } catch (Exception e) {
                        LOG.error("While updating console layout info for role {}", info.getKey(), e);
                        SyncopeConsoleSession.get().error(StringUtils.isBlank(e.getMessage()) ? e.getClass().getName() : e.getMessage());
                    }
                    ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
                }
            });
            utilityModal.show(true);
            target.add(utilityModal);
        }
    }, ActionLink.ActionType.LAYOUT_EDIT, StandardEntitlement.ROLE_UPDATE);
    panel.add(new ActionLink<RoleTO>() {

        private static final long serialVersionUID = -7978723352517770644L;

        @Override
        public void onClick(final AjaxRequestTarget target, final RoleTO ignore) {
            try {
                restClient.delete(model.getObject().getKey());
                SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
                target.add(container);
            } catch (SyncopeClientException e) {
                LOG.error("While deleting object {}", model.getObject().getKey(), e);
                SyncopeConsoleSession.get().error(StringUtils.isBlank(e.getMessage()) ? e.getClass().getName() : e.getMessage());
            }
            ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
        }
    }, ActionLink.ActionType.DELETE, StandardEntitlement.ROLE_DELETE, true);
    return panel;
}
Also used : Form(org.apache.wicket.markup.html.form.Form) AnyTypeTO(org.apache.syncope.common.lib.to.AnyTypeTO) RoleRestClient(org.apache.syncope.client.console.rest.RoleRestClient) ConsoleLayoutInfo(org.apache.syncope.client.console.layout.ConsoleLayoutInfo) StringResourceModel(org.apache.wicket.model.StringResourceModel) ResourceModel(org.apache.wicket.model.ResourceModel) AnyTypeClassRestClient(org.apache.syncope.client.console.rest.AnyTypeClassRestClient) BasePage(org.apache.syncope.client.console.pages.BasePage) StringResourceModel(org.apache.wicket.model.StringResourceModel) AnyTypeRestClient(org.apache.syncope.client.console.rest.AnyTypeRestClient) SyncopeClientException(org.apache.syncope.common.lib.SyncopeClientException) RoleTO(org.apache.syncope.common.lib.to.RoleTO) SyncopeClientException(org.apache.syncope.common.lib.SyncopeClientException) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ActionsPanel(org.apache.syncope.client.console.wicket.markup.html.form.ActionsPanel) JsonEditorPanel(org.apache.syncope.client.console.wicket.markup.html.form.JsonEditorPanel) Panel(org.apache.wicket.markup.html.panel.Panel) WizardMgtPanel(org.apache.syncope.client.console.wizards.WizardMgtPanel) UserTO(org.apache.syncope.common.lib.to.UserTO) RoleWrapper(org.apache.syncope.client.console.wizards.role.RoleWrapper) JsonEditorPanel(org.apache.syncope.client.console.wicket.markup.html.form.JsonEditorPanel)

Example 55 with Panel

use of org.apache.wicket.markup.html.panel.Panel 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

Panel (org.apache.wicket.markup.html.panel.Panel)76 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)27 ArrayList (java.util.ArrayList)21 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)18 BasePanel (com.evolveum.midpoint.gui.api.component.BasePanel)16 ITab (org.apache.wicket.extensions.markup.html.tabs.ITab)16 Before (org.junit.Before)16 AbstractTab (org.apache.wicket.extensions.markup.html.tabs.AbstractTab)15 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)13 AjaxBootstrapTabbedPanel (de.agilecoders.wicket.core.markup.html.bootstrap.tabs.AjaxBootstrapTabbedPanel)12 ResourceModel (org.apache.wicket.model.ResourceModel)11 DivTestPanel (org.odlabs.wiquery.ui.DivTestPanel)11 ItemPanelSettingsBuilder (com.evolveum.midpoint.gui.impl.prism.panel.ItemPanelSettingsBuilder)10 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)10 List (java.util.List)9 Test (org.junit.Test)9 IModel (org.apache.wicket.model.IModel)8 Model (org.apache.wicket.model.Model)6 ActionsPanel (org.apache.syncope.client.console.wicket.markup.html.form.ActionsPanel)5 Label (org.apache.wicket.markup.html.basic.Label)5