Search code examples
javagwtgxt

Collapsed ContentPanel doesn't show new Heading


I have a ContentPanel, that is set to collapsable

ContentPanel bottomPanel = new ContentPanel();
BorderLayoutData layoutData = new BorderLayoutData(LayoutRegion.SOUTH);
layoutData.setSplit(true);
layoutData.setCollapsible(true);

// some code

add(bottomPanel, layoutData);

and set the heading of that panel with

bottomPanel.setHeading("title");

If the panel is not collapsed, setting the heading sets a new heading of that panel. But if the panel is collapsed it doesn't work. The heading always shows the last heading set while not collapsed. In both states, the collapsed and the not collapsed, the getter always returns the new heading

bottomPanel.getHeading(); // "old Heading"
bottomPanel.setHeading("new Heading");
bottomPanel.getHeading(); // "new Heading"

I think it is kind of render problem


Solution

  • When a ContentPanel is collapsed, the titlebar (HEAD) is replaced by a CollapsedPanel, which creates its own header element and it is not accesible for modification (even if you change the ContentPanel heading).

    Check the CollapsePanel.class > onRender(...)

    com.extjs.gxt.ui.client.widget.ContentPanel
    com.extjs.gxt.ui.client.widget.CollapsePanel
    com.extjs.gxt.ui.client.widget.layout.BorderLayout