获取/设置当前被选中的 tab
@param {Number}  [selectedIndex] 序号
@param {Boolean} [fire]          触发 change 事件，默认 true
@fires Tab#change
@return {Object}
334072
function(selectedIndex, fire) {
        var curTab, curContent;
        if (typeof selectedIndex != 'undefined') {
            this.$tabs.removeClass('active');
            this.$contents.hide();

            this.options.selectedIndex = selectedIndex;
            curTab = $(this.$tabs[selectedIndex]).addClass('active');
            curContent = $(this.$contents[selectedIndex]).show();

            if (fire === undefined || !!fire) {
                /**
                 * 切换 tab
                 * @event Tab#change
                 * @param {Object} e            事件对象
                 * @param {Object} data         数据
                 * @param {Number} data.index   序号
                 * @param {String} data.title   tab 标题
                 * @param {String} data.content tab 内容
                 */
                curTab.trigger('change', {
                    index: selectedIndex,
                    title: curTab.text(),
                    content: curContent.html()
                });
            }
        } else {
            var curIndex = this.options.selectedIndex;
            curTab = $(this.$tabs[curIndex]);
            curContent = $(this.$contents[curIndex]);
            return {
                index: curIndex,
                title: curTab.text(),
                content: curContent.html()
            };
        }
    }
1240474
def clear_selection
      return if @selected_indices.nil? || @selected_indices.empty?
      arr = @selected_indices.dup # to un highlight
      @selected_indices.clear
      arr.each {|i| @obj.fire_row_changed(i) }
      @selected_index = nil
      @old_selected_index = nil
      #  User should ignore first two params
      lse = ListSelectionEvent.new(0, arr.size, @obj, :CLEAR)
      @obj.fire_handler :LIST_SELECTION_EVENT, lse
      arr = nil
    end
580225
function ListView_updateSelection() {
                    var indices = this._selection.getIndices(),
                        selectAll = this._selection.isEverything(),
                        selectionMap = {};

                    if (!selectAll) {
                        for (var i = 0, len = indices.length ; i < len; i++) {
                            var index = indices[i];
                            selectionMap[index] = true;
                        }
                    }

                    this._view.items.each(function (index, element, itemData) {
                        if (itemData.itemBox) {
                            var selected = selectAll || !!selectionMap[index];
                            _ItemEventsHandler._ItemEventsHandler.renderSelection(itemData.itemBox, element, selected, true);
                            if (itemData.container) {
                                _ElementUtilities[selected ? "addClass" : "removeClass"](itemData.container, _Constants._selectedClass);
                            }
                        }
                    });
                }
373204
public void onNewTab(final AjaxRequestTarget target, final T tab, final int index)
	{
		if ((index < 0) || (index >= getTabs().size()))
		{
			throw new IndexOutOfBoundsException();
		}
		getTabs().add(index, tab);
		setSelectedTab(index);
		target.add(this);
	}
1336537
function (items, options) {


            options = options || {};
            _.defaults(options, {silent: false, index: this.$items.length});

            var index = options.index;

            if (!_.isArray(items)) {
                items = [items];
            }
            var item, itemIndex;
            for (var i = 0; i < items.length; i++) {
                item = items[i];
                if (item instanceof Bindable) {
                    item.bind('change', this._onItemChange, this);
                    item.bind('*', this._onItemEvent, this);
                }
                itemIndex = index + i;
                if (_.isUndefined(this.$items[itemIndex]) || itemIndex >= this.$items.length) {
                    this.$items[itemIndex] = item;
                } else {
                    this.$items.splice(itemIndex, 0, item);
                }
                if (options.silent !== true) {
                    this.trigger('add', {item: item, index: itemIndex});
                }
            }
        }
278578
function TabsEvent(type, index) {
      classCallCheck(this, TabsEvent);

      this.type = type;

      /** @type {number} */
      this.index = index;

      /** @type {boolean} Whether `preventDefault` has been called. */
      this.defaultPrevented = false;
    }
157334
function selectTab() {
      var href = tab.href.split('#')[1];
      var panel = layout.content_.querySelector('#' + href);
      layout.resetTabState_(tabs);
      layout.resetPanelState_(panels);
      tab.classList.add(layout.CssClasses_.IS_ACTIVE);
      panel.classList.add(layout.CssClasses_.IS_ACTIVE);
    }
222767
function (selected) {
		var series = this;
		// if called without an argument, toggle
		series.selected = selected = (selected === UNDEFINED) ? !series.selected : selected;

		if (series.checkbox) {
			series.checkbox.checked = selected;
		}

		fireEvent(series, selected ? 'select' : 'unselect');
	}
1255849
function ItemEventsHandler_toggleItemSelection(itemIndex) {
                    var site = this._site,
                        selection = site.selection,
                        selected = selection._isIncluded(itemIndex);

                    if (site.selectionMode === _UI.SelectionMode.single) {
                        if (!selected) {
                            selection.set(itemIndex);
                        } else {
                            selection.clear();
                        }
                    } else {
                        if (!selected) {
                            selection.add(itemIndex);
                        } else {
                            selection.remove(itemIndex);
                        }
                    }
                }
1357359
function (panel) {
                var self = this, bar = self.get('bar'), body = self.get('body'), selectedPanelIndex = util.indexOf(panel, body.get('children'));
                body.set('selectedPanelIndex', selectedPanelIndex);
                bar.set('selectedTab', self.getTabAt(selectedPanelIndex));
                return this;
            }
569481
public boolean selectionChanged(Object source, int iStartRow, int iEndRow, int iSelectType)
    {
        boolean bChanged = super.selectionChanged(source, iStartRow, iEndRow, iSelectType);
        if (bChanged)
        { // Notify all the listSelectionListeners
            this.fireMySelectionChanged(new MyListSelectionEvent(source, this, m_iSelectedRow, iSelectType));
        }
        return bChanged;
    }
1014608
public void selectTab(GalleryTabId tabId, boolean fireEvent) {

        A_CmsTab tab = getTab(tabId);
        if (tab != null) {
            m_tabbedPanel.selectTab(tab, fireEvent);
        }
    }
920070
public void setSelectedIndex(int selectedIndex) {
        this.selectedIndex = selectedIndex;
        if (values.size() > 0) {
            T value = values.get(selectedIndex);
            if (value != null) {
                $(listbox.getElement()).val(keyFactory.generateKey(value)).trigger("change.select2", selectedIndex);
            } else {
                GWT.log("Value index is not found.", new IndexOutOfBoundsException());
            }
        }
    }
1155747
function handleSelectedIndexChange (newValue, oldValue) {
    if (newValue === oldValue) return;

    ctrl.selectedIndex     = getNearestSafeIndex(newValue);
    ctrl.lastSelectedIndex = oldValue;
    ctrl.updateInkBarStyles();
    updateHeightFromContent();
    adjustOffset(newValue);
    $scope.$broadcast('$mdTabsChanged');
    ctrl.tabs[ oldValue ] && ctrl.tabs[ oldValue ].scope.deselect();
    ctrl.tabs[ newValue ] && ctrl.tabs[ newValue ].scope.select();
  }
83965
@Override
	public boolean onClick()
	{
		if (!(parent instanceof UITabGroup))
			return super.onClick();

		if (!fireEvent(new TabChangeEvent((UITabGroup) parent, this)))
			return super.onClick();

		tabGroup().setActiveTab(this);
		return true;
	}
937347
public T select(T option)
	{
		int index = options().indexOf(option);
		if (index == -1 || index == selectedIndex)
			return selected();

		if (fireEvent(new SelectEvent<>(this, option)))
			setSelected(option);

		return selected();
	}
758865
function select (index) {
    // force form to update state for validation
    $mdUtil.nextTick(function () {
      getDisplayValue(ctrl.matches[ index ]).then(function (val) {
        var ngModel = elements.$.input.controller('ngModel');
        $mdLiveAnnouncer.announce(val + ' ' + ctrl.selectedMessage, 'assertive');
        ngModel.$setViewValue(val);
        ngModel.$render();
      }).finally(function () {
        $scope.selectedItem = ctrl.matches[ index ];
        setLoading(false);
      });
    }, false);
  }