// 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();});"));
         }
       });
 }
示例#2
0
  @OnEvent(value = "myCustomEvent")
  void onMyCustomEvent(final String someParam) {

    message = "This upload was: " + someParam;

    ajaxResponseRenderer.addRender("uploadResult", uploadResult);
  }
示例#3
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));
 }
示例#4
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);
 }
 void onSuccess() {
   ajaxResponseRenderer.addCallback(
       new JavaScriptCallback() {
         public void run(JavaScriptSupport javascriptSupport) {
           javascriptSupport.addScript(String.format(" $('#modal').modal('hide');"));
         }
       });
 }
示例#6
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);
 }
 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);
  }
示例#9
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 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);
   }
 }
 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);
   }
 }
示例#13
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 onValidateFromTableForm()
      throws InstanceNotFoundException, NumberFormatException, DuplicateInstanceException {

    if (qualifierId == -1) {
      Qualifier qualifier =
          new Qualifier(qualifierNameLang1, qualifierNameLang2, qualifierNameLang3);
      qualifierId = masterFilesService.createQualifier(qualifier).getQualifierId();
      ajaxResponseRenderer.addCallback(
          new JavaScriptCallback() {
            public void run(JavaScriptSupport javascriptSupport) {
              JSONObject newRow = new JSONObject();
              newRow.put("qualifierId", qualifierId);
              newRow.put("qualifierNameLang1", qualifierNameLang1);
              newRow.put("qualifierNameLang2", qualifierNameLang2);
              newRow.put("qualifierNameLang3", qualifierNameLang3);
              javascriptSupport.addInitializerCall("addQualifier", newRow);
            }
          });
    } else {
      masterFilesService.editQualifier(
          qualifierId, qualifierNameLang1, qualifierNameLang2, qualifierNameLang3);
    }
  }
示例#15
0
  void onUploadException(FileUploadException ex) {

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

    ajaxResponseRenderer.addRender("uploadResult", uploadResult);
  }
 void afterRender() {
   ajaxResponseRenderer.addRender(tableZone);
   javaScriptSupport.addScript(String.format("$('#table').show();"));
 }
示例#17
0
 public void onHideAll() {
   summaryList.clear();
   if (request.isXHR()) {
     ajaxResponseRenderer.addRender(journalZone);
   }
 }
示例#18
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);
 }
示例#19
0
 public void reset() {
   elementEditedId = null;
   if (request.isXHR()) ajaxResponseRenderer.addRender(journalZone);
 }
示例#20
0
 @Subscribe
 public void recordEditEvent(EditEvent e) {
   setCurrentEltAndGrp(e.getElt(), e.getElt().getGroup());
   if (request.isXHR()) ajaxResponseRenderer.addRender(elementZone);
 }
示例#21
0
 @OnEvent(value = EventConstants.ACTION, component = "createProject")
 void onActionFromNew() {
   this.project = new Project();
   renderer.addRender(Zones.projectFormZone, projectFormZone);
 }