private void pushContext() { environment.push(AjaxFormLoopContext.class, formLoopContext); }
@Inject Environment environment; @Property private DialogConfigs dialogConfigs; @Property private DialogConfig dialogConfig; void beforeRender() { dialogConfigs = new DialogConfigsImpl(); environment.push(DialogConfigs.class, dialogConfigs); } void afterRender() { environment.pop(DialogConfigs.class); }
public void setupBeforePartialZoneRender(MarkupWriter writer) { if (formComponentId == null) return; hiddenFieldPositioner = new HiddenFieldPositioner(writer, rules); actionSink = new ComponentActionSink(logger, clientDataEncoder); formSupport = createInternalFormSupport(formClientId, formComponentId, actionSink); environment.push(FormSupport.class, formSupport); environment.push(ValidationTracker.class, new ValidationTrackerImpl()); heartbeat.begin(); }
public FieldValidator createDefaultValidator(Field field, String overrideId, Messages overrideMessages, Locale locale, Class propertyType, AnnotationProvider propertyAnnotations) { environment.push(EnvironmentMessages.class, new EnvironmentMessages(overrideMessages, overrideId)); FieldValidator fieldValidator = defaultSource.createDefaultValidator(field, overrideId, overrideMessages, locale, propertyType, propertyAnnotations); environment.pop(EnvironmentMessages.class); return fieldValidator; }
public void renderMarkup(MarkupWriter writer, JSONObject reply, PartialMarkupRenderer renderer) { ValidationDecorator decorator = validationDecoratorFactory.newInstance(writer); environment.push(ValidationDecorator.class, decorator); renderer.renderMarkup(writer, reply); environment.pop(ValidationDecorator.class); } };
public void renderMarkup(MarkupWriter writer, JSONObject reply, PartialMarkupRenderer renderer) { ClientBehaviorSupportImpl support = new ClientBehaviorSupportImpl(); environment.push(ClientBehaviorSupport.class, support); renderer.renderMarkup(writer, reply); environment.pop(ClientBehaviorSupport.class); } };
public void renderMarkup(MarkupWriter writer, MarkupRenderer renderer) { ClientBehaviorSupportImpl clientBehaviorSupport = new ClientBehaviorSupportImpl(); environment.push(ClientBehaviorSupport.class, clientBehaviorSupport); renderer.renderMarkup(writer); environment.pop(ClientBehaviorSupport.class); } };
public void renderMarkup(MarkupWriter writer, MarkupRenderer renderer) { ValidationDecorator decorator = validationDecoratorFactory.newInstance(writer); environment.push(ValidationDecorator.class, decorator); renderer.renderMarkup(writer); environment.pop(ValidationDecorator.class); } };
@SetupRender void setup() { Renderable r = new Renderable() { public void render(MarkupWriter writer) { writer.element("strong"); writer.write("A message provided by the RenderableProvider component."); writer.end(); } }; environment.push(Renderable.class, r); }
public void renderMarkup(MarkupWriter writer, JSONObject reply, PartialMarkupRenderer renderer) { PartialMarkupDocumentLinker linker = new PartialMarkupDocumentLinker(); environment.push(DocumentLinker.class, linker); renderer.renderMarkup(writer, reply); environment.pop(DocumentLinker.class); linker.commit(reply); } };
public void renderMarkup(MarkupWriter writer, MarkupRenderer renderer) { Heartbeat heartbeat = new HeartbeatImpl(); heartbeat.begin(); environment.push(Heartbeat.class, heartbeat); renderer.renderMarkup(writer); environment.pop(Heartbeat.class); heartbeat.end(); } };
public FieldValidator createDefaultValidator(ComponentResources resources, String parameterName) { EnvironmentMessages em = new EnvironmentMessages(resources.getContainerMessages(), resources.getId()); environment.push(EnvironmentMessages.class, em); FieldValidator fieldValidator = defaultSource.createDefaultValidator(resources, parameterName); environment.pop(EnvironmentMessages.class); return fieldValidator; } };
public void renderMarkup(MarkupWriter writer, MarkupRenderer renderer) { DocumentLinkerImpl linker = new DocumentLinkerImpl(moduleManager, omitGeneratorMeta, enablePageloadingMask, tapestryVersion); environment.push(DocumentLinker.class, linker); renderer.renderMarkup(writer); environment.pop(DocumentLinker.class); linker.updateDocument(writer.getDocument()); } };
public void renderMarkup(MarkupWriter writer, MarkupRenderer renderer) { DocumentLinker linker = environment.peekRequired(DocumentLinker.class); JavaScriptSupportImpl support = new JavaScriptSupportImpl(linker, javascriptStackSource, javascriptStackPathConstructor, suppressCoreStylesheetsHook); environment.push(JavaScriptSupport.class, support); renderer.renderMarkup(writer); environment.pop(JavaScriptSupport.class); support.commit(); } };
public void renderMarkup(MarkupWriter writer, JSONObject reply, PartialMarkupRenderer renderer) { Heartbeat heartbeat = new HeartbeatImpl(); heartbeat.begin(); environment.push(Heartbeat.class, heartbeat); renderer.renderMarkup(writer, reply); environment.pop(Heartbeat.class); heartbeat.end(); } };
void beginRender(MarkupWriter writer) { ValidationDecorator existing = environment.peekRequired(ValidationDecorator.class); environment.push(ValidationDecorator.class, new ChattyValidationDecorator(writer, existing)); }
@Test public void peek_required_when_available() { Environment e = new EnvironmentImpl(); Location l = mockLocation(); replay(); e.push(Location.class, l); assertSame(l, e.peekRequired(Location.class)); verify(); }
@Test public void peek_required_without_value_is_error() { Environment e = new EnvironmentImpl(); Location l = mockLocation(); Component c = mockComponent(); replay(); e.push(Location.class, l); e.push(Component.class, c); try { e.peekRequired(List.class); unreachable(); } catch (UnknownValueException ex) { assertEquals( ex.getMessage(), "No object of type java.util.List is available from the Environment."); } verify(); }
private void pushAndTrainEnvironmentalObjects(Environment e, boolean hasProperty, String propertyValue) { Messages messages = mockMessages(); train_contains(messages,"testProperty-validate",hasProperty); if (hasProperty) { train_get(messages,"testProperty-validate",propertyValue); } EnvironmentMessages em = new EnvironmentMessages(messages,"testProperty"); e.push(EnvironmentMessages.class,em); replay(); }
@Test public void push_and_pop() { Environment e = new EnvironmentImpl(); Runnable r1 = mockRunnable(); Runnable r2 = mockRunnable(); replay(); assertNull(e.push(Runnable.class, r1)); assertSame(r1, e.peek(Runnable.class)); assertSame(r1, e.push(Runnable.class, r2)); assertSame(r2, e.peek(Runnable.class)); assertSame(r2, e.pop(Runnable.class)); assertSame(r1, e.pop(Runnable.class)); verify(); }