<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | |
<!-- saved from url=(0014)about:internet --> | |
<HTML> | |
<HEAD> | |
<!-- Generated by javadoc (build 1.5.0_19) on Sun Mar 20 20:56:04 PKT 2011 --> | |
<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
<TITLE> | |
Control (Click Framework API - v2.3.0) | |
</TITLE> | |
<META NAME="keywords" CONTENT="org.apache.click.Control interface"> | |
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style"> | |
<SCRIPT type="text/javascript"> | |
function windowTitle() | |
{ | |
parent.document.title="Control (Click Framework API - v2.3.0)"; | |
} | |
</SCRIPT> | |
<NOSCRIPT> | |
</NOSCRIPT> | |
</HEAD> | |
<BODY BGCOLOR="white"> | |
<!-- ========= START OF TOP NAVBAR ======= --> | |
<A NAME="navbar_top"><!-- --></A> | |
<A HREF="#skip-navbar_top" title="Skip navigation links"></A> | |
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> | |
<TR> | |
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> | |
<A NAME="navbar_top_firstrow"><!-- --></A> | |
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> | |
<TR ALIGN="center" VALIGN="top"> | |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> | |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> | |
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> | |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> | |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> | |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> | |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> | |
</TR> | |
</TABLE> | |
</TD> | |
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> | |
</EM> | |
</TD> | |
</TR> | |
<TR> | |
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> | |
<A HREF="../../../org/apache/click/Context.html" title="class in org.apache.click"><B>PREV CLASS</B></A> | |
<A HREF="../../../org/apache/click/ControlRegistry.html" title="class in org.apache.click"><B>NEXT CLASS</B></A></FONT></TD> | |
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> | |
<A HREF="../../../index.html?org/apache/click/Control.html" target="_top"><B>FRAMES</B></A> | |
<A HREF="Control.html" target="_top"><B>NO FRAMES</B></A> | |
<SCRIPT type="text/javascript"> | |
<!-- | |
if(window==top) { | |
document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>'); | |
} | |
//--> | |
</SCRIPT> | |
<NOSCRIPT> | |
<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A> | |
</NOSCRIPT> | |
</FONT></TD> | |
</TR> | |
<TR> | |
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> | |
SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD> | |
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> | |
DETAIL: <A HREF="#field_detail">FIELD</A> | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD> | |
</TR> | |
</TABLE> | |
<A NAME="skip-navbar_top"></A> | |
<!-- ========= END OF TOP NAVBAR ========= --> | |
<HR> | |
<!-- ======== START OF CLASS DATA ======== --> | |
<H2> | |
<FONT SIZE="-1"> | |
org.apache.click</FONT> | |
<BR> | |
Interface Control</H2> | |
<DL> | |
<DT><B>All Superinterfaces:</B> <DD><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/io/Serializable.html" title="class or interface in java.io">Serializable</A></DD> | |
</DL> | |
<DL> | |
<DT><B>All Known Subinterfaces:</B> <DD><A HREF="../../../org/apache/click/control/Container.html" title="interface in org.apache.click.control">Container</A></DD> | |
</DL> | |
<DL> | |
<DT><B>All Known Implementing Classes:</B> <DD><A HREF="../../../org/apache/click/control/AbstractContainer.html" title="class in org.apache.click.control">AbstractContainer</A>, <A HREF="../../../org/apache/click/control/AbstractControl.html" title="class in org.apache.click.control">AbstractControl</A>, <A HREF="../../../org/apache/click/control/AbstractLink.html" title="class in org.apache.click.control">AbstractLink</A>, <A HREF="../../../org/apache/click/control/ActionButton.html" title="class in org.apache.click.control">ActionButton</A>, <A HREF="../../../org/apache/click/control/ActionLink.html" title="class in org.apache.click.control">ActionLink</A>, <A HREF="../../../org/apache/click/control/Button.html" title="class in org.apache.click.control">Button</A>, <A HREF="../../../org/apache/click/control/Checkbox.html" title="class in org.apache.click.control">Checkbox</A>, <A HREF="../../../org/apache/click/control/Field.html" title="class in org.apache.click.control">Field</A>, <A HREF="../../../org/apache/click/control/FieldSet.html" title="class in org.apache.click.control">FieldSet</A>, <A HREF="../../../org/apache/click/control/FileField.html" title="class in org.apache.click.control">FileField</A>, <A HREF="../../../org/apache/click/control/Form.html" title="class in org.apache.click.control">Form</A>, <A HREF="../../../org/apache/click/control/HiddenField.html" title="class in org.apache.click.control">HiddenField</A>, <A HREF="../../../org/apache/click/control/ImageSubmit.html" title="class in org.apache.click.control">ImageSubmit</A>, <A HREF="../../../org/apache/click/control/Label.html" title="class in org.apache.click.control">Label</A>, <A HREF="../../../org/apache/click/control/PageLink.html" title="class in org.apache.click.control">PageLink</A>, <A HREF="../../../org/apache/click/control/Panel.html" title="class in org.apache.click.control">Panel</A>, <A HREF="../../../org/apache/click/control/PasswordField.html" title="class in org.apache.click.control">PasswordField</A>, <A HREF="../../../org/apache/click/control/Radio.html" title="class in org.apache.click.control">Radio</A>, <A HREF="../../../org/apache/click/control/RadioGroup.html" title="class in org.apache.click.control">RadioGroup</A>, <A HREF="../../../org/apache/click/control/Reset.html" title="class in org.apache.click.control">Reset</A>, <A HREF="../../../org/apache/click/control/Select.html" title="class in org.apache.click.control">Select</A>, <A HREF="../../../org/apache/click/control/Submit.html" title="class in org.apache.click.control">Submit</A>, <A HREF="../../../org/apache/click/control/Table.html" title="class in org.apache.click.control">Table</A>, <A HREF="../../../org/apache/click/control/TextArea.html" title="class in org.apache.click.control">TextArea</A>, <A HREF="../../../org/apache/click/control/TextField.html" title="class in org.apache.click.control">TextField</A></DD> | |
</DL> | |
<HR> | |
<DL> | |
<DT><PRE>public interface <B>Control</B><DT>extends <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/io/Serializable.html" title="class or interface in java.io">Serializable</A></DL> | |
</PRE> | |
<P> | |
Provides the interface for Page controls. Controls are also referred to | |
as components or widgets. | |
<p/> | |
When a Page request event is processed Controls may perform server side event | |
processing through their <A HREF="../../../org/apache/click/Control.html#onProcess()"><CODE>onProcess()</CODE></A> method. Controls are generally | |
rendered in a Page by calling their <tt>toString()</tt> method. | |
<p/> | |
The Control execution sequence is illustrated below: | |
<p/> | |
<img src="control-post-sequence-diagram.png"/> | |
<h4>HTML HEAD Elements</h4> | |
Control HTML HEAD elements can be included in the Page by overriding the | |
<A HREF="../../../org/apache/click/Control.html#getHeadElements()"><CODE>getHeadElements()</CODE></A> method. | |
<p/> | |
Below is an example of a custom TextField control specifying that the | |
<tt>custom.js</tt> file should be included in the HTML HEADer: | |
<pre class="prettyprint"> | |
public class CustomField extends TextField { | |
<span class="kw">public</span> List getHeadElements() { | |
if(headElements == null) { | |
// If headElements is null, create default headElements | |
headElements = super.getHeadElements(); | |
// Add a new JavaScript Import Element for the "/custom.js" script | |
headElements.add(new JsImport("/click/custom.js")); | |
} | |
return headElements; | |
} | |
.. | |
} </pre> | |
<a name="on-deploy"></a> | |
<h4>Deploying Resources</h4> | |
The Click framework uses the Velocity Tools <tt>WebappResourceLoader</tt> for loading templates. | |
This avoids issues associate with using the Velocity <tt>ClasspathResourceLoader</tt> and | |
<tt>FileResourceLoader</tt> on J2EE application servers. | |
To make preconfigured resources (templates, JavaScript, stylesheets, etc.) | |
available to web applications Click automatically deploys configured classpath | |
resources to the <tt class="blue">/click</tt> directory at startup | |
(existing files will not be overwritten). | |
<p/> | |
Click supports two ways of deploying pre-configured resources. The recommended | |
deployment strategy (which also the simplest) relies on packaging resources | |
into a special folder of the JAR, called <tt>'META-INF/resources'</tt>. At | |
startup time Click will scan this folder for resources and deploy them to the | |
web application. This deployment strategy is the same approach taken by the | |
Servlet 3.0 specification. Please see the section | |
<a href="../../../../user-guide/html/ch05s03.html#deploying-custom-resources">Deploying Custom Resources</a> | |
for more details. | |
<p/> | |
An alternative approach to deploying static resources on startup is provided | |
by the Control interface through the <A HREF="../../../org/apache/click/Control.html#onDeploy(javax.servlet.ServletContext)"><CODE>onDeploy(ServletContext)</CODE></A> method. | |
<p/> | |
Continuing our example, the <tt>CustomField</tt> control deploys its | |
<tt>custom.js</tt> file to the <tt>/click</tt> directory: | |
<pre class="codeJava"> | |
<span class="kw">public class</span> CustomField <span class="kw">extends</span> TextField { | |
.. | |
<span class="kw">public void</span> onDeploy(ServletContext servletContext) { | |
ClickUtils.deployFile | |
(servletContext, <span class="st">"/com/mycorp/control/custom.js"</span>, <span class="st">"click"</span>); | |
} | |
} </pre> | |
Controls using the <tt>onDeploy()</tt> method must be registered in the | |
application <tt>WEB-INF/click.xml</tt> for them to be invoked. | |
For example: | |
<pre class="codeConfig"> | |
<click-app> | |
<pages package="com.mycorp.page" automapping="true"/> | |
<controls> | |
<control classname=<span class="st">"com.mycorp.control.CustomField"</span>/> | |
</controls> | |
</click-app> </pre> | |
When the Click application starts up it will deploy any control elements | |
defined in the following files in sequential order: | |
<ul> | |
<li><tt>/click-controls.xml</tt> | |
<li><tt>/extras-controls.xml</tt> | |
<li><tt>WEB-INF/click.xml</tt> | |
</ul> | |
<b>Please note</b> <A HREF="../../../org/apache/click/control/AbstractControl.html" title="class in org.apache.click.control"><CODE>AbstractControl</CODE></A> provides | |
a default implementation of the Control interface to make it easier for | |
developers to create their own controls. | |
<P> | |
<P> | |
<DL> | |
<DT><B>See Also:</B><DD><A HREF="../../../org/apache/click/util/PageImports.html" title="class in org.apache.click.util"><CODE>PageImports</CODE></A></DL> | |
<HR> | |
<P> | |
<!-- =========== FIELD SUMMARY =========== --> | |
<A NAME="field_summary"><!-- --></A> | |
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> | |
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> | |
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> | |
<B>Field Summary</B></FONT></TH> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE>static <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A></CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../org/apache/click/Control.html#CONTROL_MESSAGES">CONTROL_MESSAGES</A></B></CODE> | |
<BR> | |
The global control messages bundle name: <tt>click-control</tt>.</TD> | |
</TR> | |
</TABLE> | |
| |
<!-- ========== METHOD SUMMARY =========== --> | |
<A NAME="method_summary"><!-- --></A> | |
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> | |
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> | |
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> | |
<B>Method Summary</B></FONT></TH> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Set.html" title="class or interface in java.util">Set</A><<A HREF="../../../org/apache/click/Behavior.html" title="interface in org.apache.click">Behavior</A>></CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../org/apache/click/Control.html#getBehaviors()">getBehaviors</A></B>()</CODE> | |
<BR> | |
Returns the list of behaviors for this control.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> <A HREF="../../../org/apache/click/Context.html" title="class in org.apache.click">Context</A></CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../org/apache/click/Control.html#getContext()">getContext</A></B>()</CODE> | |
<BR> | |
<B>Deprecated.</B> <I>getContext() is now obsolete on the Control interface, | |
but will still be available on AbstractControl: | |
<A HREF="../../../org/apache/click/control/AbstractControl.html#getContext()"><CODE>AbstractControl.getContext()</CODE></A></I></TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/List.html" title="class or interface in java.util">List</A><<A HREF="../../../org/apache/click/element/Element.html" title="class in org.apache.click.element">Element</A>></CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../org/apache/click/Control.html#getHeadElements()">getHeadElements</A></B>()</CODE> | |
<BR> | |
Return the list of HEAD <A HREF="../../../org/apache/click/element/Element.html" title="class in org.apache.click.element"><CODE>elements</CODE></A> | |
to be included in the page.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A></CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../org/apache/click/Control.html#getId()">getId</A></B>()</CODE> | |
<BR> | |
Return HTML element identifier attribute "id" value.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Map.html" title="class or interface in java.util">Map</A><<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>,<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>></CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../org/apache/click/Control.html#getMessages()">getMessages</A></B>()</CODE> | |
<BR> | |
Return the localized messages <tt>Map</tt> of the Control.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A></CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../org/apache/click/Control.html#getName()">getName</A></B>()</CODE> | |
<BR> | |
Return the name of the Control.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A></CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../org/apache/click/Control.html#getParent()">getParent</A></B>()</CODE> | |
<BR> | |
Return the parent of the Control.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> boolean</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../org/apache/click/Control.html#hasBehaviors()">hasBehaviors</A></B>()</CODE> | |
<BR> | |
Returns <tt>true</tt> if this control has any | |
<tt>Behavior</tt>s registered, <tt>false</tt> otherwise.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> boolean</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../org/apache/click/Control.html#isAjaxTarget(org.apache.click.Context)">isAjaxTarget</A></B>(<A HREF="../../../org/apache/click/Context.html" title="class in org.apache.click">Context</A> context)</CODE> | |
<BR> | |
Returns <tt>true</tt> if this control is an Ajax target, <tt>false</tt> | |
otherwise.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> void</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../org/apache/click/Control.html#onDeploy(javax.servlet.ServletContext)">onDeploy</A></B>(<A HREF="http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/ServletContext.html" title="class or interface in javax.servlet">ServletContext</A> servletContext)</CODE> | |
<BR> | |
The on deploy event handler, which provides classes the | |
opportunity to deploy static resources when the Click application is | |
initialized.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> void</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../org/apache/click/Control.html#onDestroy()">onDestroy</A></B>()</CODE> | |
<BR> | |
The on destroy request event handler.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> void</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../org/apache/click/Control.html#onInit()">onInit</A></B>()</CODE> | |
<BR> | |
The on initialize event handler.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> boolean</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../org/apache/click/Control.html#onProcess()">onProcess</A></B>()</CODE> | |
<BR> | |
The on process event handler.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> void</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../org/apache/click/Control.html#onRender()">onRender</A></B>()</CODE> | |
<BR> | |
The on render event handler.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> void</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../org/apache/click/Control.html#render(org.apache.click.util.HtmlStringBuffer)">render</A></B>(<A HREF="../../../org/apache/click/util/HtmlStringBuffer.html" title="class in org.apache.click.util">HtmlStringBuffer</A> buffer)</CODE> | |
<BR> | |
Render the control's HTML representation to the specified buffer.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> void</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../org/apache/click/Control.html#setListener(java.lang.Object, java.lang.String)">setListener</A></B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A> listener, | |
<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> method)</CODE> | |
<BR> | |
<B>Deprecated.</B> <I>this method is now obsolete on the Control interface, but | |
will still be available on AbstractControl: | |
<A HREF="../../../org/apache/click/control/AbstractControl.html#setListener(java.lang.Object, java.lang.String)"><CODE>AbstractControl.setListener(java.lang.Object, java.lang.String)</CODE></A></I></TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> void</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../org/apache/click/Control.html#setName(java.lang.String)">setName</A></B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> name)</CODE> | |
<BR> | |
Set the name of the Control.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> void</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../org/apache/click/Control.html#setParent(java.lang.Object)">setParent</A></B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A> parent)</CODE> | |
<BR> | |
Set the parent of the Control.</TD> | |
</TR> | |
</TABLE> | |
| |
<P> | |
<!-- ============ FIELD DETAIL =========== --> | |
<A NAME="field_detail"><!-- --></A> | |
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> | |
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> | |
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> | |
<B>Field Detail</B></FONT></TH> | |
</TR> | |
</TABLE> | |
<A NAME="CONTROL_MESSAGES"><!-- --></A><H3> | |
CONTROL_MESSAGES</H3> | |
<PRE> | |
static final <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>CONTROL_MESSAGES</B></PRE> | |
<DL> | |
<DD>The global control messages bundle name: <tt>click-control</tt>. | |
<P> | |
<DL> | |
<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.apache.click.Control.CONTROL_MESSAGES">Constant Field Values</A></DL> | |
</DL> | |
<!-- ============ METHOD DETAIL ========== --> | |
<A NAME="method_detail"><!-- --></A> | |
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> | |
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> | |
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> | |
<B>Method Detail</B></FONT></TH> | |
</TR> | |
</TABLE> | |
<A NAME="getContext()"><!-- --></A><H3> | |
getContext</H3> | |
<PRE> | |
<A HREF="../../../org/apache/click/Context.html" title="class in org.apache.click">Context</A> <B>getContext</B>()</PRE> | |
<DL> | |
<DD><B>Deprecated.</B> <I>getContext() is now obsolete on the Control interface, | |
but will still be available on AbstractControl: | |
<A HREF="../../../org/apache/click/control/AbstractControl.html#getContext()"><CODE>AbstractControl.getContext()</CODE></A></I> | |
<P> | |
<DD>Return the Page request Context of the Control. | |
<P> | |
<DD><DL> | |
</DL> | |
</DD> | |
<DD><DL> | |
<DT><B>Returns:</B><DD>the Page request Context</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="getHeadElements()"><!-- --></A><H3> | |
getHeadElements</H3> | |
<PRE> | |
<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/List.html" title="class or interface in java.util">List</A><<A HREF="../../../org/apache/click/element/Element.html" title="class in org.apache.click.element">Element</A>> <B>getHeadElements</B>()</PRE> | |
<DL> | |
<DD>Return the list of HEAD <A HREF="../../../org/apache/click/element/Element.html" title="class in org.apache.click.element"><CODE>elements</CODE></A> | |
to be included in the page. Example HEAD elements include | |
<A HREF="../../../org/apache/click/element/JsImport.html" title="class in org.apache.click.element"><CODE>JsImport</CODE></A>, | |
<A HREF="../../../org/apache/click/element/JsScript.html" title="class in org.apache.click.element"><CODE>JsScript</CODE></A>, | |
<A HREF="../../../org/apache/click/element/CssImport.html" title="class in org.apache.click.element"><CODE>CssImport</CODE></A> and | |
<A HREF="../../../org/apache/click/element/CssStyle.html" title="class in org.apache.click.element"><CODE>CssStyle</CODE></A>. | |
<p/> | |
Controls can contribute their own list of HEAD elements by implementing | |
this method. | |
<p/> | |
The recommended approach when implementing this method is to use | |
<tt>lazy loading</tt> to ensure the HEAD elements are only added | |
<tt>once</tt> and when <tt>needed</tt>. For example: | |
<pre class="prettyprint"> | |
public MyControl extends AbstractControl { | |
public List getHeadElements() { | |
// Use lazy loading to ensure the JS is only added the | |
// first time this method is called. | |
if (headElements == null) { | |
// Get the head elements from the super implementation | |
headElements = super.getHeadElements(); | |
// Include the control's external JavaScript resource | |
JsImport jsImport = new JsImport("/mycorp/mycontrol/mycontrol.js"); | |
headElements.add(jsImport); | |
// Include the control's external Css resource | |
CssImport cssImport = new CssImport("/mycorp/mycontrol/mycontrol.css"); | |
headElements.add(cssImport); | |
} | |
return headElements; | |
} | |
} </pre> | |
Alternatively one can add the HEAD elements in the Control's constructor: | |
<pre class="prettyprint"> | |
public MyControl extends AbstractControl { | |
public MyControl() { | |
JsImport jsImport = new JsImport("/mycorp/mycontrol/mycontrol.js"); | |
getHeadElements().add(jsImport); | |
CssImport cssImport = new CssImport("/mycorp/mycontrol/mycontrol.css"); | |
getHeadHeaders().add(cssImport); | |
} | |
} </pre> | |
One can also add HEAD elements from event handler methods such as | |
<A HREF="../../../org/apache/click/Control.html#onInit()"><CODE>onInit()</CODE></A>, <A HREF="../../../org/apache/click/Control.html#onProcess()"><CODE>onProcess()</CODE></A>, <A HREF="../../../org/apache/click/Control.html#onRender()"><CODE>onRender()</CODE></A> | |
etc. | |
<p/> | |
The order in which JS and CSS files are included will be preserved in the | |
page. | |
<p/> | |
<b>Note:</b> this method must never return null. If no HEAD elements | |
are available this method must return an empty <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/List.html" title="class or interface in java.util"><CODE>List</CODE></A>. | |
<p/> | |
<b>Also note:</b> a common problem when overriding getHeadElements in | |
subclasses is forgetting to call <em>super.getHeadElements</em>. Consider | |
carefully whether you should call <em>super.getHeadElements</em> or not. | |
<P> | |
<DD><DL> | |
</DL> | |
</DD> | |
<DD><DL> | |
<DT><B>Returns:</B><DD>the list of HEAD elements to be included in the page</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="getId()"><!-- --></A><H3> | |
getId</H3> | |
<PRE> | |
<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>getId</B>()</PRE> | |
<DL> | |
<DD>Return HTML element identifier attribute "id" value. | |
<A HREF="../../../org/apache/click/control/AbstractControl.html#getId()"><CODE>AbstractControl.getId()</CODE></A> | |
<P> | |
<DD><DL> | |
</DL> | |
</DD> | |
<DD><DL> | |
<DT><B>Returns:</B><DD>HTML element identifier attribute "id" value</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="setListener(java.lang.Object, java.lang.String)"><!-- --></A><H3> | |
setListener</H3> | |
<PRE> | |
void <B>setListener</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A> listener, | |
<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> method)</PRE> | |
<DL> | |
<DD><B>Deprecated.</B> <I>this method is now obsolete on the Control interface, but | |
will still be available on AbstractControl: | |
<A HREF="../../../org/apache/click/control/AbstractControl.html#setListener(java.lang.Object, java.lang.String)"><CODE>AbstractControl.setListener(java.lang.Object, java.lang.String)</CODE></A></I> | |
<P> | |
<DD>Set the controls event listener. | |
<p/> | |
The method signature of the listener is:<ul> | |
<li>must have a valid Java method name</li> | |
<li>takes no arguments</li> | |
<li>returns a boolean value</li> | |
</ul> | |
<p/> | |
An example event listener method would be: | |
<pre class="codeJava"> | |
<span class="kw">public boolean</span> onClick() { | |
System.out.println(<span class="st">"onClick called"</span>); | |
<span class="kw">return true</span>; | |
} </pre> | |
<P> | |
<DD><DL> | |
</DL> | |
</DD> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>listener</CODE> - the listener object with the named method to invoke<DD><CODE>method</CODE> - the name of the method to invoke</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="getMessages()"><!-- --></A><H3> | |
getMessages</H3> | |
<PRE> | |
<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Map.html" title="class or interface in java.util">Map</A><<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>,<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>> <B>getMessages</B>()</PRE> | |
<DL> | |
<DD>Return the localized messages <tt>Map</tt> of the Control. | |
<P> | |
<DD><DL> | |
</DL> | |
</DD> | |
<DD><DL> | |
<DT><B>Returns:</B><DD>the localized messages <tt>Map</tt> of the Control</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="getName()"><!-- --></A><H3> | |
getName</H3> | |
<PRE> | |
<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>getName</B>()</PRE> | |
<DL> | |
<DD>Return the name of the Control. Each control name must be unique in the | |
containing Page model or the containing Form. | |
<P> | |
<DD><DL> | |
</DL> | |
</DD> | |
<DD><DL> | |
<DT><B>Returns:</B><DD>the name of the control</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="setName(java.lang.String)"><!-- --></A><H3> | |
setName</H3> | |
<PRE> | |
void <B>setName</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> name)</PRE> | |
<DL> | |
<DD>Set the name of the Control. Each control name must be unique in the | |
containing Page model or the parent container. | |
<p/> | |
<b>Please note:</b> changing the name of a Control after it has been | |
added to its parent container is undefined. Thus it is best <b>not</b> | |
to change the name of a Control once its been set. | |
<P> | |
<DD><DL> | |
</DL> | |
</DD> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>name</CODE> - of the control | |
<DT><B>Throws:</B> | |
<DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/IllegalArgumentException.html" title="class or interface in java.lang">IllegalArgumentException</A></CODE> - if the name is null</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="getParent()"><!-- --></A><H3> | |
getParent</H3> | |
<PRE> | |
<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A> <B>getParent</B>()</PRE> | |
<DL> | |
<DD>Return the parent of the Control. | |
<P> | |
<DD><DL> | |
</DL> | |
</DD> | |
<DD><DL> | |
<DT><B>Returns:</B><DD>the parent of the Control</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="setParent(java.lang.Object)"><!-- --></A><H3> | |
setParent</H3> | |
<PRE> | |
void <B>setParent</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A> parent)</PRE> | |
<DL> | |
<DD>Set the parent of the Control. | |
<P> | |
<DD><DL> | |
</DL> | |
</DD> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>parent</CODE> - the parent of the Control</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="onDeploy(javax.servlet.ServletContext)"><!-- --></A><H3> | |
onDeploy</H3> | |
<PRE> | |
void <B>onDeploy</B>(<A HREF="http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/ServletContext.html" title="class or interface in javax.servlet">ServletContext</A> servletContext)</PRE> | |
<DL> | |
<DD>The on deploy event handler, which provides classes the | |
opportunity to deploy static resources when the Click application is | |
initialized. | |
<p/> | |
For example: | |
<pre class="codeJava"> | |
<span class="kw">public void</span> onDeploy(ServletContext servletContext) <span class="kw">throws</span> IOException { | |
ClickUtils.deployFile | |
(servletContext, <span class="st">"/com/mycorp/control/custom.js"</span>, <span class="st">"click"</span>); | |
} </pre> | |
<b>Please note:</b> a common problem when overriding onDeploy in | |
subclasses is forgetting to call <em>super.onDeploy</em>. Consider | |
carefully whether you should call <em>super.onDeploy</em> or not. | |
<p/> | |
Click also supports an alternative deployment strategy which relies on | |
packaging resource (stylesheets, JavaScript, images etc.) following a | |
specific convention. See the section | |
<a href="../../../../user-guide/html/ch05s03.html#deploying-custom-resources">Deploying Custom Resources</a> | |
for further details. | |
<P> | |
<DD><DL> | |
</DL> | |
</DD> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>servletContext</CODE> - the servlet context</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="onInit()"><!-- --></A><H3> | |
onInit</H3> | |
<PRE> | |
void <B>onInit</B>()</PRE> | |
<DL> | |
<DD>The on initialize event handler. Each control will be initialized | |
before its <A HREF="../../../org/apache/click/Control.html#onProcess()"><CODE>onProcess()</CODE></A> method is called. | |
<p/> | |
<A HREF="../../../org/apache/click/control/Container.html" title="interface in org.apache.click.control"><CODE>Container</CODE></A> implementations should recursively | |
invoke the onInit method on each of their child controls ensuring that | |
all controls receive this event. | |
<p/> | |
<b>Please note:</b> a common problem when overriding onInit in | |
subclasses is forgetting to call <em>super.onInit()</em>. Consider | |
carefully whether you should call <em>super.onInit()</em> or not, | |
especially for <A HREF="../../../org/apache/click/control/Container.html" title="interface in org.apache.click.control"><CODE>Container</CODE></A>s which by default | |
call <em>onInit</em> on all their child controls as well. | |
<P> | |
<DD><DL> | |
</DL> | |
</DD> | |
<DD><DL> | |
</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="onProcess()"><!-- --></A><H3> | |
onProcess</H3> | |
<PRE> | |
boolean <B>onProcess</B>()</PRE> | |
<DL> | |
<DD>The on process event handler. Each control will be processed when the | |
Page is requested. | |
<p/> | |
ClickServlet will process all Page controls in the order they were added | |
to the Page. | |
<p/> | |
<A HREF="../../../org/apache/click/control/Container.html" title="interface in org.apache.click.control"><CODE>Container</CODE></A> implementations should recursively | |
invoke the onProcess method on each of their child controls ensuring that | |
all controls receive this event. However when a control onProcess method | |
return false, no other controls onProcess method should be invoked. | |
<p/> | |
When a control is processed it should return true if the Page should | |
continue event processing, or false if no other controls should be | |
processed and the <A HREF="../../../org/apache/click/Page.html#onGet()"><CODE>Page.onGet()</CODE></A> or <A HREF="../../../org/apache/click/Page.html#onPost()"><CODE>Page.onPost()</CODE></A> methods | |
should not be invoked. | |
<p/> | |
<b>Please note:</b> a common problem when overriding onProcess in | |
subclasses is forgetting to call <em>super.onProcess()</em>. Consider | |
carefully whether you should call <em>super.onProcess()</em> or not, | |
especially for <A HREF="../../../org/apache/click/control/Container.html" title="interface in org.apache.click.control"><CODE>Container</CODE></A>s which by default | |
call <em>onProcess</em> on all their child controls as well. | |
<P> | |
<DD><DL> | |
</DL> | |
</DD> | |
<DD><DL> | |
<DT><B>Returns:</B><DD>true to continue Page event processing or false otherwise</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="onRender()"><!-- --></A><H3> | |
onRender</H3> | |
<PRE> | |
void <B>onRender</B>()</PRE> | |
<DL> | |
<DD>The on render event handler. This event handler is invoked prior to the | |
control being rendered, and is useful for providing pre rendering logic. | |
<p/> | |
The on render method is typically used to populate tables performing some | |
database intensive operation. By putting the intensive operations in the | |
on render method they will not be performed if the user navigates away | |
to a different page. | |
<p/> | |
<A HREF="../../../org/apache/click/control/Container.html" title="interface in org.apache.click.control"><CODE>Container</CODE></A> implementations should recursively | |
invoke the onRender method on each of their child controls ensuring that | |
all controls receive this event. | |
<p/> | |
<b>Please note:</b> a common problem when overriding onRender in | |
subclasses is forgetting to call <em>super.onRender()</em>. Consider | |
carefully whether you should call <em>super.onRender()</em> or not, | |
especially for <A HREF="../../../org/apache/click/control/Container.html" title="interface in org.apache.click.control"><CODE>Container</CODE></A>s which by default | |
call <em>onRender</em> on all their child controls as well. | |
<P> | |
<DD><DL> | |
</DL> | |
</DD> | |
<DD><DL> | |
</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="onDestroy()"><!-- --></A><H3> | |
onDestroy</H3> | |
<PRE> | |
void <B>onDestroy</B>()</PRE> | |
<DL> | |
<DD>The on destroy request event handler. Control classes should use this | |
method to add any resource clean up code. | |
<p/> | |
This method is guaranteed to be called before the Page object reference | |
goes out of scope and is available for garbage collection. | |
<p/> | |
<A HREF="../../../org/apache/click/control/Container.html" title="interface in org.apache.click.control"><CODE>Container</CODE></A> implementations should recursively | |
invoke the onDestroy method on each of their child controls ensuring that | |
all controls receive this event. | |
<p/> | |
<b>Please note:</b> a common problem when overriding onDestroy in | |
subclasses is forgetting to call <em>super.onDestroy()</em>. Consider | |
carefully whether you should call <em>super.onDestroy()</em> or not, | |
especially for <A HREF="../../../org/apache/click/control/Container.html" title="interface in org.apache.click.control"><CODE>Container</CODE></A>s which by default | |
call <em>onDestroy</em> on all their child controls as well. | |
<P> | |
<DD><DL> | |
</DL> | |
</DD> | |
<DD><DL> | |
</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="render(org.apache.click.util.HtmlStringBuffer)"><!-- --></A><H3> | |
render</H3> | |
<PRE> | |
void <B>render</B>(<A HREF="../../../org/apache/click/util/HtmlStringBuffer.html" title="class in org.apache.click.util">HtmlStringBuffer</A> buffer)</PRE> | |
<DL> | |
<DD>Render the control's HTML representation to the specified buffer. The | |
control's <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#toString()" title="class or interface in java.lang"><CODE>Object.toString()</CODE></A> method should delegate the | |
rendering to the render method for improved performance. | |
<p/> | |
An example implementation: | |
<pre class="prettyprint"> | |
public class Border extends AbstractContainer { | |
public String toString() { | |
int estimatedSizeOfControl = 100; | |
HtmlStringBuffer buffer = new HtmlStringBuffer(estimatedSizeOfControl); | |
render(buffer); | |
return buffer.toString(); | |
} | |
/** | |
* @see Control#render(HtmlStringBuffer) | |
*/ | |
public void render(HtmlStringBuffer buffer) { | |
buffer.elementStart("div"); | |
buffer.appendAttribute("name", getName()); | |
buffer.closeTag(); | |
buffer.append(getField()); | |
buffer.elementEnd("div"); | |
} | |
} | |
</pre> | |
<P> | |
<DD><DL> | |
</DL> | |
</DD> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>buffer</CODE> - the specified buffer to render the control's output to</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="hasBehaviors()"><!-- --></A><H3> | |
hasBehaviors</H3> | |
<PRE> | |
boolean <B>hasBehaviors</B>()</PRE> | |
<DL> | |
<DD>Returns <tt>true</tt> if this control has any | |
<tt>Behavior</tt>s registered, <tt>false</tt> otherwise. | |
<P> | |
<DD><DL> | |
</DL> | |
</DD> | |
<DD><DL> | |
<DT><B>Returns:</B><DD><tt>true</tt> if this control has any | |
<tt>Behavior</tt>s registered, <tt>false</tt> otherwise</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="getBehaviors()"><!-- --></A><H3> | |
getBehaviors</H3> | |
<PRE> | |
<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Set.html" title="class or interface in java.util">Set</A><<A HREF="../../../org/apache/click/Behavior.html" title="interface in org.apache.click">Behavior</A>> <B>getBehaviors</B>()</PRE> | |
<DL> | |
<DD>Returns the list of behaviors for this control. | |
<P> | |
<DD><DL> | |
</DL> | |
</DD> | |
<DD><DL> | |
<DT><B>Returns:</B><DD>the list with this control behaviors.</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="isAjaxTarget(org.apache.click.Context)"><!-- --></A><H3> | |
isAjaxTarget</H3> | |
<PRE> | |
boolean <B>isAjaxTarget</B>(<A HREF="../../../org/apache/click/Context.html" title="class in org.apache.click">Context</A> context)</PRE> | |
<DL> | |
<DD>Returns <tt>true</tt> if this control is an Ajax target, <tt>false</tt> | |
otherwise. | |
<p/> | |
In order for a Control to be considered as an Ajax target it must be | |
registered through <A HREF="../../../org/apache/click/ControlRegistry.html#registerAjaxTarget(org.apache.click.Control)"><CODE>ControlRegistry.registerAjaxTarget</CODE></A>. | |
<p/> | |
When the Click handles an Ajax request it iterates the Controls | |
registered with the <A HREF="../../../org/apache/click/ControlRegistry.html" title="class in org.apache.click"><CODE>ControlRegistry</CODE></A> | |
and checks if one of them is the Ajax target by calling | |
<A HREF="../../../org/apache/click/Control.html#isAjaxTarget(org.apache.click.Context)"><CODE>isAjaxTarget</CODE></A>. If <tt>isAjaxTarget</tt> | |
returns true, Click will process that Control's <A HREF="../../../org/apache/click/Control.html#getBehaviors()"><CODE>behaviors</CODE></A>. | |
<p/> | |
<b>Please note:</b> there can only be one target control, so the first | |
Control that is identified as the Ajax target will be processed, the other | |
controls will be skipped. | |
<p/> | |
The most common way to check whether a Control is the Ajax target is to | |
check if its <A HREF="../../../org/apache/click/Control.html#getId()"><CODE>ID</CODE></A> is available as a request parameter: | |
<pre class="prettyprint"> | |
public MyControl extends AbstractControl { | |
... | |
public boolean isAjaxTarget(Context context) { | |
return context.hasRequestParameter(getId()); | |
} | |
} </pre> | |
Not every scenario can be covered through an ID attribute though. For example | |
if an ActionLink is rendered multiple times on the same page, it cannot have an | |
ID attribute, as that would lead to duplicate IDs, which isn't allowed by | |
the HTML specification. Control implementations has to cater for how the | |
control will be targeted. In the case of ActionLink it might check against | |
its <tt>id</tt>, and if that isn't available check against its <tt>name</tt>. | |
<P> | |
<DD><DL> | |
</DL> | |
</DD> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>context</CODE> - the request context | |
<DT><B>Returns:</B><DD><tt>true</tt> if this control is an Ajax target, <tt>false</tt> | |
otherwise</DL> | |
</DD> | |
</DL> | |
<!-- ========= END OF CLASS DATA ========= --> | |
<HR> | |
<!-- ======= START OF BOTTOM NAVBAR ====== --> | |
<A NAME="navbar_bottom"><!-- --></A> | |
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> | |
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> | |
<TR> | |
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> | |
<A NAME="navbar_bottom_firstrow"><!-- --></A> | |
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> | |
<TR ALIGN="center" VALIGN="top"> | |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> | |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> | |
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> | |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> | |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> | |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> | |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> | |
</TR> | |
</TABLE> | |
</TD> | |
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> | |
</EM> | |
</TD> | |
</TR> | |
<TR> | |
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> | |
<A HREF="../../../org/apache/click/Context.html" title="class in org.apache.click"><B>PREV CLASS</B></A> | |
<A HREF="../../../org/apache/click/ControlRegistry.html" title="class in org.apache.click"><B>NEXT CLASS</B></A></FONT></TD> | |
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> | |
<A HREF="../../../index.html?org/apache/click/Control.html" target="_top"><B>FRAMES</B></A> | |
<A HREF="Control.html" target="_top"><B>NO FRAMES</B></A> | |
<SCRIPT type="text/javascript"> | |
<!-- | |
if(window==top) { | |
document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>'); | |
} | |
//--> | |
</SCRIPT> | |
<NOSCRIPT> | |
<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A> | |
</NOSCRIPT> | |
</FONT></TD> | |
</TR> | |
<TR> | |
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> | |
SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD> | |
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> | |
DETAIL: <A HREF="#field_detail">FIELD</A> | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD> | |
</TR> | |
</TABLE> | |
<A NAME="skip-navbar_bottom"></A> | |
<!-- ======== END OF BOTTOM NAVBAR ======= --> | |
<HR> | |
<style type='text/css'>.str{color:#2A00FF;}.kwd{color:#7F0055;font-weight:bold;}.com{color:#3F7F5F;}.typ{color:#000;}.lit{color:#066;}.pun{color:#660;}.pln{color:#000;}.tag{color:#000099;font-weight:bold;}.atn{color:#009900;}.atv{color:#000;}.dec{color:#606;}pre.prettyprint{padding:1em;border:1px solid #888;overflow:auto;}@media print{.str{color:#2A00FF;}.kwd{color:#7F0055;font-weight:bold;}.com{color:#3F7F5F;font-style:italic;}.typ{color:#000;font-weight:bold;}.lit{color:#044;}.pun{color:#440;}.pln{color:#000;}.tag{color:#000099;font-weight:bold;}.atn{color:#009900;}.atv{color:#000;}}</style><script type='text/javascript'>var PR_keywords={};(function(){var CPP_KEYWORDS='abstract bool break case catch char class const '+'const_cast continue default delete deprecated dllexport dllimport do '+'double dynamic_cast else enum explicit extern false float for friend '+'goto if inline int long mutable naked namespace new noinline noreturn '+'nothrow novtable operator private property protected public register '+'reinterpret_cast return selectany short signed sizeof static '+'static_cast struct switch template this thread throw true try typedef '+'typeid typename union unsigned using declaration, directive uuid '+'virtual void volatile while typeof';var CSHARP_KEYWORDS='as base by byte checked decimal delegate descending '+'event finally fixed foreach from group implicit in interface internal '+'into is lock null object override orderby params readonly ref sbyte '+'sealed stackalloc string select uint ulong unchecked unsafe ushort var';var JAVA_KEYWORDS='package synchronized boolean implements import throws '+'instanceof transient extends final strictfp native super';var JSCRIPT_KEYWORDS='debugger export function with NaN Infinity';var PERL_KEYWORDS='require sub unless until use elsif BEGIN END';var PYTHON_KEYWORDS='and assert def del elif except exec global lambda '+'not or pass print raise yield False True None';var RUBY_KEYWORDS='then end begin rescue ensure module when undef next '+'redo retry alias defined';var SH_KEYWORDS='done fi';var KEYWORDS=[CPP_KEYWORDS,CSHARP_KEYWORDS,JAVA_KEYWORDS,JSCRIPT_KEYWORDS,PERL_KEYWORDS,PYTHON_KEYWORDS,RUBY_KEYWORDS,SH_KEYWORDS];for(var k=0;k<KEYWORDS.length;k++){var kw=KEYWORDS[k].split(' ');for(var i=0;i<kw.length;i++){if(kw[i]){PR_keywords[kw[i]]=true;}}}}).call(this);var PR_STRING='str';var PR_KEYWORD='kwd';var PR_COMMENT='com';var PR_TYPE='typ';var PR_LITERAL='lit';var PR_PUNCTUATION='pun';var PR_PLAIN='pln';var PR_TAG='tag';var PR_DECLARATION='dec';var PR_SOURCE='src';var PR_ATTRIB_NAME='atn';var PR_ATTRIB_VALUE='atv';var PR_TAB_WIDTH=8;function PR_isWordChar(ch){return(ch>='a'&&ch<='z')||(ch>='A'&&ch<='Z');}function PR_spliceArrayInto(inserted,container,containerPosition,countReplaced){inserted.unshift(containerPosition,countReplaced||0);try{container.splice.apply(container,inserted);}finally{inserted.splice(0,2);}}var REGEXP_PRECEDER_PATTERN=(function(){var preceders=['!','!=','!==','#','%','%=','&','&&','&&=','&=','(','*','*=','+=',',','-=','->','/','/=',':','::',';','<','<<','<<=','<=','=','==','===','>','>=','>>','>>=','>>>','>>>=','?','@','[','^','^=','^^','^^=','{','|','|=','||','||=','~','break','case','continue','delete','do','else','finally','instanceof','return','throw','try','typeof'];var pattern='(?:'+'(?:(?:^|[^0-9\.])\\.{1,3})|'+'(?:(?:^|[^\\+])\\+)|'+'(?:(?:^|[^\\-])-)';for(var i=0;i<preceders.length;++i){var preceder=preceders[i];if(PR_isWordChar(preceder.charAt(0))){pattern+='|\\b'+preceder;}else{pattern+='|'+preceder.replace(/([^=<>:&])/g,'\\$1');}}pattern+='|^)\\s*$';return new RegExp(pattern);})();var pr_amp=/&/g;var pr_lt=/</g;var pr_gt=/>/g;var pr_quot=/"/g;function PR_attribToHtml(str){return str.replace(pr_amp,'&').replace(pr_lt,'<').replace(pr_gt,'>').replace(pr_quot,'"');}function PR_textToHtml(str){return str.replace(pr_amp,'&').replace(pr_lt,'<').replace(pr_gt,'>');}var pr_ltEnt=/</g;var pr_gtEnt=/>/g;var pr_aposEnt=/'/g;var pr_quotEnt=/"/g;var pr_ampEnt=/&/g;function PR_htmlToText(html){var pos=html.indexOf('&');if(pos<0){return html;}for(--pos;(pos=html.indexOf('&#',pos+1))>=0;){var end=html.indexOf(';',pos);if(end>=0){var num=html.substring(pos+3,end);var radix=10;if(num&&num.charAt(0)=='x'){num=num.substring(1);radix=16;}var codePoint=parseInt(num,radix);if(!isNaN(codePoint)){html=(html.substring(0,pos)+String.fromCharCode(codePoint)+html.substring(end+1));}}}return html.replace(pr_ltEnt,'<').replace(pr_gtEnt,'>').replace(pr_aposEnt,"'").replace(pr_quotEnt,'"').replace(pr_ampEnt,'&');}function PR_isRawContent(node){return'XMP'==node.tagName;}var PR_innerHtmlWorks=null;function PR_getInnerHtml(node){if(null===PR_innerHtmlWorks){var testNode=document.createElement('PRE');testNode.appendChild(document.createTextNode('<!DOCTYPE foo PUBLIC "foo bar">\n<foo />'));PR_innerHtmlWorks=!/</.test(testNode.innerHTML);}if(PR_innerHtmlWorks){var content=node.innerHTML;if(PR_isRawContent(node)){content=PR_textToHtml(content);}return content;}var out=[];for(var child=node.firstChild;child;child=child.nextSibling){PR_normalizedHtml(child,out);}return out.join('');}function PR_normalizedHtml(node,out){switch(node.nodeType){case 1:var name=node.tagName.toLowerCase();out.push('\074',name);for(var i=0;i<node.attributes.length;++i){var attr=node.attributes[i];if(!attr.specified){continue;}out.push(' ');PR_normalizedHtml(attr,out);}out.push('>');for(var child=node.firstChild;child;child=child.nextSibling){PR_normalizedHtml(child,out);}if(node.firstChild||!/^(?:br|link|img)$/.test(name)){out.push('<\/',name,'>');}break;case 2:out.push(node.name.toLowerCase(),'="',PR_attribToHtml(node.value),'"');break;case 3:case 4:out.push(PR_textToHtml(node.nodeValue));break;}}function PR_tabExpander(tabWidth){var SPACES=' ';var charInLine=0;return function(plainText){var out=null;var pos=0;for(var i=0,n=plainText.length;i<n;++i){var ch=plainText.charAt(i);switch(ch){case'\t':if(!out){out=[];}out.push(plainText.substring(pos,i));var nSpaces=tabWidth-(charInLine%tabWidth);charInLine+=nSpaces;for(;nSpaces>=0;nSpaces-=SPACES.length){out.push(SPACES.substring(0,nSpaces));}pos=i+1;break;case'\n':charInLine=0;break;default:++charInLine;}}if(!out){return plainText;}out.push(plainText.substring(pos));return out.join('');};}var pr_chunkPattern=/(?:[^<]+|<!--[\s\S]*?-->|<!\[CDATA\[([\s\S]*?)\]\]>|<\/?[a-zA-Z][^>]*>|<)/g;var pr_commentPrefix=/^<!--/;var pr_cdataPrefix=/^<\[CDATA\[/;var pr_brPrefix=/^<br\b/i;function PR_extractTags(s){var matches=s.match(pr_chunkPattern);var sourceBuf=[];var sourceBufLen=0;var extractedTags=[];if(matches){for(var i=0,n=matches.length;i<n;++i){var match=matches[i];if(match.length>1&&match.charAt(0)==='<'){if(pr_commentPrefix.test(match)){continue;}if(pr_cdataPrefix.test(match)){sourceBuf.push(match.substring(9,match.length-3));sourceBufLen+=match.length-12;}else if(pr_brPrefix.test(match)){sourceBuf.push('\n');sourceBufLen+=1;}else{extractedTags.push(sourceBufLen,match);}}else{var literalText=PR_htmlToText(match);sourceBuf.push(literalText);sourceBufLen+=literalText.length;}}}return{source:sourceBuf.join(''),tags:extractedTags};}function PR_createSimpleLexer(shortcutStylePatterns,fallthroughStylePatterns){var shortcuts={};(function(){var allPatterns=shortcutStylePatterns.concat(fallthroughStylePatterns);for(var i=allPatterns.length;--i>=0;){var patternParts=allPatterns[i];var shortcutChars=patternParts[3];if(shortcutChars){for(var c=shortcutChars.length;--c>=0;){shortcuts[shortcutChars.charAt(c)]=patternParts;}}}})();var nPatterns=fallthroughStylePatterns.length;return function(sourceCode,opt_basePos){opt_basePos=opt_basePos||0;var decorations=[opt_basePos,PR_PLAIN];var lastToken='';var pos=0;var tail=sourceCode;while(tail.length){var style;var token=null;var patternParts=shortcuts[tail.charAt(0)];if(patternParts){var match=tail.match(patternParts[1]);token=match[0];style=patternParts[0];}else{for(var i=0;i<nPatterns;++i){patternParts=fallthroughStylePatterns[i];var contextPattern=patternParts[2];if(contextPattern&&!contextPattern.test(lastToken)){continue;}var match=tail.match(patternParts[1]);if(match){token=match[0];style=patternParts[0];break;}}if(!token){style=PR_PLAIN;token=tail.substring(0,1);}}decorations.push(opt_basePos+pos,style);pos+=token.length;tail=tail.substring(token.length);if(style!==PR_COMMENT&&/\S/.test(token)){lastToken=token;}}return decorations;};}var PR_C_STYLE_STRING_AND_COMMENT_LEXER=PR_createSimpleLexer([[PR_STRING,/^\'(?:[^\\\']|\\[\s\S])*(?:\'|$)/,null,"'"],[PR_STRING,/^"(?:[^\\"]|\\[\s\S])*(?:"|$)/,null,'"'],[PR_STRING,/^\`(?:[^\\\`]|\\[\s\S])*(?:\`|$)/,null,'`']],[[PR_PLAIN,/^(?:[^\'"\`\/\#]+)/,null,' \r\n'],[PR_COMMENT,/^#[^\r\n]*/,null,'#'],[PR_COMMENT,/^\/\/[^\r\n]*/,null],[PR_STRING,/^\/(?:[^\\\*\/]|\\[\s\S])+(?:\/|$)/,REGEXP_PRECEDER_PATTERN],[PR_COMMENT,/^\/\*[\s\S]*?(?:\*\/|$)/,null]]);function PR_splitStringAndCommentTokens(sourceCode){return PR_C_STYLE_STRING_AND_COMMENT_LEXER(sourceCode);}var PR_C_STYLE_LITERAL_IDENTIFIER_PUNC_RECOGNIZER=PR_createSimpleLexer([],[[PR_PLAIN,/^\s+/,null,' \r\n'],[PR_PLAIN,/^[a-z_$@][a-z_$@0-9]*/i,null],[PR_LITERAL,/^0x[a-f0-9]+[a-z]/i,null],[PR_LITERAL,/^(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?[a-z]*/i,null,'123456789'],[PR_PUNCTUATION,/^[^\s\w\.$@]+/,null]]);function PR_splitNonStringNonCommentTokens(source,decorations){for(var i=0;i<decorations.length;i+=2){var style=decorations[i+1];if(style===PR_PLAIN){var start=decorations[i];var end=i+2<decorations.length?decorations[i+2]:source.length;var chunk=source.substring(start,end);var subDecs=PR_C_STYLE_LITERAL_IDENTIFIER_PUNC_RECOGNIZER(chunk,start);for(var j=0,m=subDecs.length;j<m;j+=2){var subStyle=subDecs[j+1];if(subStyle===PR_PLAIN){var subStart=subDecs[j];var subEnd=j+2<m?subDecs[j+2]:chunk.length;var token=source.substring(subStart,subEnd);if(token=='.'){subDecs[j+1]=PR_PUNCTUATION;}else if(token in PR_keywords){subDecs[j+1]=PR_KEYWORD;}else if(/^@?[A-Z][A-Z$]*[a-z][A-Za-z$]*$/.test(token)){subDecs[j+1]=token.charAt(0)=='@'?PR_LITERAL:PR_TYPE;}}}PR_spliceArrayInto(subDecs,decorations,i,2);i+=subDecs.length-2;}}return decorations;}var PR_MARKUP_LEXER=PR_createSimpleLexer([],[[PR_PLAIN,/^[^<]+/,null],[PR_DECLARATION,/^<!\w[^>]*(?:>|$)/,null],[PR_COMMENT,/^<!--[\s\S]*?(?:-->|$)/,null],[PR_SOURCE,/^<\?[\s\S]*?(?:\?>|$)/,null],[PR_SOURCE,/^<%[\s\S]*?(?:%>|$)/,null],[PR_SOURCE,/^<(script|style|xmp)\b[^>]*>[\s\S]*?<\/\1\b[^>]*>/i,null],[PR_TAG,/^<\/?\w[^<>]*>/,null]]);var PR_SOURCE_CHUNK_PARTS=/^(<[^>]*>)([\s\S]*)(<\/[^>]*>)$/;function PR_tokenizeMarkup(source){var decorations=PR_MARKUP_LEXER(source);for(var i=0;i<decorations.length;i+=2){if(decorations[i+1]===PR_SOURCE){var start=decorations[i];var end=i+2<decorations.length?decorations[i+2]:source.length;var sourceChunk=source.substring(start,end);var match=(sourceChunk.match(PR_SOURCE_CHUNK_PARTS));if(match){decorations.splice(i,2,start,PR_TAG,start+match[1].length,PR_SOURCE,start+match[1].length+(match[2]||'').length,PR_TAG);}}}return decorations;}var PR_TAG_LEXER=PR_createSimpleLexer([[PR_ATTRIB_VALUE,/^\'[^\']*(?:\'|$)/,null,"'"],[PR_ATTRIB_VALUE,/^"[^"]*(?:"|$)/,null,'"'],[PR_PUNCTUATION,/^[<>\/=]+/,null,'<>/=']],[[PR_TAG,/^[\w-]+/,/^</],[PR_ATTRIB_VALUE,/^[\w-]+/,/^=/],[PR_ATTRIB_NAME,/^[\w-]+/,null],[PR_PLAIN,/^\s+/,null,' \r\n']]);function PR_splitTagAttributes(source,decorations){for(var i=0;i<decorations.length;i+=2){var style=decorations[i+1];if(style===PR_TAG){var start=decorations[i];var end=i+2<decorations.length?decorations[i+2]:source.length;var chunk=source.substring(start,end);var subDecorations=PR_TAG_LEXER(chunk,start);PR_spliceArrayInto(subDecorations,decorations,i,2);i+=subDecorations.length-2;}}return decorations;}function PR_splitSourceNodes(source,decorations){for(var i=0;i<decorations.length;i+=2){var style=decorations[i+1];if(style==PR_SOURCE){var start=decorations[i];var end=i+2<decorations.length?decorations[i+2]:source.length;var subDecorations=PR_decorateSource(source.substring(start,end));for(var j=0,m=subDecorations.length;j<m;j+=2){subDecorations[j]+=start;}PR_spliceArrayInto(subDecorations,decorations,i,2);i+=subDecorations.length-2;}}return decorations;}function PR_splitSourceAttributes(source,decorations){var nextValueIsSource=false;for(var i=0;i<decorations.length;i+=2){var style=decorations[i+1];if(style===PR_ATTRIB_NAME){var start=decorations[i];var end=i+2<decorations.length?decorations[i+2]:source.length;nextValueIsSource=/^on|^style$/i.test(source.substring(start,end));}else if(style==PR_ATTRIB_VALUE){if(nextValueIsSource){var start=decorations[i];var end=i+2<decorations.length?decorations[i+2]:source.length;var attribValue=source.substring(start,end);var attribLen=attribValue.length;var quoted=(attribLen>=2&&/^["\']/.test(attribValue)&&attribValue.charAt(0)===attribValue.charAt(attribLen-1));var attribSource;var attribSourceStart;var attribSourceEnd;if(quoted){attribSourceStart=start+1;attribSourceEnd=end-1;attribSource=attribValue;}else{attribSourceStart=start+1;attribSourceEnd=end-1;attribSource=attribValue.substring(1,attribValue.length-1);}var attribSourceDecorations=PR_decorateSource(attribSource);for(var j=0,m=attribSourceDecorations.length;j<m;j+=2){attribSourceDecorations[j]+=attribSourceStart;}if(quoted){attribSourceDecorations.push(attribSourceEnd,PR_ATTRIB_VALUE);PR_spliceArrayInto(attribSourceDecorations,decorations,i+2,0);}else{PR_spliceArrayInto(attribSourceDecorations,decorations,i,2);}}nextValueIsSource=false;}}return decorations;}function PR_decorateSource(sourceCode){var decorations=PR_splitStringAndCommentTokens(sourceCode);decorations=PR_splitNonStringNonCommentTokens(sourceCode,decorations);return decorations;}function PR_decorateMarkup(sourceCode){var decorations=PR_tokenizeMarkup(sourceCode);decorations=PR_splitTagAttributes(sourceCode,decorations);decorations=PR_splitSourceNodes(sourceCode,decorations);decorations=PR_splitSourceAttributes(sourceCode,decorations);return decorations;}function PR_recombineTagsAndDecorations(sourceText,extractedTags,decorations){var html=[];var outputIdx=0;var openDecoration=null;var currentDecoration=null;var tagPos=0;var decPos=0;var tabExpander=PR_tabExpander(PR_TAB_WIDTH);function emitTextUpTo(sourceIdx){if(sourceIdx>outputIdx){if(openDecoration&&openDecoration!==currentDecoration){html.push('</span>');openDecoration=null;}if(!openDecoration&¤tDecoration){openDecoration=currentDecoration;html.push('<span class="',openDecoration,'">');}var htmlChunk=PR_textToHtml(tabExpander(sourceText.substring(outputIdx,sourceIdx))).replace(/(\r\n?|\n| ) /g,'$1 ').replace(/\r\n?|\n/g,' <br>');html.push(htmlChunk);outputIdx=sourceIdx;}}while(true){var outputTag;if(tagPos<extractedTags.length){if(decPos<decorations.length){outputTag=extractedTags[tagPos]<=decorations[decPos];}else{outputTag=true;}}else{outputTag=false;}if(outputTag){emitTextUpTo(extractedTags[tagPos]);if(openDecoration){html.push('</span>');openDecoration=null;}html.push(extractedTags[tagPos+1]);tagPos+=2;}else if(decPos<decorations.length){emitTextUpTo(decorations[decPos]);currentDecoration=decorations[decPos+1];decPos+=2;}else{break;}}emitTextUpTo(sourceText.length);if(openDecoration){html.push('</span>');}return html.join('');}function prettyPrintOne(sourceCodeHtml){try{var sourceAndExtractedTags=PR_extractTags(sourceCodeHtml);var source=sourceAndExtractedTags.source;var extractedTags=sourceAndExtractedTags.tags;var isMarkup=/^\s*</.test(source)&&/>\s*$/.test(source);var decorations=isMarkup?PR_decorateMarkup(source):PR_decorateSource(source);return PR_recombineTagsAndDecorations(source,extractedTags,decorations);}catch(e){if('console'in window){console.log(e);console.trace();}return sourceCodeHtml;}}var PR_SHOULD_USE_CONTINUATION=true;function prettyPrint(opt_whenDone){var codeSegments=[document.getElementsByTagName('pre'),document.getElementsByTagName('code'),document.getElementsByTagName('xmp')];var elements=[];for(var i=0;i<codeSegments.length;++i){for(var j=0;j<codeSegments[i].length;++j){elements.push(codeSegments[i][j]);}}codeSegments=null;var k=0;function doWork(){var endTime=(PR_SHOULD_USE_CONTINUATION?new Date().getTime()+250:Infinity);for(;k<elements.length&&new Date().getTime()<endTime;k++){var cs=elements[k];if(cs.className&&cs.className.indexOf('prettyprint')>=0){var nested=false;for(var p=cs.parentNode;p!=null;p=p.parentNode){if((p.tagName=='pre'||p.tagName=='code'||p.tagName=='xmp')&&p.className&&p.className.indexOf('prettyprint')>=0){nested=true;break;}}if(!nested){var content=PR_getInnerHtml(cs);content=content.replace(/(?:\r\n?|\n)$/,'');var newContent=prettyPrintOne(content);if(!PR_isRawContent(cs)){cs.innerHTML=newContent;}else{var pre=document.createElement('PRE');for(var i=0;i<cs.attributes.length;++i){var a=cs.attributes[i];if(a.specified){pre.setAttribute(a.name,a.value);}}pre.innerHTML=newContent;cs.parentNode.replaceChild(pre,cs);}}}}if(k<elements.length){setTimeout(doWork,250);}else if(opt_whenDone){opt_whenDone();}}doWork();}</script><script type='text/javascript'>prettyPrint();</script></BODY> | |
</HTML> |