public class JosmImageView extends ImageView
Modifier and Type | Field and Description |
---|---|
private static int |
HEIGHT_FLAG |
private Field |
heightField |
private Field |
imageField |
private static int |
LOADING_FLAG |
private static int |
RELOAD_FLAG |
private static int |
RELOAD_IMAGE_FLAG |
private Field |
stateField |
private static int |
WIDTH_FLAG |
private Field |
widthField |
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 |
---|
JosmImageView(Element elem)
Constructs a new
JosmImageView . |
Modifier and Type | Method and Description |
---|---|
AttributeSet |
getAttributes() |
Image |
getImage() |
float |
getPreferredSpan(int axis) |
private void |
loadImage()
Loads the image from the URL
getImageURL . |
void |
paint(Graphics g,
Shape a) |
private void |
refreshImage()
Loads the image and updates the size accordingly.
|
void |
setSize(float width,
float height) |
private void |
sync()
Makes sure the necessary properties and image is loaded.
|
changedUpdate, getAlignment, getAltText, getImageURL, getLoadingImageIcon, getLoadsSynchronously, getNoImageIcon, getStyleSheet, getToolTipText, modelToView, setLoadsSynchronously, setParent, setPropertiesFromAttributes, viewToModel
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
private static final int LOADING_FLAG
private static final int WIDTH_FLAG
private static final int HEIGHT_FLAG
private static final int RELOAD_FLAG
private static final int RELOAD_IMAGE_FLAG
private final Field imageField
private final Field stateField
private final Field widthField
private final Field heightField
public JosmImageView(Element elem) throws NoSuchFieldException, SecurityException
JosmImageView
.elem
- the element to create a view forSecurityException
- see Class.getDeclaredField(java.lang.String)
for detailsNoSuchFieldException
- see Class.getDeclaredField(java.lang.String)
for detailsprivate void sync()
private void refreshImage() throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, SecurityException
loadImage
or
updateImageSize
directly.IllegalAccessException
- see Field.set(java.lang.Object, java.lang.Object)
and Method.invoke(java.lang.Object, java.lang.Object...)
for detailsIllegalArgumentException
- see Field.set(java.lang.Object, java.lang.Object)
and Method.invoke(java.lang.Object, java.lang.Object...)
for detailsInvocationTargetException
- see Method.invoke(java.lang.Object, java.lang.Object...)
for detailsNoSuchMethodException
- see Class.getDeclaredMethod(java.lang.String, java.lang.Class<?>...)
for detailsSecurityException
- see Class.getDeclaredMethod(java.lang.String, java.lang.Class<?>...)
for detailsprivate void loadImage() throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, SecurityException
getImageURL
. This should
only be invoked from refreshImage
.IllegalAccessException
- see Field.set(java.lang.Object, java.lang.Object)
and Method.invoke(java.lang.Object, java.lang.Object...)
for detailsIllegalArgumentException
- see Field.set(java.lang.Object, java.lang.Object)
and Method.invoke(java.lang.Object, java.lang.Object...)
for detailsInvocationTargetException
- see Method.invoke(java.lang.Object, java.lang.Object...)
for detailsNoSuchMethodException
- see Class.getDeclaredMethod(java.lang.String, java.lang.Class<?>...)
for detailsSecurityException
- see Class.getDeclaredMethod(java.lang.String, java.lang.Class<?>...)
for detailspublic AttributeSet getAttributes()
getAttributes
in class ImageView
public float getPreferredSpan(int axis)
getPreferredSpan
in class ImageView