@Test public void trigger_immediate() { FormSupport support = mockFormSupport(); ComponentResources resources = mockComponentResources(); Heartbeat heartbeat = new HeartbeatImpl(); Request request = mockRequest(); String elementName = "myname"; train_getParameter(request, Form.SUBMITTING_ELEMENT_ID, null); train_getParameter(request, elementName, "login"); replay(); heartbeat.begin(); Submit submit = new Submit(request); TestBase.set(submit, "resources", resources, "formSupport", support, "heartbeat", heartbeat, "defer", false); submit.processSubmission("xyz", elementName); verify(); expect(resources.triggerEvent(EventConstants.SELECTED, null, null)).andReturn(false); replay(); heartbeat.end(); verify(); }
void processSubmission(String clientId, String elementName) { if (disabled || !selected(clientId, elementName)) return; final Holder<Object[]> currentContextHolder = Holder.create(); if (context != null) { Object[] currentContext = new Object[context.length]; System.arraycopy(context, 0, currentContext, 0, context.length); currentContextHolder.put(currentContext); } Runnable sendNotification = new Runnable() { public void run() { resources.triggerEvent(event, currentContextHolder.get(), eventCallback); } }; if (defer) formSupport.defer(sendNotification); else heartbeat.defer(sendNotification); }
Submit implements ClientElement { void processSubmission(String clientId, String elementName) { if (disabled || !selected(clientId, elementName)) return; final Holder<Object[]> currentContextHolder = Holder.create(); if (context != null) { Object[] currentContext = new Object[context.length]; System.arraycopy(context, 0, currentContext, 0, context.length); currentContextHolder.put(currentContext); } Runnable sendNotification = new Runnable() { public void run() { resources.triggerEvent(event, currentContextHolder.get(), eventCallback); } }; if (defer) formSupport.defer(sendNotification); else heartbeat.defer(sendNotification); } }
Submit implements ClientElement { void processSubmission(String clientId, String elementName) { if (disabled || !selected(clientId, elementName)) return; final Holder<Object[]> currentContextHolder = Holder.create(); if (context != null) { Object[] currentContext = new Object[context.length]; System.arraycopy(context, 0, currentContext, 0, context.length); currentContextHolder.put(currentContext); } Runnable sendNotification = new Runnable() { public void run() { resources.triggerEvent(event, currentContextHolder.get(), eventCallback); } }; if (defer) formSupport.defer(sendNotification); else heartbeat.defer(sendNotification); } Submit();   Submit(Request request); }
Submit implements ClientElement { void processSubmission(String clientId, String elementName) { if (disabled || !selected(clientId, elementName)) return; final Holder<Object[]> currentContextHolder = Holder.create(); if (context != null) { Object[] currentContext = new Object[context.length]; System.arraycopy(context, 0, currentContext, 0, context.length); currentContextHolder.put(currentContext); } Runnable sendNotification = new Runnable() { public void run() { resources.triggerEvent(event, currentContextHolder.get(), eventCallback); } }; if (defer) formSupport.defer(sendNotification); else heartbeat.defer(sendNotification); } Submit();   Submit(Request request); String getClientId(); }
Submit implements ClientElement { void processSubmission(String clientId, String elementName) { if (disabled || !selected(clientId, elementName)) return; final Holder<Object[]> currentContextHolder = Holder.create(); if (context != null) { Object[] currentContext = new Object[context.length]; System.arraycopy(context, 0, currentContext, 0, context.length); currentContextHolder.put(currentContext); } Runnable sendNotification = new Runnable() { public void run() { resources.triggerEvent(event, currentContextHolder.get(), eventCallback); } }; if (defer) formSupport.defer(sendNotification); else heartbeat.defer(sendNotification); } Submit();   Submit(Request request); String getClientId();  }