cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Localized Editor doesn't work

former_member612830
Discoverer
0 Likes
553

Hi everyone.

I've faced with the following problem. I created my own test widget which main purpose is to edit Product Name and Description. The widget successfully receives a Product object. However, when rendering values to edit, I've got the following result:

widget zul-file has editors tag:

 <editors id="editors" group="common"/>

 

Editors are defined in -config.xml file:

 <context component="previewEditors" type="Product">
         <y:editors xmlns:y="http://www.hybris.com/cockpit/config/hybris">
             <y:group qualifier="common">
                 <y:property qualifier="currentObject.name" type="Localized(java.lang.String)">
                     <y:label>editorarea.name</y:label>
                 </y:property>
                 <y:property qualifier="currentObject.description" type="java.lang.String" editor="com.hybris.cockpitng.editor.localized(com.hybris.cockpitng.editor.wysiwyg)">
                     <y:label>editorarea.description</y:label>
                 </y:property>
             </y:group>
         </y:editors>
     </context>


I tried to debug it and it seems that the problem is with EditorContext instance which readableLocales property is null. But I still can't get how to make it work. Any help is appreciated.

View Entire Topic
former_member612830
Discoverer
0 Likes

The problem is that DefaultCockpitEditorsRenderer (which is used by default to render all editors described in editiors tag) when creating an Editor for an EditorProperty, doesn't set it's ReadableLocales and WritableLocales properties. These properties are used in LocalizedEditor to identify what exactly locales should be rendered on the Client side. When the properties are null, LocalizedEditor has no locale to render and the result one can see at the screen-shot above in my question.

As a workaround, I created my own Renderer that extends DefaultCockpitEditorsRenderer and sets ReadableLocales and WritableLocales properties for Editor instance similar to the way it is done in AbstractEditorAreaComponentRenderer. Than I registered my renderer in Spring context as a bean and passed it's name as a renderer to Editors. And it worked.

p.s. I'm using Hybris 6.4. Perhaps in later versions it works OOTB as expected.