on 06-24-2016 5:20 AM
I created a custom editor which extends the default multi reference editor. I created a definition.xml and default.css but unfortunately the styling is not reflected in my editor. May I know what I missed that causes the styling not reflected in my editor?
I am having a similar issue and proceeded with the work around, It works perfectly. Has this issue been been addressed with the later versions ?
Also if you are using the workaround, you would not need any additional styles in your custom editor since the workaround references the parent styles.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This workaround works perfectly for Hybris 6.3
public class ProvinceDeliveryCostEditor extends DefaultExtendedMultiReferenceEditor {
@Override
public void render(final Component parent, final EditorContext context, final EditorListener listener) {
super.render(parent, context, listener);
// Link parent style configurations to the child
if (parent.getChildren().get(0) instanceof HtmlBasedComponent) {
UITools.modifySClass((HtmlBasedComponent) parent.getChildren().get(0),
"ye-com_hybris_cockpitng_editor_extendedmultireferenceeditor", true);
setComponentID("com.hybris.cockpitng.editor.extendedmultireferenceeditor");
}
}
}
definition.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<editor-definition id="your.package.provincedeliverycosteditor"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://www.hybris.com/schema/cockpitng/editor-definition.xsd"
extends="com.hybris.cockpitng.editor.extendedmultireferenceeditor">
<name>ProvinceDeliveryCost</name>
<description>Displays delivery costs in province</description>
<type>^ExtendedMultiReference-(COLLECTION|LIST|SET)\((.*)\)$</type>
<editorClassName>your.package.ProvinceDeliveryCostEditor</editorClassName>
</editor-definition>
For appropriate buttons displaying you should add file "label.properties" with this content
reference.editor.cannot.instantiate.type.selected=Choosen type ({0}) can not be created because type is abstract. Please choose another type.
saverow=Save
undochanges=Undo
removereference=Remove
editdetails=Edit Details
couldnotsaveitem=Row {0} could not be saved, reason: {1}
couldnotsaveitempermission=Row {0} could not be saved due to insufficient permissions
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
after investigation, the following should work:
public class MyCustomExtendedMultiReferenceEditor extends DefaultExtendedMultiReferenceEditor
{
private static final Logger LOG = LoggerFactory.getLogger(MyCustomExtendedMultiReferenceEditor.class);
@Override
public void render(final Component parent, final EditorContext context, final EditorListener listener)
{
LOG.info("Rendering via: " + MyCustomExtendedMultiReferenceEditor.class.getName());
super.render(parent, context, listener);
if (parent.getChildren().get(0) instanceof HtmlBasedComponent)
{
UITools.modifySClass((HtmlBasedComponent) parent.getChildren().get(0), "ye-com_hybris_cockpitng_editor_extendedmultireferenceeditor", true);
}
}
}
and the definition (mind the extends attribute!):
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<editor-definition id="com.test.backoffice.cockpitng.editor.mycustomextendedmultireferenceeditor"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://www.hybris.com/schema/cockpitng/editor-definition.xsd" extends="com.hybris.cockpitng.editor.extendedmultireferenceeditor">
<name>My Custom Extended Multi Reference Editor</name>
<description></description>
<type>^ExtendedMultiReference-(COLLECTION|LIST|SET)\((.*)\)$</type>
<editorClassName>com.test.backoffice.cockpitng.editor.mycustomextendedmultireferenceeditor.MyCustomExtendedMultiReferenceEditor</editorClassName>
</editor-definition>
Obviously the part in the renderer is a workaround in this case and it must be handled appropriately in the framework. This will be reported and fixed. For now the presented solution should be enough.
Cheers, Wojtek
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
are you using the right editor in your widgets.xml? For example in all declarations like:
<editorArea:attribute editor="com.hybris.cockpitng.editor.extendedmultireferenceeditor" qualifier="cronJobs">
Must be replaced with:
<editorArea:attribute editor="om.test.backoffice.cockpitng.editor.mycustomextendedmultireferenceeditor" qualifier="cronJobs">
Please also try to put a breakpoint in the MyCustomExtendedMultiReferenceEditor class to make sure it is picked up.
If both checks are true I think it is a bug.
Cheers, Wojtek
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
OK. Then I am reporting this as a bug. Could you give me your suite's version? THis may be important for validation.
For the time beeing - as a workaround - I recommend you to put the styles into one of the common css (scss if you are using it) files. As the bug will be reoslved you should be able to easily move the code to the dedicated file.
Cheers, Wojtek
One more comment. It is woth trying to give the css file the name of mycustomextendedmultireferenceeditor.css (last part of the editor's id + .css). This convention should also work (I expect it won't but as I said - it is worh trying).
The bug is reported and the backoffice team will be investigating it.
Any feedback on this ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
we would have to see your code to try to help.
Cheers, Wojtek
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<editor-definition id="com.test.backoffice.cockpitng.editor.mycustomextendedmultireferenceeditor"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://www.hybris.com/schema/cockpitng/editor-definition.xsd">
<name>My Custom Extended Multi Reference Editor</name>
<description></description>
<type>^ExtendedMultiReference-(COLLECTION|LIST|SET)\((.*)\)$</type>
<editorClassName>com.test.backoffice.cockpitng.editor.mycustomextendedmultireferenceeditor.MyCustomExtendedMultiReferenceEditor</editorClassName>
<sockets>
<input id="referenceEditorInput"/>
<output id="referenceEditorOutput" type="java.util.Map"/>
<output id="referenceSelected" type="com.hybris.cockpitng.data.TypeAwareSelectionContext"/>
</sockets>
<settings>
<setting key="pageSize" default-value="5" type="java.lang.Integer"/>
<setting key="listConfigContext" default-value="listview" type="java.lang.String"/>
</settings>
</editor-definition>
Hi. I have the same problem with extendedmultireferenceeditor customization. I applied your workaround but it helps me only partially. ("Edit" and "Create" buttons don't work, "Remove" button works but doesn't display) Hybris version 6.3.1
Problem:
My implementation: link text
Thanks in advance
User | Count |
---|---|
5 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.