@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;
  }
Ejemplo n.º 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));
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 4
0
  @OnEvent(value = EventConstants.SUCCESS, component = "myForm")
  Object updateZoneContentFromForm() {
    if (!request.isXHR()) {
      return this;
    }

    return myBlockForm;
  }
Ejemplo n.º 5
0
 @OnEvent(value = "action", component = "myActionLink")
 Object updateCount() {
   if (!request.isXHR()) {
     return this;
   }
   count++;
   return myBlockActionLink;
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 7
0
 @OnEvent("serveDetail")
 Object onServeDetail(int index) {
   if (!request.isXHR()) {
     return this;
   }
   user = (User) users.get(index);
   return detailZone.getBody();
 }
Ejemplo n.º 8
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);
   }
 }
Ejemplo n.º 9
0
 /**
  * Handle the "Success" event from the CategorySelection form
  *
  * @return the current page (redraw self)
  */
 @OnEvent(value = EventConstants.SUCCESS, component = "categorySelection")
 Object redrawList() {
   entryList.setEntryType(selectedEntryType);
   entryList.setSourceTypes(selectedSourceTypes);
   if (request.isXHR()) // an AJAX request?
   {
     return entryList; // return the entryList component
   } else {
     return null; // redraw the whole current page
   }
 }
Ejemplo n.º 10
0
 /**
  * As an event lister, respond to a selection from the "entryType" Select menu. Return the
  * "entryList" component (to be put into a zone). If the event is not part of an AJAX zone update
  * (i.e. the browser has JavaScript off) we return the whole page to be redrawn.
  *
  * @return
  */
 @OnEvent(value = EventConstants.VALUE_CHANGED, component = "entryType")
 Object changeEntryType(EntryType entryType) {
   if (request.isXHR()) // an AJAX request?
   {
     selectedEntryType = entryType;
     entryList.setEntryType(entryType);
     return entryList; // return the entryList component
   } else {
     return null; // redraw the whole current page
   }
 }
 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);
   }
 }
Ejemplo n.º 13
0
 /**
  * As an event lister, respond to a selection from the "sourceType" Select menu. Return the
  * "entryList" component (to be put into a zone). If the event is not part of an AJAX zone update
  * (i.e. the browser has JavaScript off) we return the whole page to be redrawn.
  *
  * @return
  */
 @OnEvent(value = EventConstants.VALUE_CHANGED, component = "sourceTypes")
 Object changeSourceType(SourceType sourceType) {
   if (request.isXHR()) // an AJAX request?
   {
     // FIXME: we only handle a single SourceType but may have more
     ArrayList<SourceType> sources = new ArrayList<SourceType>();
     sources.add(sourceType);
     entryList.setSourceTypes(sources);
     return entryList; // return the entryList component
   } else {
     return null; // redraw the whole current page
   }
 }
Ejemplo n.º 14
0
 @OnEvent(value = "MyCustomEventName")
 JSONArray myEventHandler() {
   // check if this is a AJAX request
   if (request.isXHR()) {
     String queryParameter1 = request.getParameter("queryParameter1");
     String queryParameter2 = request.getParameter("queryParameter2");
     JSONArray object = new JSONArray();
     object.put(1, "\n" + queryParameter1.toUpperCase());
     object.put(2, "\n" + queryParameter2.toUpperCase());
     object.put(3, getMessage());
     // Make your real payload
     return object;
   }
   return null;
 }
Ejemplo n.º 15
0
 public void onHideAll() {
   summaryList.clear();
   if (request.isXHR()) {
     ajaxResponseRenderer.addRender(journalZone);
   }
 }
 @CommitAfter
 Object onActionFromDelete(int id) {
   radnikDao.obrisiRadnika(id);
   return request.isXHR() ? zoneRadnici.getBody() : null;
   // return this;
 }
Ejemplo n.º 17
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);
 }
Ejemplo n.º 18
0
 public void reset() {
   elementEditedId = null;
   if (request.isXHR()) ajaxResponseRenderer.addRender(journalZone);
 }
 @CommitAfter
 Object onActionFromEdit(Radnik radnik) {
   this.radnik = radnik;
   return request.isXHR() ? formZone.getBody() : null;
   // return this;
 }
Ejemplo n.º 20
0
 @Subscribe
 public void recordEditEvent(EditEvent e) {
   setCurrentEltAndGrp(e.getElt(), e.getElt().getGroup());
   if (request.isXHR()) ajaxResponseRenderer.addRender(elementZone);
 }