Search in sources :

Example 1 with UITabsGroup

use of org.openforis.collect.model.ui.UITabsGroup in project collect by openforis.

the class TabsGroupComposer method generateNewTabName.

private String generateNewTabName(UITabsGroup parentGroup) {
    String prefix = "tab_";
    Stack<Integer> parts = new Stack<Integer>();
    UITabsGroup currentGroup = parentGroup;
    do {
        int position = currentGroup.getTabs().size() + 1;
        parts.push(position);
        currentGroup = currentGroup.getParent();
    } while (currentGroup != null);
    String suffix = StringUtils.join(parts.toArray(), "_");
    String tabName = prefix + suffix;
    return tabName;
}
Also used : UITabsGroup(org.openforis.collect.model.ui.UITabsGroup) Stack(java.util.Stack)

Example 2 with UITabsGroup

use of org.openforis.collect.model.ui.UITabsGroup in project collect by openforis.

the class TabsGroupComposer method removeTab.

@Command
@NotifyChange({ "tabs" })
public void removeTab(@BindingParam("tab") UITab tab) {
    UITabsGroup parent = tab.getParent();
    parent.removeTab(tab);
}
Also used : UITabsGroup(org.openforis.collect.model.ui.UITabsGroup) NotifyChange(org.zkoss.bind.annotation.NotifyChange) Command(org.zkoss.bind.annotation.Command)

Aggregations

UITabsGroup (org.openforis.collect.model.ui.UITabsGroup)2 Stack (java.util.Stack)1 Command (org.zkoss.bind.annotation.Command)1 NotifyChange (org.zkoss.bind.annotation.NotifyChange)1