Announcement
Collapse
No announcement yet.
X
-
For now you can achieve this using JSNI - here's some modified code that demonstrates this:
Code:public class TabTest implements EntryPoint { public void onModuleLoad() { final TabSet tabset = new TabSet(); tabset.setTabBarPosition(Side.TOP); tabset.setWidth100(); tabset.setHeight100(); Tab tab1 = new Tab("Tab1"); // tab1.setCanClose(new Boolean(true)); tabset.addTab(tab1); Canvas pane1 = new Canvas(); pane1.setBackgroundColor("red"); tab1.setPane(pane1); Tab tab2 = new Tab("Tab2"); tabset.addTab(tab2); Canvas pane2 = new Canvas(); pane2.setBackgroundColor("blue"); tab2.setPane(pane2); Canvas canvas = new Canvas(); canvas.setWidth100(); canvas.setHeight100(); canvas.addChild(tabset); canvas.draw(); setCanCloseTab(tab1.getJsObj(), tabset.getJsObj(), new Boolean(true)); tabset.addTabSelectedHandler(new TabSelectedHandler() { public void onTabSelected(TabSelectedEvent event) { Tab tab = event.getTab(); setCanCloseTab(tab.getJsObj(), tabset.getJsObj(), new Boolean(true)); } }); tabset.addTabDeselectedHandler(new TabDeselectedHandler() { @Override public void onTabDeselected(TabDeselectedEvent event) { Tab tab = event.getTab(); setCanCloseTab(tab.getJsObj(), tabset.getJsObj(), new Boolean(false)); } }); } private native void setCanCloseTab (JavaScriptObject tab, JavaScriptObject tabset, Boolean canClose) /*-{ tabset.setCanCloseTab(tab, canClose == null ? null : canClose.@java.lang.Boolean::booleanValue()()); }-*/; }
Leave a comment:
-
CloseTabIcon missing
Hi Isomorphic,
I'm using SmartGWT Pro 2.5 branch (10/21/2011 nightly build).
The Tab does not have a closeTabIcon by using the tab.setCanClose(true) if it was not set on Tab's creation.
Please see the code:
Code:public class TabTest implements EntryPoint { public void onModuleLoad() { TabSet tabset = new TabSet(); tabset.setTabBarPosition(Side.TOP); tabset.setWidth100(); tabset.setHeight100(); Tab tab1 = new Tab("Tab1"); tab1.setCanClose(new Boolean(true)); tabset.addTab(tab1); Tab tab2 = new Tab("Tab2"); tabset.addTab(tab2); Canvas canvas = new Canvas(); canvas.setWidth100(); canvas.setHeight100(); canvas.addChild(tabset); canvas.draw(); tabset.addTabSelectedHandler(new TabSelectedHandler() { public void onTabSelected(TabSelectedEvent event) { Tab tab = event.getTab(); if (tab.getCanClose() == false) tab.setCanClose(new Boolean(true)); } }); } }
The second tab2 does not have the closeTabIcon after using the tab2.setCanClose(true) on tab's selection.
How can I add the closeTabIcon to the second tab? I need to add it per request, not during the initialization.
Thank you.Tags: None
Leave a comment: