jaxcent
Class HtmlUploadForm

java.lang.Object
  extended byjaxcent.JaxcentObject
      extended byjaxcent.JaxcentHtmlElement
          extended byjaxcent.HtmlForm
              extended byjaxcent.HtmlUploadForm

public class HtmlUploadForm
extends HtmlForm

The class HtmlUploadForm extends HtmlForm, and is meant for processing file uploading. It corresponds to FORM tags. The FORM should contain an INPUT of type FILE, and a SUBMIT button. It may contain other input tags. The value of these inputs at the time of file upload can be retrieved in "onUploadData".

The action, method, encoding type and target of the form are set by Jaxcent on page load, and do not need to be set. (If specified in the FORM tag, these will be over-written.)


Constructor Summary
HtmlUploadForm(JaxcentPage page, SearchType searchType, java.lang.String str)
          Search for HTML element on page by specified search type and search string.
HtmlUploadForm(JaxcentPage page, SearchType searchType, java.lang.String[] attributes, java.lang.String[] values)
          Create new HTML element on page using the specified attributes and values.
HtmlUploadForm(JaxcentPage page, SearchType searchType, java.lang.String str, int index)
          Search for HTML Element on page by specified search type and search string, and search index.
HtmlUploadForm(JaxcentPage page, SearchType searchType, java.lang.String tag, java.lang.String text)
          Create new HTML Element on page using the specified tag.
HtmlUploadForm(JaxcentPage page, SearchType searchType, java.lang.String text, java.lang.String[] attributes, java.lang.String[] values)
          Create new HTML element on page using the specified text and attributes and values.
HtmlUploadForm(JaxcentPage page, java.lang.String id)
          Search for HTML element on page by specified ID
 
Method Summary
protected  void onUploadData(java.util.Map params, java.util.Map fileBytes)
          onUploadData is called after the completion of an upload operation.
protected  void onUploadDone(boolean success)
          onUploadDone can be overridden to receive notification of upload completion.
protected  void onUploadProgress(int bytesReceived, int totalBytes)
          onUploadProgress can be overridden to receive intermediate notifications of upload progress.
protected  void onUploadStart(int totalBytes)
          onUploadStart can be overridden to receive notification when uploads are started.
 
Methods inherited from class jaxcent.HtmlForm
getAction, getLength, getMethod, getName, getTarget, onBlur, onClick, onFocus, onMouseDown, onMouseUp, onReset, onSubmit, onSubmit, reset, scrollIntoView, setAction, setMethod, setName, setTarget, submit
 
Methods inherited from class jaxcent.JaxcentHtmlElement
checkNodeExists, deleteElement, getAttribute, getID, getInnerText, getStyle, getTag, hide, insertAfter, insertAtBeginning, insertAtBeginning, insertAtEnd, insertAtEnd, insertBefore, onDragDrop, setAttribute, setCssClass, setDraggable, setEnabled, setInnerText, setStyle, setStyle, setStyle, setStyle, setVisible, show
 
Methods inherited from class jaxcent.JaxcentObject
addJavaScriptVerification, getId, getProperty, getSelectedIndex, getSelectedValue, setId, setProperty, setProperty, setProperty, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HtmlUploadForm

public HtmlUploadForm(JaxcentPage page,
                      java.lang.String id)
Search for HTML element on page by specified ID


HtmlUploadForm

public HtmlUploadForm(JaxcentPage page,
                      SearchType searchType,
                      java.lang.String str)
Search for HTML element on page by specified search type and search string. If the search returns multiple objects, use the first one.


HtmlUploadForm

public HtmlUploadForm(JaxcentPage page,
                      SearchType searchType,
                      java.lang.String str,
                      int index)
Search for HTML Element on page by specified search type and search string, and search index. The search is expected to return multiple results. The search index is 0-based, and specifies the index in the multiple results. This constructor is not for use with createNew.


HtmlUploadForm

public HtmlUploadForm(JaxcentPage page,
                      SearchType searchType,
                      java.lang.String tag,
                      java.lang.String text)
               throws Jaxception
Create new HTML Element on page using the specified tag. Search type must be createNew and tag must be "FORM". If text is non null, the new element is populated with that text.


HtmlUploadForm

public HtmlUploadForm(JaxcentPage page,
                      SearchType searchType,
                      java.lang.String[] attributes,
                      java.lang.String[] values)
               throws Jaxception
Create new HTML element on page using the specified attributes and values. Search type must be createNew. Attributes and values arrays must have the same length.


HtmlUploadForm

public HtmlUploadForm(JaxcentPage page,
                      SearchType searchType,
                      java.lang.String text,
                      java.lang.String[] attributes,
                      java.lang.String[] values)
               throws Jaxception
Create new HTML element on page using the specified text and attributes and values. Search type must be createNew. Attributes and values arrays must have the same length.

Method Detail

onUploadStart

protected void onUploadStart(int totalBytes)
onUploadStart can be overridden to receive notification when uploads are started. The totalBytes specifies total number of bytes to be received (including file data, header etc.)


onUploadProgress

protected void onUploadProgress(int bytesReceived,
                                int totalBytes)
onUploadProgress can be overridden to receive intermediate notifications of upload progress. It can be used to display feedback to the user. It indicates "bytesReceived" out of "totalBytes" bytes have been received. "totalSize" includes length of any files, plus header bytes.


onUploadDone

protected void onUploadDone(boolean success)
onUploadDone can be overridden to receive notification of upload completion. The "success" argument is true if the upload was successfully completed. It is false if the upload was aborted due to any reason. If "success" is true, this call will be followed by a call to onUploadData.


onUploadData

protected void onUploadData(java.util.Map params,
                            java.util.Map fileBytes)
onUploadData is called after the completion of an upload operation. The "params" map contains String values for any data in the form. For file data, it will contain a filename. The "fileBytes" map contains byte[] values for any file(s) in the form.