public class SwingDocumentState extends AbstractSwingState implements State, DocumentListener
mSilent
mIsEnabled, mIsInitialized, mListenerList, mName, mReason
Constructor and Description |
---|
SwingDocumentState(JTextComponent pTextField)
Creates a new state, using the handed text field as its state source.
|
SwingDocumentState(JTextComponent pTextField,
String pContent)
Creates a new state, using the handed text field as its state source.
|
Modifier and Type | Method and Description |
---|---|
void |
changedUpdate(DocumentEvent pEvent)
Gives notification that an attribute or set of attributes changed.
|
protected boolean |
getInternalState()
Check the document state.
|
void |
insertUpdate(DocumentEvent pEvent)
Gives notification that there was an insert into the document.
|
void |
removeUpdate(DocumentEvent pEvent)
Gives notification that a portion of the document has been
removed.
|
void |
setCompareContent(String pContent)
Sets the string we compare the document against.
|
protected void |
setReason()
Set the source of the state as the reason for a change.
|
void |
updateCompareFromDocument()
Updates the compare content from the current value of the document.
|
checkStateChange, isSilent, setSilent
addChangeListener, checkDisposed, dispose, fireStateChanged, getChangeReason, getDependents, getName, isDisposed, isEnabled, isInitialized, removeChangeListener, setName, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addChangeListener, dispose, getChangeReason, getDependents, getName, isDisposed, isEnabled, isInitialized, removeChangeListener, setName
public SwingDocumentState(JTextComponent pTextField)
pTextField
- text field we take the document frompublic SwingDocumentState(JTextComponent pTextField, String pContent)
pTextField
- text field we take the document frompContent
- string to compare topublic void setCompareContent(String pContent)
pContent
- string we compare our document to, must not be nullpublic void updateCompareFromDocument()
protected boolean getInternalState()
getInternalState
in class AbstractSwingState
protected void setReason()
setReason
in class AbstractSwingState
public void insertUpdate(DocumentEvent pEvent)
insertUpdate
in interface DocumentListener
pEvent
- the document eventpublic void removeUpdate(DocumentEvent pEvent)
removeUpdate
in interface DocumentListener
pEvent
- the document eventpublic void changedUpdate(DocumentEvent pEvent)
changedUpdate
in interface DocumentListener
pEvent
- the document eventCopyright © 2017 Jürgen Zeller (privat). All rights reserved.