org.sandev.basics.util
Class RootedFormManager

java.lang.Object
  extended byorg.sandev.basics.util.AbstractFormManager
      extended byorg.sandev.basics.util.RootedFormManager
All Implemented Interfaces:
UIFormManager

public class RootedFormManager
extends AbstractFormManager
implements UIFormManager

An implementation of a UIFormManager used for working with a tree of non-persistent objects. This is typically used for structure editors, which also override dereference operations to translate them into movements within the tree.


Field Summary
static java.lang.String BADREF_PREFIX
          Default prefix text for output of each bad reference found.
static java.lang.String BRANCH_DISALLOWED
          Text for disallowed branching notification.
static java.lang.String FIX_BADREFS_BEFORE_SAVE
          Default output text added if bad references are found.
static java.lang.String REF_VALIDATION_FAILURE
          Default output text used if reference validation processing fails for any reason.
 
Fields inherited from class org.sandev.basics.util.AbstractFormManager
CLASS_DISAMBIGUATION_PROMPT, FIX_FIELDS_BEFORE_SAVE, INVALID_FIELD_VALUE_PREFIX, RC_CANCELLED, RC_DONE, RC_QUERYING, uifa
 
Constructor Summary
RootedFormManager()
           
 
Method Summary
protected  java.lang.String getBadReferenceFailureText()
          Accessor for bad reference error.
protected  java.lang.String getBadReferencePrefix()
          Accessor for bad reference prefix.
protected  java.lang.String getBranchDisallowedText()
          Override this method to return custom text to display when branching is not possible.
protected  java.lang.String getReferenceValidationFailure()
          Accessor for reference validation processing failure.
protected  boolean mergeChangesToParentBeforeAdd(UIFormContext uifc)
          Merge or reject subtree editing of an unresolved parent.
protected  void resolveReferences(UIFormContext uifc, UIFormOwner owner)
          Validate references in the rootMsg.
protected  boolean supportsTopLevelAdd()
          Returns true if this form manager allows new top level object instances to be created while in LISTING mode.
protected  boolean supportsTopLevelFind()
          Returns true if this form manager allows other top level object instances to be found while in LISTING mode.
protected  void trackUpdates(SandUpdateMessage update, UIFormContext uifc)
          Lower level changes will have been merged into the root when they were added.
 
Methods inherited from class org.sandev.basics.util.AbstractFormManager
disableUnsupportedActions, doActionAdd, doActionCancel, doActionDelete, doActionDeref, doActionDrilldown, doActionEdit, doActionFind, doActionHelp, doActionMove, doActionNew, doActionNext, doActionOk, doActionParent, doActionPrevious, doActionRemove, doActionSave, doActionSelect, fieldValidateCurrentInstance, getClassDisambiguationPrompt, getFieldValidationFailureText, getInvalidFieldMessagePrefix, initFormAdaptor, okContainedAdd, okNewReference, okTopLevelAdd, okUpdate, outstandingChangesExist, processForm, processUpdate, resolveClass, trace, wrappedGenAdd, wrappedGenMod
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.sandev.basics.util.UIFormManager
disableUnsupportedActions, initFormAdaptor, processForm
 

Field Detail

BRANCH_DISALLOWED

public static final java.lang.String BRANCH_DISALLOWED
Text for disallowed branching notification.

See Also:
Constant Field Values

REF_VALIDATION_FAILURE

public static final java.lang.String REF_VALIDATION_FAILURE
Default output text used if reference validation processing fails for any reason. The thrown exception is appended to this text. This text is not displayed under normal circumstances.

See Also:
Constant Field Values

FIX_BADREFS_BEFORE_SAVE

public static final java.lang.String FIX_BADREFS_BEFORE_SAVE
Default output text added if bad references are found.

See Also:
Constant Field Values

BADREF_PREFIX

public static final java.lang.String BADREF_PREFIX
Default prefix text for output of each bad reference found.

See Also:
Constant Field Values
Constructor Detail

RootedFormManager

public RootedFormManager()
Method Detail

getBranchDisallowedText

protected java.lang.String getBranchDisallowedText()
Override this method to return custom text to display when branching is not possible. Defaults to BRANCH_DISALLOWED.


getReferenceValidationFailure

protected java.lang.String getReferenceValidationFailure()
Accessor for reference validation processing failure. Defaults to REF_VALIDATION_FAILURE, override to return custom text.


getBadReferenceFailureText

protected java.lang.String getBadReferenceFailureText()
Accessor for bad reference error. Defaults to FIX_BADREFS_BEFORE_SAVE, override to return custom text.


getBadReferencePrefix

protected java.lang.String getBadReferencePrefix()
Accessor for bad reference prefix. Defaults to BADREF_PREFIX, override to return custom text.


mergeChangesToParentBeforeAdd

protected boolean mergeChangesToParentBeforeAdd(UIFormContext uifc)
                                         throws UIFormManagerException
Merge or reject subtree editing of an unresolved parent. Return true if the ADD action can proceed, false otherwise. This method always returns false, override to handle merge.

Examples:

Handling branching undo/merge operations requires holding a tree of context information and is not supported at this level. However a context tree is fairly typical for any GUI application with a comprehensive undo action infrastructure, so this behavior may be supported in extended classes.

Specified by:
mergeChangesToParentBeforeAdd in class AbstractFormManager
Throws:
UIFormManagerException

resolveReferences

protected void resolveReferences(UIFormContext uifc,
                                 UIFormOwner owner)
                          throws UIFormManagerException
Validate references in the rootMsg. Since the rootMsg contains the entire tree of objects we are working with, its easy to check that all references are internally consistent. This method adds error text messages for any bad references, which in turn causes save processing to fail. If no messages are produced, then save proceeds normally.

Overrides:
resolveReferences in class AbstractFormManager
Throws:
UIFormManagerException

supportsTopLevelAdd

protected boolean supportsTopLevelAdd()
Description copied from class: AbstractFormManager
Returns true if this form manager allows new top level object instances to be created while in LISTING mode. Typically a single object editor would not support this, while a general persistent object editor might.

Specified by:
supportsTopLevelAdd in class AbstractFormManager

supportsTopLevelFind

protected boolean supportsTopLevelFind()
Description copied from class: AbstractFormManager
Returns true if this form manager allows other top level object instances to be found while in LISTING mode. Typically a single object editor would not support this, while a general persistent object editor might.

Specified by:
supportsTopLevelFind in class AbstractFormManager

trackUpdates

protected void trackUpdates(SandUpdateMessage update,
                            UIFormContext uifc)
                     throws UIFormManagerException
Lower level changes will have been merged into the root when they were added. If the top level instance has changed, then we need to move the currInst into the rootMsg so that it gets written by UIFormOwner save processing.

Specified by:
trackUpdates in class AbstractFormManager
Throws:
UIFormManagerException