Add and remove default layouts

This tutorial shows you how to add and remove predefined layouts using Webcentric. It uses the FxTrader motif as an example, and assumes that you have some knowledge of Webcentric’s XML layouts.  Have a look at the Webcentric Worked Example if you need to swot up!

Predefined Layouts

Note on Webcentric Layouts: “Layouts” in this case don’t just refer to the general layout of a particular screen.  A Webcentric window can have one or more tabs, each of which takes up the whole window, and may have completely different content.  Each of these tabs is called a layout, and your app may have one or more of them defined by default.

If you’ve got the FxTrader application up and running, then your layout configuration file consists of a predefined layout, and will look something like this:

<layoutConfiguration xmlns="" applicationName="application" themes="noir"
    <layout name="FX Trader" src="fxtrader_layout.xml" defaultLayout="true"/>
    <layout name="Blank" src="blank_layout.xml" defaultLayout="true"/>

An application can consist of several predefined layouts, some of which are default layouts that always appear when the application is opened, and which cannot be closed.  Others must be opened by the user, and then deserialised from the Webcentric layout database, before being rendered.

In an application with several predefined layouts, it’s possible to set which ones are default and which are not, by setting the defaultLayout attribute, like this:

<layoutConfiguration xmlns="" applicationName="application">
    <layout name="Layout A" src="layout_A.xml" defaultLayout="true"/>
    <layout name="Layout B" src="layout_B.xml" defaultLayout="true"/>
    <layout name="Layout C" src="layout_C.xml" defaultLayout="false"/>
    <layout name="Layout D" src="layout_D.xml" defaultLayout="false"/>

You would then need to populate an XML file for each layout with something to be displayed.  For the sake of simplicity, we’ll assume that each of them has a single, rather minimalist panel, like so:

<Panel background="#000000"/>

In this application, layout_A and layout_B are loaded by default.  Layout_C and layout_D must be opened by the user.

If a user alters the layout settings in any way and then logs out, the default layouts for that user will be adjusted accordingly. Therefore if a user opens layout_D and then logs out, the next time that same user logs in, the default application layout displayed, will consist of layouts A, B and D.