List of usage examples for org.apache.wicket.extensions.ajax.markup.html.modal ModalWindow setPageCreator
public ModalWindow setPageCreator(final PageCreator creator)
PageCreator
instance. From source file:org.syncope.console.pages.panels.RolesPanel.java
License:Apache License
public RolesPanel(final String id, final UserTO userTO, final boolean templateMode) { super(id);/*from w w w . jav a 2 s. co m*/ this.userTO = userTO; final WebMarkupContainer membershipsContainer = new WebMarkupContainer("membershipsContainer"); membershipsContainer.setOutputMarkupId(true); add(membershipsContainer); final ModalWindow membershipWin = new ModalWindow("membershipWin"); membershipWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY); membershipWin.setCookieName("create-membership-modal"); add(membershipWin); BaseTree tree = new LinkTree("treeTable", roleTreeBuilder.build()) { private static final long serialVersionUID = -5514696922119256101L; @Override protected IModel getNodeTextModel(final IModel model) { return new PropertyModel(model, "userObject.displayName"); } @Override protected void onNodeLinkClicked(final Object node, final BaseTree tree, final AjaxRequestTarget target) { final RoleTO roleTO = (RoleTO) ((DefaultMutableTreeNode) node).getUserObject(); membershipWin.setPageCreator(new ModalWindow.PageCreator() { private static final long serialVersionUID = 7661763358801821185L; private MembershipTO membershipTO; @Override public Page createPage() { for (MembershipTO memberTO : membershipsView.getList()) { if (memberTO.getRoleId() == roleTO.getId()) { return new MembershipModalPage(getPage().getPageReference(), membershipWin, memberTO, templateMode); } } membershipTO = new MembershipTO(); membershipTO.setRoleId(roleTO.getId()); membershipTO.setRoleName(roleTO.getName()); return new MembershipModalPage(getPage().getPageReference(), membershipWin, membershipTO, templateMode); } }); membershipWin.show(target); } }; tree.setOutputMarkupId(true); tree.getTreeState().expandAll(); add(tree); membershipsView = new ListView<MembershipTO>("memberships", new PropertyModel<List<? extends MembershipTO>>(userTO, "memberships")) { private static final long serialVersionUID = 9101744072914090143L; @Override protected void populateItem(final ListItem item) { final MembershipTO membershipTO = (MembershipTO) item.getDefaultModelObject(); item.add(new Label("roleId", new Model(membershipTO.getRoleId()))); item.add(new Label("roleName", new Model(membershipTO.getRoleName()))); AjaxLink editLink = new IndicatingAjaxLink("editLink") { private static final long serialVersionUID = -7978723352517770644L; @Override public void onClick(final AjaxRequestTarget target) { membershipWin.setPageCreator(new ModalWindow.PageCreator() { private static final long serialVersionUID = -7834632442532690940L; @Override public Page createPage() { return new MembershipModalPage(getPage().getPageReference(), membershipWin, membershipTO, templateMode); } }); membershipWin.show(target); } }; item.add(editLink); AjaxLink deleteLink = new IndicatingDeleteOnConfirmAjaxLink("deleteLink") { private static final long serialVersionUID = -7978723352517770644L; @Override public void onClick(final AjaxRequestTarget target) { userTO.removeMembership(membershipTO); target.add(membershipsContainer); } }; item.add(deleteLink); } }; membershipsContainer.add(membershipsView); setWindowClosedCallback(membershipWin, membershipsContainer); }
From source file:org.syncope.console.pages.ReportModalPage.java
License:Apache License
private void setupExecutions() { final WebMarkupContainer executions = new WebMarkupContainer("executions"); executions.setOutputMarkupId(true);// w w w . j a v a2 s . com form.add(executions); final ModalWindow reportExecMessageWin = new ModalWindow("reportExecMessageWin"); reportExecMessageWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY); reportExecMessageWin.setCookieName("report-exec-message-win-modal"); add(reportExecMessageWin); final ModalWindow reportExecExportWin = new ModalWindow("reportExecExportWin"); reportExecExportWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY); reportExecExportWin.setCookieName("report-exec-export-win-modal"); reportExecExportWin.setInitialHeight(EXEC_EXPORT_WIN_HEIGHT); reportExecExportWin.setInitialWidth(EXEC_EXPORT_WIN_WIDTH); reportExecExportWin.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() { private static final long serialVersionUID = 8804221891699487139L; @Override public void onClose(final AjaxRequestTarget target) { AjaxExportDownloadBehavior behavior = new AjaxExportDownloadBehavior( ReportModalPage.this.exportFormat, ReportModalPage.this.exportExecId); executions.add(behavior); behavior.initiate(target); } }); add(reportExecExportWin); final List<IColumn> columns = new ArrayList<IColumn>(); columns.add(new PropertyColumn(new ResourceModel("id"), "id", "id")); columns.add(new DatePropertyColumn(new ResourceModel("startDate"), "startDate", "startDate")); columns.add(new DatePropertyColumn(new ResourceModel("endDate"), "endDate", "endDate")); columns.add(new PropertyColumn(new ResourceModel("status"), "status", "status")); columns.add(new AbstractColumn<ReportExecTO>(new ResourceModel("actions", "")) { private static final long serialVersionUID = 2054811145491901166L; @Override public String getCssClass() { return "action"; } @Override public void populateItem(final Item<ICellPopulator<ReportExecTO>> cellItem, final String componentId, final IModel<ReportExecTO> model) { final ReportExecTO taskExecutionTO = model.getObject(); final ActionLinksPanel panel = new ActionLinksPanel(componentId, model); panel.add(new ActionLink() { private static final long serialVersionUID = -3722207913631435501L; @Override public void onClick(final AjaxRequestTarget target) { reportExecMessageWin.setPageCreator(new ModalWindow.PageCreator() { private static final long serialVersionUID = -7834632442532690940L; @Override public Page createPage() { return new ExecMessageModalPage(model.getObject().getMessage()); } }); reportExecMessageWin.show(target); } }, ActionLink.ActionType.EDIT, "Reports", "read", StringUtils.hasText(model.getObject().getMessage())); panel.add(new ActionLink() { private static final long serialVersionUID = -3722207913631435501L; @Override public void onClick(final AjaxRequestTarget target) { reportExecExportWin.setPageCreator(new ModalWindow.PageCreator() { private static final long serialVersionUID = -7834632442532690940L; @Override public Page createPage() { ReportModalPage.this.exportExecId = model.getObject().getId(); return new ReportExecResultDownloadModalPage(reportExecExportWin, ReportModalPage.this.getPageReference()); } }); reportExecExportWin.show(target); } }, ActionLink.ActionType.EXPORT, "Reports", "read", ReportExecStatus.SUCCESS.name().equals(model.getObject().getStatus())); panel.add(new ActionLink() { private static final long serialVersionUID = -3722207913631435501L; @Override public void onClick(final AjaxRequestTarget target) { try { restClient.deleteExecution(taskExecutionTO.getId()); reportTO.removeExecution(taskExecutionTO); info(getString("operation_succeded")); } catch (SyncopeClientCompositeErrorException scce) { error(scce.getMessage()); } target.add(feedbackPanel); target.add(executions); } }, ActionLink.ActionType.DELETE, "Reports", "delete"); cellItem.add(panel); } }); final AjaxFallbackDefaultDataTable table = new AjaxFallbackDefaultDataTable("executionsTable", columns, new ReportExecutionsProvider(reportTO), 10); executions.add(table); }
From source file:org.syncope.console.pages.Schema.java
License:Apache License
private <T extends AbstractSchemaModalPage> List<IColumn> getColumnsForSchema( final WebMarkupContainer webContainer, final ModalWindow modalWindow, final SchemaModalPageFactory.Entity entity, final SchemaModalPageFactory.SchemaType schemaType, final String[] fields, final String readPermissions, final String deletePermissions) { List<IColumn> columns = new ArrayList<IColumn>(); for (String field : fields) { columns.add(new PropertyColumn(new ResourceModel(field), field, field)); }/*from w w w .j a va2 s . com*/ columns.add(new AbstractColumn<AbstractBaseBean>(new ResourceModel("actions", "")) { private static final long serialVersionUID = 2054811145491901166L; @Override public String getCssClass() { return "action"; } @Override public void populateItem(final Item<ICellPopulator<AbstractBaseBean>> cellItem, final String componentId, final IModel<AbstractBaseBean> model) { final AbstractBaseBean schemaTO = model.getObject(); final ActionLinksPanel panel = new ActionLinksPanel(componentId, model); panel.add(new ActionLink() { private static final long serialVersionUID = -3722207913631435501L; @Override public void onClick(final AjaxRequestTarget target) { modalWindow.setPageCreator(new ModalWindow.PageCreator() { private static final long serialVersionUID = -7834632442532690940L; @Override public Page createPage() { AbstractSchemaModalPage page = SchemaModalPageFactory.getSchemaModalPage(entity, schemaType); page.setSchemaModalPage(Schema.this.getPageReference(), modalWindow, schemaTO, false); return page; } }); modalWindow.show(target); } }, ActionType.EDIT, readPermissions); panel.add(new ActionLink() { private static final long serialVersionUID = -3722207913631435501L; @Override public void onClick(final AjaxRequestTarget target) { switch (schemaType) { case DERIVED: restClient.deleteDerivedSchema(entity.toString(), ((DerivedSchemaTO) schemaTO).getName()); break; case VIRTUAL: restClient.deleteVirtualSchema(entity.toString(), ((VirtualSchemaTO) schemaTO).getName()); break; default: restClient.deleteSchema(entity.toString(), ((SchemaTO) schemaTO).getName()); break; } info(getString("operation_succeded")); target.add(feedbackPanel); target.add(webContainer); } }, ActionType.DELETE, deletePermissions); cellItem.add(panel); } }); return columns; }
From source file:org.syncope.console.pages.Schema.java
License:Apache License
private <T extends AbstractSchemaModalPage> AjaxLink getCreateSchemaWindow(final ModalWindow createSchemaWin, final SchemaModalPageFactory.Entity entity, final SchemaModalPageFactory.SchemaType schemaType, final String winLinkName, final String winName, final String createPermissions) { AjaxLink createSchemaWinLink = new IndicatingAjaxLink(winLinkName) { private static final long serialVersionUID = -7978723352517770644L; @Override//w w w . ja v a 2 s .com public void onClick(final AjaxRequestTarget target) { createSchemaWin.setPageCreator(new ModalWindow.PageCreator() { private static final long serialVersionUID = -7834632442532690940L; @Override public Page createPage() { AbstractSchemaModalPage page = SchemaModalPageFactory.getSchemaModalPage(entity, schemaType); page.setSchemaModalPage(Schema.this.getPageReference(), new ModalWindow(winName), null, true); return page; } }); createSchemaWin.show(target); } }; MetaDataRoleAuthorizationStrategy.authorize(createSchemaWinLink, ENABLE, createPermissions); return createSchemaWinLink; }
From source file:org.syncope.console.pages.TaskModalPage.java
License:Apache License
public TaskModalPage(final TaskTO taskTO) { final TaskTO actual = taskTO.getId() == 0 ? taskTO : taskTO instanceof PropagationTaskTO ? taskRestClient.readPropagationTask(taskTO.getId()) : taskTO instanceof NotificationTaskTO ? taskRestClient.readNotificationTask(taskTO.getId()) : taskTO instanceof SyncTaskTO ? taskRestClient.readSchedTask(SyncTaskTO.class, taskTO.getId()) : taskRestClient.readSchedTask(SchedTaskTO.class, taskTO.getId()); taskTO.setExecutions(actual.getExecutions()); final ModalWindow taskExecMessageWin = new ModalWindow("taskExecMessageWin"); taskExecMessageWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY); taskExecMessageWin.setCookieName("task-exec-message-win-modal"); add(taskExecMessageWin);//from ww w . j av a2 s.c om form = new Form("form"); form.setModel(new CompoundPropertyModel(taskTO)); add(form); profile = new WebMarkupContainer("profile"); profile.setOutputMarkupId(true); form.add(profile); executions = new WebMarkupContainer("executions"); executions.setOutputMarkupId(true); form.add(executions); final Label idLabel = new Label("idLabel", new ResourceModel("id")); profile.add(idLabel); final AjaxTextFieldPanel id = new AjaxTextFieldPanel("id", getString("id"), new PropertyModel<String>(taskTO, "id"), false); id.setEnabled(false); profile.add(id); final List<IColumn> columns = new ArrayList<IColumn>(); columns.add(new PropertyColumn(new ResourceModel("id"), "id", "id")); columns.add(new DatePropertyColumn(new ResourceModel("startDate"), "startDate", "startDate")); columns.add(new DatePropertyColumn(new ResourceModel("endDate"), "endDate", "endDate")); columns.add(new PropertyColumn(new ResourceModel("status"), "status", "status")); columns.add(new AbstractColumn<TaskExecTO>(new ResourceModel("actions", "")) { private static final long serialVersionUID = 2054811145491901166L; @Override public String getCssClass() { return "action"; } @Override public void populateItem(final Item<ICellPopulator<TaskExecTO>> cellItem, final String componentId, final IModel<TaskExecTO> model) { final TaskExecTO taskExecutionTO = model.getObject(); final ActionLinksPanel panel = new ActionLinksPanel(componentId, model); panel.add(new ActionLink() { private static final long serialVersionUID = -3722207913631435501L; @Override public void onClick(final AjaxRequestTarget target) { taskExecMessageWin.setPageCreator(new ModalWindow.PageCreator() { private static final long serialVersionUID = -7834632442532690940L; @Override public Page createPage() { return new ExecMessageModalPage(model.getObject().getMessage()); } }); taskExecMessageWin.show(target); } }, ActionLink.ActionType.EDIT, "Tasks", "read", StringUtils.hasText(model.getObject().getMessage())); panel.add(new ActionLink() { private static final long serialVersionUID = -3722207913631435501L; @Override public void onClick(final AjaxRequestTarget target) { try { taskRestClient.deleteExecution(taskExecutionTO.getId()); taskTO.removeExecution(taskExecutionTO); info(getString("operation_succeded")); } catch (SyncopeClientCompositeErrorException scce) { error(scce.getMessage()); } target.add(feedbackPanel); target.add(executions); } }, ActionLink.ActionType.DELETE, "Tasks", "delete"); cellItem.add(panel); } }); final AjaxFallbackDefaultDataTable table = new AjaxFallbackDefaultDataTable("executionsTable", columns, new TaskExecutionsProvider(taskTO), 10); executions.add(table); }
From source file:org.syncope.console.pages.Users.java
License:Apache License
public Users(final PageParameters parameters) { super(parameters); // Modal window for editing user attributes final ModalWindow editModalWin = new ModalWindow("editModal"); editModalWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY); editModalWin.setInitialHeight(EDIT_MODAL_WIN_HEIGHT); editModalWin.setInitialWidth(EDIT_MODAL_WIN_WIDTH); editModalWin.setCookieName("edit-modal"); add(editModalWin);/*from ww w .j a v a2s . co m*/ final ResultSetPanel searchResult = new ResultSetPanel("searchResult", true, null, getPageReference()); add(searchResult); final ResultSetPanel listResult = new ResultSetPanel("listResult", false, null, getPageReference()); add(listResult); // create new user final AjaxLink createLink = new IndicatingAjaxLink("createLink") { private static final long serialVersionUID = -7978723352517770644L; @Override public void onClick(final AjaxRequestTarget target) { editModalWin.setPageCreator(new ModalWindow.PageCreator() { private static final long serialVersionUID = -7834632442532690940L; @Override public Page createPage() { return new EditUserModalPage(Users.this.getPageReference(), editModalWin, new UserTO()); } }); editModalWin.show(target); } }; MetaDataRoleAuthorizationStrategy.authorize(createLink, ENABLE, xmlRolesReader.getAllAllowedRoles("Users", "create")); add(createLink); setWindowClosedReloadCallback(editModalWin); final Form searchForm = new Form("searchForm"); add(searchForm); final UserSearchPanel searchPanel = new UserSearchPanel("searchPanel"); searchForm.add(searchPanel); searchForm.add(new IndicatingAjaxButton("search", new ResourceModel("search")) { private static final long serialVersionUID = -958724007591692537L; @Override protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) { final NodeCond searchCond = searchPanel.buildSearchCond(); LOG.debug("Node condition " + searchCond); doSearch(target, searchCond, searchResult); Session.get().getFeedbackMessages().clear(); target.add(searchPanel.getSearchFeedback()); } @Override protected void onError(final AjaxRequestTarget target, final Form form) { target.add(searchPanel.getSearchFeedback()); } }); }
From source file:org.syncope.console.wicket.markup.html.tree.TreeActionLinkPanel.java
License:Apache License
public TreeActionLinkPanel(final String id, final long idRole, final IModel inputModel, final ModalWindow window, final PageReference callerPageRef) { super(id);// w ww . j a v a 2s . c o m fragment = new Fragment("menuPanel", idRole == 0 ? "fakerootFrag" : "roleFrag", this); AjaxLink createRoleLink = new IndicatingAjaxLink("createRoleLink") { private static final long serialVersionUID = -7978723352517770644L; @Override public void onClick(final AjaxRequestTarget target) { window.setPageCreator(new ModalWindow.PageCreator() { private static final long serialVersionUID = -7834632442532690940L; @Override public Page createPage() { RoleTO roleTO = new RoleTO(); roleTO.setParent(idRole); RoleModalPage form = new RoleModalPage(callerPageRef, window, roleTO); return form; } }); window.show(target); } }; MetaDataRoleAuthorizationStrategy.authorize(createRoleLink, ENABLE, xmlRolesReader.getAllAllowedRoles("Roles", "create")); fragment.add(createRoleLink); if (idRole != 0) { AjaxLink updateRoleLink = new IndicatingAjaxLink("updateRoleLink") { @Override public void onClick(final AjaxRequestTarget target) { window.setPageCreator(new ModalWindow.PageCreator() { private static final long serialVersionUID = -7834632442532690940L; @Override public Page createPage() { RoleTO roleTO = restClient.readRole(idRole); RoleModalPage form = new RoleModalPage(callerPageRef, window, roleTO); return form; } }); window.show(target); } }; MetaDataRoleAuthorizationStrategy.authorize(updateRoleLink, ENABLE, xmlRolesReader.getAllAllowedRoles("Roles", "read")); fragment.add(updateRoleLink); AjaxLink dropRoleLink = new IndicatingDeleteOnConfirmAjaxLink("dropRoleLink") { @Override public void onClick(final AjaxRequestTarget target) { try { restClient.deleteRole(idRole); getSession().info(getString("operation_succeded")); } catch (SyncopeClientCompositeErrorException e) { LOG.error("While deleting role " + idRole, e); getSession().error(getString("operation_error")); } setResponsePage(new Roles(null)); } }; MetaDataRoleAuthorizationStrategy.authorize(dropRoleLink, ENABLE, xmlRolesReader.getAllAllowedRoles("Roles", "delete")); fragment.add(dropRoleLink); } add(fragment); }