Oracle UIX API Reference
Release 2.1.22.0.0
B12196-01

oracle.cabo.ui.data.tree
Class BrowseMenuUtils

java.lang.Object
  |
  +--oracle.cabo.ui.data.tree.BrowseMenuUtils

public class BrowseMenuUtils
extends java.lang.Object

The BrowseMenuBean is really a layout manager. BrowseMenuUtils adds named children and attributes to the browseMenu so that it conforms to the BLAF guidelines. The children are set to be the following:

The (simplified!) layout of a BLAF browse menu is thus:
 
 breadcrumbs
 title header
 description/instruction
 content link
   category header (text is "Categories")
   categories bulleted list
   item header (text is "Items")
   items bulleted list with descriptions
 
 
BrowseMenuUtils only sets a child or attribute if it has not already been set. That is, if a location named child has been added to browseMenu before being passed to BrowseMenuUtils, this location child is not overridden by BrowseMenuUtils.

I will use the names given above to describe what data is bound where. The data for the children and attributes of the browse menu are set to be dataBound in configureBrowseMenu to the following keys:

Please see BrowseNodeDataObject on one way to create a DataObject with the required keys.

Usage

To begin with we will give an example of hierarchical, or tree-structured, data which we will use in subsequent examples:

    private SimpleTreeData createShopNode(
       String text,
       String description)
    {
      SimpleTreeData data = new SimpleTreeData();
      data.setText( text );
      if ( description != null )
       data.setDescription( description);

      data.setDestination( "http://bali.us.oracle.com");
      data.setDestinationText( "More Information");
      return data;
    }

    private DataObject createData()
    {
      SimpleTreeData treeRoot = new SimpleTreeData();
      SimpleTreeData shop  =
           createShopNode("Shop", "Spend some money!");
      SimpleTreeData books =
           createShopNode("Books", null);
      SimpleTreeData umbrellas  =
           createShopNode("Umbrellas", "Rain, rain go away");
      SimpleTreeData  art  =
           createShopNode("Art", "Picasso et al");

      books.addChild( art);
      shop.addChild(books);
      shop.addChild(umbrellas);

      return shop;
    }

   

So this is the tree:


         shop
        /    \
     books   umbrellas
      |
     art

So "art" and "umbrellas" are leaves and therefore items, while "shop" and "books" are categories. So "shop" is one of the 'roots' of this tree. There could theoretically be multiple roots.

So let's use BrowseMenuUtils to set up a "default" looking BrowseMenu using this data. In this example we will also use the class BrowseNodeDataObject. These two classes are quite easy to use in conjuntion with one another.

In this example we are using a servlet. For those not familiar with servlets it may help to know that the init method is called once when the servlet is started while the doGet method is called once per request.

In init we would build the tree of UINodes and somewhere in there we might see the following:

    public void init(ServletConfig config)
    throws ServletException
    {
      .....

      // create the browse menu
      BrowseMenuBean browseMenu = new BrowseMenuBean();
      // give it page-wide-unique id - IMPORTANT!!
      browseMenu.setID("myBrowseMenu");
      // not using form submission
      browseMenu.setFormSubmitted(false);
      // add the "default" containers
      BrowseMenuUtils.configureBrowseMenu(
           MY_NAMESPACEURI,
           MY_LOCALNAME,
           browseMenu);

      // set treeData, an instance field,
      // to be the tree described above
      treeData = createData();

      .....
    }
   
All the children and attributes set up in BrowseMenuUtils use data binding. We now want to put a DataObject on the context with the data. If you have a tree of data and the current location you can set up the data with the correct keys using BrowseNodeDataObject. In the servlet's doGet we would have:
    public void doGet(
         HttpServletRequest request,
         HttpServletResponse response)
      throws ServletException, IOException
    {
      .....

      // get the state for the current location in the tree
      String currentLocation =
           request.getParameter("location");

      // create the data
      DataObject browseData = new BrowseNodeDataObject(
           treeData,
           currentLocation,
           MY_SERVLET_DESTINATION);

      // push the data on the context
      TableDataProvider provider = new TableDataProvider();
      provider.put(MY_NAMESPACEURI, MY_LOCALNAME, browseData);

      .....
    }

   

See Also:
SimpleTreeData, BrowseNodeDataObject, BrowseMenuBean, UIConstants

Method Summary
static void configureBrowseMenu(MutableUINode browseMenu, java.lang.String namespaceURI, java.lang.String localName)
          Sets up the attributes and named children of a browseMenu to be BLAF compliant.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

configureBrowseMenu

public static final void configureBrowseMenu(MutableUINode browseMenu,
                                             java.lang.String namespaceURI,
                                             java.lang.String localName)
Sets up the attributes and named children of a browseMenu to be BLAF compliant.
Parameters:
browseMenu - the browseMenu to which attributes are set and children are added
namespaceURI - the namespace of the DataObject from which bound values will be requested.
localName - the local name of the DataObject from which bound values will be requested.

Oracle UIX API Reference
Release 2.1.22.0.0
B12196-01

Copyright © 2002,2003, Oracle. All Rights Reserved.