List of usage examples for org.apache.wicket.ajax.markup.html AjaxLink AjaxLink
public AjaxLink(final String id)
From source file:com.evolveum.midpoint.web.page.admin.configuration.PageAccounts.java
License:Apache License
private void initLayout() { Form form = new Form(ID_MAIN_FORM); add(form);//from w w w . j a v a 2 s. co m DropDownChoice<ResourceItemDto> resources = new DropDownChoice<ResourceItemDto>(ID_RESOURCES, resourceModel, resourcesModel, new IChoiceRenderer<ResourceItemDto>() { @Override public Object getDisplayValue(ResourceItemDto object) { if (object == null) { return ""; } return object.getName(); } @Override public String getIdValue(ResourceItemDto object, int index) { return Integer.toString(index); } }); form.add(resources); initLinks(form); initTotals(form); final AjaxDownloadBehaviorFromFile ajaxDownloadBehavior = new AjaxDownloadBehaviorFromFile(true) { @Override protected File initFile() { return downloadFile; } }; ajaxDownloadBehavior.setRemoveFile(false); form.add(ajaxDownloadBehavior); WebMarkupContainer filesContainer = new WebMarkupContainer(ID_FILES_CONTAINER); filesContainer.setOutputMarkupId(true); form.add(filesContainer); filesModel = createFilesModel(); ListView<String> files = new ListView<String>(ID_FILES, filesModel) { @Override protected void populateItem(final ListItem<String> item) { AjaxLink file = new AjaxLink(ID_FILE) { @Override public void onClick(AjaxRequestTarget target) { downloadPerformed(target, item.getModelObject(), ajaxDownloadBehavior); } }; file.add(new Label(ID_FILE_NAME, item.getModelObject())); item.add(file); } }; files.setRenderBodyOnly(true); filesContainer.add(files); WebMarkupContainer accountsContainer = new WebMarkupContainer(ID_ACCOUNTS_CONTAINER); accountsContainer.setOutputMarkupId(true); form.add(accountsContainer); ObjectDataProvider provider = new ObjectDataProvider(this, ShadowType.class); provider.setOptions(SelectorOptions.createCollection(GetOperationOptions.createRaw())); provider.setQuery(ObjectQuery.createObjectQuery(createResourceQueryFilter())); TablePanel accounts = new TablePanel(ID_ACCOUNTS, provider, createAccountsColumns()); accounts.add(new VisibleEnableBehaviour() { @Override public boolean isVisible() { return resourceModel.getObject() != null; } }); accounts.setItemsPerPage(50); accountsContainer.add(accounts); }
From source file:com.evolveum.midpoint.web.page.admin.configuration.PageAccounts.java
License:Apache License
private void initLinks(Form form) { AjaxSubmitLink listSyncDetails = new AjaxSubmitLink(ID_LIST_SYNC_DETAILS) { @Override/*from ww w. jav a 2s . c o m*/ protected void onSubmit(AjaxRequestTarget target, Form<?> form) { listSyncDetailsPerformed(target); } @Override protected void onError(AjaxRequestTarget target, Form<?> form) { target.add(getFeedbackPanel()); } }; form.add(listSyncDetails); AjaxSubmitLink export = new AjaxSubmitLink(ID_EXPORT) { @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { exportPerformed(target); } @Override protected void onError(AjaxRequestTarget target, Form<?> form) { target.add(getFeedbackPanel()); } }; form.add(export); AjaxLink clearExport = new AjaxLink(ID_CLEAR_EXPORT) { @Override public void onClick(AjaxRequestTarget target) { clearExportPerformed(target); } }; form.add(clearExport); }
From source file:com.evolveum.midpoint.web.page.admin.resources.component.ContentPanel.java
License:Apache License
private void initLayout() { AjaxLink accounts = new AjaxLink("accounts") { @Override//w w w . jav a2 s .com public void onClick(AjaxRequestTarget target) { accountsPerformed(target); } }; add(accounts); // AjaxLink entitlements = new AjaxLink("entitlements") { // // @Override // public void onClick(AjaxRequestTarget target) { // entitlementsPerformed(target); // } // }; // add(entitlements); }
From source file:com.evolveum.midpoint.web.page.admin.users.component.AssociationValueChoicePanel.java
License:Apache License
private void initLayout(final IModel<PrismContainerValue<ShadowAssociationType>> value, final List<PrismPropertyValue> values, final boolean required, Class<C> type) { WebMarkupContainer textWrapper = new WebMarkupContainer(ID_TEXT_WRAPPER); textWrapper.setOutputMarkupId(true); TextField<String> text = new TextField<>(ID_TEXT, createTextModel(value)); text.add(new AjaxFormComponentUpdatingBehavior("blur") { private static final long serialVersionUID = 1L; @Override// w ww .j a va 2 s .c o m protected void onUpdate(AjaxRequestTarget ajaxRequestTarget) { } }); text.setRequired(required); text.setEnabled(false); textWrapper.add(text); FeedbackPanel feedback = new FeedbackPanel(ID_FEEDBACK, new ComponentFeedbackMessageFilter(text)); feedback.setFilter(new ComponentFeedbackMessageFilter(text)); textWrapper.add(feedback); AjaxLink edit = new AjaxLink(ID_EDIT) { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { editValuePerformed(target); } }; edit.add(new VisibleEnableBehaviour() { private static final long serialVersionUID = 1L; @Override public boolean isVisible() { return model.getObject().isEmpty(); } }); textWrapper.add(edit); add(textWrapper); initDialog(type, values); }
From source file:com.evolveum.midpoint.web.page.admin.users.component.AssociationValueChoosePanel.java
License:Apache License
private void initLayout(final IModel<PrismContainerValue<ShadowAssociationType>> value, final List<PrismPropertyValue> values, final boolean required, Class<C> type) { WebMarkupContainer textWrapper = new WebMarkupContainer(ID_TEXT_WRAPPER); textWrapper.setOutputMarkupId(true); TextField text = new TextField<>(ID_TEXT, createTextModel(value)); text.add(new AjaxFormComponentUpdatingBehavior("onblur") { @Override/*w w w . ja va2 s . c om*/ protected void onUpdate(AjaxRequestTarget ajaxRequestTarget) { } }); text.setRequired(required); text.setEnabled(false); textWrapper.add(text); FeedbackPanel feedback = new FeedbackPanel(ID_FEEDBACK, new ComponentFeedbackMessageFilter(text)); textWrapper.add(feedback); AjaxLink edit = new AjaxLink(ID_EDIT) { @Override public void onClick(AjaxRequestTarget target) { editValuePerformed(target); } }; edit.add(new VisibleEnableBehaviour() { @Override public boolean isVisible() { return model.getObject().isEmpty(); } }); textWrapper.add(edit); add(textWrapper); initDialog(type, values); }
From source file:com.evolveum.midpoint.web.page.admin.users.component.OrgMemberPanel.java
License:Apache License
private WebMarkupContainer createManagerContainer() { WebMarkupContainer managerContainer = new WebMarkupContainer(ID_CONTAINER_MANAGER); managerContainer.setOutputMarkupId(true); managerContainer.setOutputMarkupPlaceholderTag(true); RepeatingView view = new RepeatingView(ID_MANAGER_TABLE); view.setOutputMarkupId(true);//from w w w. j a va2 s .c o m ObjectQuery managersQuery = createManagerQuery(); OperationResult searchManagersResult = new OperationResult(OPERATION_SEARCH_MANAGERS); Collection<SelectorOptions<GetOperationOptions>> options = SelectorOptions.createCollection( FocusType.F_JPEG_PHOTO, GetOperationOptions.createRetrieve(RetrieveOption.INCLUDE)); List<PrismObject<FocusType>> managers = WebModelServiceUtils.searchObjects(FocusType.class, managersQuery, options, searchManagersResult, getPageBase()); for (PrismObject<FocusType> manager : managers) { ObjectWrapper<FocusType> managerWrapper = ObjectWrapperUtil.createObjectWrapper( WebComponentUtil.getEffectiveName(manager, RoleType.F_DISPLAY_NAME), "", manager, ContainerStatus.MODIFYING, getPageBase()); WebMarkupContainer managerMarkup = new WebMarkupContainer(view.newChildId()); AjaxLink<String> link = new AjaxLink<String>(ID_EDIT_MANAGER) { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { FocusSummaryPanel<FocusType> summary = (FocusSummaryPanel<FocusType>) getParent() .get(ID_MANAGER_SUMMARY); detailsPerformed(target, summary.getModelObject()); } }; if (manager.getCompileTimeClass().equals(UserType.class)) { managerMarkup.add(new UserSummaryPanel(ID_MANAGER_SUMMARY, new Model<ObjectWrapper<UserType>>((ObjectWrapper) managerWrapper))); } else if (manager.getCompileTimeClass().equals(RoleType.class)) { managerMarkup.add(new RoleSummaryPanel(ID_MANAGER_SUMMARY, new Model<ObjectWrapper<RoleType>>((ObjectWrapper) managerWrapper))); } else if (manager.getCompileTimeClass().equals(OrgType.class)) { managerMarkup.add(new OrgSummaryPanel(ID_MANAGER_SUMMARY, new Model<ObjectWrapper<OrgType>>((ObjectWrapper) managerWrapper))); } else if (manager.getCompileTimeClass().equals(ServiceType.class)) { managerMarkup.add(new ServiceSummaryPanel(ID_MANAGER_SUMMARY, new Model<ObjectWrapper<ServiceType>>((ObjectWrapper) managerWrapper))); } link.setOutputMarkupId(true); managerMarkup.setOutputMarkupId(true); managerMarkup.add(link); view.add(managerMarkup); AjaxButton removeManager = new AjaxButton(ID_REMOVE_MANAGER) { @Override public void onClick(AjaxRequestTarget target) { FocusSummaryPanel<FocusType> summary = (FocusSummaryPanel<FocusType>) getParent() .get(ID_MANAGER_SUMMARY); removeManagerPerformed(summary.getModelObject(), target); getParent().setVisible(false); target.add(OrgMemberPanel.this); } }; removeManager.setOutputMarkupId(true); managerMarkup.add(removeManager); AjaxButton deleteManager = new AjaxButton(ID_DELETE_MANAGER) { @Override public void onClick(AjaxRequestTarget target) { FocusSummaryPanel<FocusType> summary = (FocusSummaryPanel<FocusType>) getParent() .get(ID_MANAGER_SUMMARY); deleteManagerPerformed(summary.getModelObject(), this, target); } }; deleteManager.setOutputMarkupId(true); managerMarkup.add(deleteManager); } managerContainer.add(view); InlineMenu menupanel = new InlineMenu(ID_MANAGER_MENU, new Model<Serializable>((Serializable) createManagersHeaderInlineMenu())); add(menupanel); menupanel.setOutputMarkupId(true); managerContainer.add(menupanel); return managerContainer; }
From source file:com.evolveum.midpoint.web.page.self.component.ChangePasswordPanel.java
License:Apache License
private void initLayout() { model = (LoadableModel<MyPasswordsDto>) getModel(); Label oldPasswordLabel = new Label(ID_OLD_PASSWORD_LABEL, createStringResource("PageSelfCredentials.oldPasswordLabel")); add(oldPasswordLabel);//w w w . java2 s . com Label passwordLabel = new Label(ID_PASSWORD_LABEL, createStringResource("PageSelfCredentials.passwordLabel1")); add(passwordLabel); PasswordTextField oldPasswordField = new PasswordTextField(ID_OLD_PASSWORD_FIELD, new PropertyModel<String>(model, MyPasswordsDto.F_OLD_PASSWORD)); oldPasswordField.setRequired(false); oldPasswordField.setResetPassword(false); add(oldPasswordField); if (model.getObject().getPasswordChangeSecurity() != null && model.getObject().getPasswordChangeSecurity().equals(PasswordChangeSecurityType.NONE)) { oldPasswordField.setVisible(false); oldPasswordLabel.setVisible(false); } PasswordPanel passwordPanel = new PasswordPanel(ID_PASSWORD_PANEL, new PropertyModel<ProtectedStringType>(model, MyPasswordsDto.F_PASSWORD)); passwordPanel.getBaseFormComponent().add(new AttributeModifier("autofocus", "")); add(passwordPanel); WebMarkupContainer accountContainer = new WebMarkupContainer(ID_ACCOUNTS_CONTAINER); List<IColumn<PasswordAccountDto, String>> columns = initColumns(); ListDataProvider<PasswordAccountDto> provider = new ListDataProvider<PasswordAccountDto>(this, new PropertyModel<List<PasswordAccountDto>>(model, MyPasswordsDto.F_ACCOUNTS)); TablePanel accounts = new TablePanel(ID_ACCOUNTS_TABLE, provider, columns); accounts.setItemsPerPage(30); accounts.setShowPaging(false); if (model.getObject().getPropagation() != null && model.getObject().getPropagation().equals(CredentialsPropagationUserControlType.MAPPING)) { accountContainer.setVisible(false); } accountContainer.add(accounts); AjaxLink help = new AjaxLink(ID_BUTTON_HELP) { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { showHelpPerformed(target); } }; accountContainer.add(help); add(accountContainer); }
From source file:com.evolveum.midpoint.web.page.self.PageAccountActivation.java
License:Apache License
private void initLayout() { WebMarkupContainer activationContainer = new WebMarkupContainer(ID_ACTIVATION_CONTAINER); activationContainer.setOutputMarkupId(true); add(activationContainer);/* www. j a v a2 s .c o m*/ activationContainer.add(new VisibleEnableBehaviour() { private static final long serialVersionUID = 1L; @Override public boolean isVisible() { return !activated; } }); Form<?> form = new com.evolveum.midpoint.web.component.form.Form<>(ID_MAIN_FORM); activationContainer.add(form); Label usernamePanel = new Label(ID_NAME, createStringResource( "PageAccountActivation.activate.accounts.label", new PropertyModel<>(userModel, "name.orig"))); usernamePanel.add(new VisibleEnableBehaviour() { private static final long serialVersionUID = 1L; @Override public boolean isEnabled() { return false; } }); form.add(usernamePanel); PasswordTextField passwordPanel = new PasswordTextField(ID_PASSWORD, Model.of(new String())); form.add(passwordPanel); AjaxSubmitButton confirmPasswrod = new AjaxSubmitButton(ID_CONFIRM) { private static final long serialVersionUID = 1L; @Override protected void onSubmit(AjaxRequestTarget target) { propagatePassword(target, getForm()); } @Override protected void onError(AjaxRequestTarget target) { getSession().error(getString("PageAccountActivation.account.activation.failed")); target.add(getFeedbackPanel()); } }; form.add(confirmPasswrod); WebMarkupContainer confirmationContainer = new WebMarkupContainer(ID_CONFIRMATION_CONTAINER); confirmationContainer.setOutputMarkupId(true); confirmationContainer.add(new VisibleEnableBehaviour() { private static final long serialVersionUID = 1L; @Override public boolean isVisible() { return activated; } }); add(confirmationContainer); AjaxLink<Void> linkToLogin = new AjaxLink<Void>(ID_LINK_TO_LOGIN) { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { setResponsePage(PageLogin.class); } }; confirmationContainer.add(linkToLogin); RepeatingView activatedShadows = new RepeatingView(ID_ACTIVATED_SHADOWS); confirmationContainer.add(activatedShadows); List<ShadowType> shadowsToActivate = getShadowsToActivate(); if (shadowsToActivate.isEmpty()) { LOGGER.error("No accounts to validate for user {}", userModel.getObject()); getSession().warn(getString("PageAccountActivation.nothing.to.activate")); throw new RestartResponseException(PageLogin.class); } for (ShadowType shadow : shadowsToActivate) { Label shadowDesc = new Label(activatedShadows.newChildId(), WebComponentUtil.getName(shadow) + " on resource " + WebComponentUtil.getName(shadow.getResourceRef())); activatedShadows.add(shadowDesc); } }
From source file:com.francetelecom.clara.cloud.presentation.applications.ApplicationInformationPanel.java
License:Apache License
private void createButtons() { buttonContainer = new WebMarkupContainer("buttonContainer"); editButton = new AjaxLink("appModifyLink") { @Override//from w w w . ja va2 s. c o m public void onClick(AjaxRequestTarget target) { setEditable(true, target); } }; cancelButton = new AjaxLink("appCancelLink") { @Override public void onClick(AjaxRequestTarget target) { setEditable(false, target); } }; deleteButton = new AjaxLink("appDeleteLink") { @Override public void onClick(AjaxRequestTarget target) { parentPage.deleteApplication(target, appForm.getModelObject()); setResponsePage(ApplicationsPage.class); } @Override protected void updateAjaxAttributes(AjaxRequestAttributes attributes) { String applicationLabel = appForm.getModelObject().getLabel(); attributes.getAjaxCallListeners() .add(new DeleteConfirmationDecorator(getString("portal.application.action.delete.confirm", new Model<String[]>(new String[] { applicationLabel })))); } }; updateButton = new AjaxSubmitLink("appUpdateLink") { @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { try { parentPage.updateApplication(target, (Form<Application>) form, members); setEditable(false, target); List<BreadcrumbsItem> bci = ((SelectedAppPage) getPage()).getBreadcrumbsItems(); BreadcrumbsItem updatedItem = bci.get(1); updatedItem.setName(appForm.getModelObject().getLabel()); bci.remove(1); bci.add(updatedItem); send(getPage(), Broadcast.BREADTH, new BreadcrumbsUpdateEvent(bci, target)); } catch (ApplicationNotFoundException | DuplicateApplicationException | PaasUserNotFoundException e) { BusinessExceptionHandler.addError(target, parentPage.getFeedbackPanel(), e); } } @Override protected void onError(AjaxRequestTarget target, Form<?> form) { setEditable(true, target); } }; cancelButton.add(new Label("cancelLabel", getStringResourceModel("portal.application.action.cancel"))); editButton.add(new Label("modifyLabel", getStringResourceModel("portal.application.action.modify"))); deleteButton.add(new Label("deleteLabel", getStringResourceModel("portal.application.action.delete"))); updateButton.add(new Label("updateLabel", getStringResourceModel("portal.application.action.update"))); buttonContainer.add(cancelButton); buttonContainer.add(editButton); buttonContainer.add(deleteButton); buttonContainer.add(updateButton); buttonContainer.setOutputMarkupId(true); appForm.add(buttonContainer); }
From source file:com.francetelecom.clara.cloud.presentation.applications.ApplicationsPage.java
License:Apache License
private void createNewAppButton() { buttonContainer = new WebMarkupContainer("buttonContainer"); buttonContainer.setOutputMarkupId(true); // create link newApp = new AjaxLink("newAppLink") { private static final long serialVersionUID = 4466738576333544274L; @Override/*from ww w . j a v a 2s. co m*/ public void onClick(AjaxRequestTarget target) { appCreatePanel = new ApplicationCreatePanel("appCreateForm", manageApplicationRelease); // container.remove("appCreateForm"); // container.add(appCreatePanel); container.replace(appCreatePanel); target.add(container); this.setVisible(false); target.add(buttonContainer); } }; newApp.setMarkupId("newAppLink"); buttonContainer.add(newApp); add(buttonContainer); }