List of usage examples for org.apache.wicket Component modelChanged
public final void modelChanged()
From source file:de.alpharogroup.wicket.behaviors.models.ListModelUpdateBehavior.java
License:Apache License
/** * {@inheritDoc}/* www.j av a 2 s . c o m*/ */ @Override public void onEvent(final Component component, final IEvent<?> event) { super.onEvent(component, event); final List<T> currentModelObject = this.model.getObject(); if (!Objects.equals(currentModelObject, this.previousModelObject)) { this.previousModelObject = currentModelObject; component.modelChanging(); component.modelChanged(); final AjaxRequestTarget ajaxRequestTarget = ComponentFinder.findAjaxRequestTarget(); if (ajaxRequestTarget != null) { ajaxRequestTarget.add(component); } } }
From source file:de.alpharogroup.wicket.behaviors.models.ModelUpdateBehavior.java
License:Apache License
/** * {@inheritDoc}/*from w w w . j a v a 2s .c om*/ */ @Override public void onEvent(final Component component, final IEvent<?> event) { super.onEvent(component, event); final T currentModelObject = this.model.getObject(); if (!Objects.equals(currentModelObject, this.previousModelObject)) { this.previousModelObject = currentModelObject; component.modelChanging(); component.modelChanged(); final AjaxRequestTarget ajaxRequestTarget = ComponentFinder.findAjaxRequestTarget(); if (ajaxRequestTarget != null) { ajaxRequestTarget.add(component); } } }
From source file:gr.interamerican.wicket.utils.WicketUtils.java
License:Open Source License
/** * Sets the default model object without checking the new model * object equality to the old one.//from w w w. j av a2s . c o m * @param cmp * @param t */ public static <T> void setDefaultModelObject(Component cmp, T t) { cmp.modelChanging(); @SuppressWarnings("unchecked") IModel<T> model = (IModel<T>) cmp.getDefaultModel(); model.setObject(t); cmp.modelChanged(); }
From source file:org.artifactory.webapp.wicket.page.security.acl.PermissionTargetCreateUpdatePanel.java
License:Open Source License
private void addSubmitButton(final Component targetsTable) { String submitCaption = isCreate() ? "Create" : "Save"; TitledAjaxSubmitLink submit = new TitledAjaxSubmitLink("submit", submitCaption, form) { @Override//from w w w .j a va 2s. c o m protected void onSubmit(AjaxRequestTarget target, Form form) { final String name = entity.getName(); if (StringUtils.isBlank(name)) { error("Field 'Name' is required."); AjaxUtils.refreshFeedback(target); return; } boolean anySelected = repoKeysData.isAnyRemoteRepository() && repoKeysData.isAnyLocalRepository(); repoKeysData.setAnyRepository(anySelected); entity.setRepoKeys(repoKeysData.getSelectedKeysList()); aclInfo.setPermissionTarget(entity); if (isCreate()) { try { aclService.createAcl(aclInfo); AccessLogger.created("Successfully created permission target '" + name + "'"); } catch (Exception e) { String msg; if (e instanceof AlreadyExistsException) { msg = "Permission target '" + name + "' already exists"; } else { msg = "Failed to create permissions target: " + e.getMessage(); log.error(msg, e); } getPage().error(msg); AjaxUtils.refreshFeedback(target); return; } getPage().info("Successfully created permission target '" + name + "'"); } else { try { aclService.updateAcl(aclInfo); reloadData(); String message = "Successfully updated permission target '" + name + "'"; AccessLogger.updated(message); getPage().info(message); target.add(PermissionTargetCreateUpdatePanel.this); } catch (Exception e) { String msg = "Failed to update permissions target: " + e.getMessage(); log.error(msg, e); getPage().error(msg); AjaxUtils.refreshFeedback(target); return; } } //Close the modal window and re-render the table targetsTable.modelChanged(); target.add(targetsTable); AjaxUtils.refreshFeedback(target); ModalHandler.closeCurrent(target); } }; form.add(submit); form.add(new DefaultButtonBehavior(submit)); }