public class CustomImageView
extends javax.swing.text.View
Constructor and Description |
---|
CustomImageView(javax.swing.text.Element elem) |
Modifier and Type | Method and Description |
---|---|
void |
changedUpdate(javax.swing.event.DocumentEvent e,
java.awt.Shape a,
javax.swing.text.ViewFactory f)
Invoked when the Elements attributes have changed.
|
float |
getAlignment(int axis)
Determines the desired alignment for this view along an
axis.
|
java.lang.String |
getAltText()
Returns the text to display if the image can't be loaded.
|
javax.swing.text.AttributeSet |
getAttributes()
Fetches the attributes to use when rendering.
|
java.awt.Image |
getImage()
Returns the image to render.
|
java.net.URL |
getImageURL()
Return a URL for the image source,
or null if it could not be determined.
|
javax.swing.Icon |
getLoadingImageIcon()
Returns the icon to use while in the process of loading the image.
|
boolean |
getLoadsSynchronously()
Returns true if the image should be loaded when first asked for.
|
javax.swing.Icon |
getNoImageIcon()
Returns the icon to use if the image couldn't be found.
|
float |
getPreferredSpan(int axis)
Determines the preferred span for this view along an
axis.
|
protected javax.swing.text.html.StyleSheet |
getStyleSheet()
Convenience method to get the StyleSheet.
|
java.lang.String |
getToolTipText(float x,
float y,
java.awt.Shape allocation)
For images the tooltip text comes from text specified with the
ALT attribute. |
java.awt.Shape |
modelToView(int pos,
java.awt.Shape a,
javax.swing.text.Position.Bias b)
Provides a mapping from the document model coordinate space
to the coordinate space of the view mapped to it.
|
void |
paint(java.awt.Graphics g,
java.awt.Shape a)
Paints the View.
|
void |
setLoadsSynchronously(boolean newValue)
Sets how the image is loaded.
|
void |
setParent(javax.swing.text.View parent)
Establishes the parent view for this view.
|
protected void |
setPropertiesFromAttributes()
Update any cached values that come from attributes.
|
void |
setSize(float width,
float height)
Sets the size of the view.
|
int |
viewToModel(float x,
float y,
java.awt.Shape a,
javax.swing.text.Position.Bias[] bias)
Provides a mapping from the view coordinate space to the logical
coordinate space of the model.
|
append, breakView, createFragment, 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, updateChildren, updateLayout, viewToModel
public java.lang.String getAltText()
HTML.Attribute.ALT
.public java.net.URL getImageURL()
public javax.swing.Icon getNoImageIcon()
public javax.swing.Icon getLoadingImageIcon()
public java.awt.Image getImage()
public void setLoadsSynchronously(boolean newValue)
newValue
is true,
the image we be loaded when first asked for, otherwise it will
be loaded asynchronously. The default is to not load synchronously,
that is to load the image asynchronously.public boolean getLoadsSynchronously()
protected javax.swing.text.html.StyleSheet getStyleSheet()
public javax.swing.text.AttributeSet getAttributes()
getAttributes
in class javax.swing.text.View
public java.lang.String getToolTipText(float x, float y, java.awt.Shape allocation)
ALT
attribute. This is overriden to return
getAltText
.getToolTipText
in class javax.swing.text.View
JTextComponent.getToolTipText(java.awt.event.MouseEvent)
protected void setPropertiesFromAttributes()
public void setParent(javax.swing.text.View parent)
setParent
in class javax.swing.text.View
public void changedUpdate(javax.swing.event.DocumentEvent e, java.awt.Shape a, javax.swing.text.ViewFactory f)
changedUpdate
in class javax.swing.text.View
public void paint(java.awt.Graphics g, java.awt.Shape a)
paint
in class javax.swing.text.View
g
- the rendering surface to usea
- the allocated region to render intoView.paint(java.awt.Graphics, java.awt.Shape)
public float getPreferredSpan(int axis)
getPreferredSpan
in class javax.swing.text.View
axis
- may be either X_AXIS or Y_AXISpublic float getAlignment(int axis)
getAlignment
in class javax.swing.text.View
axis
- may be either X_AXIS or Y_AXISpublic java.awt.Shape modelToView(int pos, java.awt.Shape a, javax.swing.text.Position.Bias b) throws javax.swing.text.BadLocationException
modelToView
in class javax.swing.text.View
pos
- the position to converta
- the allocated region to render intojavax.swing.text.BadLocationException
- if the given position does not represent a
valid location in the associated documentView.modelToView(int, java.awt.Shape, javax.swing.text.Position.Bias)
public int viewToModel(float x, float y, java.awt.Shape a, javax.swing.text.Position.Bias[] bias)
viewToModel
in class javax.swing.text.View
x
- the X coordinatey
- the Y coordinatea
- the allocated region to render intoView.viewToModel(float, float, java.awt.Shape, javax.swing.text.Position.Bias[])
public void setSize(float width, float height)
setSize
in class javax.swing.text.View
width
- the width >= 0height
- the height >= 0