protected void removePropertyNameFromBeanValidationContext() { if (beanValidationDisabled) { return; } BeanValidationContext beanValidationContext = environment.peek(BeanValidationContext.class); if (beanValidationContext == null) return; beanValidationContext.setCurrentProperty(null); } }
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 Object get(Object instance, InstanceContext context) { return required ? environment.peekRequired(environmentalType) : environment.peek(environmentalType); }
@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); }
void beginRender(MarkupWriter writer) { ValidationDecorator existing = environment.peekRequired(ValidationDecorator.class); environment.push(ValidationDecorator.class, new ChattyValidationDecorator(writer, existing)); }
/** * Pops the {@link RadioContainer} off the Environment. */ final void afterRender() { environment.pop(RadioContainer.class); }
@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(); }
private void pushContext() { environment.push(AjaxFormLoopContext.class, formLoopContext); }
void afterRender(MarkupWriter writer) { environment.peek(Heartbeat.class).end(); formSupport.executeDeferred(); String encodingType = formSupport.getEncodingType(); if (encodingType != null) { form.forceAttributes("enctype", encodingType); } writer.end(); // form div.element("input", "type", "hidden", "name", FORM_DATA, "value", actionSink.getClientData()); div.pop(); if (autofocus) { environment.pop(ValidationDecorator.class); } }
protected final <T> void train_peekRequired(Environment env, Class<T> type, T value) { expect(env.peekRequired(type)).andReturn(value); }
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; }
@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(); }
environment.push(FormSupport.class, formSupport); environment.push(ValidationTracker.class, tracker); environment.peek(ValidationDecorator.class), tracker, javascriptSupport); environment.push(ValidationDecorator.class, autofocusDecorator); environment.push(BeanValidationContext.class, new BeanValidationContextImpl(validate)); environment.peek(Heartbeat.class).begin();
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 void renderMarkup(MarkupWriter writer, MarkupRenderer renderer) { renderer.renderMarkup(writer); environment.peekRequired(JavaScriptSupport.class).importStack(InternalConstants.CORE_STACK_NAME); } };
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) { IdAllocator idAllocator; if (request.getParameter(InternalConstants.SUPPRESS_NAMESPACED_IDS) == null) { String uid = Long.toHexString(System.nanoTime()); String namespace = "_" + uid; idAllocator = new IdAllocator(namespace); } else { // When suppressed, work just like normal rendering. idAllocator = new IdAllocator(); } DocumentLinker linker = environment.peekRequired(DocumentLinker.class); JavaScriptSupportImpl support = new JavaScriptSupportImpl(linker, javascriptStackSource, javascriptStackPathConstructor, idAllocator, true, suppressCoreStylesheetsHook); environment.push(JavaScriptSupport.class, support); renderer.renderMarkup(writer, reply); environment.pop(JavaScriptSupport.class); support.commit(); } };
protected final <T> void train_peek(Environment env, Class<T> type, T value) { expect(env.peek(type)).andReturn(value); }