org.broadleafcommerce.openadmin.web.service
Class AbstractFormBuilderExtensionHandler

java.lang.Object
  extended by org.broadleafcommerce.common.extension.AbstractExtensionHandler
      extended by org.broadleafcommerce.openadmin.web.service.AbstractFormBuilderExtensionHandler
All Implemented Interfaces:
ExtensionHandler, FormBuilderExtensionHandler

public abstract class AbstractFormBuilderExtensionHandler
extends AbstractExtensionHandler
implements FormBuilderExtensionHandler

Abstract class to provide convenience for determining how to handle form extensions in the admin

Author:
Kelly Tisdell, Phillip Verheyden (phillipuniverse)

Field Summary
 
Fields inherited from class org.broadleafcommerce.common.extension.AbstractExtensionHandler
enabled, priority
 
Constructor Summary
AbstractFormBuilderExtensionHandler()
           
 
Method Summary
protected abstract  boolean canHandle(EntityForm ef)
          Determine if e to handle this.
protected abstract  void handleModifyDetailEntityForm(EntityForm ef)
          Convenience method for modifyDetailEntityForm(EntityForm).
protected abstract  void handleModifyPopulatedEntityForm(EntityForm ef, Entity entity)
          Convenience method for modifyPopulatedEntityForm(EntityForm, Entity).
protected abstract  void handleModifyUnpopulatedEntityForm(EntityForm ef)
          Convenience method for modifyUnpopulatedEntityForm(EntityForm).
 ExtensionResultStatusType modifyDetailEntityForm(EntityForm ef)
          Invoked whenever a detailed EntityForm is built, after the initial list grids have been created on the given EntityForm.
 ExtensionResultStatusType modifyPopulatedEntityForm(EntityForm ef, Entity entity)
          Modifies an EntityForm after it has been populated with an Entity.
 ExtensionResultStatusType modifyUnpopulatedEntityForm(EntityForm ef)
          Modifies an EntityForm before it is populated with an Entity.
 
Methods inherited from class org.broadleafcommerce.common.extension.AbstractExtensionHandler
getPriority, isEnabled, setEnabled, setPriority
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.broadleafcommerce.common.extension.ExtensionHandler
getPriority, isEnabled
 

Constructor Detail

AbstractFormBuilderExtensionHandler

public AbstractFormBuilderExtensionHandler()
Method Detail

canHandle

protected abstract boolean canHandle(EntityForm ef)
Determine if e to handle this.

Parameters:
ef -
Returns:

handleModifyUnpopulatedEntityForm

protected abstract void handleModifyUnpopulatedEntityForm(EntityForm ef)
Convenience method for modifyUnpopulatedEntityForm(EntityForm). See that method for usage documentation


handleModifyPopulatedEntityForm

protected abstract void handleModifyPopulatedEntityForm(EntityForm ef,
                                                        Entity entity)
Convenience method for modifyPopulatedEntityForm(EntityForm, Entity). See that method for usage documentation


handleModifyDetailEntityForm

protected abstract void handleModifyDetailEntityForm(EntityForm ef)
Convenience method for modifyDetailEntityForm(EntityForm). See that method for usage documentation


modifyUnpopulatedEntityForm

public ExtensionResultStatusType modifyUnpopulatedEntityForm(EntityForm ef)
Description copied from interface: FormBuilderExtensionHandler
Modifies an EntityForm before it is populated with an Entity. This method is invoked after all of the EntityForm fields have been created with the appropriate metadata, but the values have not been set. An example invocation occurs when creating the 'add' form from a collection list grid. Note that this is invoked every time that an EntityForm is created, whether it is from a "main" entity (when clicking to view the details screen for an entity from from an admin section) or when building an 'add' or 'edit' form for a related list grid from the detail view for an entity.

Example usages of this method would be to modify the display for certain fields for a particular EntityForm.

This method is invoked on every EntityForm that is built from the admin (both initial creation with empty field values and populating with real values from an Entity).

Also, it's important to note that in most cases you do not need to implement both this method and FormBuilderExtensionHandler.modifyPopulatedEntityForm(EntityForm, Entity). It is usually sufficient to only modify one or the other. In fact, in some cases (like on a validation failure or when viewing the details for an entity) both this method and FormBuilderExtensionHandler.modifyPopulatedEntityForm(EntityForm, Entity) are invoked (this method is invoked first)

This methods is always invoked before FormBuilderExtensionHandler.modifyPopulatedEntityForm(EntityForm, Entity).

Specified by:
modifyUnpopulatedEntityForm in interface FormBuilderExtensionHandler
Parameters:
ef - the EntityForm that has not yet been populated with values from an entity
Returns:
See Also:
FormBuilderService#populateEntityForm(org.broadleafcommerce.openadmin.dto.ClassMetadata, EntityForm)}

modifyPopulatedEntityForm

public ExtensionResultStatusType modifyPopulatedEntityForm(EntityForm ef,
                                                           Entity entity)
Description copied from interface: FormBuilderExtensionHandler
Modifies an EntityForm after it has been populated with an Entity. This is invoked after not only all of the EntityForm fields have been created but the EntityForm field values have been actually populated with the real values from the given Entity. An example of when this method is invoked is after validation has failed (on any EntityForm from the admin) or when viewing the details for an entity.

This method is not invoked on the creation of every single EntityForm but rather only on the cases presented above. If you need functionality for every case that a particular EntityForm could be built, you should probably implement the FormBuilderExtensionHandler.modifyUnpopulatedEntityForm(EntityForm) method instead.

This method is very similar to FormBuilderExtensionHandler.modifyUnpopulatedEntityForm(EntityForm) and usually implementors will only override one or the other.

This method is always invoked after FormBuilderExtensionHandler.modifyUnpopulatedEntityForm(EntityForm).

Specified by:
modifyPopulatedEntityForm in interface FormBuilderExtensionHandler
Parameters:
ef - the EntityForm being populated
entity - the Entity that the EntityForm has used to populate all of the values for its fields
Returns:
whether or not it was handled
See Also:
FormBuilderService#populateEntityForm(org.broadleafcommerce.openadmin.dto.ClassMetadata, Entity, EntityForm)}

modifyDetailEntityForm

public ExtensionResultStatusType modifyDetailEntityForm(EntityForm ef)
Description copied from interface: FormBuilderExtensionHandler
Invoked whenever a detailed EntityForm is built, after the initial list grids have been created on the given EntityForm. This allows for further display modifications to the related ListGrids that could occur on an EntityForm, or to only modify an EntityForm when it is showing an entity in a details view

A detailed EntityForm is built when clicking on a row from the main ListGrid in an AdminSection or when viewing the details for an entity in a read-only.

As far as order of operations are concerned, this is always invoked after FormBuilderExtensionHandler.modifyPopulatedEntityForm(EntityForm, Entity), which is invoked after FormBuilderExtensionHandler.modifyUnpopulatedEntityForm(EntityForm). This means that this method is invoked last and can override values from the previous methods

Specified by:
modifyDetailEntityForm in interface FormBuilderExtensionHandler
Parameters:
ef - the EntityForm that has been built with all
Returns:
whether or not it was handled
See Also:
FormBuilderService#populateEntityForm(org.broadleafcommerce.openadmin.dto.ClassMetadata, org.broadleafcommerce.openadmin.dto.Entity, java.util.Map, EntityForm)


Copyright © 2013. All Rights Reserved.