@Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { try { Product product = (Product) form.getDefaultModelObject(); if (product.getId() == 0) { product.setActive(true); productDataProvider.persist(product); } else { productDataProvider.merge(product); } ProductViewOrEditPanel.this.removeAll(); ProductViewOrEditPanel.this.add(new ProductViewFragement().setOutputMarkupId(true)); } catch (RuntimeException e) { LOGGER.warn(e.getMessage(), e); String[] messages = e.getMessage().split(": "); String message = messages[messages.length - 1]; warn(message.substring(0, 1).toUpperCase() + message.substring(1)); } finally { target.add(target.getPage()); } }
@Override public void onClick(AjaxRequestTarget target) { ProductViewOrEditPanel.this.removeAll(); ProductViewOrEditPanel.this.add(new ProductViewFragement()).setOutputMarkupId(true); target.add(target.getPage()); }
@Override public void onBeforeRespond(Map<String, Component> map, AjaxRequestTarget target) { target.getPage().visitChildren(FormComponent.class, new AjaxRenderingVisitor(target)); }