Kuali Rice Development
  1. Kuali Rice Development
  2. KULRICE-9735

Property editor class is initiated Previously with the list<String or any type> but after 2.2.0 upgrade its not happening.

    Details

    • Type: Bug Fix Bug Fix
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.5
    • Component/s: Accessibility
    • Security Level: Public (Public: Anyone can view)
    • Labels:
      None
    • Similar issues:
      KULRICE-5354Agenda Editor only functions after ReloadingDataDictionary reloads
      KULRICE-8772Readonly flag no longer working in 2.2.0 final
      KULRICE-7563Easy display of List<String> NEW control(s)
      KULRICE-5377Develop utility class that will apply formatting using the spring property editors
      KULRICE-12255Add rule cannot read proposition property at initialization phase
      KULRICE-7077Agenda Editor: Invalid property fieldLabel of bean class MessageField
      KULRICE-5246Add hidden property names property to AttributeField
      KULRICE-8365Validation change/fix interaction after a client validation happens on action
      KULRICE-4044Hey! What would happen if BusinessObjectService detached everything as soon as its loaded?
    • Rice Module:
      KRAD
    • Sprint:
      2.4.0-rc1 Sprint 1, 2.4.0-rc1 Sprint 2, 2.4.0-rc1 Sprint 4, 2.5.0-m3 Sprint 1
    • KAI Review Status:
      Not Required
    • KTI Review Status:
      Not Required
    • Code Review Status:
      Not Required
    • Include in Release Notes?:
      Yes

      Description

      "courseSummaryDetails.scheduledTerms" specified in the following bean definition is List<String> type.

      Bean Definition:
      <bean parent="Uif-DataField" p:propertyName="courseSummaryDetails.scheduledTerms"
      p:label="Scheduled For"
      p:fieldLabel.cssClasses="fl-text-gray fl-font-size-90 myplan-text-normal"
      p:labelPlacement="LEFT" p:escapeHtmlInPropertyValue="false">
      <property name="propertyEditor" ref="scheduled_terms_list_formatter"/>
      <property name="cssClasses">
      <list merge="true">
      <value>myplan-data-list</value>
      </list>
      </property>
      </bean>

      <bean id="scheduled_terms_list_formatter" class="org.kuali.student.myplan.course.util.ScheduledTermsPropertyEditor">
      <property name="applyClassOnItem" value="true"/>
      <property name="emptyListMessage" value="Not currently scheduled"/>
      <property name="emptyListStyleClasses">
      <list merge="true">
      <value>empty</value>
      </list>
      </property>
      <property name="styleClasses">
      <list merge="true">
      <value>scheduled</value>
      </list>
      </property>
      </bean>

      Attached the ScheduledTermsPropertyEditor.java Class
      Attached the CollectionListPropertyEditor.java class which is being extended in ScheduledTermsPropertyEditor class.

      1. CollectionListPropertyEditor.java
        6 kB
        Hemanth Gajula
      2. KULRICE-9735.patch
        6 kB
        Kristina Taylor
      3. ScheduledTermsPropertyEditor.java
        1 kB
        Hemanth Gajula

        Issue Links

          Activity

          Hide
          Peter Giles (Inactive) added a comment -

          Note that this needs to be fixed in the Rice 2.3 branch.

          Show
          Peter Giles (Inactive) added a comment - Note that this needs to be fixed in the Rice 2.3 branch.
          Hide
          Kristina Taylor (Inactive) added a comment -

          I am unable to reproduce this on our 2.3.4 snapshot. Even when I set the propertyEditor in the bean, it is being initialized and all the properties from the bean are being set. I am also having trouble replicating the KPME situation, so I'm wondering if either the bug has been fixed or I am not replicating the problem correctly. Can you check to see whether you can replicate this still on a Rice 2.3.4 build?

          Show
          Kristina Taylor (Inactive) added a comment - I am unable to reproduce this on our 2.3.4 snapshot. Even when I set the propertyEditor in the bean, it is being initialized and all the properties from the bean are being set. I am also having trouble replicating the KPME situation, so I'm wondering if either the bug has been fixed or I am not replicating the problem correctly. Can you check to see whether you can replicate this still on a Rice 2.3.4 build?
          Hide
          Kristina Taylor (Inactive) added a comment -

          This issue is completely different from KPME's issue with Time objects, so I have created KULRICE-12058 to address this. The registered property editors for this issue won't get confused in the same way they do with Time/Date objects. It is possible I did not recreate this correctly since it is a property editor on a List<String> object, so this still may be an issue.

          Show
          Kristina Taylor (Inactive) added a comment - This issue is completely different from KPME's issue with Time objects, so I have created KULRICE-12058 to address this. The registered property editors for this issue won't get confused in the same way they do with Time/Date objects. It is possible I did not recreate this correctly since it is a property editor on a List<String> object, so this still may be an issue.
          Hide
          Kristina Taylor (Inactive) added a comment -

          From Jerry Neal:

          Property editors should be supported for data fields as well. It will manipulate the value for display and binding the same. So there is an issue somewhere if it is not getting picked up.

          There are other ways to control the read only display of list values as well (without a property editor). Data field has the properties readOnlyListDisplayType and readOnlyListDelimiter that can be configured.

          Show
          Kristina Taylor (Inactive) added a comment - From Jerry Neal: Property editors should be supported for data fields as well. It will manipulate the value for display and binding the same. So there is an issue somewhere if it is not getting picked up. There are other ways to control the read only display of list values as well (without a property editor). Data field has the properties readOnlyListDisplayType and readOnlyListDelimiter that can be configured.
          Hide
          Kristina Taylor (Inactive) added a comment -

          I've attached a patch that replicates the issue on 2.4.

          Show
          Kristina Taylor (Inactive) added a comment - I've attached a patch that replicates the issue on 2.4.
          Hide
          Peter Giles (Inactive) added a comment -

          Moving to 2.5

          Show
          Peter Giles (Inactive) added a comment - Moving to 2.5
          Hide
          Kristina Taylor (Inactive) added a comment -

          Even though the example is weird (injecting raw HTML as the property editor adds it as text instead of markup), I got the property editor to actually be called. It seems that the issue came from some updates in KULRICE-9997 with readOnlyDisplayReplacement. In dataInputField.ftl we have this convention:

          <#if field.readOnlyDisplayReplacement?has_content>
            ${field.readOnlyDisplayReplacement}
          <#else>
            <#-- display actual field value -->
            <@spring.bind path="KualiForm.${field.bindingInfo.bindingPath}"/>
          </#if>
          

          I was finding that the binding wasn't happening at all and thus the property editor was not consulted at all. This is because of the following in DataFieldBase:

          if (fieldValue != null && fieldValue instanceof List<?> && !((List) fieldValue).isEmpty()) {
            List<?> list = (List<?>) fieldValue;
            processReadOnlyListDisplay(model, list);
          } else {
            this.setReadOnlyDisplayReplacement("&nbsp;");
          }
          

          giving readOnlyDisplayReplacement content always and making the second part of the if-else dead code. I'm not sure why we would ever want to fill out this field with the empty space, but we do it several places and we might want to remove that convention and just leave it blank if nothing is added.

          Show
          Kristina Taylor (Inactive) added a comment - Even though the example is weird (injecting raw HTML as the property editor adds it as text instead of markup), I got the property editor to actually be called. It seems that the issue came from some updates in KULRICE-9997 with readOnlyDisplayReplacement . In dataInputField.ftl we have this convention: <# if field.readOnlyDisplayReplacement?has_content> ${field.readOnlyDisplayReplacement} <# else > <#-- display actual field value --> <@spring.bind path= "KualiForm.${field.bindingInfo.bindingPath}" /> </# if > I was finding that the binding wasn't happening at all and thus the property editor was not consulted at all. This is because of the following in DataFieldBase : if (fieldValue != null && fieldValue instanceof List<?> && !((List) fieldValue).isEmpty()) { List<?> list = (List<?>) fieldValue; processReadOnlyListDisplay(model, list); } else { this .setReadOnlyDisplayReplacement( "&nbsp;" ); } giving readOnlyDisplayReplacement content always and making the second part of the if-else dead code. I'm not sure why we would ever want to fill out this field with the empty space, but we do it several places and we might want to remove that convention and just leave it blank if nothing is added.
          Hide
          Jerry Neal (Inactive) added a comment -

          Kristina,

          That makes sense. This is convenience functionality we have for displaying lists. I would say we should put in a check for a configured property editor class, and if specified not process the read only list configuration. In other words, if a property editor is configured, skip the logic above (including the else which is setting the read only display to a blank when the value is null or empty).

          Jerry

          Show
          Jerry Neal (Inactive) added a comment - Kristina, That makes sense. This is convenience functionality we have for displaying lists. I would say we should put in a check for a configured property editor class, and if specified not process the read only list configuration. In other words, if a property editor is configured, skip the logic above (including the else which is setting the read only display to a blank when the value is null or empty). Jerry
          Hide
          Kristina Taylor (Inactive) added a comment - - edited

          This has been fixed, but I don't think the given example is a valid use case since its output is interpreted as HTML text and not HTML markup. This particular case would be better served by taking advantage of the readOnlyListDisplayType feature. Please see the KRAD Guide for more information.

          Show
          Kristina Taylor (Inactive) added a comment - - edited This has been fixed, but I don't think the given example is a valid use case since its output is interpreted as HTML text and not HTML markup. This particular case would be better served by taking advantage of the readOnlyListDisplayType feature. Please see the KRAD Guide for more information.

            People

            • Assignee:
              Kristina Taylor (Inactive)
              Reporter:
              Hemanth Gajula (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 1 day
                1d
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 3 hours Time Not Required
                3h

                  Agile

                    Structure Helper Panel