cancel
Showing results for 
Search instead for 
Did you mean: 

Opening Wizard programatically

Former Member
0 Kudos

Hey guys,

I want to open a wizard when I'm entering numbers in a textfield and pressing enter which is inside my editor-area inside the backoffice.

Is there any way to open a wizard programatically? If not what would you guys suggest to work around with?

Cheers, Daniel

Accepted Solutions (1)

Accepted Solutions (1)

former_member625836
Active Contributor
0 Kudos

Hi ,

If it is your editor, then you are half way home. If not, then you would have to extend the existing editor and change configuration so that it is used in the attributes you need. However you achieve it, you will be at the point that you have your own editor renderer there you can add a`key_pressed` listener on input and inside the listener you would have to send a socket message via some socket that you define in definition.xml of your custom editor. Then in mesh-up you need to connect your editor's output socket with Configurable Flow instance.

Cheers, Jacek

Former Member
0 Kudos

Cheers, i'll give it a try :)

Former Member
0 Kudos

is it possible that if I enter the code inside the Textbox and it equals a reference ID of an image that it is refreshing the section itself?

I've got a multireferenceeditor where I show the linked images to the product so if I add the image via the Textbox is it possible to refresh the section so the new added image gets shown? Can I implement that inside my custom editor?

And also I'm unsure of how to configure the sockets to the wizard / the editor inside the section properly? My sockets are called

 <sockets>
     <input id="cavokMediaInput"/>
     <output id="cavokMediaOutput"/>
 </sockets>

cheers,

former_member625836
Active Contributor
0 Kudos

The very first idea I would have is to take a WidgetInstanceManager from EditorContext (it is available under com.hybris.cockpitng.components.Editor#WIDGET_INSTANCE_MANAGER key), then get a Widgetslot out of it and call initialize() method - it would make an editor area reload itself.

It may not be the best idea, but I would try to go this way. You may always get deeper in this direction and try to request just a section reload.

Cheers, Jacek

Former Member
0 Kudos

Thanks for your reply,

just one more question, is there any way to trigger the wizard when triggering the Events.ON_OK event? I'm not really sure how to trigger the wizard with the socket I created in my custom editor.

former_member625836
Active Contributor
0 Kudos

You need to connect a template to your editor:

STUB_your.editor.definition.id -> any ConfigurableFlow marked as template (i.e. configurableFlow).

Here you have an example from OOTB mashup:

     <widget-connection sourceWidgetId="STUB_com.hybris.cockpitng.editor.defaultmultireferenceeditor"
                              outputId="referenceEditorOutput" targetWidgetId="configurableFlow" inputId="context"/>
Former Member
0 Kudos

Thanks for the reply, it seems like i'm doing something wrong cause it's not opening when i'm triggering the Enter button.

Editor ID:

 <editor-definition id="ecx.io.prem.pim.backoffice.widgets.renderer"

Widget Connection:

 <widget-connection sourceWidgetId="STUB_ecx.io.prem.pim.backoffice.widgets.renderer"
                        outputId="cavokMediaOutput" targetWidgetId="cavokMediaRelationWizard" inputId="contextType"/>  

Code:

 editorView.addEventListener(Events.ON_OK, new EventListener<Event>()
         {
 
             @Override
             public void onEvent(final Event event) throws Exception
             {
                 sendOutput("cavokMediaOutput", context);
             }
 
         });
Former Member
0 Kudos

you got any idea's why it's not opening the wizard?

former_member625836
Active Contributor
0 Kudos

Hi,

There are some pre-requirements for what you defined above to work:

  • does ecx.io.prem.pim.backoffice.widgets.renderer define cavokMediaOutput output?

  • did you also define a wizard widget in your backoffice-widgets.xml with cavokMediaRelationWizard id?

Except above, all look fine.

Jacek

Former Member
0 Kudos

Hey it's opening a Window right now but with a exception.

It's throwing a java.lang.IllegalArgumentException: argument type mismatch if I put the context into the sendOutput. Any Ideas?

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi I couldnt reply on your comment so I'm writing another answer, this is the defitionion of my renderer

     <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
     <editor-definition id="ecx.io.prem.pim.backoffice.widgets.renderer"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="http://www.hybris.com/schema/cockpitng/editor-definition.xsd">
     
         <name>cavokMediaWizardTextField</name>
         <description>Textfield for searching Cavok Media and opening a Wizard</description>
         <!--The type of the value this editor is capable of handling.-->
         <type>java.lang.Object</type>
         <!--this is the renderer class of the editor. It is responsible for creation of the editor view.-->
         <editorClassName>ecx.io.prem.pim.backoffice.widgets.renderer.PremCavokMediaSimpleTextFieldRenderer</editorClassName>
         <sockets>
             <input id="cavokMediaInput"/>
             <output id="cavokMediaOutput"/>
         </sockets>
     </editor-definition>


and I changed cavokMediaRelationWizard to configurableFlow.

The thing is it opens a wizard now but nothing gets displayed. Because I'm only submitting a string basically. Or should something get displayed when I submit the context? But context is just an object and the wizard inputsocket context needs a map