com.raj.htmlForms
Class HtmlFile

java.lang.Object
  |
  +--com.raj.htmlForms.HtmlFormElement
        |
        +--com.raj.htmlForms.HtmlInput
              |
              +--com.raj.htmlForms.HtmlFile

public class HtmlFile
extends HtmlInput

This class will generate an HTML text box, writing out something like:

<input type=\"text\" name=\"somename\" value=\"somevalue\">

depending on the attributes set in this class. This class implements all the HTML 4.01 Transitional attributes of a textbox.

Note: The W3C spec says that the value attribute in the <input type="file"> tag should display that as the intial filename. Many browsers (including Internet Explorer, Netscape and Mozilla) ignore this for security reasons.

This class (HtmlText.java) is part of the com.raj.htmlForms package that automatically generates HTML forms programmatically.

CREATED 26-FEB-2002, Copyright (c) Rajnish Bhaskar 2002

Author:
Rajnish Bhaskar
See Also:
W3C Reference, Explanation for why value attribute is ignored

Field Summary
 
Fields inherited from class com.raj.htmlForms.HtmlFormElement
isXHTML, out
 
Constructor Summary
HtmlFile(java.io.Writer w)
          Minimal constructor for any form element.
HtmlFile(java.io.Writer w, boolean x, java.lang.String n)
          Constructor that sets the writer and name of the control and a boolean which determines whether or not XHTML will be written
HtmlFile(java.io.Writer w, java.lang.String n)
          Constructor that just sets the name of the element
HtmlFile(java.io.Writer w, java.lang.String n, java.lang.String val)
          Constructor that sets the name and value of the element
 
Method Summary
 void accept(java.lang.String x)
          sets the comma-separated list of MIME types that this form can process
 java.lang.String getAcceptList()
          gets the list of MIME types that this form can process
 void reset()
          resets all attributes of the element back to a blank state
 java.lang.String toString()
          Writes the attributes of this object to a string and returns them.
 void write()
          writes a file selector dialog to the given writer
 
Methods inherited from class com.raj.htmlForms.HtmlInput
getAccessKey, getDisabled, getReadOnly, getSize, getValue, isDisabled, setAccessKey, setReadOnly, setSize, setValue
 
Methods inherited from class com.raj.htmlForms.HtmlFormElement
getDir, getId, getLang, getName, getOnBlur, getOnClick, getOnDblClick, getOnFocus, getOnKeyDown, getOnKeyPress, getOnKeyUp, getOnMouseDown, getOnMouseMove, getOnMouseOut, getOnMouseOver, getOnMouseUp, getOnSelect, getStyle, getTabIndex, getTheClass, getTitle, getXhtml, setDir, setId, setLang, setName, setOnBlur, setOnClick, setOnDblClick, setOnFocus, setOnKeyDown, setOnKeyPress, setOnKeyUp, setOnMouseDown, setOnMouseMove, setOnMouseOut, setOnMouseOver, setOnMouseUp, setOnSelect, setStyle, setStyle, setTabIndex, setTheClass, setTitle, setXhtml
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HtmlFile

public HtmlFile(java.io.Writer w)
Minimal constructor for any form element. All other attributes can be added by the appropriate setter method. This follows the standard Java convention for attributes, so the attribute foo becomes setFoo(). The attribute names can be found at the W3C HTML reference or many other places on the web.

Parameters:
w - the Writer to which all the data will be written out
See Also:
W3C Reference for forms

HtmlFile

public HtmlFile(java.io.Writer w,
                java.lang.String n)
Constructor that just sets the name of the element

Parameters:
w - the Writer to which all the data will be written out
n - the name of this element
See Also:
W3C Reference for forms

HtmlFile

public HtmlFile(java.io.Writer w,
                boolean x,
                java.lang.String n)
Constructor that sets the writer and name of the control and a boolean which determines whether or not XHTML will be written

Parameters:
w - the Writer to which all the data will be written out
x - if true, XHTML will be written, else false
n - the name of this element

HtmlFile

public HtmlFile(java.io.Writer w,
                java.lang.String n,
                java.lang.String val)
Constructor that sets the name and value of the element

Parameters:
w - the Writer to which all the data will be written out
n - the name of this element
val - the initial filename of this control
See Also:
W3C Reference for forms
Method Detail

accept

public void accept(java.lang.String x)
sets the comma-separated list of MIME types that this form can process

See Also:
W3C Reference of this attribute

getAcceptList

public java.lang.String getAcceptList()
gets the list of MIME types that this form can process


toString

public java.lang.String toString()
Description copied from class: HtmlFormElement
Writes the attributes of this object to a string and returns them.

The toString() method should logically return a string representing the attributes of the HTML element, eg if you set the name, title and style of the element then you should return a string containing:

name="myName" title="some title" style="foo: xxx; bar: yyy;"

The responsibility for turning this into a form deliverable to a user agent belongs to the write() method.

Overrides:
toString in class HtmlInput
See Also:
HtmlFormElement.write()

reset

public void reset()
Description copied from class: HtmlFormElement
resets all attributes of the element back to a blank state

Overrides:
reset in class HtmlInput

write

public void write()
writes a file selector dialog to the given writer

Specified by:
write in class HtmlFormElement