com.sdm.quasar.client.swing.states
Class DocumentTextAcceptedBooleanState

java.lang.Object
  extended bycom.sdm.quasar.client.core.states.AbstractState
      extended bycom.sdm.quasar.client.core.states.AbstractBooleanState
          extended bycom.sdm.quasar.client.swing.states.DocumentTextAcceptedBooleanState
All Implemented Interfaces:
BooleanState, Disposable, javax.swing.event.DocumentListener, java.util.EventListener, State

public class DocumentTextAcceptedBooleanState
extends AbstractBooleanState
implements BooleanState, javax.swing.event.DocumentListener

The BooleanState is true if the text of the Document is accepted by a given Acceptor. For convenience an acceptor with pattern matching is used to compare the text of the document with a pattern.

Author:
Martin Haft

Constructor Summary
DocumentTextAcceptedBooleanState(javax.swing.text.Document document, Acceptor acceptor)
          Constructs the BooleanState representing the acceptance of the document text with an Acceptor.
DocumentTextAcceptedBooleanState(javax.swing.text.Document document, Acceptor acceptor, java.lang.String name)
          Constructs the BooleanState representing the acceptance of the document text with an Acceptor.
DocumentTextAcceptedBooleanState(javax.swing.text.Document document, java.lang.String pattern)
          Constructs the BooleanState representing the matching of the document text with the given pattern.
DocumentTextAcceptedBooleanState(javax.swing.text.Document document, java.lang.String pattern, java.lang.String name)
          Constructs the BooleanState representing the matching of the document text with the given pattern.
 
Method Summary
 void changedUpdate(javax.swing.event.DocumentEvent e)
           
protected  boolean checkAcceptance()
          Checks if the text of the document is accepted by the Acceptor of this state.
 void insertUpdate(javax.swing.event.DocumentEvent e)
           
 void removeUpdate(javax.swing.event.DocumentEvent e)
           
 
Methods inherited from class com.sdm.quasar.client.core.states.AbstractBooleanState
getValue, isValueTrue, setValue, setValueWithoutNotification
 
Methods inherited from class com.sdm.quasar.client.core.states.AbstractState
addStateListener, appendParametersToString, dispose, fireStateChanged, getName, removeStateListener, setName, stateValueToString, toString, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.sdm.quasar.client.core.states.BooleanState
isValueTrue
 
Methods inherited from interface com.sdm.quasar.client.core.states.State
addStateListener, getName, getValue, removeStateListener, setName
 
Methods inherited from interface com.sdm.quasar.client.core.common.Disposable
dispose
 

Constructor Detail

DocumentTextAcceptedBooleanState

public DocumentTextAcceptedBooleanState(javax.swing.text.Document document,
                                        java.lang.String pattern)
Constructs the BooleanState representing the matching of the document text with the given pattern.

Parameters:
document - the Document whose text is compared wit the given pattern
pattern - the pattern the documetns text is compared with

DocumentTextAcceptedBooleanState

public DocumentTextAcceptedBooleanState(javax.swing.text.Document document,
                                        Acceptor acceptor)
Constructs the BooleanState representing the acceptance of the document text with an Acceptor.

Parameters:
document - the Document whose text is compared wit the given pattern
acceptor - An Acceptor that checks if the text of the document is accepted.

DocumentTextAcceptedBooleanState

public DocumentTextAcceptedBooleanState(javax.swing.text.Document document,
                                        java.lang.String pattern,
                                        java.lang.String name)
Constructs the BooleanState representing the matching of the document text with the given pattern.

Parameters:
document - the Document whose text is compared wit the given pattern
pattern - the pattern the documetns text is compared with
name - name of the state

DocumentTextAcceptedBooleanState

public DocumentTextAcceptedBooleanState(javax.swing.text.Document document,
                                        Acceptor acceptor,
                                        java.lang.String name)
Constructs the BooleanState representing the acceptance of the document text with an Acceptor.

Parameters:
document - the Document whose text is compared wit the given pattern
acceptor - An Acceptor that checks if the text of the document is accepted.
name - name of the state
Method Detail

insertUpdate

public void insertUpdate(javax.swing.event.DocumentEvent e)
Specified by:
insertUpdate in interface javax.swing.event.DocumentListener

removeUpdate

public void removeUpdate(javax.swing.event.DocumentEvent e)
Specified by:
removeUpdate in interface javax.swing.event.DocumentListener

changedUpdate

public void changedUpdate(javax.swing.event.DocumentEvent e)
Specified by:
changedUpdate in interface javax.swing.event.DocumentListener

checkAcceptance

protected boolean checkAcceptance()
Checks if the text of the document is accepted by the Acceptor of this state.

Returns:
true if the text of the documet is accepted