Hi Chris, yes, you can rely on CSS styling. Make sure your CSS is universal 
across browsers.

Best regards,
Fendy Tjin

On Oct 18, 2010, at 5:51 PM, Christophe <[email protected]> 
wrote:

> I've done this : do you think I can rely on CSS style name ?
> 
> public abstract class TabLayoutPanelWithAddTabButton extends
> TabLayoutPanel implements ClickHandler {
> 
>    public TabLayoutPanelWithAddTabButton(double barHeight, Style.Unit
> barUnit) {
>        super(barHeight, barUnit);
>        Image img = new Image(....);
>        // we ar looking for tabBar to move it to the right
>        double space = (barHeight-img.getHeight())/2.0;
>        LayoutPanel panel = (LayoutPanel)getWidget();
>        int widgetCount = panel.getWidgetCount();
>        for (int i=0; i<panel.getWidgetCount();i++) {
>            Widget w = panel.getWidget(i);
>            if(w.getStyleName().equals("gwt-TabLayoutPanelTabs")) {
>                panel.setWidgetLeftRight(w, img.getWidth()+2*space-6,
> Style.Unit.PX, 0, Style.Unit.PX);
>            }
>        }
>        panel.insert(img, 0);
>        panel.setWidgetLeftWidth(img, space, Style.Unit.PX,
> img.getWidth(), Style.Unit.PX);
>        panel.setWidgetTopHeight(img, space, Style.Unit.PX,
> img.getHeight(), Style.Unit.PX);
>        img.getElement().setTitle("Add a new tab");
>        img.addClickHandler(this);
>    }
> 
>    @Override
>    public void onClick(ClickEvent event) {
>        addNewTab();
>    }
> 
>    /**
>     * Implements this ta add a new Tab
>     */
>    public abstract void addNewTab();
> }
> 
> Regards,
> Christophe
> 
> On 15 oct, 18:36, Fendy Tjin <[email protected]> wrote:
>>     // Create a tab panel
>> 
>>     DecoratedTabPanel tabPanel = new DecoratedTabPanel();
>>     tabPanel.setWidth("400px");
>>     tabPanel.setAnimationEnabled(true);
>> 
>>     // Add a home tab
>>     HTML homeText = new HTML("home blabla");
>>     tabPanel.add(homeText, "home");
>> 
>>     // Add button
>>     Button normalButton = new Button(
>>         "add", new ClickHandler() {
>>           public void onClick(ClickEvent event) {
>>             // you might want to add fields for text and tabname
>>             tabPanel.add(text, tabName);
>>           }
>>         });
>> 
>> I did not test it but I think this should work.
>> 
>> Best Regards,
>> 
>> Fendy Tjin
>> 
>> On Fri, Oct 15, 2010 at 3:56 PM, Christophe <
>> 
>> [email protected]> wrote:
>>> I would like to add an icon/button to tab bar, at the right of the
>>> last tab, like Firefox does.
>> 
>>> But, in TabLayoutPanel, tabBar is private with no accessor, and I
>>> can't find a way to add this.
>> 
>>> Any suggestion ?
>> 
>>> Regards,
>>> Crhistophe
>> 
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Google Web Toolkit" group.
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to
>>> [email protected]<google-web-toolkit%[email protected]>
>>> .
>>> For more options, visit this group at
>>> http://groups.google.com/group/google-web-toolkit?hl=en.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Google Web Toolkit" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/google-web-toolkit?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to