This section describes how to position an iView within a container of a layout on a page.
Set the parameters for a JNDI lookup in the PCD.
Hashtable env = new Hashtable(); env.put(Context.INITIAL_CONTEXT_FACTORY, IPcdContext.PCD_INITIAL_CONTEXT_FACTORY); env.put(Context.SECURITY_PRINCIPAL, request.getUser()); env.put(Constants.REQUESTED_ASPECT, PcmConstants.ASPECT_SEMANTICS);
Perform a lookup of the page on which you want to position an iView.
InitialContext iCtx = null; try { iCtx = new InitialContext(env); IPage myPage =(IPage)iCtx.lookup( "pcd:portal_content/Desktop/finance");
Get a reference to the layout in which you want to move the iView, for example, by getting the default layout.
ILayout myLayout = myPage.getActiveLayoutObject();
You can also get a list of a page's layouts by calling getLayouts() on the page.
Position the iView by calling setiViewContainer() and specifying the iView that you want to move, a container, and the position within the container to which you want to move the iView. The first position is 0 , the second position is 1 , and so forth.
myLayout.setiViewInContainer("testxml", "com.sap.portal.reserved.layout.Cont1",1);
This moves the testxml iView in the page to the second position in the com.sap.portal.reserved.layout.Cont1 container of the default layout.
Save the changes to the layout.
... myLayout.save(); } catch(NamingException e) { }