public class IlvURLGraphic extends IlvGraphicSet
IlvGraphic
from a URL.
The contents of the graphic object can be specified as an SVG file, an IVL file, a DXF file, a GIF or JPG or PNG image or as a Perforce JViews prototype. The type of the file is determined by the file name extension.
This class can be used in two ways:
get(java.lang.String)
method returns
a new graphic object whose contents are described by
the specified URL.
IlvGraphic
: You can create
a new instance of IlvURLGraphic
and call
setURL(java.lang.String)
to specify the contents of the graphic
object.
The first way is recommended, because it saves the extra cost of the graphic set. The second way can be used when the object must be created through its constructor.
IlvGraphicSet.DelegateObjectInteractor
list
Constructor and Description |
---|
IlvURLGraphic()
Creates a new empty URL graphic.
|
IlvURLGraphic(IlvInputStream in)
Reads a new URL graphic from an input stream.
|
IlvURLGraphic(IlvURLGraphic source)
Creates a new copy of a URL graphic.
|
Modifier and Type | Method and Description |
---|---|
void |
applyTransform(IlvTransformer t)
Applies a transformer to this graphic object.
|
IlvGraphic |
copy()
Returns a new copy of this URL graphic.
|
void |
flush()
Flushes the URL cache that corresponds to this
IlvURLGraphic
instance. |
static void |
flush(String url)
Flushes the URL cache that corresponds to the input URL.
|
static IlvGraphic |
get(String file)
Returns an
IlvGraphic containing the graphic objects
described by the specified URL. |
Color |
getBackground()
Returns the background color of all the objects in the graphic set,
or
null if the background color has not been set. |
Color |
getForeground()
Returns the foreground color of all the objects in the graphic set,
or
null if the foreground color has not been set. |
String |
getURL()
Returns the URL that describes the contents of this URL graphic.
|
static String |
getURL(IlvGraphic g)
Returns the URL from which a graphic
object has been read.
|
static boolean |
isSupported(String file)
Returns
true if the specified URL is of a type supported
by the URL graphic class. |
void |
setBackground(Color c)
Sets the background color of all the objects in the graphic set.
|
void |
setForeground(Color c)
Sets the foreground color of all the objects in the graphic set.
|
void |
setURL(String file)
Sets the URL that describes the contents of this URL graphic.
|
void |
write(IlvOutputStream out)
Writes this URL graphic to an output stream.
|
addGraphicBagHierarchyListener, addManagerViewsHierarchyListener, addObject, addObjectAt, applyToObject, applyToObjectImpl, baseTextDirectionChanged, boundingBox, componentOrientationChanged, contains, contains, draw, drawCore, enableGraphicBagHierarchyEventForwarding, enableManagerViewsHierarchyEventForwarding, fireGraphicBagHierarchyEvent, fireManagerViewsHierarchyEvent, firstContains, getAlpha, getCardinal, getClip, getIndex, getIntersectionWithOutline, getObject, getObject, getObjectName, getObjects, getOriginalPopupMenu, getPopupMenu, getToolTipText, invalidateAndApplyToObject, invalidateBBoxCache, isBaseTextDirectionSensitive, isComponentOrientationSensitive, isLocaleSensitive, isPersistent, moveObject, needsGraphicBagHierarchyEvent, needsManagerViewsHierarchyEvent, reDrawObj, reDrawRegion, removeAll, removeGraphicBagHierarchyListener, removeManagerViewsHierarchyListener, removeObject, removeObjectAt, reshapeObject, setAlpha, setBaseTextDirection, setClip, setGraphicBag, setInsideApply, setObjectName, shouldElementBePartOfClip, shouldRestrictListOfElementsForClip, zoomable
calcResolvedBaseTextDirection, getBaseTextDirection, getComponentOrientation, getResolvedBaseTextDirection, getULocale, invalidateBidiCache, setBaseTextDirection, setBaseTextDirectionDuringConstruction
addActionListener, addNamedPropertyListener, allViewsRemoved, blinkingStateOn, boundingBox, callDraw, getAndAssociateObjectInteractor, getBlinkingAction, getBlinkingObjectOwner, getBlinkingOffPeriod, getBlinkingOnPeriod, getCenter, getDefaultInteractor, getGraphicBag, GetGraphicObject, getLocale, getName, getNamedProperty, getObjectInteractor, getPopupMenu, getPopupMenuName, getProperty, getToolTipBaseTextDirection, getToolTipText, getTopLevelGraphicBag, getTransferData, getTransferDataFlavors, getZOrderIndex, hasProperty, inside, intersects, isDataFlavorSupported, isEditable, isInApplyToObject, isMovable, isSelectable, isVisible, localeChanged, makeSelection, move, move, moveResize, needsViewNotification, notifyObjectInteractorToManager, processActionEvent, reDraw, registerBlinkingResource, removeActionListener, removeNamedProperty, removeNamedPropertyListener, removeProperty, replaceProperty, resize, rotate, scale, setBlinkingAction, setBlinkingOffPeriod, setBlinkingOnPeriod, setEditable, setFillOn, setInApplyToObject, setMovable, setName, setNamedProperty, setNameImpl, setObjectInteractor, setPopupMenu, setPopupMenuName, setProperty, setSelectable, setStrokeOn, setToolTipBaseTextDirection, setToolTipText, setVisible, setZOrderIndex, toString, translate, updateNeedsViewNotification, usesBidiMarkers, viewAddedOrRemoved
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getGraphicBag
public IlvURLGraphic()
public IlvURLGraphic(IlvInputStream in) throws IlvReadFileException, IOException
in
- The input stream.IlvReadFileException
- if the stream is not correctly formatted.IOException
- if an error occurred while reading the stream.public IlvURLGraphic(IlvURLGraphic source)
source
- The URL graphic to copy.public void setURL(String file)
file
- The URL that describes the contents of this
URL graphic. This can be an SVG file (for example:
"http://myserver/drawings/tiger.svg"
),
an IVL file (for example:
"http://myserver/drawings/butterfly.ivl"
),
or a prototype URL
(for example: "file:mydir/myprotos.ivl#aproto"
).
Since JViews 8.0, this class can load a DXF file as well. Since JViews 8.1, this class can load JPG, GIF and PNG files as well.
IllegalArgumentException
- if the URL points to a file
in a format that is not supported by the URL graphic.public String getURL()
public void write(IlvOutputStream out) throws IOException
write
in interface IlvPersistentObject
write
in class IlvGraphicSet
out
- The output stream.IOException
- if an error occurred while writing to the stream.public IlvGraphic copy()
copy
in class IlvGraphicSet
IlvGraphic
public void flush()
IlvURLGraphic
instance.
Call this method if the URL content has changed. After this method has been called the internal graphic cache is deleted. Graphics are no longer loaded from the internal cache.
public static void flush(String url)
Call this method if the URL content has changed. After this method has been called the internal graphic cache is deleted. Graphics are no longer loaded from the internal cache.
public static IlvGraphic get(String file)
IlvGraphic
containing the graphic objects
described by the specified URL.file
- The URL to read the graphics from. This can be either
an SVG file, an IVL file, a Perforce JViews prototypes URL of the form
file:/.../protos.ivl#aProto
, a DXF file,
a PNG file, a JPG file, or a GIF file.IlvGraphic
containing the graphic objects
described by the specified URL.public static boolean isSupported(String file)
true
if the specified URL is of a type supported
by the URL graphic class. Only the suffix of the URL is
checked by this method, not its actual contents.file
- The specified URL.public static String getURL(IlvGraphic g)
g
- The URL graphic.public void setForeground(Color c)
IlvBlinkingColor
.setForeground
in class IlvGraphic
c
- The new foreground color.IlvGraphic.draw(Graphics, IlvTransformer)
,
IlvGraphic.setBackground(Color)
,
IlvGraphic.setFillOn(boolean)
,
IlvGraphic.setStrokeOn(boolean)
,
IlvGraphic
public void setBackground(Color c)
IlvBlinkingColor
.setBackground
in class IlvGraphic
c
- The new background color.IlvGraphic.draw(Graphics, IlvTransformer)
,
IlvGraphic.setForeground(Color)
,
IlvGraphic.setFillOn(boolean)
,
IlvGraphic.setStrokeOn(boolean)
,
IlvGraphic
public Color getForeground()
null
if the foreground color has not been set.setForeground(java.awt.Color)
public Color getBackground()
null
if the background color has not been set.setBackground(java.awt.Color)
public void applyTransform(IlvTransformer t)
applyTransform
in class IlvGraphicSet
t
- The transformer to be applied.IlvGraphic
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.