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

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

Introduction

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

Prototype

public void insert(Widget widget, Widget tabWidget, int beforeIndex) 

Source Link

Document

Inserts a widget into the tab panel.

Usage

From source file:com.ponysdk.ui.terminal.ui.PTTabPanel.java

License:Apache License

@Override
public void add(final PTInstruction add, final UIService uiService) {

    final Widget w = asWidget(add.getObjectID(), uiService);
    final TabPanel tabPanel = uiObject;

    final int beforeIndex = add.getInt(PROPERTY.BEFORE_INDEX);

    if (add.containsKey(PROPERTY.TAB_TEXT)) {
        tabPanel.insert(w, add.getString(PROPERTY.TAB_TEXT), beforeIndex);
    } else if (add.containsKey(PROPERTY.TAB_WIDGET)) {
        final PTWidget<?> ptWidget = (PTWidget<?>) uiService.getPTObject(add.getLong(PROPERTY.TAB_WIDGET));
        tabPanel.insert(w, ptWidget.cast(), beforeIndex);
    }/*  www  .j  av  a 2s  .  c o  m*/

    if (tabPanel.getWidgetCount() == 1) {
        tabPanel.selectTab(0);
    }
}