javax.swing.text
Class DefaultFormatter.DefaultDocumentFilter

java.lang.Object
  extended byjavax.swing.text.DocumentFilter
      extended byjavax.swing.text.DefaultFormatter.DefaultDocumentFilter
All Implemented Interfaces:
Serializable
Enclosing class:
DefaultFormatter

private class DefaultFormatter.DefaultDocumentFilter
extends DocumentFilter
implements Serializable

DocumentFilter implementation that calls back to the replace method of DefaultFormatter.


Nested Class Summary
 
Nested classes inherited from class javax.swing.text.DocumentFilter
DocumentFilter.FilterBypass
 
Constructor Summary
private DefaultFormatter.DefaultDocumentFilter()
           
 
Method Summary
 void insertString(DocumentFilter.FilterBypass fb, int offset, String string, AttributeSet attr)
          Invoked prior to insertion of text into the specified Document.
 void remove(DocumentFilter.FilterBypass fb, int offset, int length)
          Invoked prior to removal of the specified region in the specified Document.
 void replace(DocumentFilter.FilterBypass fb, int offset, int length, String text, AttributeSet attr)
          Invoked prior to replacing a region of text in the specified Document.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultFormatter.DefaultDocumentFilter

private DefaultFormatter.DefaultDocumentFilter()
Method Detail

remove

public void remove(DocumentFilter.FilterBypass fb,
                   int offset,
                   int length)
            throws BadLocationException
Description copied from class: DocumentFilter
Invoked prior to removal of the specified region in the specified Document. Subclasses that want to conditionally allow removal should override this and only call supers implementation as necessary, or call directly into the FilterBypass as necessary.

Overrides:
remove in class DocumentFilter
Parameters:
fb - FilterBypass that can be used to mutate Document
offset - the offset from the beginning >= 0
length - 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.

insertString

public void insertString(DocumentFilter.FilterBypass fb,
                         int offset,
                         String string,
                         AttributeSet attr)
                  throws BadLocationException
Description copied from class: DocumentFilter
Invoked prior to insertion of text into the specified Document. Subclasses that want to conditionally allow insertion should override this and only call supers implementation as necessary, or call directly into the FilterBypass.

Overrides:
insertString in class DocumentFilter
Parameters:
fb - FilterBypass that can be used to mutate Document
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
attr - the attributes to associate with the inserted content. This may be null if there are no attributes.
Throws:
BadLocationException - the given insert position is not a valid position within the document

replace

public void replace(DocumentFilter.FilterBypass fb,
                    int offset,
                    int length,
                    String text,
                    AttributeSet attr)
             throws BadLocationException
Description copied from class: DocumentFilter
Invoked prior to replacing a region of text in the specified Document. Subclasses that want to conditionally allow replace should override this and only call supers implementation as necessary, or call directly into the FilterBypass.

Overrides:
replace in class DocumentFilter
Parameters:
fb - FilterBypass that can be used to mutate Document
offset - Location in Document
length - Length of text to delete
text - Text to insert, null indicates no text to insert
attr - AttributeSet indicating attributes of inserted text, null is legal.
Throws:
BadLocationException - the given insert position is not a valid position within the document