AW Talk is the official development team blog for AribaWeb, the Open Source component-based web application development framework for creating rich, AJAX-enabled applications with the absolute minimum of code (and no hand-coded Javascript).

AribaWeb 101: Application branding 2

Last time I tried to explain little bit  how to style your AribaWeb (AW) application and today we will look at how you can create different brands. 

As I mentioned already in previous articles AW let you create different brands so you can render different UI for different situation and all this from one application. This might be ideal for those of you who are searching for something more multi tenant. 

No what is really brand?  You can understand it as something where you take your existing styles, scripts and pictures and you give it a name and then later on in the request you can refer to this name.  Take a look at this example:

In our already familiar docroot I created different sub-directories that are representing complete UI look & feel for two different companies. As you can see in the example the company1 even have 2 different versions.  














Once you create such directory structure the only thing you need to do is to prepare special URL that will be used by users from company1 and company2. This URL e.g. company1 can look something like this:
http://{host}:{port}/example/Main/aw?awbrand=company1&awbrandversion=ver2

And this is pretty much it! 

What is happening behind the scenes?

When accessing your webpage with these two extra parameters two main things happen:
  • Session is created with brand name and brand version
  • Brand Manager is initialized and tries to scan brand directories and register all the relevant resources.
You might extend this branding manager to put it more logic that will match your complexity. 

Other areas to explore

AWBrandManager - This is the core class that registers all branding directories into ResourceManager. 

AWSession - Session keeps information what is the current brand name and brand version we are in.

AWDirectAction - You might take a look into this class as well. This one is responsible to load correct resource based on brand. Using our Resource Manager.

AWStyleSheet - Stylesheets are loaded from here and if applicable the correct branding version is read.

AWBaseImage - The same as above if branding is on it will read the correct image from your brand folder.