Uploaded image for project: 'MyFaces Trinidad'
  1. MyFaces Trinidad
  2. TRINIDAD-1889

Issue with Trinidad UIXCollection class 'createCollectionModel' method

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.0.0-beta-1
    • 1.2.14-core , 2.0.0-beta-1
    • Components
    • None
    • All

    Description

      The Trinidad UIXCollection class contains an abstract method called 'createCollectionModel'. Subclasses are supposed to override this method and use it to create a CollectionModel instance for use by the component.

      Currently subclasses like UIXTable and UIXTree use 'createCollectionModel' to get the component's 'value' attribute and wrap the object in the 'value' attribute in a CollectionModel/TreeModel instance (if necessary) .

      UIXTable and UIXTree also perform other initializations in 'createCollectionModel. For example, SelectedRowKeys and DisclosedRowKeys sets are initialized in 'createCollectionModel'.

      The issue with the current design is that the component's reference to the CollectionModel is not fully initialized until 'createCollectionModel' returns a CollectionModel instance and the resulting model is stored in the component's state by UIXCollection.

      So for example, UIXTable and UIXTree should not be performing initialization of component's attribute that depend on a fully initialized CollectionModel reference inside the 'createCollectionModel'.

      The SelectedRowKeys and DisclosedRowKeys sets require a fully initialized CollectionModel before they should be referenced. Otherwise if these attributes are EL-bound and a backing bean logic references the CollectionModel in the getter method for SelectedRowKeys and DisclosedRowKeys, the backing bean may get an uninitialized CollectionModel reference.

      The proposal is to add the following method to UIXCollection:

      /**

      • Called after <code>createCollectionModel</code> when the model is fully initialized
      • Subclasses can use this method to perform initialization of component attributes
      • that should occur only after the CollectionModel is fully initialized in
      • <code>createCollectionModel</code>
      • This is a do nothing implementation to avoid breaking existing code
      • * @see #createCollectionModel
      • @param model
        */
        protected void postCreateCollectionModel(CollectionModel model) { // do nothing }

      This method will be called by UIXCollection after 'createCollectionModel' returns and the component's reference to the CollectionModel is fully initialized. Any initialization of model-dependent attributes can then occur in 'postCreateCollectionModel'

      Attachments

        1. uixcollection1.patch
          4 kB
          Kamran Kashanian

        Activity

          People

            mattcooper Matt Cooper
            kamrankashanian Kamran Kashanian
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: