@Test public void test_imagesubmit_event_fired() { Request request = mockRequest(); final ComponentResources resources = mockComponentResources(); FormSupport formSupport = mockFormSupport(); Asset image = mockAsset(); String elementName = "myname"; train_getParameter(request, Form.SUBMITTING_ELEMENT_ID, null); train_getParameter(request, elementName + ".x", "15"); formSupport.defer(isA(Runnable.class)); replay(); Submit submit = new Submit(request); TestBase.set(submit, "resources", resources, "formSupport", formSupport, "image", image); submit.processSubmission("xyz", elementName); 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();  }