Skip to Content
9
Former Member
Jul 16, 2018 at 08:58 AM

Maptype in WCMSCockpit

231 Views

Hello, I have to implement editing feature for my custom CMSComponent and everything is OK, except for one thing - it contains maptype attribute (Map<String, CarouselDisplayingConfig>).


 <maptypes>
         <maptype code="CarouselConfigsMap"
                  argumenttype="java.lang.String"
                  returntype="CarouselDisplayingConfig"
                  autocreate="true"
                  generate="true"/>
  </maptypes>

 <itemtype code="CarouselDisplayingConfig" autocreate="true" generate="true" 
                     extends="SimpleCMSComponent"
                     jaloclass="cms.components.CarouselDisplayingConfig">
             <deployment table="carouseldisplayingconfig" typecode="16021"/>
                  <attributes>
                   --HERE LIST OF ATTRIBUTES--
                   </attributes>
 </itemtype>
 <itemtype code="TopCategoriesComponent" extends="SimpleCMSComponent"
                       autocreate="true" generate="true"
                       jaloclass="cms.components.TopCategoriesComponent">
                 <deployment table="topcategoriescomponent" typecode="16049" />
                 <attributes>
                     <attribute qualifier="heading" type="localized:java.lang.String">
                         <modifiers read="true" write="true" optional="true"/>
                         <persistence type="property"/>
                     </attribute>
                     <attribute qualifier="displayingConfigs" type="CarouselConfigsMap">
                         <modifiers read="true" write="true" optional="true"/>
                         <persistence type="property"/>
                     </attribute>
                     -- ANOTHER ATTRIBUTES IS OMITTED FOR THE SAKE OF SIMPLICITY --
                 </attributes>
 </itemtype>

I've added DefaultMapEditorRenderer to map of editors for DefaultPropertyEditorDescriptor which editor type is REFERENCE within cmscockpit-editors.xml

 <bean class="de.hybris.platform.cockpit.model.meta.DefaultPropertyEditorDescriptor">
     <property name="editorType" value="REFERENCE"/>
     <property name="defaultMode" value="single"/>
     <property name="defaultEditor" value="de.hybris.platform.cockpit.model.referenceeditor.simple.impl.DefaultSimpleReferenceUIEditor"/>
     <property name="editors">
         <map>
             <!--
                 Add this editor because of CarouselConfigsMap
             -->
             <entry key="mapEditor" value="com.hybris.cockpitng.editor.defaultmap.DefaultMapEditorRenderer"/>
             -- ANOTHER EDITORS IS OMITTED FOR THE SAKE OF SIMPLICITY --
         </map>
     </property>
     <property name="label" value="referenceEditor"/>
 </bean>

And added it to contentEditor.xml as editorCode="mapEditor"


 <?xml version="1.0" encoding="UTF-8"?>
 <content-editor hideEmpty="true" hideReadOnly="true"
                 groupCollections="true">
     <template>
         <![CDATA[
         <table style="width: 100%; margin: 0px; padding: 0px;">
             <tbody>
                 <tr><td><div style="height:6px"/></td></tr>
         <tr><td style="text-align:left"><cockpit code="property" value="TopBrandsComponent.displayingConfigurations"/></td></tr>
             </tbody>
         </table>
     ]]>
     </template>
     <custom-editors>
         <property qualifier="TopBrandsComponent.displayingConfigurations" editorCode="mapEditor"/>
     </custom-editors>
 </content-editor>

When I'm trying to edit this component within WCMSCockpit I get Error:

[Thread-62] [DefaultPropertyEditorDescriptor] Can not create editor component for type REFERENCE and mode "mapEditor".

Does someone know how to handle the editing process for Maptype within WCMSCockpit?

Hybris version: 5.7

Many thanks for any advice.