@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; }
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)); }
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); }
@OnEvent(value = EventConstants.SUCCESS, component = "myForm") Object updateZoneContentFromForm() { if (!request.isXHR()) { return this; } return myBlockForm; }
@OnEvent(value = "action", component = "myActionLink") Object updateCount() { if (!request.isXHR()) { return this; } count++; return myBlockActionLink; }
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); }
@OnEvent("serveDetail") Object onServeDetail(int index) { if (!request.isXHR()) { return this; } user = (User) users.get(index); return detailZone.getBody(); }
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); } }
/** * 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 } }
/** * 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); } }
/** * 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 } }
@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; }
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; }
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); }
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; }
@Subscribe public void recordEditEvent(EditEvent e) { setCurrentEltAndGrp(e.getElt(), e.getElt().getGroup()); if (request.isXHR()) ajaxResponseRenderer.addRender(elementZone); }