Example usage for com.google.gwt.user.client.ui InsertPanel insert

List of usage examples for com.google.gwt.user.client.ui InsertPanel insert

Introduction

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

Prototype

void insert(Widget w, int beforeIndex);

Source Link

Document

Inserts a child widget before the specified index.

Usage

From source file:org.jbpm.form.builder.ng.model.client.form.LayoutFormItem.java

License:Apache License

public FBFormItem insert(int index, FBFormItem newItem) {
    FBFormItem item = null;//from  w  ww  . ja  va2 s .  c om
    if (index == items.size()) {
        item = newItem;
        add(item);
    } else {
        if (items.get(index) == null || isWhiteSpace(items.get(index))) {
            item = items.set(index, newItem);
        } else {
            item = newItem;
            for (; index < items.size(); index++) {
                item = items.set(index, item);
            }
            items.add(item);
        }
        HasWidgets panel = getPanel();
        if (panel instanceof InsertPanel) {
            InsertPanel iPanel = (InsertPanel) panel;
            iPanel.insert(newItem, index);
        }
    }
    return item;
}