001: // Copyright 2006 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.tapestry.services;
016:
017: import java.lang.reflect.Modifier;
018:
019: import org.apache.tapestry.MarkupWriter;
020: import org.apache.tapestry.runtime.ComponentEvent;
021: import org.apache.tapestry.runtime.Event;
022:
023: /**
024: * Constants used by implementations of
025: * {@link org.apache.tapestry.services.ComponentClassTransformWorker}.
026: */
027: public final class TransformConstants {
028: // Shared parameters of a whole bunch of lifecycle methods, representing the different
029: // component render states.
030: private static final String[] RENDER_PHASE_METHOD_PARAMETERS = {
031: MarkupWriter.class.getName(), Event.class.getName() };
032:
033: /**
034: * Signature for {@link org.apache.tapestry.runtime.Component#handleEvent(Event event)
035: *
036: * @see org.apache.tapestry.annotations.OnEvent
037: */
038: public static final MethodSignature HANDLE_COMPONENT_EVENT = new MethodSignature(
039: Modifier.PUBLIC, "boolean", "handleComponentEvent",
040: new String[] { ComponentEvent.class.getName() }, null);
041:
042: /**
043: * Signature for
044: * {@link org.apache.tapestry.runtime.PageLifecycleListener#containingPageDidLoad()}.
045: */
046: public static final MethodSignature CONTAINING_PAGE_DID_LOAD_SIGNATURE = new MethodSignature(
047: "containingPageDidLoad");
048:
049: /** Signature for {@link org.apache.tapestry.runtime.Component#postRenderCleanup()}. */
050: public static final MethodSignature POST_RENDER_CLEANUP_SIGNATURE = new MethodSignature(
051: "postRenderCleanup");
052:
053: /**
054: * Signature for
055: * {@link org.apache.tapestry.runtime.PageLifecycleListener#containingPageDidDetach()}.
056: */
057: public static final MethodSignature CONTAINING_PAGE_DID_DETACH_SIGNATURE = new MethodSignature(
058: "containingPageDidDetach");
059:
060: /**
061: * Signature for
062: * {@link org.apache.tapestry.runtime.PageLifecycleListener#containingPageDidAttach()}.
063: */
064: public static final MethodSignature CONTAINING_PAGE_DID_ATTACH_SIGNATURE = new MethodSignature(
065: "containingPageDidAttach");
066:
067: /**
068: * Signature for {@link org.apache.tapestry.runtime.Component#setupRender(MarkupWriter, Event)}.
069: *
070: * @see org.apache.tapestry.annotations.SetupRender
071: */
072: public static final MethodSignature SETUP_RENDER_SIGNATURE = renderPhaseSignature("setupRender");
073:
074: /**
075: * Signature for {@link org.apache.tapestry.runtime.Component#beginRender(MarkupWriter, Event)}.
076: *
077: * @see org.apache.tapestry.annotations.BeginRender
078: */
079: public static final MethodSignature BEGIN_RENDER_SIGNATURE = renderPhaseSignature("beginRender");
080:
081: /**
082: * Signature for
083: * {@link org.apache.tapestry.runtime.Component#beforeRenderTemplate(MarkupWriter, Event)}.
084: *
085: * @see org.apache.tapestry.annotations.BeforeRenderTemplate
086: */
087: public static MethodSignature BEFORE_RENDER_TEMPLATE_SIGNATURE = renderPhaseSignature("beforeRenderTemplate");
088:
089: /**
090: * Signature for
091: * {@link org.apache.tapestry.runtime.Component#afterRenderTemplate(MarkupWriter, Event)}.
092: *
093: * @see org.apache.tapestry.annotations.BeforeRenderTemplate
094: */
095: public static MethodSignature AFTER_RENDER_TEMPLATE_SIGNATURE = renderPhaseSignature("afterRenderTemplate");
096:
097: /**
098: * Signature for
099: * {@link org.apache.tapestry.runtime.Component#beforeRenderBody(MarkupWriter, Event)}.
100: *
101: * @see org.apache.tapestry.annotations.BeforeRenderBody
102: */
103: public static final MethodSignature BEFORE_RENDER_BODY_SIGNATURE = renderPhaseSignature("beforeRenderBody");
104:
105: /**
106: * Signature for
107: * {@link org.apache.tapestry.runtime.Component#afterRenderBody(MarkupWriter, Event)}.
108: *
109: * @see org.apache.tapestry.annotations.AfterRenderBody
110: */
111: public static final MethodSignature AFTER_RENDER_BODY_SIGNATURE = renderPhaseSignature("afterRenderBody");
112:
113: /**
114: * Signature for {@link org.apache.tapestry.runtime.Component#afterRender(MarkupWriter, Event)}
115: *
116: * @see org.apache.tapestry.annotations.AfterRender
117: */
118: public static final MethodSignature AFTER_RENDER_SIGNATURE = renderPhaseSignature("afterRender");
119:
120: /**
121: * Signature for
122: * {@link org.apache.tapestry.runtime.Component#cleanupRender(MarkupWriter, Event)}.
123: *
124: * @see org.apache.tapestry.annotations.CleanupRender
125: */
126: public static final MethodSignature CLEANUP_RENDER_SIGNATURE = renderPhaseSignature("cleanupRender");
127:
128: private TransformConstants() {
129: }
130:
131: private static MethodSignature renderPhaseSignature(String name) {
132: return new MethodSignature(Modifier.PUBLIC, "void", name,
133: RENDER_PHASE_METHOD_PARAMETERS, null);
134: }
135: }
|