List of usage examples for org.apache.wicket.extensions.ajax.markup.html.modal ModalWindow ModalWindow
public ModalWindow(final String id)
From source file:org.apache.syncope.console.pages.panels.RoleDetailsPanel.java
License:Apache License
public RoleDetailsPanel(final String id, final RoleTO roleTO, final boolean templateMode) { super(id);/*from w w w .j av a 2 s.com*/ ownerContainer = new WebMarkupContainer("ownerContainer"); ownerContainer.setOutputMarkupId(true); this.add(ownerContainer); final ModalWindow userOwnerSelectWin = new ModalWindow("userOwnerSelectWin"); userOwnerSelectWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY); userOwnerSelectWin.setCookieName("create-userOwnerSelect-modal"); this.add(userOwnerSelectWin); final ModalWindow roleOwnerSelectWin = new ModalWindow("roleOwnerSelectWin"); roleOwnerSelectWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY); roleOwnerSelectWin.setCookieName("create-roleOwnerSelect-modal"); this.add(roleOwnerSelectWin); final ModalWindow parentSelectWin = new ModalWindow("parentSelectWin"); parentSelectWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY); parentSelectWin.setCookieName("create-parentSelect-modal"); this.add(parentSelectWin); if (templateMode) { parentFragment = new Fragment("parent", "parentFragment", this); parentModel = new ParentModel(roleTO); @SuppressWarnings("unchecked") final AjaxTextFieldPanel parent = new AjaxTextFieldPanel("parent", "parent", parentModel); parent.setReadOnly(true); parent.setOutputMarkupId(true); parentFragment.add(parent); final AjaxLink<Void> parentSelect = new IndicatingAjaxLink<Void>("parentSelect") { private static final long serialVersionUID = -7978723352517770644L; @Override public void onClick(final AjaxRequestTarget target) { parentSelectWin.setPageCreator(new ModalWindow.PageCreator() { private static final long serialVersionUID = -7834632442532690940L; @Override public Page createPage() { return new RoleSelectModalPage(getPage().getPageReference(), parentSelectWin, ParentSelectPayload.class); } }); parentSelectWin.show(target); } }; parentFragment.add(parentSelect); final IndicatingAjaxLink<Void> parentReset = new IndicatingAjaxLink<Void>("parentReset") { private static final long serialVersionUID = -7978723352517770644L; @Override public void onClick(final AjaxRequestTarget target) { parentModel.setObject(null); target.add(parent); } }; parentFragment.add(parentReset); } else { parentFragment = new Fragment("parent", "emptyFragment", this); } parentFragment.setOutputMarkupId(true); this.add(parentFragment); final AjaxTextFieldPanel name = new AjaxTextFieldPanel("name", "name", new PropertyModel<String>(roleTO, "name")); final WebMarkupContainer jexlHelp = JexlHelpUtil.getJexlHelpWebContainer("jexlHelp"); final AjaxLink questionMarkJexlHelp = JexlHelpUtil.getAjaxLink(jexlHelp, "questionMarkJexlHelp"); this.add(questionMarkJexlHelp); questionMarkJexlHelp.add(jexlHelp); if (!templateMode) { name.addRequiredLabel(); questionMarkJexlHelp.setVisible(false); } this.add(name); userOwnerModel = new OwnerModel(roleTO, AttributableType.USER); @SuppressWarnings("unchecked") final AjaxTextFieldPanel userOwner = new AjaxTextFieldPanel("userOwner", "userOwner", userOwnerModel); userOwner.setReadOnly(true); userOwner.setOutputMarkupId(true); ownerContainer.add(userOwner); final AjaxLink<Void> userOwnerSelect = new IndicatingAjaxLink<Void>("userOwnerSelect") { private static final long serialVersionUID = -7978723352517770644L; @Override public void onClick(final AjaxRequestTarget target) { userOwnerSelectWin.setPageCreator(new ModalWindow.PageCreator() { private static final long serialVersionUID = -7834632442532690940L; @Override public Page createPage() { return new UserOwnerSelectModalPage(getPage().getPageReference(), userOwnerSelectWin); } }); userOwnerSelectWin.show(target); } }; ownerContainer.add(userOwnerSelect); final IndicatingAjaxLink<Void> userOwnerReset = new IndicatingAjaxLink<Void>("userOwnerReset") { private static final long serialVersionUID = -7978723352517770644L; @Override public void onClick(final AjaxRequestTarget target) { userOwnerModel.setObject(null); target.add(userOwner); } }; ownerContainer.add(userOwnerReset); roleOwnerModel = new OwnerModel(roleTO, AttributableType.ROLE); @SuppressWarnings("unchecked") final AjaxTextFieldPanel roleOwner = new AjaxTextFieldPanel("roleOwner", "roleOwner", roleOwnerModel); roleOwner.setReadOnly(true); roleOwner.setOutputMarkupId(true); ownerContainer.add(roleOwner); final AjaxLink<Void> roleOwnerSelect = new IndicatingAjaxLink<Void>("roleOwnerSelect") { private static final long serialVersionUID = -7978723352517770644L; @Override public void onClick(final AjaxRequestTarget target) { parentSelectWin.setPageCreator(new ModalWindow.PageCreator() { private static final long serialVersionUID = -7834632442532690940L; @Override public Page createPage() { return new RoleSelectModalPage(getPage().getPageReference(), parentSelectWin, RoleOwnerSelectPayload.class); } }); parentSelectWin.show(target); } }; ownerContainer.add(roleOwnerSelect); final IndicatingAjaxLink<Void> roleOwnerReset = new IndicatingAjaxLink<Void>("roleOwnerReset") { private static final long serialVersionUID = -7978723352517770644L; @Override public void onClick(final AjaxRequestTarget target) { roleOwnerModel.setObject(null); target.add(roleOwner); } }; ownerContainer.add(roleOwnerReset); final AjaxCheckBoxPanel inhOwner = new AjaxCheckBoxPanel("inheritOwner", "inheritOwner", new PropertyModel<Boolean>(roleTO, "inheritOwner")); this.add(inhOwner); final AjaxCheckBoxPanel inhTemplates = new AjaxCheckBoxPanel("inheritTemplates", "inheritTemplates", new PropertyModel<Boolean>(roleTO, "inheritTemplates")); inhTemplates.getField().add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) { private static final long serialVersionUID = -1107858522700306810L; @Override protected void onUpdate(final AjaxRequestTarget target) { send(getPage(), Broadcast.BREADTH, new RoleAttrTemplatesChange(Type.rAttrTemplates, target)); send(getPage(), Broadcast.BREADTH, new RoleAttrTemplatesChange(Type.rDerAttrTemplates, target)); send(getPage(), Broadcast.BREADTH, new RoleAttrTemplatesChange(Type.rVirAttrTemplates, target)); } }); this.add(inhTemplates); }
From source file:org.apache.syncope.console.pages.panels.SchedTasks.java
License:Apache License
public SchedTasks(final String id, final PageReference pageRef) { super(id, pageRef); container = new WebMarkupContainer("container"); container.setOutputMarkupId(true);/*from ww w . j av a 2 s . c o m*/ add(container); window = new ModalWindow("taskWin"); window.setCssClassName(ModalWindow.CSS_CLASS_GRAY); window.setInitialHeight(WIN_HEIGHT); window.setInitialWidth(WIN_WIDTH); window.setCookieName(VIEW_TASK_WIN_COOKIE_NAME); add(window); ((Tasks) pageRef.getPage()).setWindowClosedCallback(window, container); paginatorRows = prefMan.getPaginatorRows(getWebRequest(), Constants.PREF_SCHED_TASKS_PAGINATOR_ROWS); table = Tasks.updateTaskTable(getColumns(), new TasksProvider<SchedTaskTO>(restClient, paginatorRows, getId(), SchedTaskTO.class), container, 0, pageRef, restClient); container.add(table); @SuppressWarnings("rawtypes") Form paginatorForm = new Form("PaginatorForm"); @SuppressWarnings({ "unchecked", "rawtypes" }) final DropDownChoice rowsChooser = new DropDownChoice("rowsChooser", new PropertyModel(this, "paginatorRows"), prefMan.getPaginatorChoices()); rowsChooser.add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) { private static final long serialVersionUID = -1107858522700306810L; @Override protected void onUpdate(final AjaxRequestTarget target) { prefMan.set(getWebRequest(), (WebResponse) getResponse(), Constants.PREF_SCHED_TASKS_PAGINATOR_ROWS, String.valueOf(paginatorRows)); table = Tasks.updateTaskTable(getColumns(), new TasksProvider<SchedTaskTO>(restClient, paginatorRows, getId(), SchedTaskTO.class), container, table == null ? 0 : (int) table.getCurrentPage(), pageRef, restClient); target.add(container); } }); paginatorForm.add(rowsChooser); add(paginatorForm); AjaxLink createLink = new ClearIndicatingAjaxLink("createLink", pageRef) { private static final long serialVersionUID = -7978723352517770644L; @Override protected void onClickInternal(final AjaxRequestTarget target) { window.setPageCreator(new ModalWindow.PageCreator() { private static final long serialVersionUID = -7834632442532690940L; @Override public Page createPage() { return new SchedTaskModalPage(window, new SchedTaskTO(), pageRef); } }); window.show(target); } }; MetaDataRoleAuthorizationStrategy.authorize(createLink, RENDER, xmlRolesReader.getAllAllowedRoles(TASKS, "create")); add(createLink); }
From source file:org.apache.syncope.console.pages.panels.StatusPanel.java
License:Apache License
public <T extends AbstractAttributableTO> StatusPanel(final String id, final AbstractSubjectTO subject, final List<StatusBean> selectedResources, final PageReference pageref) { super(id);// ww w .ja v a2s. c o m connObjectWin = new ModalWindow("connObjectWin"); connObjectWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY); connObjectWin.setInitialHeight(CONNOBJECT_WIN_HEIGHT); connObjectWin.setInitialWidth(CONNOBJECT_WIN_WIDTH); connObjectWin.setCookieName("connobject-modal"); add(connObjectWin); statusUtils = new StatusUtils(subject instanceof RoleTO ? roleRestClient : userRestClient); connObjects = statusUtils.getConnectorObjects(subject); final List<StatusBean> statusBeans = new ArrayList<StatusBean>(connObjects.size() + 1); initialStatusBeanMap = new LinkedHashMap<String, StatusBean>(connObjects.size() + 1); final StatusBean syncope = new StatusBean(subject, "syncope"); if (subject instanceof UserTO) { syncope.setAccountLink(((UserTO) subject).getUsername()); Status syncopeStatus = Status.UNDEFINED; if (((UserTO) subject).getStatus() != null) { try { syncopeStatus = Status.valueOf(((UserTO) subject).getStatus().toUpperCase()); } catch (IllegalArgumentException e) { LOG.warn("Unexpected status found: {}", ((UserTO) subject).getStatus(), e); } } syncope.setStatus(syncopeStatus); } else if (subject instanceof RoleTO) { syncope.setAccountLink(((RoleTO) subject).getDisplayName()); syncope.setStatus(Status.ACTIVE); } statusBeans.add(syncope); initialStatusBeanMap.put(syncope.getResourceName(), syncope); for (ConnObjectWrapper entry : connObjects) { final StatusBean statusBean = statusUtils.getStatusBean(entry.getAttributable(), entry.getResourceName(), entry.getConnObjectTO(), subject instanceof RoleTO); initialStatusBeanMap.put(entry.getResourceName(), statusBean); statusBeans.add(statusBean); } checkGroup = new CheckGroup<StatusBean>("group", selectedResources); checkGroup.setOutputMarkupId(true); checkGroup.add(new AjaxFormChoiceComponentUpdatingBehavior() { private static final long serialVersionUID = -151291731388673682L; @Override protected void onUpdate(final AjaxRequestTarget target) { // ignore } }); add(checkGroup); CheckGroupSelector groupSelector = new CheckGroupSelector("groupselector", checkGroup); if (subject instanceof RoleTO) { groupSelector.setVisible(false); } add(groupSelector); statusBeansListView = new AltListView<StatusBean>("resources", statusBeans) { private static final long serialVersionUID = 4949588177564901031L; @Override protected void populateItem(final ListItem<StatusBean> item) { item.add(statusUtils.getStatusImage("icon", item.getModelObject().getStatus())); final Check<StatusBean> check = new Check<StatusBean>("check", item.getModel(), checkGroup); if (subject instanceof RoleTO) { check.setVisible(false); } item.add(check); item.add(new Label("resource", new ResourceModel(item.getModelObject().getResourceName(), item.getModelObject().getResourceName()))); if (StringUtils.isNotBlank(item.getModelObject().getAccountLink())) { item.add(new Label("accountLink", new ResourceModel(item.getModelObject().getAccountLink(), item.getModelObject().getAccountLink()))); } else { item.add(new Label("accountLink", "")); } final ConnObjectTO connObjectTO = statusUtils.getConnObjectTO( item.getModelObject().getAttributableId(), item.getModelObject().getResourceName(), connObjects); if (pageref == null || connObjectTO == null) { item.add(new Label("connObject", new Model<String>())); } else { final ActionLinksPanel connObject = new ActionLinksPanel("connObject", new Model(), pageref); connObject.add(new ActionLink() { private static final long serialVersionUID = -3722207913631435501L; @Override public void onClick(final AjaxRequestTarget target) { connObjectWin.setPageCreator(new ModalWindow.PageCreator() { private static final long serialVersionUID = -7834632442532690940L; @Override public Page createPage() { return new ConnObjectModalPage(connObjectTO); } }); connObjectWin.show(target); } }, ActionLink.ActionType.SEARCH, "Resources", "getConnectorObject"); item.add(connObject); } } }; statusBeansListView.setReuseItems(true); checkGroup.add(statusBeansListView); }
From source file:org.apache.syncope.console.pages.PolicyModalPage.java
License:Apache License
public PolicyModalPage(final PageReference pageRef, final ModalWindow window, final T policyTO) { super();// ww w .ja va 2 s . com final Form<?> form = new Form<Void>(FORM); form.setOutputMarkupId(true); add(form); final AjaxTextFieldPanel policyid = new AjaxTextFieldPanel("id", "id", new PropertyModel<String>(policyTO, "id")); 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<PolicyType>("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<String>(); for (ResourceTO resource : resourceRestClient.getAll()) { resourceNames.add(resource.getName()); } fragment.add(new AjaxPalettePanel<String>("authResources", new PropertyModel<List<String>>(policyTO, "resources"), new ListModel<String>(resourceNames))); } else { fragment = new Fragment("forAccountOnly", "emptyFragment", form); } form.add(fragment); // final AbstractPolicySpec 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<IColumn<String, String>>(); 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.getId() == 0 ? Collections.<String>emptyList().iterator() : policyRestClient.getPolicy(policyTO.getId()).getUsedByResources() .subList((int) first, (int) first + (int) count).iterator(); } @Override public long size() { return policyTO.getId() == 0 ? 0 : policyRestClient.getPolicy(policyTO.getId()).getUsedByResources().size(); } @Override public IModel<String> model(final String object) { return new Model<String>(object); } }; final AjaxFallbackDefaultDataTable<String, String> resources = new AjaxFallbackDefaultDataTable<String, String>( "resources", resColumns, resDataProvider, 10); form.add(resources); List<IColumn<RoleTO, String>> roleColumns = new ArrayList<IColumn<RoleTO, String>>(); roleColumns.add(new PropertyColumn<RoleTO, String>(new ResourceModel("id", "id"), "id", "id")); roleColumns.add(new PropertyColumn<RoleTO, String>(new ResourceModel("name", "name"), "name", "name")); roleColumns.add(new AbstractColumn<RoleTO, 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<RoleTO>> cellItem, final String componentId, final IModel<RoleTO> model) { final RoleTO role = 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 RoleModalPage(PolicyModalPage.this.getPageReference(), mwindow, role); } }); mwindow.show(target); } }, ActionLink.ActionType.EDIT, "Roles"); cellItem.add(panel); } }); ISortableDataProvider<RoleTO, String> roleDataProvider = new SortableDataProvider<RoleTO, String>() { private static final long serialVersionUID = 8263758912838836438L; @Override public Iterator<? extends RoleTO> iterator(final long first, final long count) { List<RoleTO> roles = new ArrayList<RoleTO>(); if (policyTO.getId() > 0) { for (Long roleId : policyRestClient.getPolicy(policyTO.getId()).getUsedByRoles() .subList((int) first, (int) first + (int) count)) { roles.add(roleRestClient.read(roleId)); } } return roles.iterator(); } @Override public long size() { return policyTO.getId() == 0 ? 0 : policyRestClient.getPolicy(policyTO.getId()).getUsedByRoles().size(); } @Override public IModel<RoleTO> model(final RoleTO object) { return new Model<RoleTO>(object); } }; final AjaxFallbackDefaultDataTable<RoleTO, String> roles = new AjaxFallbackDefaultDataTable<RoleTO, String>( "roles", roleColumns, roleDataProvider, 10); form.add(roles); mwindow.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() { private static final long serialVersionUID = 8804221891699487139L; @Override public void onClose(final AjaxRequestTarget target) { target.add(resources); target.add(roles); 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.getId() > 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.console.pages.ReportModalPage.java
License:Apache License
private void setupProfile() { final WebMarkupContainer profile = new WebMarkupContainer("profile"); profile.setOutputMarkupId(true);/* ww w . j a v a 2s. c om*/ 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("id")); profile.add(idLabel); final AjaxTextFieldPanel id = new AjaxTextFieldPanel("id", getString("id"), new PropertyModel<String>(reportTO, "id")); id.setEnabled(false); profile.add(id); 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.console.pages.ReportModalPage.java
License:Apache License
@SuppressWarnings({ "unchecked", "rawtypes" }) private void setupExecutions() { final WebMarkupContainer executions = new WebMarkupContainer("executionContainer"); executions.setOutputMarkupId(true);// w w w .j av a 2s.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("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 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().getId(); 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.getId()); 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.getId() == 0 ? reportTO : reportRestClient.read(reportTO.getId()); 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.console.pages.Reports.java
License:Apache License
public Reports(final PageParameters parameters) { super(parameters); window = new ModalWindow("reportWin"); window.setCssClassName(ModalWindow.CSS_CLASS_GRAY); window.setInitialHeight(WIN_HEIGHT); window.setInitialWidth(WIN_WIDTH);/*w w w . j av a 2 s . c om*/ window.setCookieName("view-report-win"); add(window); setupReport(); setupAudit(); }
From source file:org.apache.syncope.console.pages.Resources.java
License:Apache License
public Resources(final PageParameters parameters) { super(parameters); add(createResourceWin = new ModalWindow("createResourceWin")); add(editResourceWin = new ModalWindow("editResourceWin")); add(createConnectorWin = new ModalWindow("createConnectorWin")); add(editConnectorWin = new ModalWindow("editConnectorWin")); statusmodal.setCssClassName(ModalWindow.CSS_CLASS_GRAY); statusmodal.setInitialHeight(STATUS_MODAL_WIN_HEIGHT); statusmodal.setInitialWidth(STATUS_MODAL_WIN_WIDTH); statusmodal.setCookieName("status-modal"); add(statusmodal);//from www.ja va 2 s . co m AjaxLink<Void> reloadLink = new ClearIndicatingAjaxLink<Void>("reloadLink", getPageReference()) { private static final long serialVersionUID = 3109256773218160485L; @Override protected void onClickInternal(final AjaxRequestTarget target) { try { connectorRestClient.reload(); info(getString(Constants.OPERATION_SUCCEEDED)); } catch (Exception e) { error(getString(Constants.ERROR) + ": " + e.getMessage()); } feedbackPanel.refresh(target); target.add(connectorContainer); } @Override protected void updateAjaxAttributes(final AjaxRequestAttributes attributes) { 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("confirmReloadConnectors") + "')) " + "{return false;} else {return true;}"; } }; attributes.getAjaxCallListeners().add(ajaxCallListener); } }; MetaDataRoleAuthorizationStrategy.authorize(reloadLink, ENABLE, xmlRolesReader.getAllAllowedRoles("Connectors", "reload")); add(reloadLink); resourcePaginatorRows = prefMan.getPaginatorRows(getRequest(), Constants.PREF_RESOURCES_PAGINATOR_ROWS); connectorPaginatorRows = prefMan.getPaginatorRows(getRequest(), Constants.PREF_CONNECTORS_PAGINATOR_ROWS); setupResources(); setupConnectors(); }
From source file:org.apache.syncope.console.pages.ResultStatusModalPage.java
License:Apache License
private ResultStatusModalPage(final Builder builder) { super();/*from w ww. j av a 2 s .c om*/ this.subject = builder.subject; statusUtils = new StatusUtils(this.userRestClient); if (builder.mode == null) { this.mode = UserModalPage.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 == UserModalPage.Mode.SELF ? "userSelfResultFrag" : "propagationResultFrag", this); fragment.setOutputMarkupId(true); container.add(fragment); if (mode == UserModalPage.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 RoleTO) && ((RoleTO) subject).getName() != null) ? ((RoleTO) subject).getName() : String.valueOf(subject.getId()))); 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", IMG_STATUSES + Status.ACTIVE.toString() + Constants.PNG_EXT); alt = "success icon"; title = "success"; failureWindow.setVisible(false); failureWindowLink.setEnabled(false); break; default: image = new Image("icon", IMG_STATUSES + 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) { if (mode == UserModalPage.Mode.SELF && anonymousUser.equals(SyncopeSession.get().getUsername())) { SyncopeSession.get().invalidate(); } builder.window.close(target); } }; container.add(close); setOutputMarkupId(true); }
From source file:org.apache.syncope.console.pages.Roles.java
License:Apache License
public Roles(final PageParameters parameters) { super(parameters); roleTabsContainer = new WebMarkupContainer("roleTabsContainer"); roleTabsContainer.setOutputMarkupId(true); add(roleTabsContainer);//from ww w . jav a 2 s. c o m editRoleWin = new ModalWindow("editRoleWin"); editRoleWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY); editRoleWin.setInitialHeight(WIN_HEIGHT); editRoleWin.setInitialWidth(WIN_WIDTH); editRoleWin.setCookieName("edit-role-modal"); add(editRoleWin); final TreeRolePanel treePanel = new TreeRolePanel("treePanel"); treePanel.setOutputMarkupId(true); roleTabsContainer.add(treePanel); final RoleSummaryPanel summaryPanel = new RoleSummaryPanel.Builder("summaryPanel").window(editRoleWin) .callerPageRef(Roles.this.getPageReference()).build(); roleTabsContainer.add(summaryPanel); editRoleWin.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() { private static final long serialVersionUID = 8804221891699487139L; @Override public void onClose(final AjaxRequestTarget target) { final RoleSummaryPanel summaryPanel = (RoleSummaryPanel) roleTabsContainer.get("summaryPanel"); final TreeNodeClickUpdate data = new TreeNodeClickUpdate(target, summaryPanel == null || summaryPanel.getSelectedNode() == null ? 0 : summaryPanel.getSelectedNode().getId()); send(getPage(), Broadcast.BREADTH, data); if (modalResult) { getSession().info(getString(Constants.OPERATION_SUCCEEDED)); feedbackPanel.refresh(target); modalResult = false; } } }); final AbstractSearchResultPanel searchResult = new RoleSearchResultPanel("searchResult", true, null, getPageReference(), restClient); add(searchResult); final Form searchForm = new Form("searchForm"); add(searchForm); final RoleSearchPanel searchPanel = new RoleSearchPanel.Builder("searchPanel").build(); searchForm.add(searchPanel); searchForm.add(new ClearIndicatingAjaxButton("search", new ResourceModel("search"), getPageReference()) { private static final long serialVersionUID = -958724007591692537L; @Override protected void onSubmitInternal(final AjaxRequestTarget target, final Form<?> form) { final String fiql = searchPanel.buildFIQL(); LOG.debug("Node condition {}", fiql); doSearch(target, fiql, searchResult); Session.get().getFeedbackMessages().clear(); searchPanel.getSearchFeedback().refresh(target); } @Override protected void onError(final AjaxRequestTarget target, final Form<?> form) { searchPanel.getSearchFeedback().refresh(target); } }); }