org.PingOO.DLAI.lib.PWidget.text
Class LetterOnlyDocument

java.lang.Object
  |
  +--javax.swing.text.AbstractDocument
        |
        +--javax.swing.text.PlainDocument
              |
              +--org.PingOO.DLAI.lib.PWidget.text.LetterOnlyDocument
Direct Known Subclasses:
CreationPanel.TextOnlyDocument, LowerCaseLetterOnlyDocument

public class LetterOnlyDocument
extends javax.swing.text.PlainDocument
implements PDocument

Document that accepts only alphabetical characters (plus some other valid ones, eg : accentuated characters).

Since:
PingOO 2.0
Version:
2.0
Author:
Fabrice Bouyé (bouye@cur-archamps.fr)
See Also:
Serialized Form

Inner classes inherited from class javax.swing.text.AbstractDocument
javax.swing.text.AbstractDocument.AbstractElement, javax.swing.text.AbstractDocument.AttributeContext, javax.swing.text.AbstractDocument.BidiElement, javax.swing.text.AbstractDocument.BidiRootElement, javax.swing.text.AbstractDocument.BranchElement, javax.swing.text.AbstractDocument.Content, javax.swing.text.AbstractDocument.DefaultDocumentEvent, javax.swing.text.AbstractDocument.ElementEdit, javax.swing.text.AbstractDocument.LeafElement
 
Fields inherited from class javax.swing.text.PlainDocument
added, defaultRoot, lineLimitAttribute, removed, tabSizeAttribute
 
Fields inherited from class javax.swing.text.AbstractDocument
AsyncLoadPriority, BAD_LOCATION, BAD_LOCK_STATE, BidiElementName, bidiRoot, ContentElementName, context, currWriter, data, documentProperties, ElementNameAttribute, I18NProperty, listenerList, numReaders, ParagraphElementName, SectionElementName
 
Constructor Summary
LetterOnlyDocument()
          Creates a new document.
 
Method Summary
 void insertString(int offs, java.lang.String s, javax.swing.text.AttributeSet a)
          Inserts some content into the document.
 boolean isCharValid(char c)
          Indicates if the argument character is valid for insertion in the current document.
 boolean isStringValid(java.lang.String s)
          Indicates if the argument string is valid for insertion in the current document.
 
Methods inherited from class javax.swing.text.PlainDocument
createDefaultRoot, getDefaultRootElement, getParagraphElement, insertComposedTextUpdate, insertUpdate, removeUpdate
 
Methods inherited from class javax.swing.text.AbstractDocument
addDocumentListener, addUndoableEditListener, calculateBidiLevels, createBranchElement, createLeafElement, createPosition, dump, fireChangedUpdate, fireInsertUpdate, fireRemoveUpdate, fireUndoableEditUpdate, getAsynchronousLoadPriority, getAttributeContext, getBidiRootElement, getContent, getCurrentWriter, getDocumentProperties, getEndPosition, getLength, getProperty, getRootElements, getStartPosition, getText, getText, isLeftToRight, postRemoveUpdate, putProperty, readLock, readObject, readUnlock, remove, removeDocumentListener, removeUndoableEditListener, render, setAsynchronousLoadPriority, setDocumentProperties, updateBidi, writeLock, writeUnlock
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Constructor Detail

LetterOnlyDocument

public LetterOnlyDocument()
Creates a new document.
Method Detail

insertString

public void insertString(int offs,
                         java.lang.String s,
                         javax.swing.text.AttributeSet a)
                  throws javax.swing.text.BadLocationException
Inserts some content into the document.
Inserting content causes a write lock to be held while the actual changes are taking place, followed by notification to the observers on the thread that grabbed the write lock.
Parameters:
offs - The starting offset >= 0.
s - The string to insert; does nothing with null/empty strings.
a - The attributes for the inserted content.
Overrides:
insertString in class javax.swing.text.AbstractDocument

isCharValid

public boolean isCharValid(char c)
Indicates if the argument character is valid for insertion in the current document.
Specified by:
isCharValid in interface PDocument
Parameters:
c - The character to be tested.

isStringValid

public boolean isStringValid(java.lang.String s)
Indicates if the argument string is valid for insertion in the current document.
Specified by:
isStringValid in interface PDocument
Parameters:
s - The string to be tested.