PAJES 3.0.21

org.pajes.html
Class SubmitAnchor

java.lang.Object
  extended by org.pajes.html.Tag
      extended by org.pajes.html.Input
          extended by org.pajes.html.Submit
              extended by org.pajes.html.SubmitAnchor
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, HTML, TextContainer

public class SubmitAnchor
extends Submit
implements TextContainer

This class builds an HTML ANCHOR tag (<A></A>) that can submit a form or act as a standard hyper-link.

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
SubmitAnchor(Anchor source, Form form)
          Create an HTML Anchor tag which performs a submit of a form for an existing Anchor instance.
SubmitAnchor(Form form, HTML object)
          Create an HTML Anchor tag which performs a submit of a form.
SubmitAnchor(Form form, HTML object, boolean disableOnClickValidation)
          Create an HTML Anchor tag which performs a submit of a form.
SubmitAnchor(Form form, java.lang.String text)
          Create an HTML Anchor tag which performs a submit of a form.
SubmitAnchor(Form form, java.lang.String text, boolean disableOnClickValidation)
          Create an HTML Anchor tag which performs a submit of a form.
 
Method Summary
 SubmitAnchor addParameter(java.lang.String name)
          Add a parameter to the URL where the value of the parameter is determined from the current request (either the query string or a submitted form).
 SubmitAnchor addParameter(java.lang.String name, Input field)
          Add a parameter to the URL where the value of the parameter is determined at button press time by the value of a specified Input field.
 SubmitAnchor addParameter(java.lang.String name, java.lang.String value)
          Add a parameter to the URL.
 java.lang.Object clone()
          Performs a deep clone, cloning and replacing the validation functions, and fixing "this" parameter references.
 java.lang.String getContainedText()
          Returns the text that this object contains.
protected  HTML getText()
          Returns the text that this anchor or link surrounds.
protected  void init()
          Called by the constructor and the Tag.destroy() method to correctly clear and initialise internal variables.
 SubmitAnchor setBase(java.lang.String href)
          Sets the base URL.
 SubmitAnchor setTarget(java.lang.String frameTarget)
          Sets the target frame of the anchor.
 SubmitAnchor setText(HTML text)
          Sets the text of the anchor.
 SubmitAnchor setText(java.lang.String text)
          Sets the text of the anchor.
 SubmitAnchor setURL(java.lang.String url)
          Sets the destination URL of the anchor.
 Input setValue(java.lang.String value)
          Over-rides Input.setValue(java.lang.String) to consistently set the display value of that anchor, in the same way that setValue on SubmitButton sets the display value of the button.
protected  void writeContent(Browser browser)
          Called by the Submit.write(org.pajes.servlet.Browser) method to write the actual tag to the browser.
protected  void writeSubmitJavaScript(Browser browser, java.lang.StringBuilder onClickHandler)
          Called by the Submit.write(org.pajes.servlet.Browser) method to append the appropriate JavaScript to the OnClick handler written to the browser to handle the form submission.
 
Methods inherited from class org.pajes.html.Submit
getHiddenField, getHiddenFieldValue, getInactiveText, isActive, isOnChangeCheckingDisabled, isOnClickValidationDisabled, setActive, setChanged, setCheckForChangedFields, setCheckForChangedFieldsConfirmation, setHiddenField, setInactiveText, setInactiveText, setOnClickValidation, setSubmitConfirmation, write, writeTag
 
Methods inherited from class org.pajes.html.Input
addClientValidation, addContent, getClientValidation, getClientValidation, getDOMReference, getFieldNameForErrorMessage, getForm, getInstance, getLabel, getName, getOnBlurHandler, getOnChangeHandler, getOnFocusHandler, getOnSelectHandler, getReadOnlyStyleSheetClass, getTabIndex, getType, getValue, isChangeFlagEnabled, isDisabled, isReadOnly, isRequiringValidation, logNoFormWarning, removeClientValidation, removeClientValidation, removeClientValidation, removeMandatoryClientValidation, setChangedFlag, setContent, setDisabled, setFieldNameInErrorMessage, setFieldNameInErrorMessage, setForm, setId, setLabel, setName, setOnBlurHandler, setOnBlurValidation, setOnChangeHandler, setOnClickHandler, setOnFocusHandler, setOnSelectHandler, setReadOnly, setReadOnlyStyleSheetClass, setTabIndex, setTabIndex, setTabIndex
 
Methods inherited from class org.pajes.html.Tag
addAttribute, addAttributes, addAttributes, clearAttribute, clearAttributes, destroy, getAttribute, getAttributes, getAttributeSet, getContainer, getContent, getDocument, getId, getOnClickHandler, getOnDBLClickHandler, getOnKeyDownHandler, getOnKeyPressHandler, getOnKeyUpHandler, getOnMouseDownHandler, getOnMouseOutHandler, getOnMouseOverHandler, getOnMouseUpHandler, getParent, getStyle, getStyleSheetClass, getTagName, getTitle, getWritePermission, hasAttribute, initAttributes, isChildOf, isChildOf, isWritable, isWritable, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttributes, setAttributes, setContainer, setContent, setOnDBLClickHandler, setOnKeyDownHandler, setOnKeyPressHandler, setOnKeyUpHandler, setOnMouseDownHandler, setOnMouseOutHandler, setOnMouseOverHandler, setOnMouseUpHandler, setParent, setStyle, setStyleSheetClass, setTagName, setTitle, setWritable, setWriteAttributes, setWriteEndTag, setWritelnAfter, setWritelnAfterContent, setWritelnBefore, setWritelnBeforeContent, setWritePermission, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SubmitAnchor

public SubmitAnchor(Anchor source,
                    Form form)
Create an HTML Anchor tag which performs a submit of a form for an existing Anchor instance. All attributes of the Anchor are copied, except any defined OnClick handler, because the SubmitAnchor builds it's own OnClick handler to perform the submit.

Parameters:
source - the Anchor instance to be copied.
form - the form which is to be submitted.

SubmitAnchor

public SubmitAnchor(Form form,
                    HTML object)
Create an HTML Anchor tag which performs a submit of a form.

Parameters:
form - the form which is to be submitted.
object - the HTML Object to appear in the anchor

SubmitAnchor

public SubmitAnchor(Form form,
                    HTML object,
                    boolean disableOnClickValidation)
Create an HTML Anchor tag which performs a submit of a form.

Parameters:
form - the form which is to be submitted.
object - the HTML Object to appear in the anchor
disableOnClickValidation - if true, suppresses the onClick validation.

SubmitAnchor

public SubmitAnchor(Form form,
                    java.lang.String text)
Create an HTML Anchor tag which performs a submit of a form.

Parameters:
form - the form which is to be submitted.
text - the text to appear in the anchor.

SubmitAnchor

public SubmitAnchor(Form form,
                    java.lang.String text,
                    boolean disableOnClickValidation)
Create an HTML Anchor tag which performs a submit of a form.

Parameters:
form - the form which is to be submitted.
text - the text to appear in the anchor.
disableOnClickValidation - if true, suppresses the onClick validation.
Method Detail

addParameter

public SubmitAnchor addParameter(java.lang.String name)
Add a parameter to the URL where the value of the parameter is determined from the current request (either the query string or a submitted form).

Parameters:
name - the name of the variable name.
Returns:
the modified SubmitAnchor instance.

addParameter

public SubmitAnchor addParameter(java.lang.String name,
                                 Input field)
                          throws java.lang.IllegalArgumentException
Add a parameter to the URL where the value of the parameter is determined at button press time by the value of a specified Input field.

Note that you cannot add another SubmitAnchor as a parameter. this will throw an IllegalArgumentException.

Parameters:
name - the name of the variable name
field - the Input field containing the value
Returns:
the modified SubmitAnchor instance.
Throws:
java.lang.IllegalArgumentException - if the field is an instance of SubmitAnchor.

addParameter

public SubmitAnchor addParameter(java.lang.String name,
                                 java.lang.String value)
Add a parameter to the URL.

Parameters:
name - the name of the variable name.
value - the value of the parameter.
Returns:
the modified SubmitAnchor instance.

clone

public java.lang.Object clone()
Performs a deep clone, cloning and replacing the validation functions, and fixing "this" parameter references.

Specified by:
clone in interface HTML
Overrides:
clone in class Input
Returns:
the cloned instance.

getContainedText

public java.lang.String getContainedText()
Returns the text that this object contains.

Specified by:
getContainedText in interface TextContainer
Returns:
the text that this object contains.

setBase

public SubmitAnchor setBase(java.lang.String href)
Sets the base URL. SubmitAnchor builds a string of JavaScript to carry out its functionality, and relies on the location.href= syntax. However, if a relative URL is used and a <BASE> header tag relied upon, the process will fail as location.href= does not appear ot observer the <BASE> tag.

Parameters:
href - the base URL that will be pre-pended to any relative URL. If provided, it must have a trailing /.
Returns:
the modified SubmitAnchor object.
See Also:
setURL(java.lang.String)

setTarget

public SubmitAnchor setTarget(java.lang.String frameTarget)
Sets the target frame of the anchor.

Parameters:
frameTarget - the name of the target frame.
Returns:
the modified SubmitAnchor object.

setText

public SubmitAnchor setText(HTML text)
Sets the text of the anchor.

Parameters:
text - is the HTML text object to be displayed.
Returns:
the modified SubmitAnchor object.

setText

public SubmitAnchor setText(java.lang.String text)
Sets the text of the anchor.

Parameters:
text - is the text to be displayed.
Returns:
the modified SubmitAnchor object.

setURL

public SubmitAnchor setURL(java.lang.String url)
Sets the destination URL of the anchor.

Parameters:
url - the destination URL.
Returns:
the modified SubmitAnchor object.
See Also:
setBase(java.lang.String)

setValue

public Input setValue(java.lang.String value)
Over-rides Input.setValue(java.lang.String) to consistently set the display value of that anchor, in the same way that setValue on SubmitButton sets the display value of the button. If a hidden field has been defined, it's value will also be set to the specified value when this anchor is selected.

Overrides:
setValue in class Input
Parameters:
value - the value to assign.
Returns:
the modified Input object.

getText

protected HTML getText()
Returns the text that this anchor or link surrounds.

Returns:
the HTML object representing the displayed contents of this anchor or link.

init

protected void init()
Called by the constructor and the Tag.destroy() method to correctly clear and initialise internal variables.

Overrides:
init in class Tag

writeContent

protected void writeContent(Browser browser)
                     throws java.io.IOException
Called by the Submit.write(org.pajes.servlet.Browser) method to write the actual tag to the browser.

Overrides:
writeContent in class Tag
Parameters:
browser - the browser to which the results are to be output.
Throws:
java.io.IOException - if an I/O error occurs writing to the browser.
See Also:
Tag.setWriteEndTag(boolean)

writeSubmitJavaScript

protected void writeSubmitJavaScript(Browser browser,
                                     java.lang.StringBuilder onClickHandler)
Called by the Submit.write(org.pajes.servlet.Browser) method to append the appropriate JavaScript to the OnClick handler written to the browser to handle the form submission.

Overrides:
writeSubmitJavaScript in class Submit
Parameters:
browser - the browser to which the results are to be output.
onClickHandler - the onClickHandler to which the JavaScript code should be appended.

PAJES 3.0.21

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