Esempio n. 1
0
 @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);
   }
 }
Esempio n. 2
0
  @Override
  public void onEvent(IEvent<?> event) {
    super.onEvent(event);

    if (event.getPayload() instanceof WebSocketPushPayload) {
      WebSocketPushPayload wsEvent = (WebSocketPushPayload) event.getPayload();
      wsEvent.getHandler().add(btn.setVisible(true));
      wsEvent.getHandler().appendJavaScript("console.log('javascript executed');");
    }
  }
Esempio n. 3
0
 @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);
   }
 }
Esempio n. 4
0
 @Override
 public void onEvent(IEvent<?> event) {
   Object payload = event.getPayload();
   if (payload instanceof ProfChangedEvent) {
     ((ProfChangedEvent) payload).getTarget().add(this);
   }
 }
  @Override
  public void onEvent(IEvent<?> event) {
    super.onEvent(event);

    if (event.getPayload() instanceof AjaxRequestTarget) {

      AjaxRequestTarget target = (AjaxRequestTarget) event.getPayload();

      if (target.getComponents().contains(this)) {

        // if this component is being repainted by ajax, directly, we must destroy Select2 so it
        // removes
        // its elements from DOM

        target.prependJavaScript(
            JQuery.execute("$('#%s').select2('destroy');", getJquerySafeMarkupId()));
      }
    }
  }