use of org.apache.tapestry5.runtime.Event in project flowlogix by flowlogix.
the class PeriodicUpdater method afterRender.
@AfterRender
void afterRender() {
final String id = zone.getClientId();
Link link;
if (context == null) {
link = resources.createEventLink(event);
} else {
link = resources.createEventLink(event, context);
}
final JSONObject spec = new JSONObject();
spec.put("period", period);
spec.put("elementId", id);
spec.put("uri", link.toAbsoluteURI());
jsSupport.addInitializerCall("periodicUpdater", spec);
}
use of org.apache.tapestry5.runtime.Event in project tapestry-5 by apache.
the class ComponentEventImplTest method matches_on_event_type.
@Test
public void matches_on_event_type() {
ComponentEventCallback handler = mockComponentEventHandler();
EventContext context = mockEventContext();
Logger logger = mockLogger();
ComponentModel model = mockComponentModel();
train_isDebugEnabled(logger, false);
train_getCount(context, 0);
replay();
ComponentEvent event = new ComponentEventImpl("eventType", "someId", context, handler, null, false, model, logger);
assertTrue(event.matches("eventType", "someId", 0));
assertFalse(event.matches("foo", "someId", 0));
verify();
}
use of org.apache.tapestry5.runtime.Event in project tapestry-5 by apache.
the class ComponentEventImplTest method store_null_result_does_not_abort_or_invoke_handler.
@Test
public void store_null_result_does_not_abort_or_invoke_handler() {
ComponentEventCallback handler = mockComponentEventHandler();
Logger logger = mockLogger();
ComponentModel model = mockComponentModel();
train_isDebugEnabled(logger, true);
logger.debug(eq(TapestryMarkers.EVENT_HANDLER_METHOD), isA(String.class));
replay();
ComponentEvent event = new ComponentEventImpl("eventType", "someId", null, handler, null, false, model, logger);
event.setMethodDescription("foo.Bar.baz()");
assertFalse(event.storeResult(null));
assertFalse(event.isAborted());
verify();
}
use of org.apache.tapestry5.runtime.Event in project tapestry-5 by apache.
the class ComponentEventImplTest method store_result_and_continue.
@Test
public void store_result_and_continue() {
Object result = new Object();
String methodDescription = "foo.Bar.baz()";
ComponentEventCallback handler = mockComponentEventHandler();
Logger logger = mockLogger();
ComponentPageElementResources resources = mockResources();
ComponentModel model = mockComponentModel();
train_isDebugEnabled(logger, true);
logger.debug(eq(TapestryMarkers.EVENT_HANDLER_METHOD), isA(String.class));
train_handleResult(handler, result, false);
replay();
ComponentEvent event = new ComponentEventImpl("eventType", "someId", null, handler, resources, false, model, logger);
event.setMethodDescription(methodDescription);
assertFalse(event.storeResult(result));
assertFalse(event.isAborted());
verify();
}
use of org.apache.tapestry5.runtime.Event in project tapestry-5 by apache.
the class ComponentEventImplTest method matches_on_component_id.
@Test
public void matches_on_component_id() {
ComponentEventCallback handler = mockComponentEventHandler();
EventContext context = mockEventContext();
Logger logger = mockLogger();
ComponentModel model = mockComponentModel();
train_isDebugEnabled(logger, false);
train_getCount(context, 0);
replay();
ComponentEvent event = new ComponentEventImpl("eventType", "someId", context, handler, null, false, model, logger);
assertTrue(event.matches("eventType", "someId", 0));
assertFalse(event.matches("eventtype", "bar", 0));
verify();
}
Aggregations