KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tapestry > IScriptProcessor


1 // Copyright 2004, 2005 The Apache Software Foundation
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
// http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14

15 package org.apache.tapestry;
16
17 import org.apache.hivemind.Resource;
18
19 /**
20  * Defines methods needed by a {@link org.apache.tapestry.IScript}to execute.
21  *
22  * @author Howard Lewis Ship
23  * @since 3.0
24  * @see org.apache.tapestry.html.Body
25  */

26
27 public interface IScriptProcessor
28 {
29     /**
30      * Adds scripting code to the main body. During the render, multiple scripts may render multiple
31      * bodies; all are concatinated together to form a single block. The
32      * {@link org.apache.tapestry.html.Body} component will write the body script contents
33      * just inside the <code>&lt;body&gt;</code> tag.
34      */

35
36     public void addBodyScript(String JavaDoc script);
37
38     /**
39      * Adds initialization script. Initialization script is executed once, when the containing page
40      * loads. Initialization script content is written only after all HTML content that could be
41      * referenced from the script (in effect, just before the <code>&lt/body&gt; tag).
42      */

43     public void addInitializationScript(String JavaDoc script);
44
45     /**
46      * Adds an external script. The processor is expected to ensure that external scripts are only
47      * loaded a single time per page.
48      */

49
50     public void addExternalScript(Resource resource);
51
52     /**
53      * Ensures that the given string is unique. The string is either returned unchanged, or a suffix
54      * is appended to ensure uniqueness.
55      */

56
57     public String JavaDoc getUniqueString(String JavaDoc baseValue);
58 }
Popular Tags