Example usage for com.google.gwt.coreext.client JsIntegerMap hasKey

List of usage examples for com.google.gwt.coreext.client JsIntegerMap hasKey

Introduction

In this page you can find the example usage for com.google.gwt.coreext.client JsIntegerMap hasKey.

Prototype

public final native boolean hasKey(int key) ;

Source Link

Document

Returns true if this map has an entry for the specified key.

Usage

From source file:com.google.speedtracer.client.visualizations.view.SluggishnessEventFilterPanel.java

License:Apache License

private void refreshEventTypeSelect(SluggishnessModel model) {
    // Remove existing options, save the first one (ALL)
    int count = filterPanelEventTypeSelect.getOptionCount();
    for (int i = 1; i < count; ++i) {
        filterPanelEventTypeSelect.removeOption(1);
    }/*from w w  w .  j  a  v  a  2s  .  c o m*/
    // Remove the old listener.
    if (eventFilterTypeRemover != null) {
        eventFilterTypeRemover.remove();
        eventFilterTypeRemover = null;
    }

    final JsIntegerMap<String> typesEncountered = model.getTypesEncountered();
    typesEncountered.iterate(new IterationCallBack<String>() {
        int typesIndex = 0;

        public void onIteration(int key, String val) {
            if (typesEncountered.hasKey(key)) {
                filterPanelEventTypeSelect.insertOption(val, String.valueOf(key), typesIndex + 1);
                typesIndex++;
            }
        }
    });

    // The click listener has to map the index of the selected item to the
    // sparse array of types we just created.
    eventFilterTypeRemover = filterPanelEventTypeSelect.addChangeListener(new ChangeListener() {
        public void onChange(ChangeEvent event) {
            int eventType = Integer.parseInt(filterPanelEventTypeSelect.getSelectedValue());
            eventFilter.setEventType(eventType);
            eventTable.renderTable();
        }
    });
}