com.partnersoft.codex.editors
Class TextModel

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

public class TextModel
extends CodexResourceModel

Author:
Russell Cagle Copyright 2006 Partner Software, Inc.

Field Summary
 
Fields inherited from class com.partnersoft.codex.CodexResourceModel
resource
 
Constructor Summary
TextModel(CodexResource resource)
           
 
Method Summary
 void addTextModelListener(TextModelListener listener)
           
 CodexResource getCodexResource()
          Should return whatever got set in setCodexResource().
 java.lang.String getModelLabel()
          Used to label the model in the user interface.
protected  java.lang.StringBuilder getStringBuilder()
           
 java.lang.String getText()
           
 void insertText(int offset, java.lang.String newValue)
           
protected  void insertTextRaw(int offset, java.lang.String str)
           
 void invalidateModel()
          When another model calls CodexResource.touch(), the resource invalidates all other models through this method.
 void removeText(int offset, int length)
           
 void removeTextModelListener(TextModelListener listener)
           
protected  void removeTextRaw(int offset, int length)
           
 void save(java.io.OutputStream outie)
          This is the counterpart to CodexResource.touch().
 void setCodexResource(CodexResource resource)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextModel

public TextModel(CodexResource resource)
Method Detail

getStringBuilder

protected java.lang.StringBuilder getStringBuilder()
                                            throws java.io.IOException
Throws:
java.io.IOException

insertTextRaw

protected void insertTextRaw(int offset,
                             java.lang.String str)
                      throws java.io.IOException
Parameters:
offset -
str -
a -
Throws:
java.io.IOException

removeTextRaw

protected void removeTextRaw(int offset,
                             int length)
                      throws java.io.IOException
Parameters:
offset -
str -
a -
Throws:
java.io.IOException

addTextModelListener

public void addTextModelListener(TextModelListener 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:

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:

getText

public java.lang.String getText()
                         throws java.io.IOException
Throws:
java.io.IOException

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

insertText

public void insertText(int offset,
                       java.lang.String newValue)

removeText

public void removeText(int offset,
                       int length)
                throws java.io.IOException
Throws:
java.io.IOException

removeTextModelListener

public void removeTextModelListener(TextModelListener 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)