Class RichTable

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

public class RichTable extends WidgetBase
Decorates a HTML Table client side with various tools

Decorations implemented depend on widget implementation. Examples are sorting, paging and skinning.

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

    • RichTable

      public RichTable()
  • Method Details

    • performFinalize

      public void performFinalize(Object model, LifecycleElement parent)
      The following initialization is performed:
      • Initializes component options for empty table message
      Specified by:
      performFinalize in interface LifecycleElement
      Overrides:
      performFinalize in class ComponentBase
      Parameters:
      model - - top level object containing the data
      parent - - parent component
    • buildTableOptions

      protected void buildTableOptions(CollectionGroup collectionGroup)
      Builds column options for sorting
      Parameters:
      collectionGroup -
    • buildSortOptions

      protected void buildSortOptions(LookupView lookupView, CollectionGroup collectionGroup)
      Builds default sorting options.
      Parameters:
      lookupView - the view for the lookup
      collectionGroup - the collection group for the table
    • getDataFieldColumnOptions

      protected String getDataFieldColumnOptions(int target, CollectionGroup collectionGroup, DataField field)
      Construct the column options for a data field
      Parameters:
      target - column index
      collectionGroup - the collectionGroup in which the data field is defined
      field - the field to construction options for
      Returns:
      options as valid for datatable
    • constructTableColumnOptions

      public String constructTableColumnOptions(int target, boolean isSortable, boolean isUseServerPaging, Class<?> dataTypeClass, String sortDataType)
      Constructs the sort data type for each data table columns in a format that will be used to initialize the data table widget via javascript
      Parameters:
      target - the column index
      isSortable - whether a column should be marked as sortable
      isUseServerPaging - is server side paging enabled?
      dataTypeClass - the class type of the column value - used determine the sType option - which identifies the search plugin to use
      sortDataType - Defines a data source type for the sorting which can be used to read realtime information from the table
      Returns:
      a formatted string with data table options for one column
    • getEmptyTableMessage

      public String getEmptyTableMessage()
      Returns the text which is used to display text when the table is empty
      Returns:
      empty table message
    • setEmptyTableMessage

      public void setEmptyTableMessage(String emptyTableMessage)
      Setter for a text to be displayed when the table is empty
      Parameters:
      emptyTableMessage -
    • isDisableTableSort

      public boolean isDisableTableSort()
      Returns true if sorting is disabled
      Returns:
      the disableTableSort
    • setDisableTableSort

      public void setDisableTableSort(boolean disableTableSort)
      Enables/disables the table sorting
      Parameters:
      disableTableSort - the disableTableSort to set
    • isShowExportOption

      public boolean isShowExportOption()
      Returns true if export option is enabled
      Returns:
      the showExportOption
    • setShowExportOption

      public void setShowExportOption(boolean showExportOption)
      Show/Hide the search and export option in tabletools
      Parameters:
      showExportOption - the showExportOptions to set
    • getHiddenColumns

      public Set<String> getHiddenColumns()
      Holds propertyNames for the ones meant to be hidden since columns are visible by default

      Duplicate entries are ignored and the order of entries is not significant

      Returns:
      a set with propertyNames of columns to be hidden
    • setHiddenColumns

      public void setHiddenColumns(Set<String> hiddenColumns)
      Setter for the hidden columns set
      Parameters:
      hiddenColumns - a set containing propertyNames
    • getSortableColumns

      public Set<String> getSortableColumns()
      Holds the propertyNames for columns that are to be sorted

      Duplicate entries are ignored and the order of entries is not significant

      Returns:
      a set of propertyNames with for columns that will be sorted
    • setSortableColumns

      public void setSortableColumns(Set<String> sortableColumns)
      Setter for sortable columns
      Parameters:
      sortableColumns - a set containing propertyNames of columns to be sorted
    • getAjaxSource

      public String getAjaxSource()
      Specifies a URL for acquiring the table data with ajax

      When the ajax source URL is specified the rich table plugin will retrieve the data by invoking the URL and building the table rows from the result. This is different from the standard use of the rich table plugin with uses progressive enhancement to decorate a table that has already been rendereed

      Returns:
      URL for ajax source
    • setAjaxSource

      public void setAjaxSource(String ajaxSource)
      Setter for the Ajax source URL
      Parameters:
      ajaxSource -
    • getGroupingOptionsJSString

      public String getGroupingOptionsJSString()
      Get groupingOption
      Returns:
      grouping options as a JS string
    • setGroupingOptionsJSString

      public void setGroupingOptionsJSString(String groupingOptionsJSString)
      Set the groupingOptions js data. This should not be set through XML configuration.
      Parameters:
      groupingOptionsJSString -
    • isForceAoColumnDefsOverride

      public boolean isForceAoColumnDefsOverride()
      If set to true and the aoColumnDefs template option is explicitly defined in templateOptions, those aoColumnDefs will be used for this table. Otherwise, if false, the aoColumnDefs will attempt to be merged with those that are automatically generated by RichTable
      Returns:
      true if the aoColumnDefs set will completely override those that are generated automatically by RichTable
    • setForceAoColumnDefsOverride

      public void setForceAoColumnDefsOverride(boolean forceAoColumnDefsOverride)
      Set forceAoColumnDefsOverride
      Parameters:
      forceAoColumnDefsOverride -
    • isForceLocalJsonData

      public boolean isForceLocalJsonData()
      If true, the table will automatically use row JSON data generated by this widget

      This forces the table backed by this RichTable to get its content from a template option called aaData. This will automatically skip row generation in the template, and cause the table receive its data from the aaData template option automatically generated and set by this RichTable. This allows the table to take advantage of the bDeferRender option (also automatically set to true) when this table is a paged table (performance increase for tables that are more than one page). Note: the CollectionGroup's isUseServerPaging flag will always override this functionality if it is also true.

      Returns:
      true if backed by the aaData option in JSON, that is generated during the ftl rendering process by this widget for this table
    • setForceLocalJsonData

      public void setForceLocalJsonData(boolean forceLocalJsonData)
      Set the forceLocalJsonData flag to force this table to use generated row json data
      Parameters:
      forceLocalJsonData -
    • getNestedLevel

      public int getNestedLevel()
      The nestedLevel property represents how many collection tables deep this particular table is

      This property must be manually set if the flag forceLocalJsonData is being used and the collection table this RichTable represents is a subcollection of a TABLE collection (not stacked collection). If this is true, add 1 for each level deep (ex. subCollection would be 1, sub-subCollection would be 2). If this property is not set javascript errors will occur on the page, as this determines how deep to escape certain characters.

      Returns:
      the nestedLevel representing the
    • setNestedLevel

      public void setNestedLevel(int nestedLevel)
      Set the nestedLevel for this table - must be set if using forceLocalJsonData and this is a subCollection of a TableCollection (also using forceLocalJsonData)
      Parameters:
      nestedLevel -
    • getAaData

      public String getAaData()
      Get the translated aaData array generated by calls to addRowToTableData by the ftl

      This data is in JSON format and expected to be consumed by datatables when utilizing the forceLocalJsonData option. This will be populated automatically if that flag is set to true.

      Returns:
      the generated aaData
    • setAaData

      protected void setAaData(String aaData)
      Set the translated aaData array

      This data is in JSON format and expected to be consumed by datatables when utilizing the forceLocalJsonData. This setter is required for copyProperties()

      Parameters:
      aaData - the generated aaData
    • getCellValue

      public String getCellValue(Object model, Field field)
      Get the simple value as a string that represents the field's sortable value, to be used as val in the custom uif json data object (accessed by mDataProp option on datatables - automated by framework) when using the forceLocalJsonData option or the CollectionGroup's isUseServerPaging option
      Parameters:
      model - model the current model
      field - the field to retrieve a sortable value from for use in custom json data
      Returns:
      the value as a String
    • addRowToTableData

      public void addRowToTableData(String row)
      Add row content passed from table ftl to the aaData array by converting and escaping the content to an object (in an array of objects) in JSON format

      The data in aaData is expected to be consumed by a call by the datatables plugin using sAjaxSource or aaData. The addRowToTableData generation call is additive must be made per a row in the ftl.

      Parameters:
      row - the row of content with each cell content surrounded by the @quot@ token and followed by a comma
    • getConfigurationService

      protected ConfigurationService getConfigurationService()