Customizing the Widgets Structure in the Backoffice-Based Application
As a widget developer, you have a possibility to extend and modify an application configuration within its custom extension.
You can proceed through the following activities:
- Adding widgets to the existing application configuration, for example adding a widget to a specific widget node
- Removing or replacing a widget in the existing application configuration
- Moving a widget from one container to another without losing connection information
- Changing a setting of a given widget
This document guides you through the basic customization steps in terms of widgets structure, starting with generating the custom extension, myextension. Next, it is recommended to follow the steps in each section to customize your perspective. However, you can perform the steps from the first section, generating a custom extension, and then follow the steps described only in one of the following sections. The last three sections are optional: each of them just presents the alternatives available in the application based on the backoffice extension.
Overview
The purpose of this tutorial is to create the custom application based on the existing Backoffice application and modify widgets structure there. This requires to modify the application configuration. The below figures show the default mash-up of the Backoffice Administration Cockpit and the Application Orchestrator view. The widgets are presented with their widgetId tags.
Figure: Default layout of Backoffice Application - end user view.
Figure: Default layout of Backoffice Application - Application Orchestrator view.
In the following sections you can find how to do the following:
- Move the Explorer Tree widget from the left-hand side to right-hand side in your custom application
- Remove the Editor Area widget
- Add the Portal Layout widget on the left-hand side where the Explorer Tree widget was placed
- Add other widgets to the Portal Layout widget.
Creating a Custom Extension
Create a custom Backoffice extension to build your project and manage widgets in the Backoffice application.
To start working on your Backoffice application project you need to have a custom Backoffice extension. Follow the steps described in Creating a Custom Backoffice Extension and then move to the next steps described in this topic.
Building Project
In this procedure, you will build your project using the command prompt.
Procedure
Starting the Application Server for Custom Extension
In this procedure, you start the application server.
Context
Optionally, you may want to deactivate the ybackoffice template extension in your localextensions.xml file. If you do so, the Backoffice template area is not displayed in the application, only your custom application.
Procedure
Moving the Explorer Tree Widget
In this procedure, you move the Explorer Tree Widget from the left-hand side and place it on the right-hand side of your Backoffice.
Context
To move the Explorer Tree Widget, do the following tasks:
- Make the east section enabled for the Border Layout widget using widgetId="hmc2" tag.
- Move the Explorer Tree widget to the right place.
Procedure
Removing the Editor Area Widget
To remove a widget, declare the widgetId of the widget to be removed from a given widget declaring an appropriate widgetId. In the example below, you can find how to remove the Editor Area widget within the widgetId="editorArea from the Collapsible Container widget.
Procedure
Adding the Portal Layout Widget
If you want to place the Portal Layout widget on the left-hand side, add it to the left slot of the Border Layout widget.
Procedure
Adding Widgets to the Portal Layout Widget
In this procedure, you add widgets to the Portal Layout widget.
Context
The code snippet shown below adds the InputTestWidget widget and OutputTestWidget widget to your custom application. However, in the same way you can add any other widget specifying appropriately the widgetDefinitionId in the myextension-backoffice-widgets.xml file.
Procedure
Optional Steps for Customizing the Widgets Structure
There are some optional steps which can be done to customize the widgets structure.
Those steps are:
Changing the Order of Perspectives
You can change the order of perspectives such as Adaptive Search or your custom perspective displayed in the Backoffice Main Layout widget. Changing a position of the area means that you change a position of a given widget in the widgetchildren collection. You can accomplish that declaring a position in the move tag.
Context
For the purpose of the steps below, it is assumed that you have the Adaptive Search perspective
with all its dependencies available in the Backoffice Application. It is available with SAP Commerce Cloud or with Commerce Search Module.
Procedure
Removing Widgets from the Portal Layout Widget
This procedure shows how to remove all children widgets from a given widget. It can be done by using the remove-all tag.
Procedure
Defining Widgets Virtual Sockets
If you want to define any virtual sockets to a given widget, you can use virtual-sockets tag. In this procedure, it is presented how to define the input and output sockets (both of type java.lang.String) in the Portal Layout widget.
in the top-right corner.