public class ImageView extends View
BadBreakWeight, ExcellentBreakWeight, ForcedBreakWeight, GoodBreakWeight, X_AXIS, Y_AXIS
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
Constructor and Description |
---|
ImageView(Element element)
Creates the image view that represents the given element.
|
Modifier and Type | Method and Description |
---|---|
float |
getAlignment(int axis)
Get the image alignment.
|
String |
getAltText()
Get the text that should be shown as the image replacement and also as the
image tool tip text.
|
AttributeSet |
getAttributes()
Returns the combination of the document and the style sheet attributes.
|
Image |
getImage()
Get the image to render.
|
URL |
getImageURL()
Get the URL location of the image to render.
|
Icon |
getLoadingImageIcon()
Get the icon that should be displayed while the image is loading and hence
not yet available.
|
boolean |
getLoadsSynchronously()
Get the image loading strategy.
|
Icon |
getNoImageIcon()
Get the icon that should be displayed when the image is not available.
|
float |
getPreferredSpan(int axis)
Get the preferred span of the image along the axis.
|
protected StyleSheet |
getStyleSheet()
Get the associated style sheet from the document.
|
String |
getToolTipText(float x,
float y,
Shape shape)
Get the tool tip text.
|
Shape |
modelToView(int pos,
Shape area,
Position.Bias bias)
This is currently implemented always to return the area of the image view,
as the image is not divideable by character positions.
|
void |
paint(Graphics g,
Shape bounds)
Paints the image or one of the two image state icons.
|
void |
setLoadsSynchronously(boolean load_on_demand)
Set if the image should be loaded only when needed (synchronuosly).
|
protected void |
setPropertiesFromAttributes()
Update all cached properties from the attribute set, returned by the
getAttributes() . |
void |
setSize(float width,
float height)
Starts loading the image asynchronuosly.
|
int |
viewToModel(float x,
float y,
Shape shape,
Position.Bias[] bias)
Maps the picture co-ordinates into the image position in the model.
|
append, breakView, changedUpdate, createFragment, dump, forwardUpdate, forwardUpdateToView, getBreakWeight, getChildAllocation, getContainer, getDocument, getElement, getEndOffset, getGraphics, getMaximumSpan, getMinimumSpan, getNextVisualPositionFrom, getParent, getResizeWeight, getStartOffset, getView, getViewCount, getViewFactory, getViewIndex, getViewIndex, insert, insertUpdate, isVisible, modelToView, modelToView, preferenceChanged, remove, removeAll, removeUpdate, replace, setParent, updateChildren, updateLayout, viewToModel
public float getAlignment(int axis)
getAlignment
in class View
axis
- -
either X_AXIS or Y_AXISpublic String getAltText()
HTML.Attribute.ALT
. If there is no such attribute, the image
name from the url is returned. If the URL is not available, the empty
string is returned.public AttributeSet getAttributes()
getAttributes
in class View
public Image getImage()
public URL getImageURL()
public Icon getLoadingImageIcon()
public boolean getLoadsSynchronously()
public Icon getNoImageIcon()
public float getPreferredSpan(int axis)
HTML.Attribute.WIDTH
and
HTML.Attribute.HEIGHT
. If they are missing, and the image is already
loaded, the image size is returned. If there are no attributes, and the
image is not loaded, zero is returned.getPreferredSpan
in class View
axis
- -
either X_AXIS or Y_AXISprotected StyleSheet getStyleSheet()
public String getToolTipText(float x, float y, Shape shape)
getAltText()
. The parameters are ignored.getToolTipText
in class View
public void paint(Graphics g, Shape bounds)
public void setLoadsSynchronously(boolean load_on_demand)
getLoadingImageIcon()
, is displayed.protected void setPropertiesFromAttributes()
getAttributes()
.public int viewToModel(float x, float y, Shape shape, Position.Bias[] bias)
viewToModel
in class View
x
- the x coordinate in the view spacey
- the y coordinate in the view spaceshape
- the allocation of this View
bias
- the bias to usex, y
public Shape modelToView(int pos, Shape area, Position.Bias bias) throws BadLocationException
modelToView
in class View
pos
- character positionarea
- of the image viewbias
- biasBadLocationException
- if pos
is invalidpublic void setSize(float width, float height)
setLoadsSynchronously(boolean)
must be
called before calling this method. The passed parameters are not used.