/** * Discards a component's body. Returns false from the {@link BeforeRenderBody} phase, which prevents the rendering of * the body. Set up as a "MixinAfter" so that components can render their an alternative body if they so desire before * this mixin cancels the normal body (from the container's template). * * @tapestrydoc */ @MixinAfter public class DiscardBody { boolean beforeRenderBody() { return false; } }
/** * A mixin that attaches to an element that renders an element. At the end of the render, if the element is empty, then * a non-breaking space ( ) is injected into the element. This is often necessary for proper rendering on the * client. * * Often used in conjunction with the {@link org.apache.tapestry5.corelib.components.Any} component. * * @since 5.1.0.0 * @tapestrydoc */ @MixinAfter public class NotEmpty { private Element element; void beginRender(MarkupWriter writer) { element = writer.getElement(); } void afterRender() { if (element.isEmpty()) { element.removeChildren(); element.raw(" "); } } }
/** * Renders an "disabled" attribute if the containing component {@link Field#isDisabled() is disabled}. * * @tapestrydoc */ @MixinAfter public class RenderDisabled { @InjectContainer private Field field; void beginRender(MarkupWriter writer) { if (field.isDisabled()) writer.attributes("disabled", "disabled"); } }
@MixinAfter public class EchoAfter
@MixinAfter public class EchoAfter2
@MixinAfter public class AltTitleDefault { @Parameter(required = true, defaultPrefix = BindingConstants.LITERAL, allowNull = false, value = "Default title") private String title; void beginRender(MarkupWriter writer) { writer.attributes("alt", title); } }
@MixinAfter public class OverrideMixin { @InjectContainer private ClientElement clientElement; void afterRender(MarkupWriter writer) { final Element element = writer.getDocument().getElementById(clientElement.getClientId()); element.element("span", "id", "overrideMixin").text(" [Override mixin]"); } }
/** * Used to render out all informal parameters, at the end of the {@link org.apache.tapestry5.annotations.BeginRender} * phase. * * This mixin can be used with components that render a single tag inside the {@link BeginRender} phase. RenderInformals * will activate during the PostBeginRender phase to write additional attributes, from the informal parameters, into the * active element. * * If you want this behavior, but need to render more than a single tag, then implement render phase methods for the * {@link BeforeRenderTemplate} and {@link AfterRenderTemplate} phases. Use those phases to write the additional * elements and close them. * * This is often used as a base class, for cases where a component doesn't have other mixins. * * @tapestrydoc */ @MixinAfter @SupportsInformalParameters public class RenderInformals { @Inject private ComponentResources resources; void beginRender(MarkupWriter writer) { resources.renderInformalParameters(writer); } }
@MixinAfter public class RenderNotification
@MixinAfter public class Placeholder {
@MixinAfter public class Tooltip extends Widget {
/** * Used to test https://issues.apache.org/jira/browse/TAP5-1680. */ @MixinAfter public class AltTitle { @InjectContainer private ClientElement container; @Parameter(required = true, defaultPrefix = BindingConstants.LITERAL) private String title; void afterRender() { container.getClientId(); } void beginRender(MarkupWriter writer) { writer.attributes("alt", title); } }
@MixinAfter public class Autocomplete
@MixinAfter public class Confirm
@MixinAfter public class Raty {