Class InlineResultsTable

  • Direct Known Subclasses:
    BagUploadConfirmInlineResultsTable

    public class InlineResultsTable
    extends java.lang.Object
    An inline table created from a Collection This table has one object per row
    Author:
    Radek Stepan, Mark Woodbridge
    • Constructor Summary

      Constructors 
      Constructor Description
      InlineResultsTable​(java.util.Collection<?> results, Model model, WebConfig webConfig, java.util.Map<java.lang.String,​java.util.List<FieldDescriptor>> classKeys, int size, boolean ignoreDisplayers, java.util.List<java.lang.Class<?>> listOfTypes)
      Construct a new InlineResultsTable object
      InlineResultsTable​(java.util.Collection<?> results, Model model, WebConfig webConfig, java.util.Map<java.lang.String,​java.util.List<FieldDescriptor>> classKeys, int size, boolean ignoreDisplayers, java.util.List<java.lang.Class<?>> listOfTypes, java.lang.String parentType, FieldDescriptor fd)
      Construct with parent type and a field descriptor.
    • Field Detail

      • results

        protected java.util.Collection<?> results
      • resultsAsList

        protected java.util.List<?> resultsAsList
      • rowObjects

        protected java.util.List<java.lang.Object> rowObjects
      • columnFullNames

        protected java.util.List<?> columnFullNames
      • model

        protected Model model
      • size

        protected int size
      • LOG

        protected static final org.apache.log4j.Logger LOG
    • Constructor Detail

      • InlineResultsTable

        public InlineResultsTable​(java.util.Collection<?> results,
                                  Model model,
                                  WebConfig webConfig,
                                  java.util.Map<java.lang.String,​java.util.List<FieldDescriptor>> classKeys,
                                  int size,
                                  boolean ignoreDisplayers,
                                  java.util.List<java.lang.Class<?>> listOfTypes)
        Construct a new InlineResultsTable object
        Parameters:
        results - the List to display object
        model - the current Model
        webConfig - the WebConfig object for this webapp
        classKeys - Map of class name to set of keys
        size - the maximum number of rows to list from the collection, or -1 if we should
        ignoreDisplayers - if true don't include any columns that have jsp displayers defined
        listOfTypes - resolved using PathQueryResultHelper.queryForTypesInCollection on a Collection, a Reference object will have null instead and its Type will be resolved using getListOfTypes()
      • InlineResultsTable

        public InlineResultsTable​(java.util.Collection<?> results,
                                  Model model,
                                  WebConfig webConfig,
                                  java.util.Map<java.lang.String,​java.util.List<FieldDescriptor>> classKeys,
                                  int size,
                                  boolean ignoreDisplayers,
                                  java.util.List<java.lang.Class<?>> listOfTypes,
                                  java.lang.String parentType,
                                  FieldDescriptor fd)
        Construct with parent type and a field descriptor.
        Parameters:
        results - the List to display object
        model - the current Model
        webConfig - the WebConfig object for this webapp
        classKeys - Map of class name to set of keys
        size - the maximum number of rows to list from the collection, or -1 if we should
        ignoreDisplayers - if true don't include any columns that have jsp displayers defined
        listOfTypes - resolved using PathQueryResultHelper.queryForTypesInCollection on a Collection, a Reference object will have null instead and its Type will be resolved using getListOfTypes()
        parentType - The type of the parent for this list
        fd - The field descriptor this list represents.
    • Method Detail

      • getResultsAsList

        public java.util.List<?> getResultsAsList()
        Returns:
        the results as a list.
      • getParentType

        public java.lang.String getParentType()
        Get the parent's type
        Returns:
        the type of the parent
      • getFieldDescriptor

        public FieldDescriptor getFieldDescriptor()
        Get the fields descriptor this list represents.
        Returns:
        a field descriptor.
      • getListOfTypes

        public java.util.List<java.lang.Class<?>> getListOfTypes()
        Returns:
        a list of types in a Collection or a Reference contained in this table
        See Also:
        reason for retrieving types for Reference here is that PathQueryResultHelper.queryForTypesInCollection() does not work for References (obviously)
      • getHasMoreThanOneType

        public java.lang.Boolean getHasMoreThanOneType()
        Returns:
        true if the table has more than one Type of object
        See Also:
        in mind that this method will return true if there are different Types in the whole table, not just the "30" odd rows subset!
      • getTableFieldConfigs

        public java.util.List<FieldConfig> getTableFieldConfigs()
        Returns:
        a list of (all) FieldConfigs/Columns for this table
      • getClassFieldConfigs

        protected java.util.List<FieldConfig> getClassFieldConfigs​(ClassDescriptor cd)
        Find the FieldConfig objects for the the given ClassDescriptor.
        Parameters:
        cd - a ClassDescriptor
        Returns:
        the FieldConfig objects for the the given ClassDescriptor
      • returnNewTableRow

        protected java.lang.Object returnNewTableRow()
        Create a table row object, overriden on BagUploadConfirm where we go custom
        Returns:
        an InlineResultsTableRow (default)
      • setClassNameOnTableRow

        protected void setClassNameOnTableRow​(java.lang.String className,
                                              java.lang.Object tableRowObject)
        Set a class name on table row, used for type safety as overriden on BagUploadConfirm
        Parameters:
        className - string name of the class of the object
        tableRowObject - InlineResultsTableRow (default)
      • addResultElementToTableRow

        protected void addResultElementToTableRow​(java.lang.Object resultElement,
                                                  java.lang.Object tableRowObject)
        Add a result element (RE or "" String), used for type safety as overriden on BagUploadConfirm
        Parameters:
        resultElement - to be saved in the list
        tableRowObject - InlineResultsTableRow (default)
      • saveObjectIdOnTableRow

        protected void saveObjectIdOnTableRow​(java.lang.Integer id,
                                              java.lang.Object tableRowObject)
        Used on BagUploadConfirm
        Parameters:
        id - imObj
        tableRowObject - InlineResultsTableRow (default)
      • getResultElementRows

        public java.util.List<java.lang.Object> getResultElementRows()
        Main method used from report to resolve a tablefull of ResultElements
        Returns:
        a list of lists of ResultElements
      • getColumnsSize

        public java.lang.Integer getColumnsSize()
        Returns:
        the number of columns in each table, based on all FieldConfigs for all objects