Example usage for com.google.gwt.dom.client LIElement getAttribute

List of usage examples for com.google.gwt.dom.client LIElement getAttribute

Introduction

In this page you can find the example usage for com.google.gwt.dom.client LIElement getAttribute.

Prototype

@Override
    public String getAttribute(String name) 

Source Link

Usage

From source file:com.horaz.client.widgets.ListView.java

License:Open Source License

/**
 * get the model behind a LI-Element. The li element must have to attribute data-modelid.
 * @param el//from   w  ww  . jav  a  2  s . co m
 * @return model or null
 * @throws IllegalArgumentException if data-modelid is not set
 */
public T getModel(LIElement el) {
    if (el.getAttribute("data-modelid") == null) {
        throw new IllegalStateException("LI Element needs the attribute data-modelid");
    }
    int id = Integer.valueOf(el.getAttribute("data-modelid"));
    return modelsCache.get((long) id);
}