@Override public void onEvent(IEvent event) { // Page level SaveModelEvents triggered by button in the Page Detail Form: if (event.getPayload() instanceof SaveModelEvent) { SaveModelEvent modelEvent = (SaveModelEvent) event.getPayload(); switch (modelEvent.getOperation()) { case ADD: add((Page3EO) modelEvent.getEntity()); break; case UPDATE: modelChanged(); break; case DELETE: prune(); break; default: LOG.error("onEvent caught invalid operation"); break; } AjaxRequestTarget target = ((SaveModelEvent) event.getPayload()).getAjaxRequestTarget(); LOG.debug(".onEvent AJAX - Page3 - SaveModelEvent: " + target.toString()); } // Page level AJAX events - replace TreeGrid: else if (event.getPayload() instanceof AjaxRequestTarget) { LOG.info("Page level AjaxRequestTarget Event Occurred"); AjaxRequestTarget target = ((AjaxRequestTarget) event.getPayload()); target.add(grid); } }
@Override public void onEvent(final IEvent<?> event) { if (event.getPayload() instanceof SelectModelEvent) { SelectModelEvent modelEvent = (SelectModelEvent) event.getPayload(); final Page3EO page3EO = (Page3EO) modelEvent.getEntity(); this.setModelObject(page3EO); LOG.info("Received SelectModelEvent, customer: " + page3EO.getCustomer()); } else if (event.getPayload() instanceof AjaxRequestTarget) { AjaxRequestTarget target = ((AjaxRequestTarget) event.getPayload()); LOG.info(".onEvent AjaxRequestTarget: " + target.toString()); target.add(editForm); } }