Example usage for com.google.gwt.user.client.ui WidgetCollection iterator

List of usage examples for com.google.gwt.user.client.ui WidgetCollection iterator

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui WidgetCollection iterator.

Prototype

public Iterator<Widget> iterator() 

Source Link

Document

Gets an iterator on this widget collection.

Usage

From source file:com.gwtcx.extgwt.client.widgets.NavigationPane.java

License:Open Source License

public void selectRecord(String name) {

    Log.debug("selectRecord(String name): [" + name + "]");

    WidgetCollection children = this.getChildren();

    Iterator<Widget> iterator = children.iterator();

    while (iterator.hasNext()) {

        Widget child = (Widget) iterator.next();

        // assert child instanceof NavigationPaneSection : "NavigationPane children must be NavigationPaneSections";

        NavigationPaneSection section = (NavigationPaneSection) child;

        Log.debug("sectionName: " + section.getText());

        ListStore<NavigationPaneSectionModel> store = section.getGrid().getStore();

        Log.debug("store.size(): " + store.size());

        NavigationPaneSectionModel model = store.findModelWithKey(name);

        if (model != null) {
            int rowIndex = store.indexOf(model);

            Log.debug("selectRecord(rowIndex): " + rowIndex);

            if (!section.isExpanded()) {
                section.expand();//from  w w  w  . j  a  v a  2  s. c  o m
            }

            section.selectRecord(rowIndex);
            return;
        }
    }

    Log.debug("selectRecord(String name): no match");
}

From source file:com.smartgwt.mobile.client.widgets.Canvas.java

License:Open Source License

public final boolean hasChild(Widget widget) {
    WidgetCollection children = getChildren();
    Iterator<Widget> it = children.iterator();
    while (it.hasNext()) {
        Widget child = it.next();/*w  w w  .  j a v a2  s  .c  o m*/
        if (child instanceof WidgetCanvas) {
            if (((WidgetCanvas) child)._getWidget().equals(widget)) {
                return true;
            }
        }
    }
    return false;
}

From source file:com.smartgwt.mobile.client.widgets.Canvas.java

License:Open Source License

public void removeChild(Widget widget) {
    WidgetCollection children = getChildren();
    Iterator<Widget> it = children.iterator();
    while (it.hasNext()) {
        Widget child = it.next();//  w  w w . j  a  v a 2  s. c o  m
        if (child instanceof WidgetCanvas) {
            if (((WidgetCanvas) child)._getWidget().equals(widget)) {
                it.remove();
                return;
            }
        }
    }
}