Thursday, April 9, 2015

GwtBootstrap3 how to implement collapse button for menu bar e.g. navbar


NavbarCollapseButton can have many targets that are collapsable components:

<b:NavbarCollapseButton dataTarget="#ab-toolbar-collapse,#other-toolbar-collapse"/>

     <b:NavbarCollapse ui:field="abToolbarCollapse"> 
               (#id for "abToolbarCollapse" should be set in corresponded UiBinder java class)
     </b:NavbarCollapse>

     <b:NavbarCollapse ui:field="other-toolbar-collapse"> 
               (#id for "otherToolbarCollapse" should be set in corresponded UiBinder java class)
     </b:NavbarCollapse>

Java: get key by value from map - GWT BiMap

public static <T, E> T getKeyByValue(BiMap<T, E> map, E value) {
        for (Map.Entry<T, E> entry : map.entrySet()) {
            if (value.equals(entry.getValue())) {
                return entry.getKey();
            }
        }
        return null;
    }