001 // Copyright 2006, 2007, 2009 The Apache Software Foundation 002 // 003 // Licensed under the Apache License, Version 2.0 (the "License"); 004 // you may not use this file except in compliance with the License. 005 // You may obtain a copy of the License at 006 // 007 // http://www.apache.org/licenses/LICENSE-2.0 008 // 009 // Unless required by applicable law or agreed to in writing, software 010 // distributed under the License is distributed on an "AS IS" BASIS, 011 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 012 // See the License for the specific language governing permissions and 013 // limitations under the License. 014 015 package org.apache.tapestry5.annotations; 016 017 import java.lang.annotation.Documented; 018 import java.lang.annotation.ElementType; 019 import java.lang.annotation.Retention; 020 import static java.lang.annotation.RetentionPolicy.RUNTIME; 021 import java.lang.annotation.Target; 022 023 import static org.apache.tapestry5.ioc.annotations.AnnotationUseContext.*; 024 import org.apache.tapestry5.ioc.annotations.UseWith; 025 026 /** 027 * Marker annotation for methods that should be executed at the start of rendering the component. This usually includes 028 * rendering of the component's start tag. 029 * <p/> 030 * Such methods may optionally take a {@link org.apache.tapestry5.MarkupWriter} parameter, and may return void or 031 * boolean. Returning true or void will allow the component to advance into the render template / render body phase. If 032 * a body is present, the {@link org.apache.tapestry5.annotations.BeforeRenderBody} phase will execute. If a component 033 * has a template, the {@link BeforeRenderTemplate} phase will execute (and the render body will only occur if the 034 * template directs so). 035 * <p/> 036 * Either way, the {@link org.apache.tapestry5.annotations.AfterRender} phase will execute after the template and/or 037 * body have rendered. A component with a body but without a template will still see the {@link 038 * org.apache.tapestry5.annotations.BeforeRenderBody} phase execute. 039 * <p/> 040 * Returning false will skip rendering of the template and/or body, and jump directly to the {@link AfterRender} phase. 041 */ 042 @Target(ElementType.METHOD) 043 @Retention(RUNTIME) 044 @Documented 045 @UseWith({COMPONENT,MIXIN,PAGE}) 046 public @interface BeginRender 047 { 048 049 }