Class RemoteFieldsHolder

All Implemented Interfaces:
Serializable, Cloneable, Copyable, DictionaryBean, UifDictionaryBean, Component, DataBinding, Ordered, ScriptEventSupport, LifecycleElement, org.springframework.core.Ordered

public class RemoteFieldsHolder extends ComponentBase implements DataBinding
A placeholder in the configuration for a Container list of items that will be invoked to retrieve a list of RemotableAttributeField instances which will then be inserted into the containers list at the position of the holder

Since remotable fields are dynamic by nature, the individual fields cannot be configured initially with the container. Further more the properties for the field are constructed with code. This gives the ability to specify where that list of fields should be placed, along with configured on how to retrieve the remote fields.

The fetching properties are used to configure what method to invoke that will return the list of remotable fields. Specifying the getFetchingMethodToCall() only assumes the method is on the view helper service for the contained view. For invoking other classes, such as services or static classes, use getFetchingMethodInvoker()

The list of remotable fields should bind to a Map property on the model. The getPropertyName() and getBindingInfo() properties specify the path to this property. The property names configured on the returned fields are assumed to be keys in that above configured map, with the corresponding map value giving the actual model value for the remote field.

e.g. configuration <property name="items"> <list> <bean parent="RemoteFieldsHolder" p:propertyName="remoteFieldValuesMap" p:fetchingMethodToCall="retrieveRemoteFields"/> ... This example will invoke a method named 'retrieveRemoteFields' on the view helper service, which should return a list of RemotableAttributeField instances. The view, model instance, and parent container will be sent to the method as arguments. The returned fields will be translated to InputField instances that bind to a map property named 'remoteFieldValuesMap' on the model.

Author:
Kuali Rice Team (rice.collab@kuali.org)
See Also:
  • Constructor Details

    • RemoteFieldsHolder

      public RemoteFieldsHolder()
  • Method Details

    • fetchAndTranslateRemoteFields

      public List<InputField> fetchAndTranslateRemoteFields(Container parent)
      Invokes the configured fetching method to retrieve a list of remotable fields, then invoked the ComponentFactory to translate the fields, and finally sets up the binding for the attribute fields
      Parameters:
      parent - container instance that holder is configured for, sent to the fetching method
      Returns:
      list of attribute fields that should be placed into container, if no remotable fields were returned from the fetching method the list will be empty
    • getComponentTypeName

      public String getComponentTypeName()
      Description copied from interface: Component
      The name for the component type

      This is used within the rendering layer to pass the component instance into the template. The component instance is exported under the name given by this method.

      Specified by:
      getComponentTypeName in interface Component
      Returns:
      String type name
    • getPropertyName

      public String getPropertyName()
      Path to the Map property that the translated fields bind to

      It is assumed this property points to a Map where the property names on the returned remotable fields are keys in that map, with the corresponding map value giving the model value for the field

      Specified by:
      getPropertyName in interface DataBinding
      Returns:
      path to property on model
    • setPropertyName

      public void setPropertyName(String propertyName)
      Setter for the property name that points to the binding Map
      Parameters:
      propertyName -
    • getBindingInfo

      public BindingInfo getBindingInfo()
      Can be used to for more complex binding paths

      Generally not necessary to set on a field level, any default object path or binding prefixes set on the view or container will be inherited

      Specified by:
      getBindingInfo in interface DataBinding
      Returns:
      BindingInfo instance containing binding information for the Map property
      See Also:
    • setBindingInfo

      public void setBindingInfo(BindingInfo bindingInfo)
      Setter for the Map property binding info instance
      Specified by:
      setBindingInfo in interface DataBinding
      Parameters:
      bindingInfo -
    • getFetchingMethodToCall

      public String getFetchingMethodToCall()
      Name of the method to invoke for retrieving the list of remotable fields

      When only the fetching method to call is configured it is assumed to be a valid method on the view helper service for the containing view. The method name must accept the view, model object, and parent container as arguments, and return a list of RemotableAttributeField instances.

      For invoking the method on classes other than the view helper service, see getFetchingMethodInvoker()

      Returns:
      name of method to invoke for fetching remote fields
    • setFetchingMethodToCall

      public void setFetchingMethodToCall(String fetchingMethodToCall)
      Setter for the fetching method to call
      Parameters:
      fetchingMethodToCall -
    • getFetchingMethodInvoker

      public MethodInvokerConfig getFetchingMethodInvoker()
      Configuration for the method to invoke for retrieving the list of remotable fields

      Through the method invoker config, a service or static class can be configured along with the method name that will be invoked. The method name must accept the view, model object, and parent container as arguments, and return a list of RemotableAttributeField instances.

      Note the MethodInvokerConfig.getTargetMethod() property can be configured, or the getFetchingMethodToCall(). In the case of both configurations, the target method on the method invoker config will be used

      Returns:
      MethodInvokerConfig instance containing method configuration
    • setFetchingMethodInvoker

      public void setFetchingMethodInvoker(MethodInvokerConfig fetchingMethodInvoker)
      Setter for the fetching method to invoke configuration
      Parameters:
      fetchingMethodInvoker -