Class LightTable

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

public class LightTable extends GroupBase implements DataBinding
LightTable is a light-weight collection table implementation that supports a subset of features, Current known supported features are:
  • DataField
  • InputField with TextControl, CheckboxControl, or single SelectControl
  • MessageField
  • LinkField
  • ActionField
  • ImageField
  • most RichTable options
  • FieldGroup containing only Actions, Image, Messages, or Links
  • SpringEL for String properties on supported components only
  • SpringEL specifically for the render property
Other features are not guaranteed to work, but may work at your own risk. The intent of this table is to be a light-weight alternative to the fully featured table already available in KRAD and it is more suited to displaying large sets of simple data to the user.
Author:
Kuali Rice Team (rice.collab@kuali.org)
See Also:
  • Constructor Details

    • LightTable

      public LightTable()
      LightTable constructor
  • Method Details

    • performInitialization

      public void performInitialization(Object model)
      Initialization override that sets up DataField value placeholders for parsing and populates the expressionConversionMap
      Specified by:
      performInitialization in interface LifecycleElement
      Overrides:
      performInitialization in class GroupBase
      Parameters:
      model - - object instance containing the view data
      See Also:
    • buildExpressionMap

      protected Map<String,String> buildExpressionMap(Component item, Map<String,String> expressionMap)
      Builds the expression map which contains "propertyName@@@id" and the expression. Also fills the renderIdExpressionMap which contains all the component ids and expressions for render conditions, and overrides ids with a placeholder id. This method is recursive for child components which match certain supported types.
      Parameters:
      item - the item to iterate on
      expressionMap - the map holding the expressions for the items of this collection
      Returns:
      the expressionMap with expressions populated
    • processExpression

      public void processExpression(String name, Component item, Map<String,String> expressionMap, List<String> toRemove)
      Process the expression for the item by putting placeholder values in for String properties and adding markers for render expressions to the component; adds the original expression to the expressionMap
      Parameters:
      name - the property name
      item - the component this expressio is on
      expressionMap - the map to add expressions to
      toRemove - the property name is added this map to be removed later
    • addChildExpressions

      protected Map<String,String> addChildExpressions(Collection<? extends LifecycleElement> components, Map<String,String> expressionMap)
      Add expressions to the expression map for nested components of specific types
      Parameters:
      components - the child components
      expressionMap - the map to add expressions to
      Returns:
      the map with child component expressions added
    • performFinalize

      public void performFinalize(Object model, LifecycleElement parent)
      performFinalize override corrects the binding path for the DataFields and turns off rendering on some components
      Specified by:
      performFinalize in interface LifecycleElement
      Overrides:
      performFinalize in class GroupBase
      Parameters:
      model - - top level object containing the data
      parent - - parent component
    • buildRows

      public void buildRows(View view, String rowTemplate, UifFormBase model)
      Build the rows from the rowTemplate passed in. This method uses regex to locate pieces of the row that need to be replaced with row specific content per row.
      Parameters:
      view - the view instance the table is being built within
      rowTemplate - the first row of the collection in html generated from the ftl
      model - the model
    • evaluateAndReplaceExpressionValues

      protected String evaluateAndReplaceExpressionValues(String row, int index, Object model, Map<String,Object> expandedContext, Pattern expressionPattern, ExpressionEvaluator expressionEvaluator)
      Evaluate expressions and replace content found by the expressionPattern in the row
      Parameters:
      row - the row being modified
      index - the line index
      model - the model
      expandedContext - the context to evaluate expressions against
      expressionPattern - the expression pattern used to find expression tokens for value replacement
      expressionEvaluator - the expression service to use for evaluation
      Returns:
      the modified row
    • evaluateRenderExpressions

      protected String evaluateRenderExpressions(String row, int index, Object model, Map<String,Object> expandedContext, ExpressionEvaluator expressionEvaluator)
      Evaluates the render expressions for the row and removes the content if render is evaluated false
      Parameters:
      row - the row being modified
      index - the line index
      model - the model
      expandedContext - the context to evaluate expressions against
      expressionEvaluator - the expression service to use for evaluation
      Returns:
      the modified row
    • handleDataFieldInRow

      protected String handleDataFieldInRow(Component item, Object obj, String row, int index, String originalId)
      Special handling of the DataField in the row, replaces necessary content with row specific content
      Parameters:
      item - the item being processed
      obj - the row's object model
      row - the row in html
      index - the current row index
      originalId - the original id of the component item
      Returns:
      the updated row
    • handleInputFieldInRow

      protected String handleInputFieldInRow(Component item, Object obj, String row, int index, String originalId)
      Special handling of the InputField in the row, replaces necessary content with row specific content
      Parameters:
      item - the item being processed
      obj - the row's object model
      row - the row in html
      index - the current row index
      originalId - the original id of the component item
      Returns:
      the updated row
    • getPropertyName

      public String getPropertyName()
      The propertyName of the list backing this collection
      Specified by:
      getPropertyName in interface DataBinding
      Returns:
      the propertyName of this collection
    • setPropertyName

      public void setPropertyName(String propertyName)
      Set the propertyName
      Parameters:
      propertyName -
    • getBindingInfo

      public BindingInfo getBindingInfo()
      The bindingInfo for this collection table, containg the property path and other options
      Specified by:
      getBindingInfo in interface DataBinding
      Returns:
      the bindingInfo
      See Also:
    • setBindingInfo

      public void setBindingInfo(BindingInfo bindingInfo)
      Set the bindingInfo
      Specified by:
      setBindingInfo in interface DataBinding
      Parameters:
      bindingInfo -
    • getHeaderLabels

      public List<Label> getHeaderLabels()
      The labels for the header derived from the items of this collection (the fields)
      Returns:
      the header labels
    • getRichTable

      public RichTable getRichTable()
      The richTable widget definition for this table for setting dataTable javascript options
      Returns:
      the RichTable widget
    • setRichTable

      public void setRichTable(RichTable richTable)
      Set the richTable widget
      Parameters:
      richTable -
    • getConditionalRowCssClasses

      public Map<String,String> getConditionalRowCssClasses()
      The row css classes for the rows of this layout

      To set a css class on all rows, use "all" as a key. To set a class for even rows, use "even" as a key, for odd rows, use "odd". Use a one-based index to target a specific row by index. SpringEL can be used as a key and the expression will be evaluated; if evaluated to true, the class(es) specified will be applied.

      Returns:
      a map which represents the css classes of the rows of this layout
    • setConditionalRowCssClasses

      public void setConditionalRowCssClasses(Map<String,String> conditionalRowCssClasses)
      Set the conditionalRowCssClasses
      Parameters:
      conditionalRowCssClasses -
    • isEmptyTable

      public boolean isEmptyTable()
      True if this table is empty, false otherwise
      Returns:
      true if the collection backing this table is empty
    • setHeaderLabels

      public void setHeaderLabels(List<Label> headerLabels)
    • setExpressionConversionMap

      public void setExpressionConversionMap(Map<String,String> expressionConversionMap)
    • getExpressionConversionMap

      public Map<String,String> getExpressionConversionMap()
    • getInitialComponentIds

      public List<String> getInitialComponentIds()
    • getRenderIdExpressionMap

      public Map<String,String> getRenderIdExpressionMap()
    • setInitialComponentIds

      public void setInitialComponentIds(List<String> initialComponentIds)
    • setRenderIdExpressionMap

      public void setRenderIdExpressionMap(Map<String,String> renderIdExpressionMap)
    • setEmptyTable

      public void setEmptyTable(boolean emptyTable)
    • getCurrentColumnValue

      protected String getCurrentColumnValue()
      Returns:
      the current column value
    • setCurrentColumnValue

      protected void setCurrentColumnValue(String currentColumnValue)
      Set the current column value
      Parameters:
      currentColumnValue -