Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
public class DefaultHTMLCallback
- Object
- DefaultHTMLCallback
ImplementsHTMLCallback, ParserCallback
This is a default implementation of HTMLCallback that basically doesn’t do much but does keep the HTMLComponent work intact. This class was created so developers will avoid pitfalls of HTMLCallback, as using the wrong return values.
Note that in any case an HTMLComponent doesn’t have to use an HTMLCallback.
Fields
public static final int ERROR_CSS_ATTRIBUTE_NOT_SUPPORTED = 200 | Error code denoting that an unsupported CSS attribute (by XHTML-MP 1.0 standards) was found in the HTML or external CSS files |
public static final int ERROR_CSS_ATTIBUTE_VALUE_INVALID = 201 | Error code denoting that an invalid attribute value was found in the CSS |
public static final int ERROR_CSS_NOT_FOUND = 202 | Error code denoting that a CSS file referenced from the HTML or from another external CSS file was not found |
public static final int ERROR_CSS_NO_BASE_URL = 203 | Error code denoting that a relative URL was referenced from a document with no base URL (A document that was loaded via setBody/setHTML/setDOM and not via setPage) In this case the return value of parsingError is not considered - parsing co… |
Constructors
public DefaultHTMLCallback() |
Methods
Inherited fields
From HTMLCallback
ERROR_CONNECTING, ERROR_IMAGE_NOT_FOUND, ERROR_IMAGE_BAD_FORMAT, ERROR_NO_BASE_URL, ERROR_INVALID_TAG_HIERARCHY, STATUS_NONE, STATUS_ERROR, STATUS_CANCELLED, STATUS_REQUESTED, STATUS_CONNECTED, STATUS_PARSED, STATUS_DISPLAYED, STATUS_COMPLETED, STATUS_REDIRECTED, FIELD_TEXT, FIELD_PASSWORD, LINK_REGULAR, LINK_VISTED, LINK_FORBIDDEN
Inherited methods
Field details
ERROR_CSS_ATTRIBUTE_NOT_SUPPORTED
public static final int ERROR_CSS_ATTRIBUTE_NOT_SUPPORTED = 200ERROR_CSS_ATTIBUTE_VALUE_INVALID
public static final int ERROR_CSS_ATTIBUTE_VALUE_INVALID = 201ERROR_CSS_NOT_FOUND
public static final int ERROR_CSS_NOT_FOUND = 202ERROR_CSS_NO_BASE_URL
public static final int ERROR_CSS_NO_BASE_URL = 203Constructor details
DefaultHTMLCallback
public DefaultHTMLCallback()Method details
titleUpdated
public void titleUpdated(HTMLComponent htmlC, String title)Parameters
htmlCHTMLComponent- The HTMLComponent that triggered the event
titleString- The new title
parsingError
public boolean parsingError(int errorId, String tag, String attribute, String value, String description)Parameters
errorIdint- The error ID, one of the ERROR_* constants
tagString- The tag in which the error occured (Can be null for non-tag related errors)
attributeString- The attribute in which the error occured (Can be null for non-attribute related errors)
valueString- The value in which the error occured (Can be null for non-value related errors)
descriptionString- A verbal description of the error
Returns
pageStatusChanged
public void pageStatusChanged(HTMLComponent htmlC, int status, String url)Parameters
htmlCHTMLComponent- The HTMLComponent in which the status change occured
statusint- The new status, one of the STATUS_* constants
urlString- The URL of the page
fieldSubmitted
public String fieldSubmitted(HTMLComponent htmlC, TextArea ta, String actionURL, String id, String value, int type, String errorMsg)Parameters
htmlCHTMLComponent- The HTMLComponent in which this event occured
taTextArea- The TextArea/TextField of this field
actionURLString- The action URL of the form
idString- The ID of the field
valueString- The value entered
typeint- The type of the field, one of the FIELD_* constants
errorMsgString- The error message if any error occured (i.e. input validation error) or null if no error occured
Returns
getAutoComplete
public String getAutoComplete(HTMLComponent htmlC, String actionURL, String id)Parameters
htmlCHTMLComponent- The HTMLComponent in which this event occured
actionURLString- The action URL of the form
idString- The ID of the field
Returns
getLinkProperties
public int getLinkProperties(HTMLComponent htmlC, String url)Parameters
htmlCHTMLComponent- The HTMLComponent
urlString- The Link URL
Returns
linkClicked
public boolean linkClicked(HTMLComponent htmlC, String url)Parameters
htmlCHTMLComponent- The HTMLComponent
urlString- The Link URL
Returns
actionPerformed
public void actionPerformed(ActionEvent evt, HTMLComponent htmlC, HTMLElement element)Parameters
evtActionEvent- The event triggered, the component can be extracted using getSource
htmlCHTMLComponent- The HTMLComponent
elementHTMLElement- The element associated with the component that triggered the event
focusGained
public void focusGained(Component cmp, HTMLComponent htmlC, HTMLElement element)Parameters
cmpComponent- The component that triggered the event
htmlCHTMLComponent- The HTMLComponent
elementHTMLElement- The element associated with the component that triggered the event
focusLost
public void focusLost(Component cmp, HTMLComponent htmlC, HTMLElement element)Parameters
cmpComponent- The component that triggered the event
htmlCHTMLComponent- The HTMLComponent
elementHTMLElement- The element associated with the component that triggered the event
selectionChanged
public void selectionChanged(int oldSelected, int newSelected, HTMLComponent htmlC, List list, HTMLElement element)Parameters
oldSelectedint- old selected index in list model
newSelectedint- new selected index in list model
htmlCHTMLComponent- The HTMLComponent
listList- The list that triggered the event (Usually a ComboBox but not always)
elementHTMLElement- The element associated with the component that triggered the event (Should be TAG_SELECT)
dataChanged
public void dataChanged(int type, int index, HTMLComponent htmlC, TextField textField, HTMLElement element)Parameters
typeint- the type data change; REMOVED, ADDED or CHANGED
indexint- item index in a list model
htmlCHTMLComponent- The HTMLComponent
textFieldTextField- The TextField that triggerd the event
elementHTMLElement- The element associated with the component that triggered the event (Should be TAG_INPUT with type text/password)