001// Copyright 2011-2013 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 015package org.apache.tapestry5.services.javascript; 016 017import org.apache.tapestry5.ioc.services.SymbolSource; 018import org.apache.tapestry5.services.AssetSource; 019 020/** 021 * Defines the types of extensions to a JavaScript stack that can be contributed to an extensible JavaScript stack. 022 * 023 * @see StackExtension 024 * @see ExtensibleJavaScriptStack 025 * @since 5.3 026 */ 027public enum StackExtensionType 028{ 029 /** 030 * A JavaScript library. The extension value will be converted using {@link AssetSource#getExpandedAsset(String)}, 031 * meaning that {@linkplain SymbolSource symbols} will be expanded. 032 * 033 * @see JavaScriptSupport#importJavaScriptLibrary(org.apache.tapestry5.Asset) 034 * @see org.apache.tapestry5.services.javascript.JavaScriptStack#getJavaScriptLibraries() 035 */ 036 LIBRARY, 037 038 /** 039 * A dependency on another JavaScriptStack. Note that this is especially useful as, starting in 5.4, there is 040 * no automatic dependency on the "core" stack, as there was in earlier versions. 041 * 042 * @see JavaScriptSupport#importStack(String) 043 * @see org.apache.tapestry5.services.javascript.JavaScriptStack#getStylesheets() 044 * @since 5.4 045 */ 046 STACK, 047 048 /** 049 * A stylesheet. The extension value will be converted using {@link AssetSource#getExpandedAsset(String)}, 050 * meaning that {@linkplain SymbolSource symbols} will be expanded. 051 * 052 * @see JavaScriptSupport#importStylesheet(org.apache.tapestry5.Asset) 053 * @see org.apache.tapestry5.services.javascript.JavaScriptStack#getStylesheets() 054 */ 055 STYLESHEET, 056 057 /** 058 * A module to aggregate with the stack. The module's JavaScript is included after any libraries. 059 * In development mode (with aggregation disabled), the library will be included individually. 060 * Unlike the RequireJS {@code r.js} tool, this does not process 061 * dependencies and is based on a simple regular expression parser. 062 * <p/> 063 * Note that this only loads the module's <em>code</em> and defines the module as available; 064 * the module's function will not be invoked unless {@link JavaScriptSupport#require(String)} is invoked to establish 065 * a dependency. 066 * <p/> 067 * Note that at this time, {@linkplain JavaScriptModuleConfiguration#exports(String) shimmed modules} can not 068 * be aggregated into stacks properly; the shimmed module will be aggregated, but then will still be loaded via 069 * a subsequent HTTP request. 070 * 071 * @since 5.4 072 */ 073 MODULE, 074 075 /** 076 * Extra JavaScript initialization (rarely used). No symbol expansion takes place. 077 * 078 * @see JavaScriptSupport#addScript(String, Object...) 079 * @see org.apache.tapestry5.services.javascript.JavaScriptStack#getInitialization() 080 * @deprecated Deprecated in 5.4 with no replacement; initialization may be removed in the future. 081 */ 082 INITIALIZATION; 083}