PAJES 3.0.21

org.pajes.html
Class Script

java.lang.Object
  extended by org.pajes.html.Tag
      extended by org.pajes.html.TraversableElement
          extended by org.pajes.html.Container
              extended by org.pajes.html.Script
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, HTML, Traversable

public class Script
extends Container

This class generates the tags to send JavaScript to the client.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.pajes.html.Tag
ON_CLICK_ATTRIBUTE, TAG_CLOSE, TAG_LEFT, TAG_RIGHT
 
Constructor Summary
Script()
          Creates the <script> tags.
Script(java.lang.String sourceFileURL)
          Allows for a file containing the JavaScript to be specified in the constructor.
 
Method Summary
 Traversable add(HTML plainText)
          Over-rides Container.add(HTML) to prevent anything except text being added to a script object.
 Container add(java.lang.String code, boolean suppressNewLine)
          Adds a line of code to the script.
 java.lang.String getSourceName()
          Retreives the URL of the file containing the JavaScript source.
 boolean hasSourceFile()
          Determines if this script draws its JavaScript source file from the server, rather than from lines of text contained between the script tags.
protected  void setAttribute(TagAttribute attribute)
          Adds the specified attribute.
 Script setLanguage(java.lang.String language)
          Sets the scripting language for the script statements.
 Script setSourceName(java.lang.String sourceFileURL)
          Allows for a file containing the JavaScript to be specified.
 Script setType(java.lang.String contentType)
          Sets the content type of the script statements.
 
Methods inherited from class org.pajes.html.Container
add, add, addContent, clear, clone, delete, delete, destroy, get, getContent, getContents, getPosition, insert, replace, set, setContent, setContent, size, writeContent
 
Methods inherited from class org.pajes.html.TraversableElement
dump, dump, getAll, getFieldByName, getFirstFieldByName, getFirstTagByAttribute, getFirstTagByClass, getFirstTagByID, getFirstTagByName, getTagByAttribute, getTagByClass, getTagByID, getTagByName, setWritable
 
Methods inherited from class org.pajes.html.Tag
addAttribute, addAttributes, addAttributes, clearAttribute, clearAttributes, getAttribute, getAttributes, getAttributeSet, getContainer, getDocument, getId, getOnClickHandler, getOnDBLClickHandler, getOnKeyDownHandler, getOnKeyPressHandler, getOnKeyUpHandler, getOnMouseDownHandler, getOnMouseOutHandler, getOnMouseOverHandler, getOnMouseUpHandler, getParent, getStyle, getStyleSheetClass, getTagName, getTitle, getWritePermission, hasAttribute, init, initAttributes, isChildOf, isChildOf, isWritable, isWritable, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttributes, setAttributes, setContainer, setId, setOnClickHandler, setOnDBLClickHandler, setOnKeyDownHandler, setOnKeyPressHandler, setOnKeyUpHandler, setOnMouseDownHandler, setOnMouseOutHandler, setOnMouseOverHandler, setOnMouseUpHandler, setParent, setStyle, setStyleSheetClass, setTagName, setTitle, setWritable, setWriteAttributes, setWriteEndTag, setWritelnAfter, setWritelnAfterContent, setWritelnBefore, setWritelnBeforeContent, setWritePermission, toString, write
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.pajes.html.Traversable
isWritable
 
Methods inherited from interface org.pajes.html.HTML
getContainer, getDocument, getId, getParent, getWritePermission, isChildOf, isChildOf, setContainer, setParent, setWritePermission, write
 

Constructor Detail

Script

public Script()
Creates the <script> tags.


Script

public Script(java.lang.String sourceFileURL)
Allows for a file containing the JavaScript to be specified in the constructor.

Parameters:
sourceFileURL - the URL of the file containing the JavaScript source.
Method Detail

add

public Traversable add(HTML plainText)
Over-rides Container.add(HTML) to prevent anything except text being added to a script object.

Specified by:
add in interface Traversable
Overrides:
add in class Container
Parameters:
plainText - the object to be added
Returns:
the updated Container instance.
Throws:
TagException - if anything except PlainText is added to the script.

add

public Container add(java.lang.String code,
                     boolean suppressNewLine)
Adds a line of code to the script.

Overrides:
add in class Container
Parameters:
code - the line of executable script code.
suppressNewLine - suppresses a new line after the text.
Returns:
the modified Container object.
Throws:
TagException - if the SRC attribute has already been defined on this script.

getSourceName

public java.lang.String getSourceName()
Retreives the URL of the file containing the JavaScript source.

Returns:
the URL of the file containing the JavaScript source, or null if it has no file been defined.

hasSourceFile

public boolean hasSourceFile()
Determines if this script draws its JavaScript source file from the server, rather than from lines of text contained between the script tags.

Returns:
true if this script draws its JavaScript source file from the server.

setLanguage

public Script setLanguage(java.lang.String language)
Sets the scripting language for the script statements. The default is "JavaScript";

Parameters:
language - the scripting language for the script statments.
Returns:
the modified Script object.

setSourceName

public Script setSourceName(java.lang.String sourceFileURL)
Allows for a file containing the JavaScript to be specified.

Parameters:
sourceFileURL - the URL of the file containing the JavaScript source.
Returns:
the modified Script object.
Throws:
TagException - if any script content has already been add(org.pajes.html.HTML)ed to this script.

setType

public Script setType(java.lang.String contentType)
Sets the content type of the script statements. The default is "text/javascript";

Parameters:
contentType - the content type of the script statements.
Returns:
the modified Script object.

setAttribute

protected void setAttribute(TagAttribute attribute)
Description copied from class: Tag
Adds the specified attribute.

Overrides:
setAttribute in class Tag
Parameters:
attribute - The attribute.
See Also:
Tag.setAttribute(org.pajes.html.TagAttribute)

PAJES 3.0.21

Copyright © 1998-2007 Viridian Pty Limited. All Rights Reserved.