示例#1
0
  @OnEvent(value = "myCustomEvent")
  void onMyCustomEvent(final String someParam) {

    message = "This upload was: " + someParam;

    ajaxResponseRenderer.addRender("uploadResult", uploadResult);
  }
示例#2
0
 private void removeElement(JournalElement elt) {
   setCurrentEltAndGrp(elt, elt.getGroup());
   elt.removeFromGroup();
   elementDeletedList.add(elt.getId());
   if (request.isXHR()) ajaxResponseRenderer.addRender(elementZone);
   eventBusRecorder.post(new JournalDeleteEvent(elt));
 }
示例#3
0
 public void onEditElement(String eltId, String gpId) {
   JournalElement elt = getElementFromGroup(eltId, getGroupFromGroupsList(gpId));
   group = elt.getGroup();
   element = elt;
   eventBusRecorder.post(new JournalEditEvent(elt));
   elementEditedId = element.getId();
   if (request.isXHR()) ajaxResponseRenderer.addRender(journalZone);
 }
示例#4
0
 private void createElement(JournalElement elt, JournalGroup grp) {
   group = grp;
   if (elementDeletedList.contains(elt.getId())) elementDeletedList.remove(elt.getId());
   group.add(elt);
   element = elt;
   elementEditedId = element.getId();
   if (request.isXHR()) ajaxResponseRenderer.addRender(journalZone);
 }
示例#5
0
 public void onDisplayAll() {
   for (JournalGroup grp : groups) {
     for (JournalElement elt : grp.getElements()) {
       if (!summaryList.contains(elt.getId())) summaryList.add(elt.getId());
     }
   }
   if (request.isXHR()) {
     ajaxResponseRenderer.addRender(journalZone);
   }
 }
  @CommitAfter
  Object onSuccess() {
    radnikDao.dodajIliUpdatujRadnika(radnik);
    radnik = new Radnik();

    if (request.isXHR()) {
      ajaxResponseRenderer.addRender(zoneRadnici).addRender(formZone);
    }
    return request.isXHR() ? zoneRadnici.getBody() : null;
    // return this;
  }
 void onValidateCreditCardName() {
   String creditCardName = request.getParameter("param");
   if (creditCardName == null) {
     creditCardNameMsg = "Value is required";
   } else if (creditCardName.length() < 3) {
     creditCardNameMsg = "Value is required";
   } else {
     creditCardNameMsg = "";
   }
   if (request.isXHR()) {
     ajaxResponseRenderer.addRender("creditCardNameMsgZone", creditCardNameMsgZone);
   }
 }
 // Valores por defecto en el formulario de inserción
 void onInsert() {
   ajaxResponseRenderer.addRender(zone);
   ajaxResponseRenderer.addCallback(
       new JavaScriptCallback() {
         public void run(JavaScriptSupport javascriptSupport) {
           javascriptSupport.addScript(
               String.format(
                   " $('#modal').modal('show'); "
                       + "$('#modal').on('shown.bs.modal', function() {"
                       + "			$('.focus').focus();});"));
         }
       });
 }
 void onValidateCreditCardNumber() {
   String creditCardNumber = request.getParameter("param");
   if (creditCardNumber == null) {
     creditCardMsg = "Value is required";
   } else if (creditCardNumber.length() != 16) {
     creditCardMsg = "Credit card number must 16 digits long";
   } else {
     creditCardMsg = "";
   }
   if (request.isXHR()) {
     ajaxResponseRenderer.addRender("creditCardMsgZone", creditCardMsgZone);
   }
 }
示例#10
0
  @OnEvent(component = "uploadFile", value = JQueryEventConstants.AJAX_UPLOAD)
  void onUploadFile(UploadedFileItem uploadedFile) throws IOException {

    if (uploadedFile != null) {
      this.uploadedFiles.add(uploadedFile);
    }

    message = "This upload was: AJAX_UPLOAD";

    logger.info("Temp directory is set to : " + tempDir);
    saveFile(uploadedFile);
    ajaxResponseRenderer.addRender("uploadResult", uploadResult);
    uploadedFile.cleanup();
  }
 void onEdit(int id) throws InstanceNotFoundException {
   qualifier = masterFilesService.getQualifierByQualifierId(id);
   qualifierId = qualifier.getQualifierId();
   qualifierNameLang1 = qualifier.getQualifierNameLang1();
   qualifierNameLang2 = qualifier.getQualifierNameLang2();
   qualifierNameLang3 = qualifier.getQualifierNameLang3();
   ajaxResponseRenderer.addCallback(
       new JavaScriptCallback() {
         public void run(JavaScriptSupport javascriptSupport) {
           javascriptSupport.addScript(
               String.format(
                   " $('#modal').modal('show'); "
                       + "$('#modal').on('shown.bs.modal', function() {"
                       + "			$('.focus').focus();});"));
         }
       });
   ajaxResponseRenderer.addRender(zone);
 }
  Object onActionFromUpdate() {
    wilmaMessage = "His Wife, Wilma.";

    // Do one the new way
    ajaxResponseRenderer.addRender("fred", fredBlock);

    ajaxResponseRenderer.addCallback(
        new JavaScriptCallback() {
          public void run(JavaScriptSupport javascriptSupport) {
            javascriptSupport.importJavaScriptLibrary(library);
            javascriptSupport.addInitializerCall(
                "writeMessageTo", new JSONObject("id", "message", "message", "Updated"));
          }
        });

    // Do the rest the old way, to test backwards compatibility

    return new MultiZoneUpdate("barney", barneyBlock).add("dino", "His dog, Dino.").add(wilmaZone);
  }
 void afterRender() {
   ajaxResponseRenderer.addRender(tableZone);
   javaScriptSupport.addScript(String.format("$('#table').show();"));
 }
示例#14
0
 @Subscribe
 public void recordEditEvent(EditEvent e) {
   setCurrentEltAndGrp(e.getElt(), e.getElt().getGroup());
   if (request.isXHR()) ajaxResponseRenderer.addRender(elementZone);
 }
示例#15
0
  void onUploadException(FileUploadException ex) {

    message = "Upload exception: " + ex.getMessage();

    ajaxResponseRenderer.addRender("uploadResult", uploadResult);
  }
示例#16
0
 @OnEvent(value = EventConstants.ACTION, component = "createProject")
 void onActionFromNew() {
   this.project = new Project();
   renderer.addRender(Zones.projectFormZone, projectFormZone);
 }
示例#17
0
 public void onHideAll() {
   summaryList.clear();
   if (request.isXHR()) {
     ajaxResponseRenderer.addRender(journalZone);
   }
 }
示例#18
0
 public void reset() {
   elementEditedId = null;
   if (request.isXHR()) ajaxResponseRenderer.addRender(journalZone);
 }
示例#19
0
 public void onDisplaySummary(String eltId, String gpId) {
   if (summaryList.contains(eltId)) summaryList.remove(eltId);
   else summaryList.add(eltId);
   setCurrentEltAndGrp(eltId, gpId);
   if (request.isXHR()) ajaxResponseRenderer.addRender(elementZone);
 }