com.partnersoft.codex.editors
Class ImageModel

java.lang.Object
  extended by com.partnersoft.codex.CodexResourceModel
      extended by com.partnersoft.codex.editors.ImageModel
All Implemented Interfaces:
CodexNodeView

public class ImageModel
extends CodexResourceModel

Edits a CodexResource as a Image.

Author:
Russell Cagle Copyright 2006 Partner Software, Inc.

Field Summary
 
Fields inherited from class com.partnersoft.codex.CodexResourceModel
resource
 
Constructor Summary
ImageModel(CodexResource resource)
           
 
Method Summary
 void addImageModelListener(ImageModelListener listener)
           
 CodexResource getCodexResource()
          Should return whatever got set in setCodexResource().
 java.awt.Image getImage()
          Returns a copy of the image referred to by this resource.
 java.lang.String getModelLabel()
          Used to label the model in the user interface.
protected  java.awt.Image innerGetImage()
           
 void invalidateModel()
          When another model calls CodexResource.touch(), the resource invalidates all other models through this method.
 void removeImageModelListener(ImageModelListener listener)
           
 void save(java.io.OutputStream outie)
          This is the counterpart to CodexResource.touch().
 void setCodexResource(CodexResource resource)
           
 void setImage(java.awt.Image newImage)
          Replaces the image referred to by this resource with the one provided.
protected  void setImageRaw(java.awt.Image value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageModel

public ImageModel(CodexResource resource)
Method Detail

innerGetImage

protected java.awt.Image innerGetImage()
                                throws java.io.IOException
Throws:
java.io.IOException

setImageRaw

protected void setImageRaw(java.awt.Image value)

addImageModelListener

public void addImageModelListener(ImageModelListener listener)

getCodexResource

public CodexResource getCodexResource()
Description copied from class: CodexResourceModel
Should return whatever got set in setCodexResource(). This lets CodexResource manage the parent-child relationship.

Overrides:
getCodexResource in class CodexResourceModel
Returns:

getImage

public java.awt.Image getImage()
                        throws java.io.IOException
Returns a copy of the image referred to by this resource. If you plan on modifying it, you have to call setImage() with your modified results, and the model must not have been invalidated in between.

Throws:
java.io.IOException

setImage

public void setImage(java.awt.Image newImage)
              throws java.io.IOException
Replaces the image referred to by this resource with the one provided. Makes a defensive copy so further modifications to the one provided will not affect the resource. Throws an IllegalStateException if the resource has been invalidated.

Throws:
java.io.IOException

getModelLabel

public java.lang.String getModelLabel()
Description copied from class: CodexResourceModel
Used to label the model in the user interface.

Specified by:
getModelLabel in class CodexResourceModel
Returns:

invalidateModel

public void invalidateModel()
Description copied from class: CodexResourceModel
When another model calls CodexResource.touch(), the resource invalidates all other models through this method. Models should clear out their internal model. For example, the CogModel should clear out its Cog object. Models should NOT regenerate their internal model.

Specified by:
invalidateModel in class CodexResourceModel

removeImageModelListener

public void removeImageModelListener(ImageModelListener listener)

save

public void save(java.io.OutputStream outie)
          throws java.io.IOException
Description copied from class: CodexResourceModel
This is the counterpart to CodexResource.touch(). CodexResource.touch() invalidates the resource's bytes, and then the resource calls CodexResourceModel.save() when it needs its bytes back.

Specified by:
save in class CodexResourceModel
Throws:
java.io.IOException

setCodexResource

public void setCodexResource(CodexResource resource)