Class JosmImageView
java.lang.Object
javax.swing.text.View
javax.swing.text.html.ImageView
org.openstreetmap.josm.gui.widgets.JosmImageView
- All Implemented Interfaces:
SwingConstants
Specialized Image View allowing to display SVG images.
- Since:
- 8933
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate final Fieldprivate final Fieldprivate static final intprivate static final intprivate static final intprivate final Fieldprivate static final intprivate final FieldFields inherited from class javax.swing.text.View
BadBreakWeight, ExcellentBreakWeight, ForcedBreakWeight, GoodBreakWeight, X_AXIS, Y_AXISFields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidLoads the image from the URLgetImageURL.private voidLoads the image and updates the size accordingly.private voiddoSync()Makes sure the necessary properties and image is loaded.private static FieldgetDeclaredField(String name) getImage()floatgetPreferredSpan(int axis) voidvoidsetSize(float width, float height) Methods inherited from class javax.swing.text.html.ImageView
changedUpdate, getAlignment, getAltText, getImageURL, getLoadingImageIcon, getLoadsSynchronously, getNoImageIcon, getStyleSheet, getToolTipText, modelToView, setLoadsSynchronously, setParent, setPropertiesFromAttributes, viewToModelMethods inherited from class javax.swing.text.View
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
-
Field Details
-
LOADING_FLAG
- See Also:
-
WIDTH_FLAG
- See Also:
-
HEIGHT_FLAG
- See Also:
-
RELOAD_FLAG
- See Also:
-
RELOAD_IMAGE_FLAG
- See Also:
-
imageField
-
stateField
-
widthField
-
heightField
-
-
Constructor Details
-
JosmImageView
Constructs a newJosmImageView.- Parameters:
elem- the element to create a view for- Throws:
SecurityException- seeClass.getDeclaredField(java.lang.String)for detailsNoSuchFieldException- seeClass.getDeclaredField(java.lang.String)for details
-
-
Method Details
-
getDeclaredField
- Throws:
NoSuchFieldException
-
doSync
Makes sure the necessary properties and image is loaded. -
doRefreshImage
private void doRefreshImage() throws IllegalAccessException, InvocationTargetException, NoSuchMethodExceptionLoads the image and updates the size accordingly. This should be invoked instead of invokingloadImageorupdateImageSizedirectly.- Throws:
IllegalAccessException- seeField.set(java.lang.Object, java.lang.Object)andMethod.invoke(java.lang.Object, java.lang.Object...)for detailsIllegalArgumentException- seeField.set(java.lang.Object, java.lang.Object)andMethod.invoke(java.lang.Object, java.lang.Object...)for detailsInvocationTargetException- seeMethod.invoke(java.lang.Object, java.lang.Object...)for detailsNoSuchMethodException- seeClass.getDeclaredMethod(java.lang.String, java.lang.Class<?>...)for detailsSecurityException- seeClass.getDeclaredMethod(java.lang.String, java.lang.Class<?>...)for details
-
doLoadImage
private void doLoadImage() throws IllegalAccessException, InvocationTargetException, NoSuchMethodExceptionLoads the image from the URLgetImageURL. This should only be invoked fromrefreshImage.- Throws:
IllegalAccessException- seeField.set(java.lang.Object, java.lang.Object)andMethod.invoke(java.lang.Object, java.lang.Object...)for detailsIllegalArgumentException- seeField.set(java.lang.Object, java.lang.Object)andMethod.invoke(java.lang.Object, java.lang.Object...)for detailsInvocationTargetException- seeMethod.invoke(java.lang.Object, java.lang.Object...)for detailsNoSuchMethodException- seeClass.getDeclaredMethod(java.lang.String, java.lang.Class<?>...)for detailsSecurityException- seeClass.getDeclaredMethod(java.lang.String, java.lang.Class<?>...)for details
-
getImage
-
getAttributes
- Overrides:
getAttributesin classImageView
-
paint
-
getPreferredSpan
- Overrides:
getPreferredSpanin classImageView
-
setSize
-