Creating Composed Widgets
In Backoffice Framework, it is possible to create a widget that can be composed with one or more widgets. This tutorial explains how to achieve that.
As an example, you will extend simple chat widget, that you already created by following Passing Data Between Widgets. You will add to this widget a slot, to which you can add additional widget (for example you may want your user to use his chat with additional list of all users or some special widget that displays history of his conversations or both of them).
From a technical point of view, the chat widget should have additional slot:
-
widgetslot: This slot makes it possible to add and display one widget as a child component of main widget's view.
-
widgetchildren: This slot makes it possible to add and display more than one widget as a child component of main widget's view. All widgets added to this slot will appear depending on your settings, these can be tabs, lists, portal.
Modify a Widget View
To the existing ZUL file of the chat widget, add a widgetslot slot that makes it possible to add only one additional widget.
Add the following to your widget view:
widgetid.zul
<!-- ... -->
<widgetslot slotID="additionalArea" width="100%" height="100%"/>
</widget>
For more information on ZK components, see the List of ZK Components
The slotID is the name of the slot, displayed in the application orchestrator.
In the end, the view definition of the chat widget should look like that:
widgetid.zul
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <widget xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.zkoss.org/2005/zul"> <div> <textbox id="msgInput"/> <button id="sendBtn" label="Send"/> </div> <div> <label id="lastMsgLabel" value="No message."></label> </div> <widgetslot slotID="additionalArea" width="100%" height="100%"/> </widget>
The Chat widget with its additionalArea slot is rendered in the application orchestrator:
Start hybris Server
Normal operation mode:
- Navigate to the <HYBRIS_BIN_DIR>/platform directory.
- To start the hybris Server:
- On Windows systems call the hybrisserver.bat file.
- On Unix systems call the hybrisserver.sh file, such as: ./hybrisserver.sh
Debug operation mode, requiring develop configuration template:
- Navigate to the <HYBRIS_BIN_DIR>/platform directory.
- To start the hybris Server:
- On Windows systems run the hybrisserver.bat file with the debug parameter, such as hybrisserver.bat debug.
- On Unix systems call the hybrisserver.sh file with the debug parameter, such as ./hybrisserver.sh debug.