Package com.facilita.fc.web
Class InputElement
- java.lang.Object
-
- com.facilita.fc.web.HtmlElement
-
- com.facilita.fc.web.InputElement
-
- Direct Known Subclasses:
FileElement
,ImageButtonElement
public class InputElement extends HtmlElement
Represents an HTML input element within an HTML form. An HTML element is everything from the start tag to the end tag.e.g.
<input type="text" name="firstname">
would be represented by a singleInputElement
object.An
InputElement
is submitted as a key/value pair when the containingForm
is sent to the web server.- See Also:
Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
InputElement.InputElementType
Enumerates the different types ofInputElement
that are available.
-
Constructor Summary
Constructors Constructor Description InputElement(long cPtr, boolean cMemoryOwn)
For internal use only.InputElement(java.lang.String name, java.lang.String value)
Creates anInputElement
object with the specifiedname
andvalue
attributes.InputElement(java.lang.String name, java.lang.String value, java.lang.String encoding)
Creates anInputElement
object with the specifiedname
andvalue
attributes, and encoded with the specified characterencoding
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description HtmlElement
clone()
Creates a copy of this HTML element.void
delete()
static long
getCPtr(InputElement obj)
For internal use only.InputElement.InputElementType
getType()
Gets the type of thisInputElement
.boolean
isChecked()
Returnstrue
if the"checked"
attribute has been set for thisInputElement
.boolean
isSubmitted()
Returnstrue
if thisInputElement
has been submitted.boolean
isSuccessfulControl()
Returnstrue
if thisInputElement
represents a successful control.static InputElement
makeFrom(HtmlElement htmlElement)
For internal use only.void
setChecked(boolean checked)
Sets or removes the"checked"
attribute for thisInputElement
.void
setSubmitted(boolean value)
Sets a value indicating whether thisInputElement
has been submitted.-
Methods inherited from class com.facilita.fc.web.HtmlElement
getAfterEndTagPosition, getAfterStartTagPosition, getAttribute, getAttributes, getCharEncoding, getContent, getContentPosition, getCPtr, getId, getName, getTag, getValue, hasAttribute, isDisabled, removeAttribute, setAttribute, setAttribute, setCharEncoding, setContent, setDisabled, setId, setName, setValue
-
-
-
-
Constructor Detail
-
InputElement
public InputElement(long cPtr, boolean cMemoryOwn)
For internal use only. Of no interest to the user.- Parameters:
cPtr
- pointer to the CPP wrapped objectcMemoryOwn
- indicates if this object is responsible for memory management of the CPP object
-
InputElement
public InputElement(java.lang.String name, java.lang.String value, java.lang.String encoding) throws java.io.UnsupportedEncodingException
Creates anInputElement
object with the specifiedname
andvalue
attributes, and encoded with the specified characterencoding
.- Parameters:
name
- the value to assign to the"name"
attributevalue
- the value to assign to the"value"
attributeencoding
- the character encoding to use when encoding the name/value- Throws:
java.io.UnsupportedEncodingException
- The encoding is not supported
-
InputElement
public InputElement(java.lang.String name, java.lang.String value) throws java.io.UnsupportedEncodingException
Creates anInputElement
object with the specifiedname
andvalue
attributes.- Parameters:
name
- the value to assign to the"name"
attributevalue
- the value to assign to the"value"
attribute- Throws:
java.io.UnsupportedEncodingException
- The encoding is not supported
-
-
Method Detail
-
getCPtr
public static long getCPtr(InputElement obj)
For internal use only. Of no interest to the user.- Parameters:
obj
- a reference to an object of this class- Returns:
- a long containing the address of the CPP wrapped object
-
makeFrom
public static InputElement makeFrom(HtmlElement htmlElement)
For internal use only. Of no interest to the user.- Parameters:
htmlElement
- Internal use only.- Returns:
- a new InputElement
-
delete
public void delete()
- Overrides:
delete
in classHtmlElement
-
getType
public InputElement.InputElementType getType()
Gets the type of thisInputElement
. This method is similar togetAttribute("type")
, but returns the type as an enum value.- Returns:
- the type of this
InputElement
-
isChecked
public boolean isChecked()
Returnstrue
if the"checked"
attribute has been set for thisInputElement
. This method is equivalent tohasAttribute("checked")
.- Returns:
true
if the"checked"
attribute exists in thisInputElement
- See Also:
setChecked(boolean)
-
setChecked
public void setChecked(boolean checked)
Sets or removes the"checked"
attribute for thisInputElement
.setChecked(true)
is equivalent tosetAttribute("checked")
.setChecked(false)
is equivalent toremoveAttribute("checked")
.- Parameters:
checked
-true
to check the input element,false
to uncheck it- See Also:
isChecked()
-
setSubmitted
public void setSubmitted(boolean value)
Sets a value indicating whether thisInputElement
has been submitted. For example, a button is submitted when it is pressed.- Parameters:
value
- whether thisInputElement
should be submitted or not
-
isSubmitted
public boolean isSubmitted()
Returnstrue
if thisInputElement
has been submitted. For example, a button is submitted when it is pressed.- Returns:
true
if thisInputElement
was submitted
-
isSuccessfulControl
public boolean isSuccessfulControl()
Returnstrue
if thisInputElement
represents a successful control. A successful control is valid for submission. Every successful control has its control name and current value submitted when the form is sent to the web server.- Overrides:
isSuccessfulControl
in classHtmlElement
- Returns:
true
if thisInputElement
represents a successful control
-
clone
public HtmlElement clone()
Description copied from class:HtmlElement
Creates a copy of this HTML element.- Overrides:
clone
in classHtmlElement
- Returns:
- a new
HtmlElement
object which is an exact copy of this HTML element
-
-