Editor Area Widget

The Editor Area widget allows you to view and modify a business object instance through the display of attributes, columns, tabs, sections, and panels.

Widget Definition

Name

Editor Area

ID

com.hybris.cockpitng.backoffice.defaultEditorArea

Category

Data Manipulation

Description

This widget allows you to view and modify a business object instance through the display of attributes, columns, tabs, sections, and panels.

Applied In

Not applicable.

Based On

Not applicable.

Author

SAP

Inputs

Details of input sockets:

  • inputObject
    • Type: java.lang.Object
    • Multiplicity: Single
    • Description: Object passed to this socket is presented for modification.
  • resize
    • Type: java.lang.Map
    • Multiplicity: Single
    • Description: Notifies the widget that a parent component has changed it's size. It allows to react on resizing the browser window, see Fluid Mode Functionality.
  • reset
    • Type: java.lang.Map
    • Multiplicity: Single
    • Description: Notifies the widget when its content should be reset to the initial state - useful when parent widget is invalidated.
  • focus
    • Type: com.hybris.cockpitng.widgets.baseeditorarea.FocusRequest
    • Multiplicity: Single
    • Displays received object. Then, the first found attribute editor with name equal to the message is focused (if needed, a tab is changed)

Outputs

Details of output sockets:

  • objectSaved
    • Type: java.lang.Object
    • Multiplicity: Single
    • Description: This socket output sends current object that was saved.
  • widgetTitle
    • Type: java.lang.String
    • Multiplicity: Single
    • Description: Text generated using attributes taken from the input object, separated by dashes.

      In the following screenshot, the text "DSC-H20_MD..." represents the widgetTitle text that is generated.

Generated Events

None. Events that are generated originate not from the widget but from the underlying business logic.

Widget Model Keys

  • currentObject: A reference to the currently selected object. You would send currentObject when deleting the selected object, for example.

Configuration

The Editor Area Widget is highly configurable.

Layout Components as Defined by item-editor.xsd

Configuration of this widget is defined by the item-editor.xsd file.

The following elements can be used in your configuration file:
  • editorArea: Root element.

    • @name (java.lang.String), required: Key for localized Editor Area name. Value is looked up in the localization bundles.
    • @logic-handler (com.hybris.cockpitng.widgets.baseeditorarea.EditorAreaLogicHandler), points to a Spring bean, which is responsible for handling all logic (default: editorAreaLogicHandler of type: com.hybris.cockpitng.widgets.baseeditorarea.DefaultEditorAreaLogicHandler)
    • hideTabNameIfOnlyOneVisible (java.lang.Boolean): Allows user to hide tab name in case only one tab is currently visible. Default value is true.
    • essentials (0-1):
      • essentialSection or essentialCustomSection (1): Allows user to specify section which is displayed in all tabs, always as a first section in a tab. Such section has a distinctive style and its state (whether is opened or not) is persisted when switching between tabs. Specific tab could decide if section should be displayed by specifying the displayEssentialSectionIfPresent flag.

        • @initiallyOpened (java.lang.Boolean), optional: Tabs can be opened by default. It takes effect only in the Compare View widget. As the Compare View widget derives configuration from the Editor Area widget, this configuration needs to be done in the corresponding editor area. Default value: false.
        • essentialSection: see configuration options for section

        • essentialCustomSection: see configuration options for customSection
    • tab or customTab (0+):

      • tab (0+): Configures a tab for the editor area.

        • @name (java.lang.String), required: Key for localized tab name. Value is looked up in the localization bundles.

        • @merge-mode (java.lang.String), optional: Defines configuration merging mode. Possible values: merge, replace, remove. Default value: merge.
        • @displayEssentialSectionIfPresent (java.lang.Boolean), optional: Specifies if essential section is displayed on the tab. Default: true.
        • @position (int), optional: Defines tab's index within the editor area.
        • @tooltipText (java.lang.String), optional: Key for localized tab tooltip text. Value is looked up in the localization bundles.
        • @initiallyOpened (java.lang.Boolean), optional: Tabs can be opened by default. It takes effect only in the Compare View widget. As the Compare View widget derives configuration from the Editor Area widget, this configuration needs to be done in the corresponding editor area. Default value: false.
        • section or customSection (0+)

          • section (0+): Configures a single section within a tab.

            • @name (java.lang.String), required: Key for localized section name. Value is looked up in the localization bundles.

            • @description (java.lang.String), optional: Key for localized section description. Value is looked up in the localization bundles.

            • @initiallyOpened (java.lang.Boolean), optional: When the value is set to false, section content is lazily loaded and rendered when you click the section bar or click the expand icon for the first time. Default: true.

            • @merge-mode (java.lang.String), optional: Defines configuration merging mode. Possible values: merge, replace, remove. Default value: merge.

            • @columns (int), optional: Number of columns. Default: 2.

            • @position (int), optional: Defines section's index within the tab.
            • panel or customPanel (0+)

              • panel (0+): Configures a single panel within a section.

                • @name (java.lang.String), required: Key for localized panel name. Value is looked up in the localization bundles.

                • @colspan (int), optional: Number of columns to span. Default: 1.

                • @rowspan (int), optional: Number of rows to span. Default: 1.

                • @description (java.lang.String), optional: Key for localized panel description. Value is looked up in the localization bundles.
                • @merge-mode (java.lang.String), optional: Defines configuration merging mode. Possible values: merge, replace, remove. Default value: merge.

                • @position (int), optional: Defines panel's index within the section.
                • attribute (0+): Configures attributes for the panel.

                  • @qualifier: (java.lang.String), required

                  • @label (java.lang.String), optional: Key for localized column name. Value is looked up in the localization bundles. If this String is blank, the attribute is named according to the qualifier.

                  • @visible (java.lang.Boolean), optional: Default: true.

                  • @readonly (java.lang.Boolean), optional: Default: false.

                  • @editor (java.lang.String), optional: Specifies the editor's id to define explicit editor to be used. Also, nested editors functionality may be used.

                  • editor-parameter: (0+) Specifies parameters for the current editor. The available parameters are defined in the documentation of each particular editor.

                    • name (java.lang.String): parameter name
                    • value (java.lang.String): parameter value
                  • @position (int), optional: Defines attribute's index within the panel or section.
                  • @merge-mode (java.lang.String), optional: Defines configuration merging mode. Possible values: merge, replace, remove. Default value: merge.

                  • @description (java.lang.String), optional: Key for localized attribute description. See the Backoffice Framework - Technical Overview, Attribute Descriptions in the Widgets section.
              • custom (0+): Configures custom HTML code to be inserted in the panel.

                Custom HTML code is parsed and put into proper location (see @position attribute). The code provided may be localized and contain dynamic values depending on the edited item properties. For more information, see Panel Configuration - Custom HTML.

          • customPanel (0+): Configures a single custom panel within a section.
            • @name (java.lang.String), required: Key for localized custom panel name. Value is looked up in the localization bundles.

            • @colspan (int), optional: Default: 1.

            • @rowspan (int), optional: Default: 1.

            • @description (java.lang.String), optional: Key for localized custom panel description. Value is looked up in the localization bundles.
            • @merge-mode (java.lang.String), optional: Defines configuration merging mode. Possible values: merge, replace, remove. Default value: merge.

            • @class (java.lang.String), optional: Canonical class name of custom cell renderer to use for rendering the column cells. The renderer must implement the com.hybris.cockpitng.widgets.common.WidgetComponentRenderer.

            • @spring-bean (java.lang.String), optional: Spring bean of custom cell renderer to use for rendering the column cells. Spring bean must implement the com.hybris.cockpitng.widgets.common.WidgetComponentRenderer. This attribute is only valid if @class is not defined (IllegalStateException is thrown if both are defined).

            • render-parameter (0+): Specifies parameters for custom renderer
              • @name (java.lang.String): parameter name
              • @value (java.lang.String): parameter value
          • attribute (0+): Configures attributes for the section.

            • Contains the same elements as previous element attribute.

          • custom (0+): Configures a custom HTML code to be inserted in the section

            Custom HTML code is parsed and put into proper location (see @position attribute). The code provided may be localized and contain dynamic values depending on the edited item properties. For more information, see Section Configuration - Custom HTML.

          • customSection (0+): Configures a single custom section within a tab.

            • @name (java.lang.String), required: Key for localized custom section name. Value is looked up in the localization bundles.

            • @description (java.lang.String), optional: Key for localized custom section description. Value is looked up in the localization bundles.

            • @initiallyOpened (java.lang.Boolean), optional: When the value is set to false, section content is lazily loaded and rendered when you click the section bar or click the expand icon for the first time. Default: true.

            • @merge-mode (java.lang.String), optional: Defines configuration merging mode. Possible values: merge, replace, remove. Default value: merge.

            • @class (java.lang.String), optional: Canonical class name of custom cell renderer to use for rendering the column cells. The renderer must implement the com.hybris.cockpitng.widgets.common.WidgetComponentRenderer.

            • @spring-bean (java.lang.String), optional: Spring bean of custom cell renderer to use for rendering the column cells. Spring bean must implement the com.hybris.cockpitng.widgets.common.WidgetComponentRenderer. This attribute is only valid if @class is not defined (IllegalStateException is thrown if both are defined).

            • render-parameter (0+): Specifies parameters for custom renderer
              • @name (java.lang.String): parameter name
              • @value (java.lang.String): parameter value
        • customTab (0+): Configures a custom tab.

          • @name (java.lang.String), required: Key for localized custom tab name. Value is looked up in the localization bundles.

          • @merge-mode (java.lang.String), optional: Defines configuration merging mode. Possible values: merge, replace, remove. Default value: merge.

          • @class (java.lang.String), optional: Canonical class name of custom cell renderer to use for rendering the column cells. The renderer must implement the com.hybris.cockpitng.widgets.common.WidgetComponentRenderer.

          • @spring-bean (java.lang.String), optional: Spring bean of custom cell renderer to use for rendering the column cells. Spring bean must implement the com.hybris.cockpitng.widgets.common.WidgetComponentRenderer. This attribute is only valid if @class is not defined (IllegalStateException is thrown if both are defined).

          • render-parameter (0+): Specifies parameters for custom renderer
            • @name (java.lang.String): parameter name
            • @value (java.lang.String): parameter value
          • @displayEssentialSectionIfPresent (java.lang.Boolean), optional: Specify if essential section is displayed on the tab. Default: true.
  • reloadEditorOnCurrentObjectChange (java.lang.Boolean), default value: false. When set to true, the Editor Area reloads the value of the editor every time the current object of the Editor Area is set.

The following example configuration in the cockpit-config.xml file defines the layout for a Product type.

<!--...-->
 <context component="editor-area" type="Product">
	<ea:editorArea xmlns:ea="http://www.hybris.com/cockpitng/component/editorArea" name="Default">
		<ea:tab name="Basic">
			<ea:section name="name.section1a" columns="3">
				<ea:attribute qualifier="name"/>
				<ea:attribute qualifier="code" />
				<ea:attribute qualifier="pk" />
			</ea:section>
			<ea:section name="name.section1b" columns="1">
				<ea:attribute qualifier="name"/>
			</ea:section>
			<ea:customSection name="name.section1c" spring-bean="helloWorldCustomRenderer" description="desc.section1c"/>
		</ea:tab>
		<ea:tab name="Advanced">
			<ea:section name="name.section2a" columns="1" description="desc.section2a">
				<ea:panel name="name.panel2a">
					<ea:attribute qualifier="name"/>
					<ea:attribute qualifier="code" />
				</ea:panel>
			</ea:section>
		</ea:tab>
	</ea:editorArea>
</context>
<!--...-->

Panel Configuration - Custom HTML

You can define custom HTML code in the panel configuration of the Editor Area widget. Custom HTML code is parsed and put into proper location. The code provided may be localized and contain dynamic values depending on the edited item properties.

Panel - Mandatory Definitions for HTML Code

Custom HTML code tag allows to define different code for different localizations. It is mandatory to define a default element to define the code which is used if no locale-specific code is defined for the current locale.

See the example cockpit-config.xml:

<!--...-->
 <context component="editor-area" type="Product">
	<ea:editorArea xmlns:ea="http://www.hybris.com/cockpitng/component/editorArea" name="Default">
		<ea:tab name="Basic">
			<ea:section name="name.section1a" >
				<ea:panel name="name.panel1a" > 
				
					<!--...-->

					<ea:custom>
						<ea:default><![CDATA[<div>Any text you want or anything else</div>]]></ea:default>
					</ea:custom>

					<!--...-->
				</ea:panel>
			</ea:section>

			<!--...-->

		</ea:tab>
		
		<!--...-->

	</ea:editorArea>
</context>
<!--...-->

Panel - Localization Definitions for HTML Code

If you want to define different codes for different localizations, then use the locale tag with @lang attribute.

The editor area looks for the custom definition for the current locale. If none found, then the default is used.

See the example cockpit-config.xml:

<!--...-->
 <context component="editor-area" type="Product">
	<ea:editorArea xmlns:ea="http://www.hybris.com/cockpitng/component/editorArea" name="Default">
		<ea:tab name="Basic">
			<ea:section name="name.section1a" >
				<ea:panel name="name.panel1a" >
				
					<!--...-->

					<ea:custom>
						<ea:default> <!--...--> </ea:default>
						<ea:locale lang="en"><![CDATA[<div>Any text you want or anything else</div>]]></ea:locale>
					</ea:custom>

					<!--...-->
				
				</ea:panel>
			</ea:section>

			<!--...-->

		</ea:tab>
		
		<!--...-->

	</ea:editorArea>
</context>
<!--...-->

Panel - Code Localization for HTML

To localize HTML code, the square brackets [ ] should be used.

To add a new localization key, first you need to define it in the i3-label.properties file. The localization mechanism uses the MessageFormat that allows to link arguments in the brackets. To learn more how to define the values for localization keys, see the Oracle specification of the MessageFormatInformation published on non-SAP site.

Any text in the code written between the square brackets is interpreted as a definition of the localized text (\ may be used as the escape character). If the default code contains any localizations, then the values for the current locale are used. The text between brackets is interpreted as follows:

  • if the text does not contain a colon, then whole text is interpreted as an i3-label property key which is searched in the i3-label.properties file. See the example cockpit-config.xml:
    <!--...-->
     <context component="editor-area" type="Product">
    	<ea:editorArea xmlns:ea="http://www.hybris.com/cockpitng/component/editorArea" name="Default">
    		<ea:tab name="Basic">
    			<ea:section name="name.section1a" >
    				<ea:panel name="name.panel1a" >
    				
    					<!--...-->
    
    					<ea:custom>
    						<ea:default><![CDATA[<div>[localized.sample.text]</div>]]></ea:default>
    					</ea:custom>
    
    					<!--...-->
    				</ea:panel>
    			</ea:section>
    
    			<!--...-->
    
    		</ea:tab>
    		
    		<!--...-->
    
    	</ea:editorArea>
    </context>
    <!--...-->
  • if the text contains a colon, then everything before the colon is considered as an i3-label property key and everything after the colon is considered as property arguments separated with a vertical bar: | (\ may be used as the escape character) See the example cockpit-config.xml:
    <!--...-->
     <context component="editor-area" type="Product">
    	<ea:editorArea xmlns:ea="http://www.hybris.com/cockpitng/component/editorArea" name="Default">
    		<ea:tab name="Basic">
    			<ea:section name="name.section1a" >
    				<ea:panel name="name.panel1a" >
    				
    					<!--...-->
    
    					<ea:custom>
    						<ea:default><![CDATA[<div>[localized.sample.text.with.arguments:first argument value|other argument value]</div>]]></ea:default>
    					</ea:custom>
    
    					<!--...-->
    
    				</ea:panel>
    			</ea:section>
    
    			<!--...-->
    
    		</ea:tab>
    		
    		<!--...-->
    
    	</ea:editorArea>
    </context>
    <!--...-->
  • if it is needed, the property arguments may be specified as SpEL expressions in regards to the currently edited item (see Spring DocumentationInformation published on non-SAP site for more information) or some other property value - each property argument is parsed again separately to determine its value. See the example cockpit-config.xml:
    <!--...-->
     <context component="editor-area" type="Product">
    	<ea:editorArea xmlns:ea="http://www.hybris.com/cockpitng/component/editorArea" name="Default">
    		<ea:tab name="Basic">
    			<ea:section name="name.section1a" >
    				<ea:panel name="name.panel1a" >
    				
    					<!--...-->
    
    					<ea:custom>
    						<ea:default><![CDATA[<div>[localized.sample.text.with.arguments:[localized.sample.argument]|{some.SpEL.epression}]</div>]]></ea:default>
    					</ea:custom>
    
    					<!--...-->
    				</ea:panel>
    			</ea:section>
    
    			<!--...-->
    
    		</ea:tab>
    		
    		<!--...-->
    
    	</ea:editorArea>
    </context>
    <!--...-->

Panel - Dynamic HTML Code

If needed, SpEL expressions (see Spring DocumentationInformation published on non-SAP site for more information) may be used in HTML code.

All expressions refer to the currently edited item. This allows to dynamically determine the code to be injected (i.e. put the item's name). All SpEL expressions should be put in braces { }. Contrary to the localization arguments, these expressions are treated as they are (nested evaluations are not supported).

See the example cockpit-config.xml:
<!--...-->
 <context component="editor-area" type="Product">
	<ea:editorArea xmlns:ea="http://www.hybris.com/cockpitng/component/editorArea" name="Default">
		<ea:tab name="Basic">
			<ea:section name="name.section1a" >
				<ea:panel name="name.panel1a" >
				
					<!--...-->

					<ea:custom>
						<ea:default><![CDATA[<div>This is topic for {name} of type {itemtype} in catalog {catalogVersion.catalog.name}</div>]]></ea:default>
					</ea:custom>

					<!--...-->
				</ea:panel>
			</ea:section>

			<!--...-->

		</ea:tab>
		
		<!--...-->

	</ea:editorArea>
</context>
<!--...-->

Section Configuration - Custom HTML

You can define custom HTML code in the section configuration of the Editor Area widget. Custom HTML code is parsed and put into proper location. The code provided may be localized and contain dynamic values depending on the edited item properties.

Section - Mandatory Definitions for HTML Code

Custom HTML code tag allows to define different codes for different localizations. It is mandatory to define the default element to define the code which is used if no locale-specific code is defined for the current locale.

See the example cockpit-config.xml:
<!--...--> 
 <context component="editor-area" type="Product"> 
	<ea:editorArea xmlns:ea="http://www.hybris.com/cockpitng/component/editorArea" name="Default"> 	
		<ea:tab name="Basic"> 
			<ea:section name="name.section1a" columns="3"> 
 
				<!--...--> 
 
				<ea:custom> 
					<ea:default><![CDATA[<div>Any text you want or anything else</div>]]></ea:default> 
				</ea:custom> 
 
				<!--...--> 
 
			</ea:section> 
				
			<!--...--> 
 
		</ea:tab> 
 
		<!--...--> 
 
	</ea:editorArea> 
</context> 
<!--...-->

Section - Localization Definitions for HTML Code

If you want to define different codes for different localizations, then use the locale tag with @lang attribute.

The editor area looks for the custom definition for the current locale. If none found, then the default is used.

See the example cockpit-config.xml:
<!--...--> 
 <context component="editor-area" type="Product"> 
	<ea:editorArea xmlns:ea="http://www.hybris.com/cockpitng/component/editorArea" name="Default"> 
		<ea:tab name="Basic"> 
			<ea:section name="name.section1a" columns="3"> 
				
				<!--...--> 
				<ea:custom> 				
					<ea:locale lang="en"><![CDATA[<div>Any text you want or anything else</div>]]></ea:default> 
				</ea:custom> 
				<!--...--> 
			</ea:section> 
			
			<!--...--> 
		</ea:tab> 
		
		<!--...--> 
	
	</ea:editorArea> 
</context> 
<!--...-->

Section - Code Localization for HTML

To localize the HTML code, square brackets [ ] should be used.

To add a new localization key, first you need to define it in the i3-label.properties file. The localization mechanism uses the MessageFormat that allows to link arguments in the brackets. To learn more how to define the values for localization keys, see the Oracle specification of MessageFormatInformation published on non-SAP site.

Any text in the code written between the square brackets is interpreted as a definition of the localized text (\ may be used as the escape character). If the default code contains any localizations, then the values for the current locale are used. The text between brackets is interpreted as follows:

  • if the text does not contain a colon, the whole text is interpreted as a i3-label property key which is searched in the i3-label.properties file. See the example cockpit-config.xml:
    <!--...--> 
     <context component="editor-area" type="Product"> 
    	<ea:editorArea xmlns:ea="http://www.hybris.com/cockpitng/component/editorArea" name="Default"> 
    		<ea:tab name="Basic"> 
    			<ea:section name="name.section1a" columns="3"> 
    					
    				<!--...--> 	
     
    				<ea:custom> 
    					<ea:default><![CDATA[<div>[localized.sample.text]</div>]]></ea:default> 
    				</ea:custom> 
     
    				<!--...--> 
    			</ea:section> 	
     
    			<!--...--> 
    		</ea:tab> 
     
    		<!--...--> 
    	</ea:editorArea> 
    </context> 
    <!--...-->
  • if the text contains a colon, then everything before the colon is considered as a property key and everything after the colon is considered as property arguments separated with | (\ may be used as the escape character). See the example cockpit-config.xml:
    <!--...--> 
     <context component="editor-area" type="Product"> 
    	<ea:editorArea xmlns:ea="http://www.hybris.com/cockpitng/component/editorArea" name="Default"> 
    		<ea:tab name="Basic"> 
    			<ea:section name="name.section1a" columns="3"> <!--...--> 
    				
    				<ea:custom> 
    					<ea:default><![CDATA[<div>[localized.sample.text.with.arguments:first argument value|other argument value]</div>]]></ea:default> 
    				</ea:custom> 
    					
    				<!--...--> 
    			</ea:section> 
     
    			<!--...--> 
    		</ea:tab> 
     
    		<!--...--> 
    	</ea:editorArea> 
    </context> 
    <!--...-->
  • if it is needed, property arguments may be specified as SpEL expressions in regards to the currently edited item (see Spring DocumentationInformation published on non-SAP site for more information) or some other property value - technically each property argument is parsed again separately to determine its value. See the example cockpit-config.xml:
    <!--...--> 
     <context component="editor-area" type="Product"> 
    	<ea:editorArea xmlns:ea="http://www.hybris.com/cockpitng/component/editorArea" name="Default"> 
    		<ea:tab name="Basic"> 
    			<ea:section name="name.section1a" columns="3"> 
     
    				<!--...--> 
     
    				<ea:custom> 
    					<ea:default><![CDATA[<div>[localized.sample.text.with.arguments:[localized.sample.argument]|{some.SpEL.expression}]</div>]]></ea:default> 
    				</ea:custom> 
    			
    				<!--...--> 
    			</ea:section> 
     
    			<!--...--> 
    		</ea:tab> 
    
    		<!--...--> 
    	</ea:editorArea> 
    </context> 
    <!--...-->

Section - Dynamic HTML Code

If needed, SpEL expressions may be used in HTML code. For more information, see the Spring Expression Language (SpEL)Information published on non-SAP site.

All expressions refer to the currently edited item. This allows to dynamically determine the code to be injected (i.e. put the item's name). All SpEL expressions should be put in braces { }. Contrary to the localization arguments, these expressions are treated as they are (nested evaluations are not supported).

See the example cockpit-config.xml:
<!--...-->
 <context component="editor-area" type="Product"> 
	<ea:editorArea xmlns:ea="http://www.hybris.com/cockpitng/component/editorArea" name="Default"> 
		<ea:tab name="Basic"> 
			<ea:section name="name.section1a" columns="3"> 
 
				<!--...--> 
			
				<ea:custom> 
					<ea:default><![CDATA[<div>This is topic for {name} of type {itemtype} in catalog {catalogVersion.catalog.name}</div>]]></ea:default> 
				</ea:custom> 
 
				<!--...--> 
			</ea:section> 
 
			<!--...--> 
		</ea:tab> 
 
		<!--...--> 
 
	</ea:editorArea> 
</context> 
<!--...-->

Custom Layout Components

In Editor Area widget, you can define your custom components in place of standard ones.

Instead of the standard tab, panel, and section components, you can use your own custom component renderer. To do this, set up a Spring bean or class name of your custom renderer within the customTab, customPanel, and customSection elements, as shown in the following example.

cockpit-config.xml

<!--...-->

<ea:customTab name="test2" class="com.hybris.cockpitng.widgets.editorarea.renderer.impl.HelloWorldCustomRenderer"/>

<!--...-->
<ea:customPanel name="test2" spring-bean="helloWorldCustomRenderer"/>

<!--...-->

A custom component does not need any content. The content rendering is delegated to the given renderer, so all the inner elements in the content are ignored. If you want to create your own custom renderer, it must implement the WidgetComponentRenderer interface.

Event Listener for Custom Layout Components

While implementing a custom tab, panel, or section, you can also add an event listener, that is triggered after the object is saved or after changes on the object are discarded like in the case of uploading media. The event listener is managed using the following utility class: EditorAreaRendererUtils.

Classification Tab Configuration

You can manually set up a Classification tab in the editor-area configuration for a given type. Provide a customTab tag and specify the following attributes:

  • name of the customTab
  • classificationTabEditorAreaRenderer bean which is responsible for rendering content

cockpit-config.xml

<context component="editor-area">    
	<context type="Product">
	<ea:editorArea xmlns:ea="http://www.hybris.com/cockpitng/component/editorArea" name="Default">
	...
		<ea:customTab name="Classification" spring-bean="classificationTabEditorAreaRenderer">
			<ea:render-parameter>
				<ea:name>initiallyOpened</ea:name>
				<ea:value>true</ea:value>
			</ea:render-parameter>
		</ea:customTab>
	</ea:editorArea>
	</context>
</context>

As a result, a new tab appears, containing all classification attributes assigned to a given Product type. Attributes are grouped into classification categories.

If the value of the initiallyOpened parameter is set to false, then all the sections of the classification are lazily loaded and rendered when you click the section bar or click the expand icon for the first time. Default: true.

Unbound Section Configuration

You can manually set up a section which displays all the attributes not listed in any other section. This section is called the Unbound section. Moreover, if you want to get the attributes displayed more than once, the same set of the attributes can be shown.

To display the Unbound section, you need to provide the following configuration in all tabs you want the section to be displayed:

cockpit-config.xml

<editorArea:tab>
	<!-- other sections -->
    <editorArea:customSection spring-bean="unboundSectionRenderer" name="Unbound"/>
</editorArea:tab>

The Unbound section can be configured within the following properties of the unboundSectionRenderer bean:

backoffice-widgets-spring.xml

<alias name="backofficeUnboundSectionRenderer" alias="unboundSectionRenderer"/>
<bean id="backofficeUnboundSectionRenderer"  parent="defautlUnboundSectionRenderer">
    <property name="numberOfColumns" value="5"/>
</bean>

By default, there is no configuration or a fallback mechanism to get the Unbound section visible for a type in a separate tab.

Variant Attributes Section Configuration

With no additional configuration, all variant attributes of Variant Products are displayed in the Unbound section. In order to group the attributes and display them in another tab, a configuration of a custom section is required. Sample configuration might be as follows:

cockpit-config.xml

<context merge-by="type" parent="Product" type="VariantProduct" component="editor-area">
	<editorArea:editorArea name="">
    	<editorArea:tab name="hmc.tab.product.properties">
			<editorArea:customSection name="hmc.section.variantattributes" spring-bean="variantAttributesSectionRenderer" position="0"/>
        </editorArea:tab>
    </editorArea:editorArea>
</context>

Example: Thanks to the above configuration, the variant attributes that are defined are displayed for edition in the Variant Attributes section, and not in the Unbound section.

Merging Configurations

The editor-area configurations are mergeable.

You can define an editor-area configuration in the context of type A by extending the configuration that was defined in the context of type B. For more information, see the Creation and Use of UI Configuration Merging Mechanism.

Configuration Fallback Strategy

In Editor Area widget, there is a fallback strategy in case there nothing defined.

The editor-area configuration is used in order to define which attributes of the type are displayed in which tabs, sections, and panels. If no part of the editor-area configuration is available for a given type, the fallback strategy editorAreaConfigurationFallbackStrategy is applied. This fallback strategy creates a configuration on the fly that contains all mandatory and unique attributes of the given type in the two dedicated tabs. To change the fallback strategy, create your own strategy, redefining the editorAreaConfigurationFallbackStrategy bean. For more details, read the Creation and Use of UI Configuration Merging Mechanism.

Actions Toolbar Configuration

In Editor Area widget, you can customize the action toolbar for a given type.

The following is the example how to customize the actions toolbar. The component attribute must match the widget's actionSlotComponentId setting and the type information must be provided.

cockpit-config.xml

<!-- ... -->
 
<context component="customActions" type="Product">
        <y:actions xmlns:y="http://www.hybris.com/cockpit/config/hybris">
			<y:group qualifier="common">
				<y:label>actiongroup.common</y:label>
				<y:action action-id="com.hybris.cockpitng.action.delete" property="currentObject" />
			</y:group>
	</y:actions>
</context>
 
<!-- ... -->

Action Configuration Fallback Strategy

The editorareaactions configuration for the Delete action button is used to delete the selected category, catalog, or product type from the editor area. If no editorareaactions configuration is available for a given type, then editorActionConfigurationFallBackStrategy is applied. This fallback strategy creates a configuration on the fly that adds a Delete action that, after being clicked, is triggered on currentObject. To change the fallback strategy, create your own strategy, redefining the editorActionConfigurationFallBackStrategy bean.

Information Icon Configuration

You can configure an information icon to display descriptions for types attributes in the Backoffice.

Context

The steps show how to add an information icon to an attribute for a specific type. In this example it's a Product type, and Article Number attribute.

Procedure

  1. Log in to Backoffice as Administrator.
  2. In the Explorer Tree, go to Start of the navigation pathSystem Next navigation step TypesEnd of the navigation path.
  3. Choose Product from the identifiers list.
  4. In the edit mode, choose PROPERTIES.
  5. In the PROPERTIES section, choose the attribute for which you want an Information to be displayed.

    Choose code to add the Article Number description.

  6. Click the three dots icon next to the selected qualifier, and choose Edit Details.
  7. Enter the description you want to be displayed in the information button.
  8. Save your changes.

Results

You can check your changes by going to Products, selecting an item, and checking the Article Number, in the ESSENTIAL section of the editor area.

Widget Preview

The preview of the Editor Area widget.

Component Name

Description

Title

Title text provided by input widget.

Actions Toolbar

Actions the user can perform. Default ones are Delete, Previous, Next, Refresh and Save actions.

Tabs

You can switch between the the sets of content.

Content area

The appearance of the content area of the Editor Area widget depends on how it is configured in cockpit-config.xml file. Layout options include panels, tabs, sections, columns, and attributes.

Lock/Unlock button

You can use this button to disable the changing state functionality for a given section. This button, although appears in the Editor Area widget, is a part of the Collapsible Container widget.

Collapse/Expand button

Click this button to collapse or expand the section, depending on the section's current state. This button, although appears in the Editor Area widget, is a part of the Collapsible Container widget.

Layout Components for Content Area

Component Name

Description

Tabs

Tabs provide secondary pages that users can switch to and can contain sections.

Sections

Sections separate content into chunks within the same page and can be collapsed by clicking the title at the far right of the section. They can contain attributes, columns, and panels.

Panels

Panels can span columns and rows and can contain their own sets of attributes.

In the following example, panels are contained in a two-column section.

Settings

Setting

Type

Description

accordionMold

java.lang.Boolean

If set to true, the editor area view changes from the default tabs view to the accordion mold view. Default value: false.

actionSlotComponentId

java.lang.String

Specifies the component code of the UI configuration to use for the action set at the top of the Editor Area widget, as defined in cockpit-config.xml file.

Default: editorareaactions

bottomToolbar

java.lang.Boolean

Indicates whether the toolbar should be rendered at the bottom. Default value: false.

editorAreaConfigCtx

java.lang.String

Specifies the component code of the UI configuration to use for the content that appears in the Editor Area, as defined in the cockpit-config.xml file.

Default: editor-area.

enableEmbededTitle

java.lang.Boolean

Enables inline title for editor area. When set to true, the current object label is displayed as on the embeded title. Default value: false.

enableTitleByCtxName

java.lang.Boolean

Enables fixed editor area main title, instead of the currently edited item label. Default value: false.

embededTitlePrefix

java.lang.String

Specifies the prefix for the final label. It refers to a localization key - when it is specified, a prefix label is added to the current title (when there is no label represented by this key, the key is taken as a fallback).

embededTitle

java.lang.String

Specifies the label for the given item. It refers to a localization key, when it is specified default object title is evaluated based on that key (when there is no label represented by this key, the label representation from the base configuration is taken into account; when there is no base configuration, the key is taken as a fallback).

essentialsInOverviewTab

java.lang.Boolean

If value is set as true, then additional tab called Overview is displayed with Essentials configuration. Essentials are removed from other tabs. Default value: False.

initViewMode

java.lang.String

Indicates the initial view mode for a current instance. Default value: fluid. Possible value: empty.

fluidViewCode

java.lang.String

Defines a fluid mode code. Default value: fluid. Possible value: empty.

toolbarButtonsPosition java.lang.ENUM Defines where the SAVE and REFRESH buttons are positioned. Possible values: top and bottom. Default value: top. To manipulate action buttons, use the bottomToolbar setting.

toolbarDisabled

java.lang.Boolean

Indicates whether the toolbar with default SAVE and RESET buttons is disabled or not. Default value: false.

viewModeBtnVisible

java.lang.Boolean

Indicates whether an additional button for changing view mode should be rendered in the toolbar of the Editor Area widget. Default value: false.

widgetStyleAttribute

java.lang.String

Allows adding inline CSS style. Default value: empty.

widgetStyleClass

java.lang.String

Allows adding a CSS class. Default value: empty.

Additional settings

disableSaveOnSync

java.lang.Boolean

By default, when an item is being synchronized, you can see a confirmation message box with option to ignore or save. If disableSaveOnSync is set to true there are only cancel and ignore buttons visible, save is not available. Default value: false.

Widget Slots

slotID

Multiplicity

Type

Slots Composition

cockpitWidgetChildrenInvisible

multi

Not applicable.

General purpose slot available for the widgets. Any widget placed on this slot is not displayed in the application view but can be accessed through its socket API.

previousItemSelectorSlot

single

Not applicable.

Slot that creates a placeholder for the Previous Item Selector widget.

nextItemSelectorSlot

single

Not applicable.

Slot which creates a placeholder for the Next Item Selector widget.

staticSectionSlot

single

Not applicable.

Slot that allows to display a widget next to tabs content.

Media Item Upload Panel Renderer

The MediaItemUploadPanelRenderer supports uploading and downloading content of an existing Media Model.

An instance is provided by default with a name mediaItemUploadRenderer in the backoffice-web-spring.xml file.

For example, you can use MediaItemUploadPanelRenderer in the Editor Area widget. The bean instance uses mediaItemUploadRenderer as an alias.

Configuration

MediaItemUploadPanelRenderer in the cockpit-config.xml

<context component="editor-area">
	<context parent="" type="Media">
		<editorArea:editorArea xmlns:editorArea="http://www.hybris.com/cockpitng/component/editorArea">
			<editorArea:tab merge-mode="" name="hmc.media">
				<editorArea:section name="">
					<editorArea:customPanel name="mediaSection" spring-bean="mediaItemUploadRenderer"/>
				</editorArea:section>
				<editorArea:section name="">
					<editorArea:attribute qualifier="code"/>
					<editorArea:attribute qualifier="mediaFormat"/>
					<editorArea:attribute qualifier="mime"/>
					<editorArea:attribute qualifier="description"/>
					<editorArea:attribute qualifier="downloadURL"/>
					<editorArea:attribute qualifier="realFileName"/>
					<editorArea:attribute qualifier="folder"/>
					<editorArea:attribute qualifier="altText"/>
				</editorArea:section>
			</editorArea:tab>
			
		</editorArea:editorArea>
	</context>
</context>

After you defined the mediaItemUploadRenderer in you cockpit-config.xml, you can upload your media items.

An example of the mediaItemUploadRenderer configuration

<alias name="genericMediaItemUploadPanelRenderer" alias="mediaItemUploadRenderer"/>
    <bean id="genericMediaItemUploadPanelRenderer"
          class="com.hybris.backoffice.cockpitng.components.renderer.GenericMediaItemUploadPanelRenderer" scope="prototype">
        <property name="attributeDescriptionIconRenderer" ref="attributeDescriptionIconRenderer"/>
        <property name="objectFacade" ref="objectFacade"/>
        <property name="modelService" ref="modelService"/>
        <property name="cockpitLocaleService" ref="cockpitLocaleService"/>
        <property name="cockpitUserService" ref="cockpitUserService"/>
        <property name="labelService" ref="labelService"/>
        <property name="permissionFacade" ref="permissionFacade"/>
        <property name="propertyValueService" ref="propertyValueService"/>
        <property name="mediaService" ref="mediaService"/>
        <property name="cockpitProperties" ref="cockpitProperties"/>
        <property name="permissionFacadeStrategy" ref="defaultPermissionFacadeStrategy"/>
        <property name="objectPreviewService" ref="objectPreviewService"/>
    </bean>

GenericMediaItemUploadPanelRenderer could be configured by providing render-parameters such as dataModelProperty and dataModelAttribute. Values of these parameters specify which object in widget model should be presented by this renderer. If you configure this panel renderer for Media object, you do not have to specify it, because default value is 'currentObject'. However, f you want to display the Product thumbnail, then the configuration is as follows:

cockpit-config.xml

<editorArea:customPanel ... spring-bean="mediaItemUploadRenderer">
  <editorArea:render-parameter>
    <editorArea:name>dataModelProperty</editorArea:name>
    <editorArea:value>currentObject</editorArea:value>
  </editorArea:render-parameter>
  <editorArea:render-parameter>
    <editorArea:name>dataModelAttribute</editorArea:name>
    <editorArea:value>thumbnail</editorArea:value>
  </editorArea:render-parameter>
</editorArea:customPanel>

Additionally, you can access all media items in the Explorer Tree widget by adding the following code snippet to the cockpit-config.xml file:

<explorer-tree:navigation-node id="hmc.catalog">
	<!-- ... -->			
	<explorer-tree:type-node code="Media" id="Media"/>
	<!-- ... -->			
</explorer-tree:navigation-node>

Content Icons Preview

The bean mediaItemUploadRenderer can have two optional maps to facilitate icons for the MIME types. If a binary content of a media is in the displayable format, for example it is an image, then the preview of the picture is displayed. Otherwise, the replaceable icon can be put to present the content. There are implemented two maps to provide the configuration of the icons:

  1. mediaGroups: which allows to map the MIME type to the Media group.

  2. mediaIcons: which enables you to map the Media group to the icon file.

Variant Product Management

Backoffice supports variants management in Editor Area widget.

Managing Variant Products is possible under condition that the base Product has a variant type set first - this allows to add Variants to the base Product. Nevertheless the support for managing variant product is there in Backoffice, it is different than managing regular relations. Here's the list of differences that have to be taken into consideration when working in the Variants Products (with out-of-the-box configuration):

  • Editor Area widget does not allow to assign variants to a product unless it has variant type set
  • When variant type is set, the new base product must be saved in order to set variants (the editor for variants remains disabled until the item is saved)
  • The variant type may be set only when there are no variants assigned; assignment of at least one variant disables the editor of variant type
  • Create wizard for new variant products does not save the variant immediately; the variant is saved along with the base product i.e. if you do not save the base product, the variant product is not created in the database

Fluid Mode Functionality

In the Editor Area widget, the responsive design feature reveals as the fluid mode functionality.

IFluid mode enables you to configure a flexible content area where the amount of the editor fields are displayed dynamically. It adjusts to the size of the browser window where the Backoffice Application runs. For more information on the responsive design configuration, go to the Responsive Design in Backoffice Application document.

Notifications

The Editor Area widget can send notifications.

Notification source is the widget id or a value of notificationSource setting, which sets the source name. Editor Area widget sends the following notification:

Type Importance level References Description
LoadObject FAILURE java.util.Map<Object, com.hybris.cockpitng.dataaccess.facades.object.exceptions.ObjectNotFoundException>: a map containing the object that was to be displayed, and the associated exception Occurs whenever an object that was to be displayed cannot be found.
UpdateObject FAILURE java.util.Map<Object, com.hybris.cockpitng.dataaccess.facades.object.exceptions.ObjectAccessException>: a map containing the object that was to be modified, and the associated exception Occurs whenever there is a problem with object modification.
UpdateObject

SUCCESS

java.util.List<Object>: list of objects that were updated Occurs whenever objects were successfully updated.

For details regarding notifications, refer to Notification Area Widget.

Editor Area Predefined Parameters

Editor Area widget has a few predefined parameters.

Name

Description

nestedObjectWizardNonPersistablePropertiesList

It is a predefined parameter name which can be used for an attribute in editor area to exclude certain properties from persistence during creation of a nested object. The nested object is here a type of an attribute.

Value for the nestedObjectWizardNonPersistablePropertiesList is a list of properties names which should not be automatically persisted when creation of the nested object is completed. Properties names to both save and persist in a wizard are specified in a wizard configuration in initialize elements. If no wizard configuration is defined, then a fallback configuration is loaded. Name of a property to be persisted in a fallback configuration is newObject. Properties specified in the value tag are separated by commas.

Generic configuration

<editorArea:attribute qualifier="attributeNameOfRootObject">
	<editorArea:editor-parameter>
		<editorArea:name>nestedObjectWizardNonPersistablePropertiesList</editorArea:name>
		<editorArea:value>property1,property2,property3,…,propertyN</editorArea:value>
	</editorArea:editor-parameter>
</editorArea:attribute>

Example:

Configuration to create new variant type and not persist it immediately after creation. Usage example:
<editorArea:attribute qualifier="variantType">
	<editorArea:editor-parameter>
		<editorArea:name>nestedObjectWizardNonPersistablePropertiesList</editorArea:name>
          <editorArea:value>newObject</editorArea:value>
	</editorArea:editor-parameter>
</editorArea:attribute>

inputInstant

The inputInstant parameter can be configured for InputElement of editors via XML files. This property is set via the AbstractTextBasedEditorRenderer class. The setInstant() method of InputElement sets the instant attribute. When the attribute is true, it invokes the onChange event as soon as a user types in the input component. Moreover, this property enables basic validation functionality. For example, when a user types a value "84." while the instant is set to true, the validation mechanism removes the dot and final value is changed to "84". Setting the instant attribute to false disables this functionality and in the same situation the entered value "84." remains unchanged and the dot is not removed. To configure the inputInstant property, edit the cockpit-config.xml file via Application Orchestrator at runtime (or edit XML configuration files in source files). By default, the inputInstant parameter is set to true.

Example configuration for editor-area component of type PriceRow in the cockpit-config.xml file may look as follows:

<context merge-by="type" parent="PDTRow" type="PriceRow" component="editor-area" module="platformbackoffice">
	<editorArea:editorArea xmlns:editorArea="http://www.hybris.com/cockpitng/component/editorArea" xmlns:advanced-search="http://www.hybris.com/cockpitng/config/advancedsearch" 
	xmlns:df="http://www.hybris.com/cockpitng/component/dynamicForms" xmlns:dsb="http://www.hybris.com/cockpitng/config/dashboard" xmlns:explorer-tree="http://www.hybris.com/cockpitng/config/explorertree" 
	xmlns:list-view="http://www.hybris.com/cockpitng/component/listView" xmlns:simple-search="http://www.hybris.com/cockpitng/config/simplesearch" 
	xmlns:wz="http://www.hybris.com/cockpitng/config/wizard-config" 
	xmlns:y="http://www.hybris.com/cockpit/config/hybris" name="">
        <editorArea:tab name="hmc.properties">
            <editorArea:section name="hmc.properties">
              <editorArea:attribute qualifier="price">
                  <editorArea:editor-parameter>
                      <editorArea:name>inputInstant</editorArea:name>
                      <editorArea:value>false</editorArea:value>
                  </editorArea:editor-parameter>
              </editorArea:attribute>
            </editorArea:section>
        </editorArea:tab>
  </editorArea:editorArea>
</context>

Note, that the inputInstant parameter for price qualifier for the editor-area component of type PriceRow is set to false.

You can see this configuration in action after logging into Backoffice Application and navigating to Start of the navigation pathPrice Settings Next navigation step Prices Next navigation step Price RowsEnd of the navigation path, choosing any row and editing Price field. This is an example configuration and it can be applied to any other editor, which uses a renderer extending the AbstractTextBasedEditorRenderer class.

Customization Examples

There are many different options how to customize your Editor Area widget.

What you are presented below is an example of how this widget may be customized/extended. Please, bear in mind that it needs some tailoring to your needs and that there are more possibilities for further customization.

Adding Custom Logic to Save Operation

It is possible to add your custom logic to the save operation.

Prerequisites

An extension with Backoffice nature is created using ant extgen command. It is called myextension for the purpose of this trail.

Procedure

  1. In myextension/backoffice/src folder, create a custom logic handler class that implements com.hybris.cockpitng.widgets.baseeditorarea.EditorAreaLogicHandler interface.

    Most preferably and for your own convenience, the class that you create should extend the com.hybris.backoffice.editorarea.BackofficeEditorAreaLogicHandler class.

    myextension/backoffice/src/some/package/editorarea/MyCustomLogicHandler.java

    public class MyCustomLogicHandler extends DefaultEditorAreaLogicHandler
    {
         
        @Override
        public Object performSave(final WidgetInstanceManager widgetInstanceManager, final Object currentObject)
                throws ObjectSavingException
        {
            return super.performSave(widgetInstanceManager, currentObject);
        }
     
        @Override
        public void executeSaveWithConfirmation(final WidgetInstanceManager widgetInstanceManager, final Executable save,
                final Object currentObject)
        {
            super.executeSaveWithConfirmation(widgetInstanceManager, save, currentObject);
        }
     
        @Override
        public Object performRefresh(final WidgetInstanceManager widgetInstanceManager, final Object currentObject)
                throws ObjectNotFoundException
        {
            return super.performRefresh(widgetInstanceManager, currentObject);
        }
     
        @Override
        public List<ValidationInfo> performValidation(final WidgetInstanceManager widgetInstanceManager, final Object currentObject,
                final ValidationContext validationContext)
        {
            return super.performValidation(widgetInstanceManager, currentObject, validationContext);
        }
     
        @Override
        public List<ValidationInfo> performValidation(final WidgetInstanceManager widgetInstanceManager, final Object currentObject,
                final List<String> qualifiers, final ValidationContext validationContext)
        {
            return performValidation(widgetInstanceManager, currentObject, qualifiers, validationContext);
        }
     
        @Override
        public void beforeEditorAreaRender(final WidgetInstanceManager widgetInstanceManager, final Object currentObject)
        {
            super.beforeEditorAreaRender(widgetInstanceManager, currentObject);
        }
     
    }

    You may put any custom logic to any of the methods mentioned in the example above.

  2. Register your newly created class in Backoffice Spring context:

    myextension/resources/myextension-backoffice-spring.xml

    <bean id="myCustomLogicHandler" class="some.package.editorarea.renderer.MyCustomLogicHandler" parent="defaultBackofficeEditorAreaLogicHandler"/>
  3. Point to newly registered handler in the Editor area configuration:

    myextension/resources/myextension-backoffice-config.xml

    <context type="SomeType" component="editor-area" merge-by="type">
        <editorArea:editorArea name="" logic-handler="myCustomLogicHandler" xmlns:editorArea="http://www.hybris.com/cockpitng/component/editorArea" />
    </context>

    A value of the type attribute should be replaced with a type code for which an Editor area logic should be changed.

    The merge-by attribute may be changed accordingly (or even removed). In this particular example, an Editor area configuration will be added to this that is configured for parent types of SomeType.

    The component attribute value from the example is pointing to Editor area from Administration cockpit. To amend a different instance, change this value (see the editorAreaConfigCtx setting of a particular Editor area widget instance).