PDA

View Full Version : ContentPanel Header confusion



scaswell1
11 May 2009, 11:17 AM
Hi all,

I'm trying to learn my way around GXT. I've been tinkering with the mail application sample that comes with the source, trying to make certain things work before I get to building my own UI.

I have been unsuccessful at manipulating the set up of the ContentPanel widgets that the application displays in the West region of a BorderLayout. Specifically, I want to be able to manipulate the ToolButton objects that the header panel contains, and their alignment thereof. Ideally, I would first have a small image on the left side of the header (the only way I have gotten the header to do this at all is to create a ToolButton which does nothing.) Then, a space and following that space, the header text. Finally, any ToolButtons that I need would be aligned coming towards the header text from the right side of the Header.

In the mail sample, the west region is a number of ContentPanel objects contained in a FitLayout; in my edit, I have changed it to an AccordionLayout. That is essentially the only difference (besides changing header text, etc.)

However, in the mail sample, the collapse ToolButton is aligned to the right of the Header. My code, essentially an exact replica, renders that same button above the Header text, making the Header bulky and ugly. I've been playing with it, but haven't been able to figure out why or how to fix it. Any ideas?

This is the code that initializes the West region:


BorderLayoutData data = new BorderLayoutData(LayoutRegion.WEST, 200, 150, 350);
data.setMargins(new Margins(5, 0, 5, 5));

west = new ContentPanel();
west.setBodyBorder(false);
west.setHeaderVisible(false);
west.setLayoutOnChange(true);
AccordionLayout al = new AccordionLayout();
al.setHideCollapseTool(true); // eliminates ugly, misplaced collapse buttons
west.setLayout(al);

viewport.add(west, data);The viewport and each of its regions are contained by Registry, to refer to easily later.

Creating each panel contained by the AccordionLayout and adding it to the layout:

setHeading("title");
setTitle("title");
getHeader().addTool(new ToolButton("user"));
getHeader().addTool(new ToolButton("x-tool-close"));

ContentPanel west = (ContentPanel) Registry.get(AppView.WEST_PANEL);
west.add(catalog);
Any thoughts/pointers?
Thanks in advance.

scaswell1
12 May 2009, 4:09 AM
So I realized that making an image appear for the header is a simple call of Header's setIconStyle() (dumb moment.) But I'm still at a loss regarding the other details...