JdbcMapper/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/javascript/IScriptReporter.java

63 lines
2.4 KiB
Java

/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* $Header:$
*/
package org.apache.beehive.netui.tags.javascript;
import org.apache.beehive.netui.util.internal.InternalStringBuilder;
import org.apache.beehive.netui.tags.rendering.AbstractRenderAppender;
/**
* A <code>ScriptReporter</code> acts as a container for JavaScript generated by children of
* the tag. Usually a <code>ScriptReporter</code> will gather up all of the JavaScript
* generated by children into a single &lt;script> element output into the HTML. A script container
* will implement a map beteween the TagId and the real <code>name</code> or <code>id</code> attribute
* written into the HTML.
*/
public interface IScriptReporter
{
/**
* This method will add Script as a function.
* @param placement
* @param script the text of the function. This value must not be null.
*/
void addScriptFunction(ScriptPlacement placement, String script);
/**
* Adds a tagID and tagName to the id to name map. A script container
* can maintain a mapping of user ids to actual ids generated by
* the tagId. This method will track these.
* @param tagId the id of a child tag.
* @param tagName the name of a child tag.
*/
void addLegacyTagIdMappings(String tagId, String tagName);
/**
* @param tagId
* @param realId
* @param realName
*/
void addTagIdMappings(String tagId, String realId, String realName);
/**
* This method will output all of the Script associated with the script reporter.
* @param sb The script is written into the provided InternalStringBuilder. This value must not be null.
*/
void writeScript(AbstractRenderAppender sb);
}