Creating the right-hand sidebar

In this recipe, we are going to create a sidebar to be placed on the right-hand side. This sidebar will be used for some dynamic contents based on the main contents at the center.

How to do it...

  1. Define the method getRightSidebar:
    public ContentPanel getRightSideBar()
    {
    ContentPanel rightSidebarPanel = new ContentPanel();
    rightSidebarPanel.setHeading("Right" Sidebar");
    return rightSidebarPanel;
    }
    
  2. Call the add method of class ContentPanel in the constructor to add the sidebar in the content panel:
    add(getRightSideBar(), rightSidebarLayoutData);
    

How it works...

The method getRightSideBar creates a content panel instance, and sets a heading Right Sidebar. This heading will be modified later.

The right-hand sidebar created by this method is added in the east region of the main content panel by invoking add(getRightSideBar(), rightSidebarLayoutData) in the constructor.

See also

  • The Creating the home page layout class recipe
  • The Adding the banner recipe
  • The Adding menus recipe
  • The Creating the left-hand sidebar recipe
  • The Creating the main content panel recipe
  • The Creating the footer recipe
  • The Using the HomePage instance in EntryPoint recipe