Hybrid View

  1. #1
    Sencha User
    Join Date
    Mar 2012
    Posts
    88
    Vote Rating
    3
    esag_dk is on a distinguished road

      0  

    Default Feature Request: ToolTip for TabPanel

    Feature Request: ToolTip for TabPanel


    Back in GXT 2.x it was possible to define a ToolTip for the tab itself (described here). Since there is no header/TabItem anymore, it is only possible to use ToolTips within the widget itself, but not for the tab buttons. Is there any chance you will add this feature it in the future?

  2. #2
    Sencha User
    Join Date
    Sep 2012
    Posts
    3
    Vote Rating
    0
    gmartinezg011 is on a distinguished road

      0  

    Default TabPanel toolTip missing version 3.x

    TabPanel toolTip missing version 3.x


    Same problem too.
    Any suggestions please?
    Guillermo Martinez

  3. #3
    Sencha User
    Join Date
    Mar 2012
    Posts
    88
    Vote Rating
    3
    esag_dk is on a distinguished road

      0  

    Default


    In the end I wrote my own TabItemConfig adding a "toolTip" value and an extended TabPanelBaseAppearance rendering a simple html-title (instead of gxt tooltip). It works OK, but I'm still missing the GXT ToolTip allowing advanced tooltips.


    ToolTipTabItem.html (render template):
    Code:
    <li title="{config.toolTip}"><a class="{style.tabStripClose}"></a>
    	<a class="{style.tabRight}"> <em class="{style.tabLeft}"> <span
    			class="{style.tabStripInner}"> <span
    				class="{style.tabStripText}">{config.text}</span>
    		</span>
    	</em>
    </a></li>

    ToolTipTabAppearance (if it's our tooltip config - render our tabpanel with tooltip):
    Code:
    ...
        public interface ToolTipItemTemplate extends XTemplates
        {
            @XTemplate(source = "ToolTipTabItem.html")
            SafeHtml render(TabPanelStyle style, ToolTipTabItemConfig config);
        }
    ...
        protected ToolTipItemTemplate toolTipItemTemplate;
    
    
     public ToolTipTabPanelAppearance(TabPanelResources resources, Template template,
                        ItemTemplate itemTemplate, ToolTipItemTemplate toolTipItemTemplate)
        {
            super(resources, template, itemTemplate);
            this.toolTipItemTemplate = toolTipItemTemplate;
        }
    
    
      @Override
        public void insert(XElement parent, TabItemConfig config, int index)
        {
            if (config instanceof ToolTipTabItemConfig)
            {
                XElement item = XDOM.create(toolTipItemTemplate
                                .render(style, (ToolTipTabItemConfig) config).asString());
                item.setClassName(CommonStyles.get().disabled(), !config.isEnabled());
    
    
                if (config.isHTML())
                {
                    XElement textEl = item.selectNode("." + style.tabStripText());
                    textEl.setInnerHTML(config.getHTML());
                }
    
    
                getStrip(parent).insertChild(item, index);
    
    
                if (config.getIcon() != null)
                {
                    setItemIcon(item, config.getIcon());
                }
    
    
                if (config.isClosable())
                {
                    item.addClassName(style.tabStripClosable());
                }
            }
            else
            {
                super.insert(parent, config, index);
            }
        }

    And that's how you can use it:
    Code:
        protected TabPanel tabPanel = new TabPanel(new ToolTipTabPanelAppearance());
     ToolTipTabItemConfig tic = new ToolTipTabItemConfig();
            tic.setToolTip("myToolTip");
            tic.setText("myCaption");
            tabPanel.add(tabContent, tic);

    I hope, this workaround helps you

  4. #4
    Sencha User
    Join Date
    Sep 2012
    Posts
    3
    Vote Rating
    0
    gmartinezg011 is on a distinguished road

      0  

    Default Complete Code

    Complete Code


    If you don't mind could you please post the complete ToolTipTabAppearance and ToolTipTabItemConfig code?
    I'm barely new with Sencha code and any help to the implementation will be appreciate.


    Thank you.
    Guillermo Martinez

  5. #5
    Sencha User
    Join Date
    Mar 2012
    Posts
    88
    Vote Rating
    3
    esag_dk is on a distinguished road

      0  

    Default


    ToolTipTabItemConfig just adds a toolTip attribute:
    Code:
    public class ToolTipTabItemConfig extends TabItemConfig{
        private String toolTip;
    
    
        public ToolTipTabItemConfig()
        {
            super();
        }
    
    
        public ToolTipTabItemConfig(String text, boolean close)
        {
            super(text, close);
        }
    
    
        public ToolTipTabItemConfig(String text)
        {
            super(text);
        }
    
    
        public String getToolTip()
        {
            return toolTip;
        }
    
    
        public void setToolTip(String toolTip)
        {
            this.toolTip = toolTip;
        }
    }
    ToolTipTabAppearance - I override the insert method and check, which config class is beeing used:
    Code:
    public class ToolTipTabPanelAppearance extends TabPanelBaseAppearance{
        public interface ToolTipItemTemplate extends XTemplates
        {
            @XTemplate(source = "ToolTipTabItem.html")
            SafeHtml render(TabPanelStyle style, ToolTipTabItemConfig config);
        }
    
    
        protected ToolTipItemTemplate toolTipItemTemplate;
    
    
        public ToolTipTabPanelAppearance()
        {
            this(GWT.<TabPanelResources> create(TabPanelResources.class), GWT
                            .<Template> create(Template.class), GWT
                            .<ItemTemplate> create(ItemTemplate.class), GWT
                            .<ToolTipItemTemplate> create(ToolTipItemTemplate.class));
        }
    
    
        public ToolTipTabPanelAppearance(TabPanelResources resources, Template template,
                        ItemTemplate itemTemplate, ToolTipItemTemplate toolTipItemTemplate)
        {
            super(resources, template, itemTemplate);
            this.toolTipItemTemplate = toolTipItemTemplate;
        }
    
    
        @Override
        public void insert(XElement parent, TabItemConfig config, int index)
        {
            if (config instanceof ToolTipTabItemConfig)
            {
                XElement item = XDOM.create(toolTipItemTemplate
                                .render(style, (ToolTipTabItemConfig) config).asString());
                item.setClassName(CommonStyles.get().disabled(), !config.isEnabled());
    
    
                if (config.isHTML())
                {
                    XElement textEl = item.selectNode("." + style.tabStripText());
                    textEl.setInnerHTML(config.getHTML());
                }
    
    
                getStrip(parent).insertChild(item, index);
    
    
                if (config.getIcon() != null)
                {
                    setItemIcon(item, config.getIcon());
                }
    
    
                if (config.isClosable())
                {
                    item.addClassName(style.tabStripClosable());
                }
            }
            else
            {
                super.insert(parent, config, index);
            }
        }
    }
    Also you need to create "ToolTipTabItem.html" in the same package as ToolTipTabPanelAppearance (see the code in my other post).

  6. #6
    Sencha User
    Join Date
    Sep 2012
    Posts
    3
    Vote Rating
    0
    gmartinezg011 is on a distinguished road

      0  

    Default


    Thank you so much
    Guillermo Martinez

  7. #7
    Sencha User
    Join Date
    Apr 2014
    Location
    Russia
    Posts
    1
    Vote Rating
    0
    King-Strider is on a distinguished road

      0  

    Default


    Hello,It doesn't work for me too. I have an error ("Deferred binding result type 'com.sencha.gxt.theme.base.client.tabs.TabPanelBaseAppearance.TabPanelResources' should not be abstract") while using this solution. This error is appears during call "GWT. create(TabPanelResources.class)"

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi