Dresden OCL Toolkit

tudresden.ocl.gui
Class OCLEditor.OCLEditorDocument

java.lang.Object
  extended byjavax.swing.text.AbstractDocument
      extended byjavax.swing.text.DefaultStyledDocument
          extended bytudresden.ocl.gui.OCLEditor.OCLEditorDocument
All Implemented Interfaces:
Document, Serializable, StyledDocument
Enclosing class:
OCLEditor

protected static class OCLEditor.OCLEditorDocument
extends DefaultStyledDocument

A specialized styled document that will prevent editing of portions of text which have been specially marked "allowEdit"==FALSE.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.text.DefaultStyledDocument
DefaultStyledDocument.AttributeUndoableEdit, DefaultStyledDocument.ElementBuffer, DefaultStyledDocument.ElementSpec, DefaultStyledDocument.SectionElement
 
Nested classes inherited from class javax.swing.text.AbstractDocument
AbstractDocument.AbstractElement, AbstractDocument.AttributeContext, AbstractDocument.BranchElement, AbstractDocument.Content, AbstractDocument.DefaultDocumentEvent, AbstractDocument.ElementEdit, AbstractDocument.LeafElement
 
Field Summary
private  int m_nDoCheckUneditable
          If >= 0, checkEditLocation(int, int) will throw a BadLocationException on attempts to remove or modify elements which are marked "allowEdit"==FALSE.
 
Fields inherited from class javax.swing.text.DefaultStyledDocument
buffer, BUFFER_SIZE_DEFAULT
 
Fields inherited from class javax.swing.text.AbstractDocument
BAD_LOCATION, BidiElementName, ContentElementName, ElementNameAttribute, listenerList, ParagraphElementName, SectionElementName
 
Fields inherited from interface javax.swing.text.Document
StreamDescriptionProperty, TitleProperty
 
Constructor Summary
protected OCLEditor.OCLEditorDocument()
           
 
Method Summary
protected  void checkEditLocation(int offset, int length)
          Check the edit range for intersection with any elements that are marked uneditable.
protected  Element getNeighbouringElement(Element e)
           
 void insertString(int offset, String str, AttributeSet a)
           
 void remove(int offset, int length)
           
 void restartChecking()
          Restart checking for uneditable elements.
 void stopChecking()
          Stop checking for uneditable elements.
 
Methods inherited from class javax.swing.text.DefaultStyledDocument
addDocumentListener, addStyle, create, createDefaultRoot, getBackground, getCharacterElement, getDefaultRootElement, getFont, getForeground, getLogicalStyle, getParagraphElement, getStyle, getStyleNames, insert, insertUpdate, removeDocumentListener, removeStyle, removeUpdate, setCharacterAttributes, setLogicalStyle, setParagraphAttributes, styleChanged
 
Methods inherited from class javax.swing.text.AbstractDocument
addUndoableEditListener, createBranchElement, createLeafElement, createPosition, dump, fireChangedUpdate, fireInsertUpdate, fireRemoveUpdate, fireUndoableEditUpdate, getAsynchronousLoadPriority, getAttributeContext, getBidiRootElement, getContent, getCurrentWriter, getDocumentFilter, getDocumentListeners, getDocumentProperties, getEndPosition, getLength, getListeners, getProperty, getRootElements, getStartPosition, getText, getText, getUndoableEditListeners, postRemoveUpdate, putProperty, readLock, readUnlock, removeUndoableEditListener, render, replace, setAsynchronousLoadPriority, setDocumentFilter, setDocumentProperties, writeLock, writeUnlock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.swing.text.Document
addUndoableEditListener, createPosition, getEndPosition, getLength, getProperty, getRootElements, getStartPosition, getText, getText, putProperty, removeUndoableEditListener, render
 

Field Detail

m_nDoCheckUneditable

private int m_nDoCheckUneditable
If >= 0, checkEditLocation(int, int) will throw a BadLocationException on attempts to remove or modify elements which are marked "allowEdit"==FALSE.

Constructor Detail

OCLEditor.OCLEditorDocument

protected OCLEditor.OCLEditorDocument()
Method Detail

insertString

public void insertString(int offset,
                         String str,
                         AttributeSet a)
                  throws BadLocationException
Throws:
BadLocationException

remove

public void remove(int offset,
                   int length)
            throws BadLocationException
Throws:
BadLocationException

stopChecking

public void stopChecking()
Stop checking for uneditable elements. Must be paired with calls to restartChecking().


restartChecking

public void restartChecking()
Restart checking for uneditable elements. Must be paired with calls to stopChecking().


checkEditLocation

protected void checkEditLocation(int offset,
                                 int length)
                          throws BadLocationException
Check the edit range for intersection with any elements that are marked uneditable.

Throws:
BadLocationException

getNeighbouringElement

protected Element getNeighbouringElement(Element e)

Dresden OCL Toolkit

Submit a bug
Developed at the Dresden University of Technology.
This software is published under the GNU Lesser General Public License.