public class XMLView
extends com.codename1.ui.Container
Modifier and Type | Class and Description |
---|---|
static interface |
XMLView.ViewFactory
Interface to be implemented by all view factories.
|
Modifier and Type | Field and Description |
---|---|
static int |
ASPECT_16X9
16:9 aspect ratio
|
static int |
ASPECT_SQUARE
1:1 aspect ratio
|
BASELINE, BOTTOM, BRB_CENTER_OFFSET, BRB_CONSTANT_ASCENT, BRB_CONSTANT_DESCENT, BRB_OTHER, CENTER, 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, LEFT, RIGHT, TOP
Constructor and Description |
---|
XMLView()
Creates an XML view.
|
Modifier and Type | Method and Description |
---|---|
com.codename1.ui.Component |
createView(com.codename1.xml.Element el)
Creates a view for the given XML element.
|
com.codename1.ui.EncodedImage |
getDefault16x9PlaceholderImage()
Retrieves the placeholder for 16x9 images.
|
com.codename1.ui.EncodedImage |
getDefaultSquarePlaceholderImage()
Retrieves a placeholder image for the standard square image size.
|
com.codename1.ui.Image |
getIcon(java.lang.String charCode,
int width,
int height)
Gets image icon using the icon font.
|
com.codename1.ui.Image |
getIcon(java.lang.String charCode,
int width,
int height,
int color)
Gets a font icon for a particular character code in a specified width,
height, and color
|
com.codename1.ui.Image |
getImage(java.lang.String url,
java.lang.String placeholder,
int aspectPreference)
Gets an image from a particular URL and stretches it to the given aspect ratio.
|
com.codename1.ui.EncodedImage |
getPlaceholderImage(java.lang.String name,
int aspectPreference)
Gets a placeholder image.
|
void |
load(java.lang.String url,
com.codename1.util.Callback<com.codename1.xml.Element> callback)
Loads an XML page from a url.
|
void |
registerViewFactory(java.lang.String tagName,
XMLView.ViewFactory factory)
Registers a view factory with the view.
|
void |
setPlaceholderImage(java.lang.String name,
com.codename1.ui.EncodedImage img)
Sets a placeholder image.
|
void |
setXML(com.codename1.xml.Element root)
Sets the XML contents of the view.
|
void |
setXML(com.codename1.xml.Element root,
java.lang.String base)
Sets the XML contents to view.
|
void |
setXML(java.lang.String xml)
Sets the XML contents of the view.
|
void |
setXML(java.lang.String xml,
java.lang.String base)
Sets the XML contents of the view.
|
java.lang.String |
toAbsoluteUrl(java.lang.String url)
Converts a url to an absolute URL.
|
add, add, add, add, addComponent, addComponent, addComponent, addComponent, animateHierarchy, animateHierarchyAndWait, animateHierarchyFade, animateHierarchyFadeAndWait, animateLayout, animateLayoutAndWait, animateLayoutFade, animateLayoutFadeAndWait, animateUnlayout, animateUnlayoutAndWait, applyRTL, calcPreferredSize, cancelRepaints, clearClientProperties, contains, createAnimateMotion, dragInitiated, drop, encloseIn, encloseIn, findFirstFocusable, fireClicked, flushReplace, forceRevalidate, getBottomGap, getClosestComponentTo, getComponentAt, getComponentAt, getComponentCount, getComponentIndex, getGridPosX, getGridPosY, getLayout, getLayoutHeight, getLayoutWidth, getLeadComponent, getLeadParent, getScrollIncrement, getSideGap, getUIManager, initLaf, invalidate, isEnabled, isScrollableX, isScrollableY, isSelectableInteraction, iterator, keyPressed, keyReleased, layoutContainer, morph, morphAndWait, paint, paintComponentBackground, paintGlass, paramString, pointerHover, pointerPressed, refreshTheme, removeAll, removeComponent, replace, replace, replaceAndWait, replaceAndWait, replaceAndWait, revalidate, scrollComponentToVisible, setCellRenderer, setEnabled, setLayout, setLeadComponent, setScrollable, setScrollableX, setScrollableY, setScrollIncrement, setShouldCalcPreferredSize, setShouldLayout, setUIManager
addDragOverListener, addDropListener, addFocusListener, addPointerDraggedListener, addPointerPressedListener, addPointerReleasedListener, addPullToRefresh, addScrollListener, animate, bindProperty, calcScrollSize, contains, deinitialize, deinitializeCustomStyle, dragEnter, dragExit, dragFinished, draggingOver, drawDraggedImage, focusGained, focusLost, getAbsoluteX, getAbsoluteY, getAllStyles, getBaseline, getBaselineResizeBehavior, getBindablePropertyNames, getBindablePropertyTypes, getBorder, getBoundPropertyValue, getBounds, getClientProperty, getCloudBoundProperty, getCloudDestinationProperty, getComponentForm, getComponentState, getDirtyRegion, getDisabledStyle, getDraggedx, getDraggedy, getDragImage, getDragRegionStatus, getDragSpeed, getHeight, getLabelForComponent, getName, getNextFocusDown, getNextFocusLeft, getNextFocusRight, getNextFocusUp, getParent, getPreferredH, getPreferredSize, getPreferredW, getPressedStyle, getPropertyNames, getPropertyTypeNames, getPropertyTypes, getPropertyValue, getSameHeight, getSameWidth, getScrollable, getScrollAnimationSpeed, getScrollDimension, getScrollOpacity, getScrollOpacityChangeSpeed, getScrollX, getScrollY, getSelectCommandText, getSelectedRect, getSelectedStyle, getStyle, getTensileLength, getUIID, getUnselectedStyle, getVisibleBounds, getWidth, getX, getY, growShrink, handlesInput, hasFocus, initComponent, initCustomStyle, installDefaultPainter, isAlwaysTensile, isCellRenderer, isDragActivated, isDragAndDropOperation, isDraggable, isDragRegion, isDropTarget, isFlatten, isFocusable, isGrabsPointerEvents, isHideInPortrait, isInClippingRegion, isInitialized, isRTL, isScrollable, isScrollVisible, isSmoothScrolling, isSnapToGrid, isStickyDrag, isTactileTouch, isTactileTouch, isTensileDragEnabled, isVisible, keyRepeated, laidOut, longKeyPress, longPointerPress, onScrollX, onScrollY, paintBackground, paintBackgrounds, paintBorder, paintComponent, paintComponent, paintLock, paintLockRelease, paintScrollbars, paintScrollbarX, paintScrollbarY, pinch, pointerDragged, pointerDragged, pointerHoverPressed, pointerHoverReleased, pointerPressed, pointerReleased, pointerReleased, putClientProperty, refreshTheme, refreshTheme, removeDragOverListener, removeDropListener, removeFocusListener, removePointerDraggedListener, removePointerPressedListener, removePointerReleasedListener, removeScrollListener, repaint, repaint, requestFocus, resetFocusable, scrollRectToVisible, scrollRectToVisible, setAlwaysTensile, setBoundPropertyValue, setCloudBoundProperty, setCloudDestinationProperty, setComponentState, setDirtyRegion, setDisabledStyle, setDraggable, setDropTarget, setFlatten, setFocus, setFocusable, setGrabsPointerEvents, setHandlesInput, setHeight, setHideInPortrait, setInitialized, setIsScrollVisible, setLabelForComponent, setName, setNextFocusDown, setNextFocusLeft, setNextFocusRight, setNextFocusUp, setPreferredH, setPreferredSize, setPreferredW, setPressedStyle, setPropertyValue, setRTL, setSameHeight, setSameWidth, setScrollAnimationSpeed, setScrollOpacityChangeSpeed, setScrollSize, setScrollVisible, setScrollX, setScrollY, setSelectCommandText, setSelectedStyle, setSize, setSmoothScrolling, setSnapToGrid, setTactileTouch, setTensileDragEnabled, setTensileLength, setUIID, setUnselectedStyle, setVisible, setWidth, setX, setY, shouldBlockSideSwipe, styleChanged, toString, unbindProperty
public static final int ASPECT_SQUARE
public static final int ASPECT_16X9
public com.codename1.ui.EncodedImage getDefaultSquarePlaceholderImage()
public com.codename1.ui.EncodedImage getDefault16x9PlaceholderImage()
public void setPlaceholderImage(java.lang.String name, com.codename1.ui.EncodedImage img)
name
- The name of the image.img
- The placeholder image.public com.codename1.ui.EncodedImage getPlaceholderImage(java.lang.String name, int aspectPreference)
name
- The name of the placeholder image.aspectPreference
- The aspect ratio preference. One of ASPECT_16X9
and ASPECT_SQUARE
.public com.codename1.ui.Image getImage(java.lang.String url, java.lang.String placeholder, int aspectPreference)
url
- The URL of the image.placeholder
- The placeholder for the image.aspectPreference
- Preferred aspect ratio for the image.public com.codename1.ui.Image getIcon(java.lang.String charCode, int width, int height, int color)
charCode
- The char code to display.width
- The width of the rendered icon.height
- The height of the rendered icon.color
- THe color of the rendered icon.public com.codename1.ui.Image getIcon(java.lang.String charCode, int width, int height)
charCode
- The char code to render. This is font-dependent.width
- The width to render the image in px.height
- The height to render the image in px.public void setXML(java.lang.String xml, java.lang.String base)
xml
- The XML to render.base
- The base URL of the document. This is used to retrieve relative
resources like images that are referenced in the document.public void setXML(java.lang.String xml)
xml
- The XML to load.public void setXML(com.codename1.xml.Element root, java.lang.String base)
root
- The root XML element to display.base
- The base URL. Used for retrieving dependent resources like images
that are referenced using a relative path.public void setXML(com.codename1.xml.Element root)
root
- The root element to display.public com.codename1.ui.Component createView(com.codename1.xml.Element el)
el
- The XML element to convert to a view.public java.lang.String toAbsoluteUrl(java.lang.String url)
url
- The URL to convert.public void registerViewFactory(java.lang.String tagName, XMLView.ViewFactory factory)
tagName
- The tag name that the view factory processes.factory
- The view factory.public void load(java.lang.String url, com.codename1.util.Callback<com.codename1.xml.Element> callback)
url
- The URL to load.callback
- A callback that is called when loading is complete.