Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class ProductDetails extends Panel {
- @EJB
- private ProductServicesLocal productServices;
- private Product product;
- public ProductDetails(String id, Product product) {
- super(id);
- setOutputMarkupId(true);
- this.theModel = new CompoundPropertyModel(product);
- add(new Label("id"));
- Form<Product> form = new Form<Product>("form", this.theModel);
- form.add(new AjaxEditableLabel<String>("codProduct"));
- add(new AjaxLink<String>("save") {
- @Override
- public void onClick(AjaxRequestTarget target) {
- System.out.println("saving product .... ");
- }
- });
- add(form);
- }
- public void setCurrentProduct(Product product) {
- this.theModel.setObject(product);
- }
- }
- This is from another component to update the panel:
- @Override
- public void onClick(AjaxRequestTarget target) {
- Product product = item.getModelObject();
- productDetails.setCurrentProduct(product);
- target.addComponent(productDetails);
- System.out.println(product.getId());
- }
- };
- item.add(link);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement