Skip to end of metadata
Go to start of metadata

By default, GateIn delivers a number of built-in container layouts such as Rows, Columns, Tabs layout v.v… which you can use inside the site/page.

In the case of you want to define a new container layout, fully customize it. You can easily achieve it by implementing your own implementation of UI Container, then register it to portal via ServiceLoader and Portal extension mechanism.

We are going to explain you whole this magic work by following sample:

1. Create custom UI container layout

The custom container layout must extend from org.exoplatform.portal.webui.container.UIContainer

In this sample, we create UIAddOnContainer which uses different template and defines a custom action listener

In the UIAddOnContainer.gtmpl template, it just render a link to trigger the action:

2. A service provider for the custom container layout

Let's say we create a service provider org.gatein.examples.AddOnContainerFactory which is an implementation of org.exoplatform.portal.webui.container.UIComponentFactory<T>

In this implementation, we check if the factoryID is equivalent to "ADDON_CONTAINER", then create and return a UIAddOnContainer instance. Otherwise, it retunns NULL.

Its jar file also needs to contain a file named META-INF/services/org.exoplatform.portal.webui.container.UIComponentFactory with the content is fully-qualified binary name of the service provider class:

3. Using the new UI container

After deploying the jar with the custom UI container layout, we can use it by configuring initial data, or even by editing layout at run-time

3.1. Configuration

Here is a page layout sample:

In this sample, you can notice that we specify  "ADDON_CONTAINER" as the factory-id of the container. This is necessary information to tell Portal to initialize proper UI Container instance.

3.2. Edit Layout at run-time

To make the custom container layout available to be used at run-time in Edit Layout mode (by Drag & Drop). You will need to override the file portal.war!/WEB-INF/conf/uiconf/portal/webui/container/ContainerConfigOption.groovy. By adding/registering the information of custom container layout, something like:

Again, you will notice that factory-id is indicated to the custom container layout.

As usual, you can absolutely rely on the portal extension mechanism to override this file. There will be one more item in the Composer popup for the custom container layout available to be used.

Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.