org.wings.text
Interface SDocument

All Superinterfaces:
SDelayedEventModel, Serializable
All Known Implementing Classes:
DefaultDocument

public interface SDocument
extends Serializable, SDelayedEventModel

Author:
hengels

Method Summary
 void addDocumentListener(SDocumentListener listener)
          Registers the given observer to begin receiving notifications when changes are made to the document.
 SDocumentListener[] getDocumentListeners()
          Returns an array of all the SDocumentListeners added to this SDocument via addDocumentListener().
 int getLength()
          Returns number of characters of content currently in the document.
 String getText()
           
 String getText(int offset, int length)
          Fetches the text contained within the given portion of the document.
 void insert(int offset, String string)
          Inserts a string of content.
 void remove(int offs, int len)
          Removes a portion of the content of the document.
 void removeDocumentListener(SDocumentListener listener)
          Unregisters the given observer from the notification list so it will no longer receive change updates.
 void setText(String text)
           
 
Methods inherited from interface org.wings.SDelayedEventModel
fireDelayedFinalEvents, fireDelayedIntermediateEvents, getDelayEvents, setDelayEvents
 

Method Detail

getLength

int getLength()
Returns number of characters of content currently in the document.

Returns:
number of characters >= 0

getDocumentListeners

SDocumentListener[] getDocumentListeners()
Returns an array of all the SDocumentListeners added to this SDocument via addDocumentListener().

Returns:
all of the SDocumentListeners added or an empty array if no listeners are present
See Also:
addDocumentListener(org.wings.event.SDocumentListener), removeDocumentListener(org.wings.event.SDocumentListener)

addDocumentListener

void addDocumentListener(SDocumentListener listener)
Registers the given observer to begin receiving notifications when changes are made to the document.

Parameters:
listener - the observer to register
See Also:
removeDocumentListener(org.wings.event.SDocumentListener)

removeDocumentListener

void removeDocumentListener(SDocumentListener listener)
Unregisters the given observer from the notification list so it will no longer receive change updates.

Parameters:
listener - the observer to register
See Also:
addDocumentListener(org.wings.event.SDocumentListener)

remove

void remove(int offs,
            int len)
            throws BadLocationException
Removes a portion of the content of the document. This will cause a DocumentEvent of type DocumentEvent.EventType.REMOVE to be sent to the registered DocumentListeners, unless an exception is thrown. The notification will be sent to the listeners by calling the removeUpdate method on the DocumentListeners.

Parameters:
offs - the offset from the beginning >= 0
len - the number of characters to remove >= 0
Throws:
BadLocationException - some portion of the removal range was not a valid part of the document. The location in the exception is the first bad position encountered.
See Also:
DocumentEvent, DocumentListener, UndoableEditEvent, UndoableEditListener

insert

void insert(int offset,
            String string)
            throws BadLocationException
Inserts a string of content. This will cause a DocumentEvent of type DocumentEvent.EventType.INSERT to be sent to the registered DocumentListers, unless an exception is thrown. The DocumentEvent will be delivered by calling the insertUpdate method on the DocumentListener. The offset and length of the generated DocumentEvent will indicate what change was actually made to the Document.

Parameters:
offset - the offset into the document to insert the content >= 0. All positions that track change at or after the given location will move.
string - the string to insert
Throws:
BadLocationException

getText

String getText(int offset,
               int length)
               throws BadLocationException
Fetches the text contained within the given portion of the document.

Parameters:
offset - the offset into the document representing the desired start of the text >= 0
length - the length of the desired string >= 0
Returns:
the text, in a String of length >= 0
Throws:
BadLocationException - some portion of the given range was not a valid part of the document. The location in the exception is the first bad position encountered.

getText

String getText()

setText

void setText(String text)


wingS Swings ;-)