I am passing a bunch of tabs from a zul file to a java file like so:
tabs.zul
<tabs>
<tab id="tab1" label="Tab1"> </tab>
<tab id="tab2" label="Tab2"> </tab>
</tabs>
<zscript>
testTabs = new TestTabs();
Tab[] tabs = {tab1, tab2}
testTabs.registerTabs(tabs)
</zscript>
TestTabs.java
public class TestTabs {
....
private HashMap<String,Tab> tabMap;
void registerTabs (Tab[] tabs) {
this.tabMap = new HashMap<String,Tab>();
for (Tab t: tabs) {
this.tabMap.put(t.getId(),t);
}
}
if(condition) {
tabMap.get("tab1").setVisible(true);
tabMap.get("tab2").setVisible(true);
}
}
Now, I guess using Hashmaps to access a tab is a roundabout way. Using a getFellow(String id) method to access a tab would be much simpler, right ? But, I am not sure how to implement that. Can someone help me with this?
Thanks, Sony