public abstract class IlvCachingLinkConnector extends IlvLinkConnector
useCache()
returns
true
.IlvLinkConnector
,
Serialized FormConstructor and Description |
---|
IlvCachingLinkConnector()
Creates an empty
IlvCachingLinkConnector . |
IlvCachingLinkConnector(IlvGraphic node)
Creates an
IlvCachingLinkConnector attached to the node
node . |
IlvCachingLinkConnector(IlvInputStream stream)
Reads the object from an
IlvInputStream . |
IlvCachingLinkConnector(IlvLinkImage link,
boolean origin)
Creates an
IlvCachingLinkConnector attached to the
origin or destination of the link link . |
Modifier and Type | Method and Description |
---|---|
protected void |
allLinksRemoved()
Called when all the links are removed from the node.
|
protected abstract IlvPoint |
calcConnectionPoint(IlvLinkImage link,
boolean origin,
IlvTransformer transformer)
Calculates the connection point of
link . |
protected void |
cleanCache()
Cleans the cache for all links.
|
protected void |
cleanCache(IlvLinkImage link)
Cleans the cache for the input link.
|
void |
detach(boolean redraw)
Detaches the link connector from the attached node and from the
attached links (if any).
|
void |
detach(IlvLinkImage link,
boolean origin,
boolean redraw)
Detaches the link connector from the origin or the destination
of a link.
|
void |
disconnectAllLinks()
Disconnects all the links connected to the link connector.
|
void |
disconnectLink(IlvLinkImage link,
boolean origin)
Disconnects a link from the link connector.
|
int |
getCacheSize()
Returns the cache size.
|
IlvPoint |
getConnectionPoint(IlvLinkImage link,
boolean origin,
IlvTransformer transformer)
Returns the connection point of
link . |
void |
linkChanged(IlvLinkImage link)
This method is called internally by some link classes whenever the shape
of the link has changed.
|
static void |
LinkChanged(IlvLinkImage link)
This convenience method checks whether the input link uses any
IlvCachingLinkConnector and calls linkChanged(ilog.views.IlvLinkImage)
on them. |
void |
linkRemoved(IlvLinkImage link)
Called when a link is removed from the node.
|
static void |
LinkRemoved(IlvLinkImage link)
This convenience method checks whether the input link uses any
IlvCachingLinkConnector and calls cleanCache(ilog.views.IlvLinkImage)
on them. |
void |
setCacheSize(int size)
Sets the size of the cache.
|
protected abstract boolean |
useCache()
Returns
true if the caching link connector actually
uses the cache. |
protected boolean |
useCache(IlvLinkImage link)
Return
true if the caching link connector actually
uses the cache for the input link. |
void |
write(IlvOutputStream stream)
Writes the object to an
IlvOutputStream . |
allowsConnectionPointMove, attach, attach, attach, connectLink, drawGhost, Get, Get, GetAttached, GetAttached, getClosestConnectionPoint, getGhostBoundingBox, getNode, isPersistent, read, supportsDrawGhost, write, zoomable
public IlvCachingLinkConnector()
IlvCachingLinkConnector
. It can be
attached either to a node (using
IlvLinkConnector.attach(ilog.views.IlvGraphic,boolean)
) or to an extremity
of a link (using
IlvLinkConnector.attach(ilog.views.IlvLinkImage,boolean,boolean)
).public IlvCachingLinkConnector(IlvGraphic node)
IlvCachingLinkConnector
attached to the node
node
.public IlvCachingLinkConnector(IlvLinkImage link, boolean origin)
IlvCachingLinkConnector
attached to the
origin or destination of the link link
.
If the argument origin
is true
,
this creates a link connector for the origin of link
.
If the argument origin
is false
,
this creates a link connector for the destination of link
.public IlvCachingLinkConnector(IlvInputStream stream) throws IlvReadFileException
IlvInputStream
.
Note that any subclass (except one that overrides the method
IlvLinkConnector.isPersistent()
to return false
) must provide a
constructor with an IlvInputStream
argument.
The first line of the constructor must be super(stream)
.
stream
- The input stream.IlvReadFileException
- if the format is not correct.write(ilog.views.io.IlvOutputStream)
,
IlvLinkConnector.isPersistent()
,
IlvLinkConnector.attach(IlvGraphic, boolean)
,
detach(boolean)
public void write(IlvOutputStream stream) throws IOException
IlvOutputStream
.
You must override this method if specific data is to be stored.
Note that the first instruction in your implementation of the method must
be super.write(stream)
.
You should not
call this method directly; instead, you should use the write
methods of the IlvGrapher
that contains the node
to which the link connector is attached.
write
in interface IlvPersistentObject
write
in class IlvLinkConnector
stream
- The output stream.IOException
- thrown when an exception occurs during
the write operation for this object.IlvLinkConnector.isPersistent()
protected abstract boolean useCache()
true
if the caching link connector actually
uses the cache.protected boolean useCache(IlvLinkImage link)
true
if the caching link connector actually
uses the cache for the input link.
Caches can only be used for subclasses of IlvPolicyAwareLinkImage
.
Additionally, it checks whether useCache()
returns
true
.public void setCacheSize(int size)
2
.
The cache size should be one more than the views that are displaying
the links. For instance, if you display links in a main view and in
an overview, you should use cache size 3
, which is also
the default.getCacheSize()
public int getCacheSize()
setCacheSize(int)
public IlvPoint getConnectionPoint(IlvLinkImage link, boolean origin, IlvTransformer transformer)
link
.getConnectionPoint
in class IlvLinkConnector
link
- The link.origin
- If true
, the position of the
connection point for the link origin is determined. Otherwise, the
position of the connection point for the link destination is found.transformer
- The transformer that is used to draw the node.null
.protected abstract IlvPoint calcConnectionPoint(IlvLinkImage link, boolean origin, IlvTransformer transformer)
link
.
This is called from getConnectionPoint(ilog.views.IlvLinkImage, boolean, ilog.views.IlvTransformer)
if the connection
point is not yet cached.link
- The link.origin
- If true
, the position of the
connection point for the link origin is determined. Otherwise, the
position of the connection point for the link destination is found.transformer
- The transformer that is used to draw the
node to which is connected the corresponding extremity of the link.public void detach(boolean redraw)
detach
in class IlvLinkConnector
redraw
- If true
, the node to which the connector is
attached and its adjacent links will be redrawn.IlvLinkConnector.attach(IlvGraphic, boolean)
,
IlvLinkConnector.detach(IlvLinkImage, boolean, boolean)
public void detach(IlvLinkImage link, boolean origin, boolean redraw)
detach
in class IlvLinkConnector
link
- The link from which the link connector is detached.origin
- If true
, the link connector is detached
from the origin of link
. Otherwise, it is detached
from the destination of link
.redraw
- If true
, the node to which the connector is
attached and its adjacent links will be redrawn.IlvLinkConnector.attach(IlvLinkImage, boolean, boolean)
,
IlvLinkConnector.detach(boolean)
public void linkRemoved(IlvLinkImage link)
linkRemoved
in class IlvLinkConnector
protected void allLinksRemoved()
allLinksRemoved
in class IlvLinkConnector
public void disconnectLink(IlvLinkImage link, boolean origin)
disconnectLink
in class IlvLinkConnector
link
- The link to be disconnected.origin
- If set to true
, the origin of the link
is disconnected. If false
the destination link is
disconnected.IlvLinkConnector.connectLink(ilog.views.IlvLinkImage, ilog.views.IlvPoint, boolean, ilog.views.IlvTransformer)
public void disconnectAllLinks()
public void linkChanged(IlvLinkImage link)
public static void LinkChanged(IlvLinkImage link)
IlvCachingLinkConnector
and calls linkChanged(ilog.views.IlvLinkImage)
on them.public static void LinkRemoved(IlvLinkImage link)
IlvCachingLinkConnector
and calls cleanCache(ilog.views.IlvLinkImage)
on them.protected void cleanCache(IlvLinkImage link)
protected void cleanCache()
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.