sjivan / gwt-ext

Automatically exported from code.google.com/p/gwt-ext
0 stars 0 forks source link

No longer possible to set title for collapsed panels #212

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
When using a border layout in GWT-Ext 1.x it was possible to set a title to
be used on collapsed regions, however this functionality seems to be
missing in 2.x.  In my application we have a collapsible "Tools" panel at
the bottom of the screen and I would like the title area of the collapsed
panel to say "Tools" when it is minimized.  Is there any way to accomplish
this in the new version?

Original issue reported on code.google.com by mhutchin...@gmail.com on 13 Feb 2008 at 9:45

GoogleCodeExporter commented 8 years ago
It happens in version GWT-Ext 2.0.4 for the class Panel too :-(
<code>
        final Panel pane = new Panel("Title");
        panel.setCollapsible(true);
</code>

Original comment by cristesc...@gmail.com on 29 Aug 2008 at 11:55

GoogleCodeExporter commented 8 years ago
Wow! This defect is opened since February 13 and nobody did anything? Come on 
!!! 
Need a fix here...

Original comment by cristesc...@gmail.com on 15 Sep 2008 at 12:29

GoogleCodeExporter commented 8 years ago
I have a desire similar to the topic starter. A collapsed panel turns obscure, 
not 
user-friendly...

Please...  

Original comment by michiel....@gmail.com on 15 Sep 2008 at 2:10

GoogleCodeExporter commented 8 years ago
I haven't found a way to work around this, so a fix would still be greatly 
appreciated.

Original comment by mhutchin...@gmail.com on 15 Sep 2008 at 2:22

GoogleCodeExporter commented 8 years ago
This is not supported by Ext, however there's a user plugin that adds this
functionality. 

http://tdg-i.com/30/how-to-get-titles-in-collapsed-panels-for-border-layout

Feel free to integrate it. If yoo'd like to make this extension contribution to
GWT-Ext-UX, let me know and I'll grant you commit privileges.

Original comment by sanjiv.j...@gmail.com on 15 Sep 2008 at 8:41

GoogleCodeExporter commented 8 years ago
Thank you, I will look into that!

In the meanwhile I have changed the BorderLayout to a RowLayout. This way you 
do have 
a title when collapsed, but no more animations :'(

Added theCollapsingPanel.setTitleCollapse(true) so you can press on the entire 
bar 
when collapsed to expand and not just on the tiny icon. 

Original comment by michiel....@gmail.com on 16 Sep 2008 at 8:24

GoogleCodeExporter commented 8 years ago
I wrote a workaround for this:

p.addListener(new PanelListenerAdapter() {
    @Override
    public void onCollapse(Panel panel) {
        JavaScriptObject jsObj = DOM.getElementById(panel.getId()+"-xcollapsed");
        if (jsObj != null) {
            JavaScriptObjectHelper.setAttribute(JavaScriptObjectHelper.getAttributeAsElement(jsObj, "firstChild"),"innerHTML"," <div style=\"position: absolute; left: 20px;top:5px;font-weight:bold;\">"+panel.getTitle()+"</div>");
        }
    }
});

It works in FF and Chrome, but not in IE. IE has a problem with "position: 
absolute", I'm still trying do solve this.
This solution will work for north and south panels, for west and east panels 
you have to rotate the title-text in some way.

Original comment by seiersbr...@gmail.com on 8 Jun 2010 at 2:25

GoogleCodeExporter commented 8 years ago
Was anyone able to figure out a solution to this issue?

Original comment by kreh...@gmail.com on 28 Jan 2011 at 5:20

GoogleCodeExporter commented 8 years ago
Figured it out... Thanks to seiersbr...@googlemail.com's post.. This is for IE 
EAST Panel:

p.addListener(new PanelListenerAdapter() {
    @Override
    public void onCollapse(Panel panel) {
    String panelTitleId = "panelTitle";

        //Only need to set it once.
        if (DOM.getElementById(panelTitleId) == null) {
            com.google.gwt.user.client.Element panelElement = DOM.getElementById(panel.getId() + "-xcollapsed");
            com.google.gwt.user.client.Element panelTitle = null;

            panelTitle = DOM.createDiv();
            panelTitle.setId(panelTitleId);
            panelTitle.setInnerHTML("<span style=\"font:bold 11px Trebuchet Ms,tahoma,arial,helvetica,sans-serif;color:white;" +
                    "writing-mode: tb-rl;" +
                    "-webkit-transform: rotate(90deg);" +
                    "-moz-transform: rotate(90deg);" +
                    "\">" + panel.getTitle() + "</span>");

            if (panelElement != null) {
                JavaScriptObjectHelper.setAttribute(panelElement, "style.margin", "'3px 3px 5px 3px'");
                DOM.appendChild(panelElement, panelTitle);
            }
        }
    }
});

Original comment by kreh...@gmail.com on 31 Jan 2011 at 6:33