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 singleInputElementobject.An
InputElementis submitted as a key/value pair when the containingFormis sent to the web server.- See Also:
Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classInputElement.InputElementTypeEnumerates the different types ofInputElementthat 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 anInputElementobject with the specifiednameandvalueattributes.InputElement(java.lang.String name, java.lang.String value, java.lang.String encoding)Creates anInputElementobject with the specifiednameandvalueattributes, and encoded with the specified characterencoding.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description HtmlElementclone()Creates a copy of this HTML element.voiddelete()static longgetCPtr(InputElement obj)For internal use only.InputElement.InputElementTypegetType()Gets the type of thisInputElement.booleanisChecked()Returnstrueif the"checked"attribute has been set for thisInputElement.booleanisSubmitted()Returnstrueif thisInputElementhas been submitted.booleanisSuccessfulControl()Returnstrueif thisInputElementrepresents a successful control.static InputElementmakeFrom(HtmlElement htmlElement)For internal use only.voidsetChecked(boolean checked)Sets or removes the"checked"attribute for thisInputElement.voidsetSubmitted(boolean value)Sets a value indicating whether thisInputElementhas 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.UnsupportedEncodingExceptionCreates anInputElementobject with the specifiednameandvalueattributes, 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.UnsupportedEncodingExceptionCreates anInputElementobject with the specifiednameandvalueattributes.- 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:
deletein 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()
Returnstrueif the"checked"attribute has been set for thisInputElement. This method is equivalent tohasAttribute("checked").- Returns:
trueif 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-trueto check the input element,falseto uncheck it- See Also:
isChecked()
-
setSubmitted
public void setSubmitted(boolean value)
Sets a value indicating whether thisInputElementhas been submitted. For example, a button is submitted when it is pressed.- Parameters:
value- whether thisInputElementshould be submitted or not
-
isSubmitted
public boolean isSubmitted()
Returnstrueif thisInputElementhas been submitted. For example, a button is submitted when it is pressed.- Returns:
trueif thisInputElementwas submitted
-
isSuccessfulControl
public boolean isSuccessfulControl()
Returnstrueif thisInputElementrepresents 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:
isSuccessfulControlin classHtmlElement- Returns:
trueif thisInputElementrepresents a successful control
-
clone
public HtmlElement clone()
Description copied from class:HtmlElementCreates a copy of this HTML element.- Overrides:
clonein classHtmlElement- Returns:
- a new
HtmlElementobject which is an exact copy of this HTML element
-
-