public class HTMLComponent extends Container implements ActionListener, IOCallback
BASELINE, BOTTOM, BRB_CENTER_OFFSET, BRB_CONSTANT_ASCENT, BRB_CONSTANT_DESCENT, BRB_OTHER, CENTER, CROSSHAIR_CURSOR, DEFAULT_CURSOR, DRAG_REGION_IMMEDIATELY_DRAG_X, DRAG_REGION_IMMEDIATELY_DRAG_XY, DRAG_REGION_IMMEDIATELY_DRAG_Y, DRAG_REGION_LIKELY_DRAG_X, DRAG_REGION_LIKELY_DRAG_XY, DRAG_REGION_LIKELY_DRAG_Y, DRAG_REGION_NOT_DRAGGABLE, DRAG_REGION_POSSIBLE_DRAG_X, DRAG_REGION_POSSIBLE_DRAG_XY, DRAG_REGION_POSSIBLE_DRAG_Y, E_RESIZE_CURSOR, HAND_CURSOR, LEFT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NW_RESIZE_CURSOR, RIGHT, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, TOP, W_RESIZE_CURSOR, WAIT_CURSOR
Constructor and Description |
---|
HTMLComponent()
Deprecated.
Constructs HTMLComponent
|
HTMLComponent(DocumentRequestHandler handler)
Deprecated.
Constructs HTMLComponent
|
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(ActionEvent evt)
Deprecated.
{Invoked when an action occurred on a component}
|
void |
addCharEntitiesRange(String[] symbols,
int startcode)
Deprecated.
Adds the given symbols array to the user defined char entities table with the startcode provided as the code of the first string, startcode+1 for the second etc.
|
void |
addCharEntity(String symbol,
int code)
Deprecated.
Adds the given symbol and code to the user defined char entities table.
|
static void |
addFont(String fontKey,
Font font)
Deprecated.
Sets the given Codename One font for use with HTMLComponents.
|
static void |
addSpecialKey(String specialKeyName,
int specialKeyCode)
Deprecated.
Adds support for a special key to be used as an accesskey.
|
boolean |
animate()
Deprecated.
Allows the animation to reduce "repaint" calls when it returns false.
|
void |
cancel()
Deprecated.
Cancels the loading of the current page
|
protected void |
deinitialize()
Deprecated.
If the component is taken off for any reason, makes sure access keys are not active
|
DocumentInfo |
getDocumentInfo()
Deprecated.
Returns the DocumentInfo that currently represents the document loaded/shown
|
HTMLElement |
getDOM()
Deprecated.
Returns the DOM representing this document
|
HTMLCallback |
getHTMLCallback()
Deprecated.
Returns the HTMLCallback that is set on this HTMLComponent
|
int |
getPageStatus()
Deprecated.
Returns the page status
|
String |
getPageURL()
Deprecated.
Returns the page's URL
|
String[] |
getPropertyNames()
Deprecated.
A component may expose mutable property names for a UI designer to manipulate, this
API is designed for usage internally by the GUI builder code
|
Class[] |
getPropertyTypes()
Deprecated.
Matches the property names method (see that method for further details).
|
Object |
getPropertyValue(String name)
Deprecated.
Returns the current value of the property name, this method is used by the GUI builder
|
DocumentRequestHandler |
getRequestHandler()
Deprecated.
Returns the document request handler
|
String |
getTitle()
Deprecated.
Returns the HTML page's title as described in its TITLE tag
|
protected void |
initComponent()
Deprecated.
Overrides initComponent to add the key listeners to the access keys when the component is first added to the form/displayed
This is useful when the component is added only after the page was read
|
boolean |
isEventsEnabled()
Deprecated.
Returns the current status of the events enabled flag
|
boolean |
isSupressExceptions()
Deprecated.
|
void |
layoutContainer()
Deprecated.
{Performs the layout of the container if a layout is necessary}
|
void |
refreshDOM()
Deprecated.
Refreshes the current DOM so it any changes done after loading will be rendered.
|
void |
scrollPages(int pages,
boolean animate)
Deprecated.
Scrolls the HTMLComponent several pages forward/backward.
|
void |
scrollPixels(int pixels,
boolean animate)
Deprecated.
Scrolls the HTMLComponent several pixels forward/backward.
|
void |
scrollToElement(HTMLElement element,
boolean animate)
Deprecated.
Scrolls the HTMLComponent to the specified element
|
void |
setAutoFocusOnFirstLink(boolean autoFocus)
Deprecated.
Determines whether to auto-focus on the first link after page load
Note that focusing will happen only if the link is within a visible range (no scrolling is performed since this is rarely a wanted behaviour in this case)
|
void |
setBodyText(String htmlText)
Deprecated.
Sets the given string containing HTML code as this HTMLComponent's body
|
boolean |
setBodyText(String htmlText,
String encoding)
Deprecated.
Sets the given string containing HTML code as this HTMLComponent's body.
|
static void |
setCSSSupportedMediaTypes(String[] supportedMediaTypes)
Deprecated.
Sets the supported CSS media types to the given strings.
|
void |
setDefaultFont(String fontKey,
Font font)
Deprecated.
Sets the default font for this HTMLComponent
|
void |
setDOM(HTMLElement dom)
Deprecated.
Sets this HTMLComponent to render the document in the specified DOM.
|
void |
setDOM(HTMLElement dom,
String baseURL)
Deprecated.
Sets this HTMLComponent to render the document in the specified DOM
|
void |
setEventsEnabled(boolean enabled)
Deprecated.
Sets whether the active controls in the HTML will trigger events, and whether the DOM will change dynamically due to user input.
|
boolean |
setHTML(String htmlText,
String encoding,
String title,
boolean isFullHTML)
Deprecated.
Sets the given string containing HTML code either as this HTMLComponent's body or as the full HTML.
|
void |
setHTMLCallback(HTMLCallback callback)
Deprecated.
Sets an HTMLCallback to listen to this HTMLCOmponent
|
void |
setIgnoreCSS(boolean ignore)
Deprecated.
Sets whether this HTMLComponent will ignore all CSS.directives.
|
static void |
setMaxThreads(int threadsNum)
Deprecated.
Sets the maximum number of threads to use for image download
|
void |
setPage(String pageURL)
Deprecated.
Sets this HTMLComponent to render the document in the specified URL
|
void |
setPageStyle(Style pageStyle)
Deprecated.
Sets the style of the page, allowing for example to set transparency to the main page.
|
void |
setPageUIID(String pageUIID)
Deprecated.
Sets the UIID of the page (the internal container)
This applies not only to the current page, but rather to all pages created with this HTMLComponent instance.
|
void |
setParser(HTMLParser parser)
Deprecated.
Sets a custom HTMLParser for this HTMLComponent
By default, a new HTMLParser instance is created for each HTMLComponent, use this method if you have a custom parser.
|
String |
setPropertyValue(String name,
Object value)
Deprecated.
Sets a new value to the given property, returns an error message if failed
and null if successful.
|
void |
setRequestHandler(DocumentRequestHandler handler)
Deprecated.
Changes the document request handler
|
void |
setShowImages(boolean show)
Deprecated.
Sets whether this HTMLComponent will download and show linked images or not
|
void |
setSupressExceptions(boolean supressExceptions)
Deprecated.
|
void |
streamReady(InputStream is,
DocumentInfo docInfo)
Deprecated.
This method should be called only by AsyncDocumentRequestHandler implementations after an async fetch of a document
|
add, add, add, add, add, add, addAll, addComponent, addComponent, addComponent, addComponent, animateHierarchy, animateHierarchyAndWait, animateHierarchyFade, animateHierarchyFadeAndWait, animateLayout, animateLayoutAndWait, animateLayoutFade, animateLayoutFadeAndWait, animateUnlayout, animateUnlayoutAndWait, applyRTL, calcPreferredSize, cancelRepaints, clearClientProperties, constrainHeightWhenScrollable, constrainWidthWhenScrollable, contains, createAnimateHierarchy, createAnimateHierarchyFade, createAnimateLayout, createAnimateLayoutFade, createAnimateLayoutFadeAndWait, createAnimateMotion, createAnimateUnlayout, createReplaceTransition, dragInitiated, drop, encloseIn, encloseIn, findDropTargetAt, findFirstFocusable, fireClicked, flushReplace, forceRevalidate, getBottomGap, getChildrenAsList, getClosestComponentTo, getComponentAt, getComponentAt, getComponentCount, getComponentIndex, getGridPosX, getGridPosY, getLayout, getLayoutHeight, getLayoutWidth, getLeadComponent, getLeadParent, getResponderAt, getSafeAreaRoot, getScrollIncrement, getSideGap, getUIManager, initLaf, invalidate, isEnabled, isSafeArea, isSafeAreaRoot, isScrollableX, isScrollableY, isSelectableInteraction, isSurface, iterator, iterator, keyPressed, keyReleased, morph, morphAndWait, paint, paintBackground, paintBorderBackground, paintComponentBackground, paintGlass, paramString, pointerPressed, refreshTheme, removeAll, removeComponent, replace, replace, replaceAndWait, replaceAndWait, replaceAndWait, revalidate, revalidateLater, revalidateWithAnimationSafety, scrollComponentToVisible, setCellRenderer, setEnabled, setLayout, setLeadComponent, setSafeArea, setSafeAreaRoot, setScrollable, setScrollableX, setScrollableY, setScrollIncrement, setShouldCalcPreferredSize, setShouldLayout, setUIManager, updateTabIndices
addDragFinishedListener, addDragOverListener, addDropListener, addFocusListener, addLongPressListener, addPointerDraggedListener, addPointerPressedListener, addPointerReleasedListener, addPullToRefresh, addScrollListener, addStateChangeListener, bindProperty, blocksSideSwipe, calcScrollSize, contains, containsOrOwns, createStyleAnimation, deinitializeCustomStyle, dragEnter, dragExit, dragFinished, draggingOver, drawDraggedImage, focusGained, focusLost, getAbsoluteX, getAbsoluteY, getAllStyles, getAnimationManager, getBaseline, getBaselineResizeBehavior, getBindablePropertyNames, getBindablePropertyTypes, getBorder, getBoundPropertyValue, getBounds, getBounds, getClientProperty, getCloudBoundProperty, getCloudDestinationProperty, getComponentForm, getComponentState, getCursor, getDefaultDragTransparency, getDirtyRegion, getDisabledStyle, getDraggedx, getDraggedy, getDragImage, getDragRegionStatus, getDragSpeed, getDragTransparency, getEditingDelegate, getHeight, getInlineAllStyles, getInlineDisabledStyles, getInlinePressedStyles, getInlineSelectedStyles, getInlineStylesTheme, getInlineUnselectedStyles, getInnerHeight, getInnerPreferredH, getInnerPreferredW, getInnerWidth, getInnerX, getInnerY, getLabelForComponent, getName, getNativeOverlay, getNextFocusDown, getNextFocusLeft, getNextFocusRight, getNextFocusUp, getOuterHeight, getOuterPreferredH, getOuterPreferredW, getOuterWidth, getOuterX, getOuterY, getOwner, getParent, getPreferredH, getPreferredSize, getPreferredSizeStr, getPreferredTabIndex, getPreferredW, getPressedStyle, getPropertyTypeNames, getSameHeight, getSameWidth, getScrollable, getScrollAnimationSpeed, getScrollDimension, getScrollOpacity, getScrollOpacityChangeSpeed, getScrollX, getScrollY, getSelectCommandText, getSelectedRect, getSelectedStyle, getStyle, getTabIndex, getTensileLength, getTextSelectionSupport, getTooltip, getUIID, getUnselectedStyle, getVisibleBounds, getVisibleBounds, getWidth, getX, getY, growShrink, handlesInput, hasFixedPreferredSize, hasFocus, hideNativeOverlay, initCustomStyle, initDisabledStyle, initPressedStyle, initSelectedStyle, initUnselectedStyle, installDefaultPainter, isAlwaysTensile, isBlockLead, isCellRenderer, isChildOf, isDragActivated, isDragAndDropOperation, isDraggable, isDragRegion, isDropTarget, isEditable, isEditing, isFlatten, isFocusable, isGrabsPointerEvents, isHidden, isHidden, isHideInLandscape, isHideInPortrait, isIgnorePointerEvents, isInClippingRegion, isInitialized, isOpaque, isOwnedBy, isPinchBlocksDragAndDrop, isRippleEffect, isRTL, isScrollable, isScrollVisible, isSetCursorSupported, isSmoothScrolling, isSnapToGrid, isStickyDrag, isTactileTouch, isTactileTouch, isTensileDragEnabled, isTraversable, isVisible, keyRepeated, laidOut, longKeyPress, longPointerPress, onScrollX, onScrollY, paintBackgrounds, paintBorder, paintComponent, paintComponent, paintIntersectingComponentsAbove, paintLock, paintLockRelease, paintRippleOverlay, paintScrollbars, paintScrollbarX, paintScrollbarY, paintShadows, parsePreferredSize, pinch, pinch, pinchReleased, pointerDragged, pointerDragged, pointerHover, pointerHoverPressed, pointerHoverReleased, pointerPressed, pointerReleased, pointerReleased, putClientProperty, refreshTheme, refreshTheme, remove, removeDragFinishedListener, removeDragOverListener, removeDropListener, removeFocusListener, removeLongPressListener, removePointerDraggedListener, removePointerPressedListener, removePointerReleasedListener, removeScrollListener, removeStateChangeListener, repaint, repaint, requestFocus, resetFocusable, respondsToPointerEvents, scrollRectToVisible, scrollRectToVisible, setAlwaysTensile, setBlockLead, setBoundPropertyValue, setCloudBoundProperty, setCloudDestinationProperty, setComponentState, setCursor, setDefaultDragTransparency, setDirtyRegion, setDisabledStyle, setDraggable, setDragTransparency, setDropTarget, setEditingDelegate, setFlatten, setFocus, setFocusable, setGrabsPointerEvents, setHandlesInput, setHeight, setHidden, setHidden, setHideInLandscape, setHideInPortrait, setIgnorePointerEvents, setInitialized, setInlineAllStyles, setInlineDisabledStyles, setInlinePressedStyles, setInlineSelectedStyles, setInlineStylesTheme, setInlineUnselectedStyles, setIsScrollVisible, setLabelForComponent, setName, setNextFocusDown, setNextFocusLeft, setNextFocusRight, setNextFocusUp, setOpaque, setOwner, setPinchBlocksDragAndDrop, setPreferredH, setPreferredSize, setPreferredSizeStr, setPreferredTabIndex, setPreferredW, setPressedStyle, setRippleEffect, setRTL, setSameHeight, setSameSize, setSameWidth, setScrollAnimationSpeed, setScrollOpacityChangeSpeed, setScrollSize, setScrollVisible, setScrollX, setScrollY, setSelectCommandText, setSelectedStyle, setSize, setSmoothScrolling, setSnapToGrid, setTabIndex, setTactileTouch, setTensileDragEnabled, setTensileLength, setTooltip, setTraversable, setUIID, setUIID, setUnselectedStyle, setVisible, setWidth, setX, setY, shouldBlockSideSwipe, shouldBlockSideSwipeLeft, shouldBlockSideSwipeRight, shouldRenderComponentSelection, showNativeOverlay, startEditingAsync, stopEditing, stripMarginAndPadding, styleChanged, toImage, toString, unbindProperty, updateNativeOverlay, visibleBoundsContains
public HTMLComponent()
public HTMLComponent(DocumentRequestHandler handler)
handler
- The HttpRequestHandler to which all requests for links will be sentpublic static void addFont(String fontKey, Font font)
fontKey
- The font key in the format described abovefont
- The actual Codename One font objectpublic void setParser(HTMLParser parser)
parser
- The HTMLParser to usepublic void addCharEntity(String symbol, int code)
symbol
- The symbol to addcode
- The symbol's codepublic static void addSpecialKey(String specialKeyName, int specialKeyCode)
specialKeyName
- The name of the special key as denoted in CSS filesspecialKeyCode
- The special key codepublic void addCharEntitiesRange(String[] symbols, int startcode)
symbols
- The symbols to addstartcode
- The symbol's codepublic static void setMaxThreads(int threadsNum)
threadsNum
- the maximum number of threads to use for image downloadpublic static void setCSSSupportedMediaTypes(String[] supportedMediaTypes)
supportedMediaTypes
- A string array containing the media types that should be supportedpublic DocumentRequestHandler getRequestHandler()
public void setRequestHandler(DocumentRequestHandler handler)
handler
- the new document request handlerpublic DocumentInfo getDocumentInfo()
public void setHTMLCallback(HTMLCallback callback)
callback
- The HTMLCallback that will receive eventspublic HTMLCallback getHTMLCallback()
public void setDefaultFont(String fontKey, Font font)
fontKey
- The font key in the format described in setFont (Can be null for default font, but it is recommended to add a descriptive key if this is a bitmap font to enable the font engine to use it in other cases as well)font
- The actual Codename One font objectpublic void setShowImages(boolean show)
show
- true to show images, false otherwisepublic void setIgnoreCSS(boolean ignore)
ignore
- true to ignore CSS directives, false otherwisepublic void scrollPixels(int pixels, boolean animate)
pixels
- The number of pixels to scroll (positive for forward and negative for backward)animate
- true to animate the scrolling, false otherwisepublic void scrollPages(int pages, boolean animate)
pages
- The number of pages to scroll (positive for forward and negative for backward)animate
- true to animate the scrolling, false otherwisepublic void scrollToElement(HTMLElement element, boolean animate)
element
- The element to scroll to (must be contained in the document)animate
- true to animate the scrolling, false otherwiseIllegalArgumentException
- if the element is not contained in the current document.public void setBodyText(String htmlText)
htmlText
- The HTML body to setpublic boolean setBodyText(String htmlText, String encoding)
htmlText
- The HTML body to setencoding
- The encoding to use when reading the HTML i.e. UTF8, ISO-8859-1 etc.public boolean setHTML(String htmlText, String encoding, String title, boolean isFullHTML)
htmlText
- The HTML to setencoding
- The encoding to use when reading the HTML i.e. UTF8, ISO-8859-1 etc.title
- The HTML title, or null if none (Used only when isFullHTML is false)isFullHTML
- true if this is a full HTML document (with html/body tags), false if this HTML should be used as the HTMLComponent's bodypublic void cancel()
public void setPage(String pageURL)
pageURL
- The URL containing the HTML documentpublic void setPageStyle(Style pageStyle)
pageStyle
- The style to set to the pagepublic void setPageUIID(String pageUIID)
pageUIID
- The UIID that should be applied to the pagepublic void streamReady(InputStream is, DocumentInfo docInfo)
streamReady
in interface IOCallback
is
- The InputStream of the documentdocInfo
- The document infopublic void setDOM(HTMLElement dom)
dom
- An HTMLElement representing the root of the HTML documentIllegalArgumentException
- if the HTMLElement supplied is not an 'html' tagpublic void setDOM(HTMLElement dom, String baseURL)
dom
- An HTMLElement representing the root of the HTML documentbaseURL
- The base URL for this DOM (Necessary if document references relative links)IllegalArgumentException
- if the HTMLElement supplied is not an 'html' tagpublic HTMLElement getDOM()
IllegalStateException
- if the page is still loadingpublic void refreshDOM()
public void setEventsEnabled(boolean enabled)
enabled
- true to enable event dispatching, false otherwisepublic boolean isEventsEnabled()
public void setAutoFocusOnFirstLink(boolean autoFocus)
autoFocus
- true to auto-focus, false otherwisepublic boolean animate()
Component
Display
class.public String getTitle()
public String getPageURL()
public int getPageStatus()
protected void initComponent()
initComponent
in class Component
protected void deinitialize()
deinitialize
in class Component
public void layoutContainer()
layoutContainer
in class Container
public void actionPerformed(ActionEvent evt)
actionPerformed
in interface ActionListener
evt
- event object describing the source of the action as well as
its triggerpublic String[] getPropertyNames()
getPropertyNames
in class Component
public Class[] getPropertyTypes()
getPropertyTypes
in class Component
public Object getPropertyValue(String name)
getPropertyValue
in class Component
name
- the name of the propertypublic String setPropertyValue(String name, Object value)
setPropertyValue
in class Component
name
- the name of the propertyvalue
- new value for the propertypublic boolean isSupressExceptions()
public void setSupressExceptions(boolean supressExceptions)
supressExceptions
- the supressExceptions to set