public class Image extends StyledWidget
Image
,
ImageLoader
EMPTY_ELEMENT_ARRAY
Constructor and Description |
---|
Image()
Creates an image without source.
|
Image(ej.microui.display.Image source)
Creates an image with the source to display.
|
Image(java.lang.String source)
Creates an image with the path to the source to display.
|
Modifier and Type | Method and Description |
---|---|
ej.microui.display.Image |
getSource()
Gets the displayed source of the image.
|
void |
renderContent(ej.microui.display.GraphicsContext g,
Style style,
Rectangle availableBounds)
Renders the content of the renderable without the border, margin and padding specified in the style.
|
void |
setSource(ej.microui.display.Image source)
Sets the source to display for this image.
|
void |
setSource(java.lang.String source)
Sets the source to display for this image.
|
void |
updateSource(ej.microui.display.Image source)
Updates the source to display for this image without asking for repaint.
|
void |
updateSource(java.lang.String source)
Updates the source to display for this image without asking for repaint.
|
Rectangle |
validateContent(Style style,
Rectangle availableBounds)
Gets the content size of the renderable without the border, margin and padding specified in the style.
|
addClassSelector, contains, gainFocus, getAttribute, getChild, getChildrenCount, getChildrenElements, getContentBounds, getParentElement, getStyle, hasClassSelector, isInState, isTransparent, lostFocus, mergeStyle, removeAllClassSelectors, removeClassSelector, removeInstanceStyle, render, setClassSelectors, setEnabled, updateStyle, updateStyleOnly, validate
getAbsoluteX, getAbsoluteX, getAbsoluteY, getAbsoluteY, getEventHandler, getHeight, getPanel, getParent, getPreferredHeight, getPreferredWidth, getRelativeX, getRelativeY, getWidgetAt, getWidth, getX, getY, handleEvent, hasFocus, hideNotify, invalidate, isEnabled, isShown, isValid, isVisible, repaint, repaint, requestFocus, requestFocus, revalidate, revalidateSubTree, setBounds, setEventHandler, setLocation, setPreferredSize, setSize, setVisible, showNotify
public Image()
public Image(java.lang.String source)
The image loader service is used to load the image from the given path.
source
- the path to the source to display.java.lang.NullPointerException
- if the given source is null
.ImageLoader.getImage(String)
public Image(@Nullable ej.microui.display.Image source)
source
- the source to display.@Nullable public ej.microui.display.Image getSource()
public void setSource(java.lang.String source)
source
- the path to new source to display.java.lang.NullPointerException
- if the given source is null
.setSource(ej.microui.display.Image)
,
ImageLoader.getImage(String)
,
updateSource(String)
public void updateSource(java.lang.String source)
source
- the path to new source to display.java.lang.NullPointerException
- if the given source is null
.setSource(ej.microui.display.Image)
,
ImageLoader.getImage(String)
public void setSource(@Nullable ej.microui.display.Image source)
source
- the new source to display. Can be null
.updateSource(ej.microui.display.Image)
public void updateSource(@Nullable ej.microui.display.Image source)
source
- the new source to display. Can be null
.public void renderContent(ej.microui.display.GraphicsContext g, Style style, Rectangle availableBounds)
StyledRenderable
The given graphics context is translated and clipped according to the given bounds (the border, margin and padding are applied on this graphics context before).
g
- the graphics context where to render the content of the renderable.style
- the style to use.availableBounds
- the remaining size to render the content.Outline.apply(GraphicsContext, Rectangle)
,
Border.apply(GraphicsContext, Rectangle, int)
,
StyleHelper.renderWithoutContent(GraphicsContext, Rectangle, Style)
public Rectangle validateContent(Style style, Rectangle availableBounds)
StyledRenderable
style
- the style to use.availableBounds
- the bounds available for the content. A width or a height equals to MWT.NONE
means no
constraint on this dimension.