|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.vinculumtech.carrierwave.image.ImageGraph
The ImageGraph class maintains all Image
instances associated in a graph.
When two Image instances are associated by calling the setter on the parent with the child
as the arguement, one of three things will happen:
ImageHelper
,
Serialized FormConstructor Summary | |
|
ImageGraph()
|
protected |
ImageGraph(Image originImage)
|
protected |
ImageGraph(ImageGraph imageGraph)
This constructor will assume all the images held by the given ImageGraph instance. Note the given ImageGraph instance will be in an undefined state and should be discarded. |
Method Summary | |
boolean |
acceptImage(Image image)
Moves the given Image instance from its current ImageGraph to this ImageGraph instance, removeImage is called on the original ImageGraph instance.Reference counts and origin status is preserved. Note that if this ImageGraph instance already contains an Image instance with an equivalent identity (Icon), the old Image instance will not be replaced. |
protected void |
addImagesFrom(ImageGraph imageGraph)
|
protected void |
addImagesTo(ImageGraph imageGraph)
|
void |
addOriginImage(Image originImage)
Makes the given Image instance an origin (possibly one of many). If the given Image instance is owned by another ImageGraph instance, an IllegalArgumentException will be thrown. |
protected void |
associateImage(Image image)
Adds the given Image instance to the current ImageGraph if it is not already a member. It is assumed the given image is intended as a child to an Image existing in this ImageGraph. |
protected void |
associateImageGraphs(ImageGraph imageGraph)
Handles the association between this ImageGraph instance and the given child ImageGraph instance (associated with an Image added via associateImage )
It is intended that this method be overidden for special cases. |
protected ImageGraph |
becomeImageGraph()
Intended to be used by subclasses implementing the writeReplace method for serialization support. |
void |
clear()
Clears all images and origins from this ImageGraph instance. |
void |
clearOriginImages()
Sets the number of origin Image instances to zero, and markes thier origin status accordingly. |
boolean |
containsImage(Icon icon)
Tests the local image Map for an Image instance with equivalent identity. |
protected void |
decrementImage(Image image)
|
protected void |
disassociateImage(Icon icon)
|
protected void |
disassociateImage(Image image)
Disassociates the given Image image from the graph. It is assumed the given Image instance has lost a parent child relationship with an Image in this ImageGraph instance. Note that disassociation does not remove the Image instance, but simply decrements its reference count. |
java.util.Collection |
getIcons()
Returns only Icon instances that have an associated Image instance in the graph. |
Image |
getImage(Icon icon)
Returns an Image instance equivalent to the given Icon instance. By default, this method calls getImageLocal . |
Image |
getImageLocal(Icon icon)
Retrieves the Image instance with the given Icon identity from the 'local' image Map. Override getImage to delegate Image retrieval from an additional source. |
java.util.Map |
getImageMap()
|
java.util.Collection |
getImages()
|
protected java.util.Map |
getImagesPrivate()
|
Image |
getOriginImage()
|
java.util.List |
getOriginImages()
Returns a List of all origin Image instances. The result of a 'select' guarantees one origin. |
protected java.util.List |
getOriginsPrivate()
|
boolean |
hasManyOriginImages()
An ImageGraph may have zero or more origin Images. |
protected void |
incrementImage(Image image)
|
boolean |
isDurable()
A durable ImageGraph instance is one that will not release its owned Image instances during a parent child association. By default the parent ImageGraph will assume the instances owned by the child ImageGraph instance. |
boolean |
isStrict()
A strict ImageGraph instance is one that represents the whole graph as represented on the server. |
void |
makeDurable()
Forces this ImageGraph instance to be durable. |
void |
makeOriginImage(Image originImage)
Forces the given Image instance to be the only origin in the graph. It is expected that the given Image instance is already a member of this ImageGraph instance. |
void |
makeOriginImages(java.util.List originImages)
Forces all the Image instances in the given List to be the only origin image instances in the graph. It is expected that all the given Image instances in the List are already in the current ImageGraph instance. |
void |
makeStrict()
Forces this ImageGraph instance to be strict. |
Image |
putImage(Image image)
Places the the given Image instance directly into this ImageGraph instance and returns any Image instance with an equivalent identity (Icon) as the given Image instance. Reference counts are not not incremented. |
protected void |
reassociateImage(Icon oldIcon,
Icon newIcon)
Reassociates an Image instance from the oldIcon to the newIcon. This method is used when Icon instances are made soft or have lost thier identity (intentionally). |
void |
removeImage(Image image)
Removes the given Image instance from this ImageGraph instance. |
protected void |
removeOrigin(Image image)
|
void |
setDurable(boolean durable)
|
void |
setIsStrict(boolean isStrict)
|
protected java.util.Map |
setThisOnAll(java.util.Map images)
|
int |
size()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ImageGraph()
protected ImageGraph(Image originImage)
protected ImageGraph(ImageGraph imageGraph)
imageGraph
- Method Detail |
protected final java.util.Map getImagesPrivate()
protected final java.util.List getOriginsPrivate()
public boolean isStrict()
public void makeStrict()
public void setIsStrict(boolean isStrict)
public boolean isDurable()
public void makeDurable()
public void setDurable(boolean durable)
public java.util.Collection getImages()
public java.util.Collection getIcons()
public java.util.Map getImageMap()
public void clear()
public int size()
public final Image getImageLocal(Icon icon)
getImage
to delegate Image retrieval from an additional source.
icon
-
public Image getImage(Icon icon)
getImageLocal
. Override this method to
delegate Image retrieval from and additional source.
icon
-
public boolean containsImage(Icon icon)
icon
-
public Image getOriginImage()
public boolean hasManyOriginImages()
public java.util.List getOriginImages()
public void clearOriginImages()
public void makeOriginImage(Image originImage)
originImage
- public void makeOriginImages(java.util.List originImages)
originImages
- public void addOriginImage(Image originImage)
originImage
- protected void removeOrigin(Image image)
public boolean acceptImage(Image image)
removeImage
is called on the original ImageGraph instance.
image
-
public Image putImage(Image image)
image
-
public void removeImage(Image image)
image
- protected void associateImage(Image image)
image
- protected void associateImageGraphs(ImageGraph imageGraph)
associateImage
)
It is intended that this method be overidden for special cases.
imageGraph
- protected void addImagesFrom(ImageGraph imageGraph)
protected void addImagesTo(ImageGraph imageGraph)
protected void reassociateImage(Icon oldIcon, Icon newIcon)
oldIcon
- newIcon
- protected void disassociateImage(Image image)
image
- protected void disassociateImage(Icon icon)
protected void incrementImage(Image image)
protected void decrementImage(Image image)
protected java.util.Map setThisOnAll(java.util.Map images)
protected ImageGraph becomeImageGraph()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |