com.jaxfront.core.type
Class TypeController

java.lang.Object
  extended by com.jaxfront.core.type.TypeController
All Implemented Interfaces:
DOMChangeListener, java.beans.PropertyChangeListener, java.util.EventListener

public class TypeController
extends java.lang.Object
implements java.beans.PropertyChangeListener, DOMChangeListener

The TypeController controls any value changes in the underlying JAXFront DOM. If a value changed the TypeController checks all relevant rules defined in the XUI document. He keeps track of all occured validation errors. In case of a validation error, a ValidationChangeEvent gets fired.

Version:
1.60

Field Summary
static java.lang.String PROPERTYCHANGE
           
static java.lang.String SERIALIZABLE_CHANGED
           
static java.lang.String TEMPORARY_PROPERTYCHANGE
           
static java.lang.String XUI_INITIALIZED
           
 
Constructor Summary
TypeController(Document dom)
           
 
Method Summary
 void addChangeLog(LogEntry logEntry)
          Add a log to the logging list.
 void addDirtyChangeListener(DirtyChangeListener newListener)
          Register a new listener for receiving dirty changes.
 FormulaExpression addFormula(FormulaExpression formula)
          Adds a formula.
 void addIndeterminateXPath(Type source, java.lang.String xpath, Type xuiType)
          Adds an none deterministic xpath.
 LoggingListener addLogListener(LoggingListener listener)
           
 LoggingListener addLogListener(Type sourceType, java.lang.String scope, java.lang.String logLevel)
          Add a log for a certain type.
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Adds a propertyChangeListener.
 Rule addRule(Rule rule)
          Adds a rule.
 void applySaveRules(boolean isRunningOnServer)
          Applies all defined rules without checking scope and event type.
 void applySaveRules(java.lang.Object event, boolean isRunningOnServer)
          Applies all defined rules without checking scope and event type.
 void cleanLogging()
          Clears all logged changes.
 void domChanged(DOMChangeEvent event)
          Respond method for a DOM state changed (DOMChangeEvent).
 void domChanged(DOMChangeEvent event, java.util.Stack callStack)
          Acts as an observer for all DOMChanges fired by the JAXFrontDOM.
 void dumpLog()
          Dumps the logged changes to the System.out.
 void fireDirtyChange()
           
 void fireDirtyChange(DirtyChangeEvent event)
           
 void fireDOMValidated(Document dom)
           
 ErrorController getErrorController()
           
 java.lang.StringBuffer getInfo()
           
 java.util.List getLoggedChanges()
          Returns a list of all logged changes.
 java.util.Hashtable getLoggingListeners()
          Returns all LoggingListeners.
 MathEvaluator getMathEvaluator()
          Returns the single instance of the MathEvaluator for Parsing/Evaluating formula expressions.
 Rule getRule(FormulaExpression formula)
           
 Rule getRule(java.lang.String id)
          Return a rule for the given id.
 java.util.List getRules(Type source, boolean initializationRulesOnly)
          Returns all rules for a certain type (source).
 java.util.List getRules(Type source, boolean initializationRulesOnly, boolean inclDerived)
          Returns all rules for a certain type (source).
static void handleDynamicRequiredState(Type source, boolean checkParent)
           
 boolean hasChanged()
          Returns true if any node in the underlying DOM has changed its state.
 void hasChanged(boolean hasChanged)
          Marks the underlying DOM as changed.
 boolean isDebug()
           
 void printRules()
           
 void propertyChange(java.beans.PropertyChangeEvent evt)
          Keeps track of all propertyChanges occuring in the underlying JAXFront DOM and performs the defined XUI rules.
 void release()
          Releases rules, validationErrors, validationChangeListener and propertyChangeSupport.
 void releaseRules()
          Releases all rules.
 void removeDirtyChangeListener(DirtyChangeListener listener)
          Remove listener.
 void removeLogListener(LoggingListener listener)
          Removes a loggin listener.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Removes the given PropertyChangeListener.
 void removeRule(FormulaExpression formula)
          Removes all Rules for the given sourceTpe.
 void removeRule(Rule rule)
          Removes the given Rule.
 void removeRule(Type sourceType)
          Removes the given Rule.
 void removeRule(Type sourceType, boolean inclDerived)
          Removes the given Rule.
 void setDebug(boolean _debug)
           
static Type updateXUICompUserObject(Type aType)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TEMPORARY_PROPERTYCHANGE

public static final java.lang.String TEMPORARY_PROPERTYCHANGE
See Also:
Constant Field Values

PROPERTYCHANGE

public static final java.lang.String PROPERTYCHANGE
See Also:
Constant Field Values

XUI_INITIALIZED

public static final java.lang.String XUI_INITIALIZED
See Also:
Constant Field Values

SERIALIZABLE_CHANGED

public static final java.lang.String SERIALIZABLE_CHANGED
See Also:
Constant Field Values
Constructor Detail

TypeController

public TypeController(Document dom)
Method Detail

addIndeterminateXPath

public void addIndeterminateXPath(Type source,
                                  java.lang.String xpath,
                                  Type xuiType)
Adds an none deterministic xpath.

Parameters:
xpath - none deterministic xpath
xuiType - holding xui type

addFormula

public FormulaExpression addFormula(FormulaExpression formula)
Adds a formula. This is done by initializing a tableCell.

Parameters:
formula - a formula that should be added
Returns:
the given formula

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a propertyChangeListener.

Parameters:
listener - a propertyChangeListener that should be added

addRule

public Rule addRule(Rule rule)
Adds a rule. This is done by the BehaviourDefinition when initializing a XUI Document.

Parameters:
rule - a rule that should be added
Returns:
the given rule

getRules

public java.util.List getRules(Type source,
                               boolean initializationRulesOnly)
Returns all rules for a certain type (source).

Parameters:
source - Type to look for
initializationRulesOnly - indicates if only initialization rules should be considered

getRules

public java.util.List getRules(Type source,
                               boolean initializationRulesOnly,
                               boolean inclDerived)
Returns all rules for a certain type (source).

Parameters:
source - Type to look for
initializationRulesOnly - indicates if only initialization rules should be considered

getRule

public Rule getRule(FormulaExpression formula)

getRule

public Rule getRule(java.lang.String id)
Return a rule for the given id.

Parameters:
source - Type to look for
initializationRulesOnly - indicates if only initialization rules should be considered

fireDOMValidated

public void fireDOMValidated(Document dom)

applySaveRules

public void applySaveRules(boolean isRunningOnServer)
Applies all defined rules without checking scope and event type.


applySaveRules

public void applySaveRules(java.lang.Object event,
                           boolean isRunningOnServer)
Applies all defined rules without checking scope and event type.


domChanged

public void domChanged(DOMChangeEvent event,
                       java.util.Stack callStack)
Acts as an observer for all DOMChanges fired by the JAXFrontDOM. In case of the initialization of any JAXFront Type (InitializationEvent), all relevant initialization rules defined in the XUI will be launched.


getMathEvaluator

public MathEvaluator getMathEvaluator()
Returns the single instance of the MathEvaluator for Parsing/Evaluating formula expressions.

Returns:
com.jaxfront.core.rule.MathEvaluator

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent evt)
Keeps track of all propertyChanges occuring in the underlying JAXFront DOM and performs the defined XUI rules.

Specified by:
propertyChange in interface java.beans.PropertyChangeListener
Parameters:
evt - a propertyChangeEvent that occured

handleDynamicRequiredState

public static void handleDynamicRequiredState(Type source,
                                              boolean checkParent)

release

public void release()
Releases rules, validationErrors, validationChangeListener and propertyChangeSupport.


getInfo

public java.lang.StringBuffer getInfo()

releaseRules

public void releaseRules()
Releases all rules.


removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes the given PropertyChangeListener.

Parameters:
listener - a PropertyChangeListener that should be removed

removeRule

public void removeRule(Type sourceType)
Removes the given Rule.

Parameters:
type - a Rule that should be removed

removeRule

public void removeRule(Type sourceType,
                       boolean inclDerived)
Removes the given Rule.

Parameters:
type - a Rule that should be removed

removeRule

public void removeRule(FormulaExpression formula)
Removes all Rules for the given sourceTpe.

Parameters:
rule - a Rule that should be removed

hasChanged

public boolean hasChanged()
Returns true if any node in the underlying DOM has changed its state.

Returns:

hasChanged

public void hasChanged(boolean hasChanged)
Marks the underlying DOM as changed.

Parameters:
hasChanged - indicates if the underlying DOM has changed.

fireDirtyChange

public void fireDirtyChange()

fireDirtyChange

public void fireDirtyChange(DirtyChangeEvent event)

addDirtyChangeListener

public void addDirtyChangeListener(DirtyChangeListener newListener)
Register a new listener for receiving dirty changes.

Parameters:
newListener - a new listener

removeDirtyChangeListener

public void removeDirtyChangeListener(DirtyChangeListener listener)
Remove listener.

Parameters:
listener - to remove

addLogListener

public LoggingListener addLogListener(Type sourceType,
                                      java.lang.String scope,
                                      java.lang.String logLevel)
Add a log for a certain type. Depending on the scope the whole subtree gets logged on any property change (XUITypes.UIS_ALL_DERIVED_LEAFS) or the source only (XUITypes.UIS_SOURCE_ONLY).

Parameters:
sourceType - Type of the logging source
scope - eather source or whole subtree will be logged
logLevel - log level

addLogListener

public LoggingListener addLogListener(LoggingListener listener)

removeLogListener

public void removeLogListener(LoggingListener listener)
Removes a loggin listener.

Parameters:
listener - listener to remove

getLoggingListeners

public java.util.Hashtable getLoggingListeners()
Returns all LoggingListeners.


cleanLogging

public void cleanLogging()
Clears all logged changes.


getLoggedChanges

public java.util.List getLoggedChanges()
Returns a list of all logged changes.


addChangeLog

public void addChangeLog(LogEntry logEntry)
Add a log to the logging list. If a log already exists for this source type, only the current time will be updated.

Parameters:
logEntry -

dumpLog

public void dumpLog()
Dumps the logged changes to the System.out.


isDebug

public boolean isDebug()

setDebug

public void setDebug(boolean _debug)

getErrorController

public ErrorController getErrorController()

updateXUICompUserObject

public static Type updateXUICompUserObject(Type aType)

domChanged

public void domChanged(DOMChangeEvent event)
Description copied from interface: DOMChangeListener
Respond method for a DOM state changed (DOMChangeEvent).

Specified by:
domChanged in interface DOMChangeListener
Parameters:
event - occured DOMChangeEvent

printRules

public void printRules()

removeRule

public void removeRule(Rule rule)
Removes the given Rule.

Parameters:
rule - a Rule that should be removed