List of usage examples for org.apache.wicket.extensions.ajax.markup.html.modal ModalWindow show
public void show(final IPartialPageRequestHandler target)
From source file:org.apache.directory.fortress.web.panel.UserListPanel.java
License:Apache License
private void addRoleSearchModal(Radio roleRb) { final ModalWindow rolesModalWindow; userformsearchfields.add(rolesModalWindow = new ModalWindow("rolesearchmodal")); final RoleSearchModalPanel roleSearchModalPanel = new RoleSearchModalPanel(rolesModalWindow.getContentId(), rolesModalWindow, false);//from w w w .j av a 2 s. c o m rolesModalWindow.setContent(roleSearchModalPanel); rolesModalWindow.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() { /** Default serialVersionUID */ private static final long serialVersionUID = 1L; @Override public void onClose(AjaxRequestTarget target) { UserRole roleConstraint = roleSearchModalPanel.getRoleSelection(); if (roleConstraint != null) { LOG.debug("modal selected:" + roleConstraint.getName()); searchData.setField1(roleConstraint.getName()); selectedRadioButton = ROLES; enableRoleSearch(); target.add(searchFields); target.add(radioGroup); } } }); roleRb.add(new SecureIndicatingAjaxLink("roleAssignLinkLbl", GlobalIds.REVIEW_MGR, GlobalIds.FIND_ROLES) { /** Default serialVersionUID */ private static final long serialVersionUID = 1L; public void onClick(AjaxRequestTarget target) { roleSearchModalPanel.setRoleSearchVal(searchData.getField1()); roleSearchModalPanel.setAdmin(false); target.prependJavaScript(GlobalIds.WICKET_WINDOW_UNLOAD_CONFIRMATION_FALSE); rolesModalWindow.show(target); } @Override protected void updateAjaxAttributes(AjaxRequestAttributes attributes) { super.updateAjaxAttributes(attributes); AjaxCallListener ajaxCallListener = new AjaxCallListener() { /** Default serialVersionUID */ private static final long serialVersionUID = 1L; @Override public CharSequence getFailureHandler(Component component) { return GlobalIds.WINDOW_LOCATION_REPLACE_COMMANDER_HOME_HTML; } }; attributes.getAjaxCallListeners().add(ajaxCallListener); } }); rolesModalWindow.setTitle("RBAC Role Search Modal"); rolesModalWindow.setInitialWidth(700); rolesModalWindow.setInitialHeight(450); rolesModalWindow.setCookieName("role-assign-modal"); }
From source file:org.apache.directory.fortress.web.panel.UserListPanel.java
License:Apache License
private void addAdminRoleSearchModal(Radio adminRoleRb) { final ModalWindow adminRolesModalWindow; userformsearchfields.add(adminRolesModalWindow = new ModalWindow("adminrolesearchmodal")); final RoleSearchModalPanel adminRoleSearchModalPanel = new RoleSearchModalPanel( adminRolesModalWindow.getContentId(), adminRolesModalWindow, true); adminRolesModalWindow.setContent(adminRoleSearchModalPanel); adminRolesModalWindow.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() { /** Default serialVersionUID */ private static final long serialVersionUID = 1L; @Override//from w w w. ja va 2 s . c o m public void onClose(AjaxRequestTarget target) { UserRole roleConstraint = adminRoleSearchModalPanel.getRoleSelection(); if (roleConstraint != null) { searchData.setField1(roleConstraint.getName()); selectedRadioButton = ADMIN_ROLES; enableAdminSearch(); target.add(searchFields); target.add(radioGroup); } } }); adminRoleRb.add(new SecureIndicatingAjaxLink("adminRoleAssignLinkLbl", GlobalIds.DEL_REVIEW_MGR, GlobalIds.FIND_ROLES) { /** Default serialVersionUID */ private static final long serialVersionUID = 1L; public void onClick(AjaxRequestTarget target) { String msg = "clicked on admin roles search"; msg += "adminRoleSelection: " + searchData.getField1(); adminRoleSearchModalPanel.setRoleSearchVal(searchData.getField1()); adminRoleSearchModalPanel.setAdmin(true); LOG.debug(msg); target.prependJavaScript(GlobalIds.WICKET_WINDOW_UNLOAD_CONFIRMATION_FALSE); adminRolesModalWindow.show(target); } @Override protected void updateAjaxAttributes(AjaxRequestAttributes attributes) { super.updateAjaxAttributes(attributes); AjaxCallListener ajaxCallListener = new AjaxCallListener() { /** Default serialVersionUID */ private static final long serialVersionUID = 1L; @Override public CharSequence getFailureHandler(Component component) { return GlobalIds.WINDOW_LOCATION_REPLACE_COMMANDER_HOME_HTML; } }; attributes.getAjaxCallListeners().add(ajaxCallListener); } }); adminRolesModalWindow.setTitle("Admin Role Search Modal"); adminRolesModalWindow.setInitialWidth(700); adminRolesModalWindow.setInitialHeight(450); adminRolesModalWindow.setCookieName("role-assign-modal"); }
From source file:org.apache.directory.fortress.web.panel.UserListPanel.java
License:Apache License
private void addOUSearchModal(Radio ouRb) { final ModalWindow ousModalWindow; userformsearchfields.add(ousModalWindow = new ModalWindow("ousearchmodal")); final OUSearchModalPanel ouSearchModalPanel = new OUSearchModalPanel(ousModalWindow.getContentId(), ousModalWindow, true);/* w w w . j a v a 2 s. co m*/ ousModalWindow.setContent(ouSearchModalPanel); ousModalWindow.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() { /** Default serialVersionUID */ private static final long serialVersionUID = 1L; @Override public void onClose(AjaxRequestTarget target) { OrgUnit ou = ouSearchModalPanel.getSelection(); if (ou != null) { searchData.setField1(ou.getName()); } selectedRadioButton = OUS; enableOuSearch(); target.add(searchFields); target.add(radioGroup); } }); ouRb.add(new SecureIndicatingAjaxLink("ouAssignLinkLbl", GlobalIds.DEL_REVIEW_MGR, "searchOU") { /** Default serialVersionUID */ private static final long serialVersionUID = 1L; public void onClick(AjaxRequestTarget target) { ouSearchModalPanel.setSearchVal(searchData.getField1()); target.prependJavaScript(GlobalIds.WICKET_WINDOW_UNLOAD_CONFIRMATION_FALSE); ousModalWindow.show(target); } @Override protected void updateAjaxAttributes(AjaxRequestAttributes attributes) { super.updateAjaxAttributes(attributes); AjaxCallListener ajaxCallListener = new AjaxCallListener() { /** Default serialVersionUID */ private static final long serialVersionUID = 1L; @Override public CharSequence getFailureHandler(Component component) { return GlobalIds.WINDOW_LOCATION_REPLACE_COMMANDER_HOME_HTML; } }; attributes.getAjaxCallListeners().add(ajaxCallListener); } }); ousModalWindow.setTitle("User Organizational Unit Search Modal"); ousModalWindow.setInitialWidth(450); ousModalWindow.setInitialHeight(450); ousModalWindow.setCookieName("userou-modal"); }
From source file:org.apache.directory.fortress.web.panel.UserListPanel.java
License:Apache License
private void addPermSearchModal(Radio permRb) { final ModalWindow permsModalWindow; userformsearchfields.add(permsModalWindow = new ModalWindow("permsearchmodal")); final PermSearchModalPanel permSearchModalPanel = new PermSearchModalPanel(permsModalWindow.getContentId(), permsModalWindow, false);/*from www . j a v a 2 s .c o m*/ permsModalWindow.setContent(permSearchModalPanel); permsModalWindow.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() { /** Default serialVersionUID */ private static final long serialVersionUID = 1L; @Override public void onClose(AjaxRequestTarget target) { Permission permSelection = permSearchModalPanel.getSelection(); if (permSelection != null) { searchData.setField1(permSelection.getObjName()); searchData.setField2(permSelection.getOpName()); } selectedRadioButton = PERMS; enablePermSearch(); target.add(searchFields); target.add(radioGroup); } }); permRb.add(new SecureIndicatingAjaxLink("permLinkLbl", GlobalIds.REVIEW_MGR, GlobalIds.FIND_PERMISSIONS) { /** Default serialVersionUID */ private static final long serialVersionUID = 1L; public void onClick(AjaxRequestTarget target) { String msg = "clicked on perms search"; msg += "permSelection: " + permission; String objectSearchVal = ""; if (StringUtils.isNotEmpty(searchData.getField1())) { objectSearchVal = searchData.getField1(); } permSearchModalPanel.setSearchVal(objectSearchVal); LOG.debug(msg); target.prependJavaScript(GlobalIds.WICKET_WINDOW_UNLOAD_CONFIRMATION_FALSE); permsModalWindow.show(target); } @Override protected void updateAjaxAttributes(AjaxRequestAttributes attributes) { super.updateAjaxAttributes(attributes); AjaxCallListener ajaxCallListener = new AjaxCallListener() { /** Default serialVersionUID */ private static final long serialVersionUID = 1L; @Override public CharSequence getFailureHandler(Component component) { return GlobalIds.WINDOW_LOCATION_REPLACE_COMMANDER_HOME_HTML; } }; attributes.getAjaxCallListeners().add(ajaxCallListener); } }); permsModalWindow.setTitle("Permission Search Modal"); permsModalWindow.setInitialWidth(650); permsModalWindow.setInitialHeight(450); permsModalWindow.setCookieName("perm-search-modal"); }
From source file:org.apache.jetspeed.portlets.rpad.RPADEditor.java
License:Apache License
public RPADEditor() { final PortletDeployer deployer = new JetspeedPortletDeployer(); IModel getRepo = new LoadableDetachableModel() { protected Object load() { return getRepo(); }//from w ww. jav a 2 s. c o m }; final WebMarkupContainer tableGroup = new WebMarkupContainer("tableGroup"); final ModalWindow metaDataModalWindow = new ModalWindow("modalwindow"); final PageableListView listview = new PageableListView("repositories", getRepo, 10) { @Override protected void populateItem(final ListItem item) { final Repository repo = (Repository) item.getModelObject(); item.add(new Label("name", repo.getName())); item.add(new Label("url", repo.getConfigPath())); item.add(new AjaxLink("edit", item.getModel()) { @Override public void onClick(AjaxRequestTarget target) { metaDataModalWindow.setContent( new RepositoryPanel(metaDataModalWindow.getContentId(), repo, tableGroup)); metaDataModalWindow.show(target); } }); item.add(new AjaxLink("remove", item.getModel()) { @Override public void onClick(AjaxRequestTarget target) { try { getPortletRequest().getPreferences().reset(repo.getName()); getRepositoryManager() .reload(RemotePortletAppDeployer.getReposList(getPortletRequest())); target.addComponent(tableGroup); } catch (ReadOnlyException e) { logger.error("The preference is read-only: {}", repo.getName()); } } }); } }; listview.setOutputMarkupId(true); tableGroup.setOutputMarkupId(true); tableGroup.add(new PagingNavigator("navigator", listview)); tableGroup.add(listview); add(metaDataModalWindow); add(tableGroup); add(new AjaxLink("newRepo") { @Override public void onClick(AjaxRequestTarget target) { metaDataModalWindow.setContent(new RepositoryPanel(metaDataModalWindow.getContentId(), new SimpleRepository("", ""), tableGroup)); metaDataModalWindow.show(target); } }); }
From source file:org.apache.syncope.client.console.pages.PolicyModalPage.java
License:Apache License
public PolicyModalPage(final PageReference pageRef, final ModalWindow window, final T policyTO) { super();/* w ww . j a v a 2 s . c o m*/ final Form<?> form = new Form<>(FORM); form.setOutputMarkupId(true); add(form); final AjaxTextFieldPanel policyid = new AjaxTextFieldPanel("key", "key", new PropertyModel<String>(policyTO, "key")); policyid.setEnabled(false); policyid.setStyleSheet("ui-widget-content ui-corner-all short_fixedsize"); form.add(policyid); final AjaxTextFieldPanel description = new AjaxTextFieldPanel("description", "description", new PropertyModel<String>(policyTO, "description")); description.addRequiredLabel(); description.setStyleSheet("ui-widget-content ui-corner-all medium_dynamicsize"); form.add(description); final AjaxDropDownChoicePanel<PolicyType> type = new AjaxDropDownChoicePanel<>("type", "type", new PropertyModel<PolicyType>(policyTO, "type")); switch (policyTO.getType()) { case GLOBAL_ACCOUNT: case ACCOUNT: type.setChoices(Arrays.asList(new PolicyType[] { PolicyType.GLOBAL_ACCOUNT, PolicyType.ACCOUNT })); break; case GLOBAL_PASSWORD: case PASSWORD: type.setChoices(Arrays.asList(new PolicyType[] { PolicyType.GLOBAL_PASSWORD, PolicyType.PASSWORD })); break; case GLOBAL_SYNC: case SYNC: type.setChoices(Arrays.asList(new PolicyType[] { PolicyType.GLOBAL_SYNC, PolicyType.SYNC })); default: } type.setChoiceRenderer(new PolicyTypeRenderer()); type.addRequiredLabel(); form.add(type); // Authentication resources - only for AccountPolicyTO Fragment fragment; if (policyTO instanceof AccountPolicyTO) { fragment = new Fragment("forAccountOnly", "authResourcesFragment", form); final List<String> resourceNames = new ArrayList<>(); for (ResourceTO resource : resourceRestClient.getAll()) { resourceNames.add(resource.getKey()); } fragment.add(new AjaxPalettePanel<>("authResources", new PropertyModel<List<String>>(policyTO, "resources"), new ListModel<>(resourceNames))); } else { fragment = new Fragment("forAccountOnly", "emptyFragment", form); } form.add(fragment); // final PolicySpec policy = getPolicySpecification(policyTO); form.add(new PolicyBeanPanel("panel", policy)); final ModalWindow mwindow = new ModalWindow("metaEditModalWin"); mwindow.setCssClassName(ModalWindow.CSS_CLASS_GRAY); mwindow.setInitialHeight(WIN_HEIGHT); mwindow.setInitialWidth(WIN_WIDTH); mwindow.setCookieName("meta-edit-modal"); add(mwindow); List<IColumn<String, String>> resColumns = new ArrayList<>(); resColumns.add(new AbstractColumn<String, String>(new StringResourceModel("name", this, null, "")) { private static final long serialVersionUID = 2054811145491901166L; @Override public void populateItem(final Item<ICellPopulator<String>> cellItem, final String componentId, final IModel<String> rowModel) { cellItem.add(new Label(componentId, rowModel.getObject())); } }); resColumns.add(new AbstractColumn<String, String>(new StringResourceModel("actions", this, null, "")) { private static final long serialVersionUID = 2054811145491901166L; @Override public String getCssClass() { return "action"; } @Override public void populateItem(final Item<ICellPopulator<String>> cellItem, final String componentId, final IModel<String> model) { final String resource = model.getObject(); final ActionLinksPanel panel = new ActionLinksPanel(componentId, model, getPageReference()); panel.add(new ActionLink() { private static final long serialVersionUID = -3722207913631435501L; @Override public void onClick(final AjaxRequestTarget target) { mwindow.setPageCreator(new ModalWindow.PageCreator() { private static final long serialVersionUID = -7834632442532690940L; @Override public Page createPage() { return new ResourceModalPage(PolicyModalPage.this.getPageReference(), mwindow, resourceRestClient.read(resource), false); } }); mwindow.show(target); } }, ActionLink.ActionType.EDIT, "Resources"); cellItem.add(panel); } }); ISortableDataProvider<String, String> resDataProvider = new SortableDataProvider<String, String>() { private static final long serialVersionUID = 8263758912838836438L; @Override public Iterator<? extends String> iterator(final long first, final long count) { return policyTO.getKey() == 0 ? Collections.<String>emptyList().iterator() : policyRestClient.getPolicy(policyTO.getKey()).getUsedByResources() .subList((int) first, (int) first + (int) count).iterator(); } @Override public long size() { return policyTO.getKey() == 0 ? 0 : policyRestClient.getPolicy(policyTO.getKey()).getUsedByResources().size(); } @Override public IModel<String> model(final String object) { return new Model<>(object); } }; final AjaxFallbackDefaultDataTable<String, String> resources = new AjaxFallbackDefaultDataTable<>( "resources", resColumns, resDataProvider, 10); form.add(resources); List<IColumn<GroupTO, String>> groupColumns = new ArrayList<>(); groupColumns.add(new PropertyColumn<GroupTO, String>(new ResourceModel("key", "key"), "key", "key")); groupColumns.add(new PropertyColumn<GroupTO, String>(new ResourceModel("name", "name"), "name", "name")); groupColumns.add(new AbstractColumn<GroupTO, String>(new StringResourceModel("actions", this, null, "")) { private static final long serialVersionUID = 2054811145491901166L; @Override public String getCssClass() { return "action"; } @Override public void populateItem(final Item<ICellPopulator<GroupTO>> cellItem, final String componentId, final IModel<GroupTO> model) { final GroupTO group = model.getObject(); final ActionLinksPanel panel = new ActionLinksPanel(componentId, model, getPageReference()); panel.add(new ActionLink() { private static final long serialVersionUID = -3722207913631435501L; @Override public void onClick(final AjaxRequestTarget target) { mwindow.setPageCreator(new ModalWindow.PageCreator() { private static final long serialVersionUID = -7834632442532690940L; @Override public Page createPage() { return new GroupModalPage(PolicyModalPage.this.getPageReference(), mwindow, group); } }); mwindow.show(target); } }, ActionLink.ActionType.EDIT, "Groups"); cellItem.add(panel); } }); ISortableDataProvider<GroupTO, String> groupDataProvider = new SortableDataProvider<GroupTO, String>() { private static final long serialVersionUID = 8263758912838836438L; @Override public Iterator<? extends GroupTO> iterator(final long first, final long count) { List<GroupTO> groups = new ArrayList<>(); if (policyTO.getKey() > 0) { for (Long groupId : policyRestClient.getPolicy(policyTO.getKey()).getUsedByGroups() .subList((int) first, (int) first + (int) count)) { groups.add(groupRestClient.read(groupId)); } } return groups.iterator(); } @Override public long size() { return policyTO.getKey() == 0 ? 0 : policyRestClient.getPolicy(policyTO.getKey()).getUsedByGroups().size(); } @Override public IModel<GroupTO> model(final GroupTO object) { return new Model<>(object); } }; final AjaxFallbackDefaultDataTable<GroupTO, String> groups = new AjaxFallbackDefaultDataTable<>("groups", groupColumns, groupDataProvider, 10); form.add(groups); mwindow.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() { private static final long serialVersionUID = 8804221891699487139L; @Override public void onClose(final AjaxRequestTarget target) { target.add(resources); target.add(groups); if (isModalResult()) { info(getString(Constants.OPERATION_SUCCEEDED)); feedbackPanel.refresh(target); setModalResult(false); } } }); final AjaxButton submit = new IndicatingAjaxButton(APPLY, new ResourceModel(APPLY)) { private static final long serialVersionUID = -958724007591692537L; @Override protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) { setPolicySpecification(policyTO, policy); try { if (policyTO.getKey() > 0) { policyRestClient.updatePolicy(policyTO); } else { policyRestClient.createPolicy(policyTO); } ((BasePage) pageRef.getPage()).setModalResult(true); window.close(target); } catch (Exception e) { LOG.error("While creating policy", e); error(getString(Constants.ERROR) + ": " + e.getMessage()); ((NotificationPanel) getPage().get(Constants.FEEDBACK)).refresh(target); } } @Override protected void onError(final AjaxRequestTarget target, final Form<?> form) { ((NotificationPanel) getPage().get(Constants.FEEDBACK)).refresh(target); } }; form.add(submit); final IndicatingAjaxButton cancel = new IndicatingAjaxButton(CANCEL, new ResourceModel(CANCEL)) { private static final long serialVersionUID = -958724007591692537L; @Override protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) { window.close(target); } @Override protected void onError(final AjaxRequestTarget target, final Form<?> form) { } }; cancel.setDefaultFormProcessing(false); form.add(cancel); }
From source file:org.apache.syncope.client.console.pages.ReportModalPage.java
License:Apache License
private void setupProfile() { final WebMarkupContainer profile = new WebMarkupContainer("profile"); profile.setOutputMarkupId(true);/*from w w w . ja v a 2s.c o m*/ form.add(profile); final ModalWindow reportletConfWin = new ModalWindow("reportletConfWin"); reportletConfWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY); reportletConfWin.setCookieName("reportlet-conf-win-modal"); reportletConfWin.setInitialHeight(REPORTLET_CONF_WIN_HEIGHT); reportletConfWin.setInitialWidth(REPORTLET_CONF_WIN_WIDTH); reportletConfWin.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() { private static final long serialVersionUID = 8804221891699487139L; @Override public void onClose(final AjaxRequestTarget target) { int foundIdx = -1; if (modalReportletConfOldName != null) { for (int i = 0; i < reportTO.getReportletConfs().size() && foundIdx == -1; i++) { if (reportTO.getReportletConfs().get(i).getName().equals(modalReportletConfOldName)) { foundIdx = i; } } } if (modalReportletConf != null) { if (foundIdx == -1) { reportTO.getReportletConfs().add(modalReportletConf); } else { reportTO.getReportletConfs().set(foundIdx, modalReportletConf); } } target.add(reportlets); } }); add(reportletConfWin); final Label idLabel = new Label("idLabel", new ResourceModel("key")); profile.add(idLabel); final AjaxTextFieldPanel key = new AjaxTextFieldPanel("key", getString("key"), new PropertyModel<String>(reportTO, "key")); key.setEnabled(false); profile.add(key); final Label nameLabel = new Label("nameLabel", new ResourceModel("name")); profile.add(nameLabel); final AjaxTextFieldPanel name = new AjaxTextFieldPanel("name", getString("name"), new PropertyModel<String>(reportTO, "name")); profile.add(name); final AjaxTextFieldPanel lastExec = new AjaxTextFieldPanel("lastExec", getString("lastExec"), new DateFormatROModel(new PropertyModel<String>(reportTO, "lastExec"))); lastExec.setEnabled(false); profile.add(lastExec); final AjaxTextFieldPanel nextExec = new AjaxTextFieldPanel("nextExec", getString("nextExec"), new DateFormatROModel(new PropertyModel<String>(reportTO, "nextExec"))); nextExec.setEnabled(false); profile.add(nextExec); reportlets = new ListChoice<AbstractReportletConf>("reportletConfs", new Model<AbstractReportletConf>(), reportTO.getReportletConfs(), new IChoiceRenderer<ReportletConf>() { private static final long serialVersionUID = 1048000918946220007L; @Override public Object getDisplayValue(final ReportletConf object) { return object.getName(); } @Override public String getIdValue(final ReportletConf object, final int index) { return object.getName(); } }) { private static final long serialVersionUID = 4022366881854379834L; @Override protected CharSequence getDefaultChoice(final String selectedValue) { return null; } }; reportlets.setNullValid(true); profile.add(reportlets); reportlets.add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) { private static final long serialVersionUID = -1107858522700306810L; @Override protected void onUpdate(final AjaxRequestTarget target) { target.add(reportlets); } }); profile.add(new AjaxLink<Void>(ADD_BUTTON_ID) { private static final long serialVersionUID = -7978723352517770644L; @Override public void onClick(final AjaxRequestTarget target) { reportletConfWin.setPageCreator(new ModalWindow.PageCreator() { private static final long serialVersionUID = -7834632442532690940L; @Override public Page createPage() { modalReportletConfOldName = null; modalReportletConf = null; return new ReportletConfModalPage(null, reportletConfWin, ReportModalPage.this.getPageReference()); } }); reportletConfWin.show(target); } }); profile.add(new AjaxLink<Void>(EDIT_BUTTON_ID) { private static final long serialVersionUID = -7978723352517770644L; @Override public void onClick(final AjaxRequestTarget target) { if (reportlets.getModelObject() != null) { reportletConfWin.setPageCreator(new ModalWindow.PageCreator() { private static final long serialVersionUID = -7834632442532690940L; @Override public Page createPage() { modalReportletConfOldName = reportlets.getModelObject().getName(); modalReportletConf = null; return new ReportletConfModalPage(reportlets.getModelObject(), reportletConfWin, ReportModalPage.this.getPageReference()); } }); reportletConfWin.show(target); } } }); profile.add(new AjaxLink<Void>(REMOVE_BUTTON_ID) { private static final long serialVersionUID = -7978723352517770644L; @Override public void onClick(final AjaxRequestTarget target) { reportTO.getReportletConfs().remove(reportlets.getModelObject()); reportlets.setModelObject(null); target.add(reportlets); } @Override protected void updateAjaxAttributes(final AjaxRequestAttributes attributes) { if (reportlets.getModelObject() != null) { super.updateAjaxAttributes(attributes); final AjaxCallListener ajaxCallListener = new AjaxCallListener() { private static final long serialVersionUID = 7160235486520935153L; @Override public CharSequence getPrecondition(final Component component) { return "if (!confirm('" + getString("confirmDelete") + "')) {return false;}"; } }; attributes.getAjaxCallListeners().add(ajaxCallListener); } } }); profile.add(new AjaxLink<Void>(UP_BUTTON_ID) { private static final long serialVersionUID = -7978723352517770644L; @Override public void onClick(final AjaxRequestTarget target) { if (reportlets.getModelObject() != null) { moveUp(reportlets.getModelObject()); target.add(reportlets); } } }); profile.add(new AjaxLink<Void>(DOWN_BUTTON_ID) { private static final long serialVersionUID = -7978723352517770644L; @Override public void onClick(final AjaxRequestTarget target) { if (reportlets.getModelObject() != null) { moveDown(reportlets.getModelObject()); target.add(reportlets); } } }); }
From source file:org.apache.syncope.client.console.pages.ReportModalPage.java
License:Apache License
@SuppressWarnings({ "unchecked", "rawtypes" }) private void setupExecutions() { final WebMarkupContainer executions = new WebMarkupContainer("executionContainer"); executions.setOutputMarkupId(true);/*from w w w . j a v a2s . co m*/ 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("key"), "key", "key")); 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 ActionColumn<ReportExecTO, String>(new ResourceModel("actions", "")) { private static final long serialVersionUID = 2054811145491901166L; @Override public ActionLinksPanel getActions(final String componentId, final IModel<ReportExecTO> model) { final ReportExecTO taskExecutionTO = model.getObject(); final ActionLinksPanel panel = new ActionLinksPanel(componentId, model, getPageReference()); 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", 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().getKey(); return new ReportExecResultDownloadModalPage(reportExecExportWin, ReportModalPage.this.getPageReference()); } }); reportExecExportWin.show(target); } }, ActionLink.ActionType.EXPORT, "Reports", 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 { reportRestClient.deleteExecution(taskExecutionTO.getKey()); reportTO.getExecutions().remove(taskExecutionTO); info(getString(Constants.OPERATION_SUCCEEDED)); } catch (SyncopeClientException scce) { error(scce.getMessage()); } feedbackPanel.refresh(target); target.add(executions); } }, ActionLink.ActionType.DELETE, "Reports"); return panel; } @Override public Component getHeader(final String componentId) { final ActionLinksPanel panel = new ActionLinksPanel(componentId, new Model(), getPageReference()); panel.add(new ActionLink() { private static final long serialVersionUID = -7978723352517770644L; @Override public void onClick(final AjaxRequestTarget target) { if (target != null) { final ReportTO currentReportTO = reportTO.getKey() == 0 ? reportTO : reportRestClient.read(reportTO.getKey()); reportTO.getExecutions().clear(); reportTO.getExecutions().addAll(currentReportTO.getExecutions()); final AjaxFallbackDefaultDataTable currentTable = new AjaxFallbackDefaultDataTable( "executionsTable", columns, new ReportExecutionsProvider(reportTO), 10); currentTable.setOutputMarkupId(true); target.add(currentTable); executions.addOrReplace(currentTable); } } }, ActionLink.ActionType.RELOAD, TASKS, "list"); return panel; } }); final AjaxFallbackDefaultDataTable table = new AjaxFallbackDefaultDataTable("executionsTable", columns, new ReportExecutionsProvider(reportTO), 10); executions.add(table); }
From source file:org.apache.syncope.client.console.pages.ResultStatusModalPage.java
License:Apache License
private ResultStatusModalPage(final Builder builder) { super();//from w w w . ja va 2 s . c o m this.subject = builder.subject; statusUtils = new StatusUtils(this.userRestClient); if (builder.mode == null) { this.mode = Mode.ADMIN; } else { this.mode = builder.mode; } final BaseModalPage page = this; final WebMarkupContainer container = new WebMarkupContainer("container"); container.setOutputMarkupId(true); add(container); final Fragment fragment = new Fragment("resultFrag", mode == Mode.SELF ? "userSelfResultFrag" : "propagationResultFrag", this); fragment.setOutputMarkupId(true); container.add(fragment); if (mode == Mode.ADMIN) { // add Syncope propagation status PropagationStatus syncope = new PropagationStatus(); syncope.setResource("Syncope"); syncope.setStatus(PropagationTaskExecStatus.SUCCESS); List<PropagationStatus> propagations = new ArrayList<PropagationStatus>(); propagations.add(syncope); propagations.addAll(subject.getPropagationStatusTOs()); fragment.add(new Label("info", ((subject instanceof UserTO) && ((UserTO) subject).getUsername() != null) ? ((UserTO) subject).getUsername() : ((subject instanceof GroupTO) && ((GroupTO) subject).getName() != null) ? ((GroupTO) subject).getName() : String.valueOf(subject.getKey()))); final ListView<PropagationStatus> propRes = new ListView<PropagationStatus>("resources", propagations) { private static final long serialVersionUID = -1020475259727720708L; @Override protected void populateItem(final ListItem<PropagationStatus> item) { final PropagationStatus propTO = (PropagationStatus) item.getDefaultModelObject(); final ListView attributes = getConnObjectView(propTO); final Fragment attrhead; if (attributes.getModelObject() == null || attributes.getModelObject().isEmpty()) { attrhead = new Fragment("attrhead", "emptyAttrHeadFrag", page); } else { attrhead = new Fragment("attrhead", "attrHeadFrag", page); } item.add(attrhead); item.add(attributes); attrhead.add(new Label("resource", propTO.getResource())); attrhead.add(new Label("propagation", propTO.getStatus() == null ? "UNDEFINED" : propTO.getStatus().toString())); final Image image; final String alt, title; final ModalWindow failureWindow = new ModalWindow("failureWindow"); final AjaxLink<?> failureWindowLink = new AjaxLink<Void>("showFailureWindow") { private static final long serialVersionUID = -7978723352517770644L; @Override public void onClick(AjaxRequestTarget target) { failureWindow.show(target); } }; switch (propTO.getStatus()) { case SUCCESS: case SUBMITTED: case CREATED: image = new Image("icon", new ContextRelativeResource( IMG_PREFIX + Status.ACTIVE.toString() + Constants.PNG_EXT)); alt = "success icon"; title = "success"; failureWindow.setVisible(false); failureWindowLink.setEnabled(false); break; default: image = new Image("icon", new ContextRelativeResource( IMG_PREFIX + Status.SUSPENDED.toString() + Constants.PNG_EXT)); alt = "failure icon"; title = "failure"; } image.add(new Behavior() { private static final long serialVersionUID = 1469628524240283489L; @Override public void onComponentTag(final Component component, final ComponentTag tag) { tag.put("alt", alt); tag.put("title", title); } }); final FailureMessageModalPage executionFailureMessagePage; if (propTO.getFailureReason() == null) { executionFailureMessagePage = new FailureMessageModalPage(failureWindow.getContentId(), StringUtils.EMPTY); } else { executionFailureMessagePage = new FailureMessageModalPage(failureWindow.getContentId(), propTO.getFailureReason()); } failureWindow.setPageCreator(new ModalWindow.PageCreator() { private static final long serialVersionUID = -7834632442532690940L; @Override public Page createPage() { return executionFailureMessagePage; } }); failureWindow.setCookieName("failureWindow"); failureWindow.setCssClassName(ModalWindow.CSS_CLASS_GRAY); failureWindowLink.add(image); attrhead.add(failureWindowLink); attrhead.add(failureWindow); } }; fragment.add(propRes); } final AjaxLink<Void> close = new IndicatingAjaxLink<Void>("close") { private static final long serialVersionUID = -7978723352517770644L; @Override public void onClick(final AjaxRequestTarget target) { builder.window.close(target); } }; container.add(close); setOutputMarkupId(true); }
From source file:org.apache.syncope.client.console.pages.Schema.java
License:Apache License
private <T extends AbstractSchemaModalPage> List<IColumn> getColumns(final WebMarkupContainer webContainer, final ModalWindow modalWindow, final AttributableType attributableType, final SchemaType schemaType, final Collection<String> fields) { List<IColumn> columns = new ArrayList<IColumn>(); for (final String field : fields) { final Field clazzField = ReflectionUtils.findField(schemaType.getToClass(), field); if (clazzField != null) { if (clazzField.getType().equals(Boolean.class) || clazzField.getType().equals(boolean.class)) { columns.add(new AbstractColumn<AbstractSchemaTO, String>(new ResourceModel(field)) { private static final long serialVersionUID = 8263694778917279290L; @Override/*from w w w .jav a2 s.c om*/ public void populateItem(final Item<ICellPopulator<AbstractSchemaTO>> item, final String componentId, final IModel<AbstractSchemaTO> model) { BeanWrapper bwi = new BeanWrapperImpl(model.getObject()); Object obj = bwi.getPropertyValue(field); item.add(new Label(componentId, "")); item.add(new AttributeModifier("class", new Model<String>(obj.toString()))); } @Override public String getCssClass() { return "small_fixedsize"; } }); } else { IColumn column = new PropertyColumn(new ResourceModel(field), field, field) { private static final long serialVersionUID = 3282547854226892169L; @Override public String getCssClass() { String css = super.getCssClass(); if ("key".equals(field)) { css = StringUtils.isBlank(css) ? "medium_fixedsize" : css + " medium_fixedsize"; } return css; } }; columns.add(column); } } } columns.add(new AbstractColumn<AbstractSchemaTO, String>(new ResourceModel("actions", "")) { private static final long serialVersionUID = 2054811145491901166L; @Override public String getCssClass() { return "action"; } @Override public void populateItem(final Item<ICellPopulator<AbstractSchemaTO>> item, final String componentId, final IModel<AbstractSchemaTO> model) { final AbstractSchemaTO schemaTO = model.getObject(); final ActionLinksPanel panel = new ActionLinksPanel(componentId, model, getPageReference()); panel.addWithRoles(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(attributableType, schemaType); page.setSchemaModalPage(Schema.this.getPageReference(), modalWindow, schemaTO, false); return page; } }); modalWindow.show(target); } }, ActionType.EDIT, allowedReadRoles); panel.addWithRoles(new ActionLink() { private static final long serialVersionUID = -3722207913631435501L; @Override public void onClick(final AjaxRequestTarget target) { switch (schemaType) { case DERIVED: restClient.deleteDerSchema(attributableType, schemaTO.getKey()); break; case VIRTUAL: restClient.deleteVirSchema(attributableType, schemaTO.getKey()); break; default: restClient.deletePlainSchema(attributableType, schemaTO.getKey()); break; } info(getString(Constants.OPERATION_SUCCEEDED)); feedbackPanel.refresh(target); target.add(webContainer); } }, ActionType.DELETE, allowedDeleteRoles); item.add(panel); } }); return columns; }