Synchronize and redraw the UI after an item is added.

@method _syncUiForItemAdd
@protected
166723
function (obj) {
            var attr,
                carousel   = this,
                carouselEl = carousel._carouselEl,
                el,
                item,
                itemsTable = carousel._itemsTable,
                oel,
                pos,
                sibling,
                styles;

            pos  = JS.isUndefined(obj.pos) ?
                   obj.newPos || itemsTable.numItems - 1 : obj.pos;

            if (!oel) {
                item = itemsTable.items[pos] || {};
                el = carousel._createCarouselItem({
                        className : item.className,
                        styles    : item.styles,
                        content   : item.item,
                        id        : item.id,
                        pos       : pos
                });
                if (JS.isUndefined(obj.pos)) {
                    if (!JS.isUndefined(itemsTable.loading[pos])) {
                        oel = itemsTable.loading[pos];
                        // if oel is null, it is a problem ...
                    }
                    if (oel) {
                        // replace the node
                        carouselEl.replaceChild(el, oel);
                        // ... and remove the item from the data structure
                        delete itemsTable.loading[pos];
                    } else {
                        carouselEl.appendChild(el);
                    }
                } else {
                    if (!JS.isUndefined(itemsTable.items[obj.pos + 1])) {
                        sibling = Dom.get(itemsTable.items[obj.pos + 1].id);
                    }
                    if (sibling) {
                        carouselEl.insertBefore(el, sibling);
                    } else {
                        YAHOO.log("Unable to find sibling","error",WidgetName);
                    }
                }
            } else {
                if (JS.isUndefined(obj.pos)) {
                    if (!Dom.isAncestor(carousel._carouselEl, oel)) {
                        carouselEl.appendChild(oel);
                    }
                } else {
                    if (!Dom.isAncestor(carouselEl, oel)) {
                        if (!JS.isUndefined(itemsTable.items[obj.pos + 1])) {
                            carouselEl.insertBefore(oel,
                                    Dom.get(itemsTable.items[obj.pos + 1].id));
                        }
                    }
                }
            }

            if (!carousel._hasRendered) {
                carousel._refreshUi();
            }

            if (carousel.get("selectedItem") < 0) {
                carousel.set("selectedItem", carousel.get("firstVisible"));
            }

            carousel._syncUiItems();
        }
726806
public void redraw() {
		if (isAttached()) {
			int width = getElement().getClientWidth();
			int height = getElement().getClientHeight();
			onResize(width, height);
		}
	}
1126494
function (items, index, before) {
        var self = this, curItems, beforeItems, afterItems;

        items = self.create(items);
        curItems = self.items();

        if (!before && index < curItems.length - 1) {
          index += 1;
        }

        if (index >= 0 && index < curItems.length) {
          beforeItems = curItems.slice(0, index).toArray();
          afterItems = curItems.slice(index).toArray();
          curItems.set(beforeItems.concat(items, afterItems));
        }

        return self.renderNew();
      }
1169030
function () {
                var oldItems = this.items;
                var oldItemsLength = oldItems.length;
                var newItems = [];
                var initialArray = this.initialArray;

                if (ariaUtilsType.isObject(initialArray)) {
                    var oldItemsMap = new ariaUtilsStackHashMap();
                    var oldElt;
                    for (var i = 0; i < oldItemsLength; i++) {
                        oldElt = oldItems[i];
                        oldItemsMap.push(oldElt.value, oldElt);
                    }

                    var j = 0;
                    for (var p in initialArray) {
                        if (initialArray.hasOwnProperty(p) && !json.isMetadata(p)) {
                            newItems[j] = oldItemsMap.pop(initialArray[p]);
                            j++;
                        }
                    }
                    oldItemsMap.$dispose();
                } else {

                    for (var i = 0; i < oldItemsLength; i++) {
                        var elt = oldItems[i];
                        newItems[elt.initIndex] = elt;
                        delete oldItems[i];
                    }
                }
                this.items = newItems;
                var curState = this._currentState;
                curState.sortOrder = this.SORT_INITIAL;
                curState.sortName = null;
                curState.sortKeyGetter = null;
                this._changes = this._changes | this._CHANGED_PAGE_DATA;
            }
109352
function pushEdit (edits, item, added, removed) {
  var last = edits[edits.length - 1]

  if (last && last.added === added && last.removed === removed) {
    last.items.unshift(item) // Not push: edits get reversed later
  } else {
    edits.push({
      items: [item],
      added: added,
      removed: removed
    })
  }
}
1118867
function() {
        var changed = this._changedObjs;
        // Adjust the viewport
        if (this._dirtyViewport) {
            this._setViewport();
            this._dirtyViewport = false;
        }

        //if no objects have been changed, stop
        if (!changed.length) return;

        var i = 0,
            k = changed.length;
        //loop over all DOM elements needing updating
        for (; i < k; ++i) {
            changed[i].draw()._changed = false;
        }

        //reset DOM array
        changed.length = 0;
    }
856643
function () {
            var attr,
                carousel = this,
                numItems = carousel.get("numItems"),
                i,
                itemsTable = carousel._itemsTable,
                items = itemsTable.items,
                loading = itemsTable.loading,
                item,
                styles;

            for (i = 0; i < numItems; i++) {
                item = items[i] || loading[i];

                if (item && item.id) {
                    styles = getCarouselItemPosition.call(carousel, i);
                    item.styles = item.styles || {};
                    for (attr in styles) {
                        if (styles.hasOwnProperty(attr)) {
                            item.styles[attr] = styles[attr];
                        }
                    }
                    setStyles(Dom.get(item.id), styles);
                }
            }
        }
22059
function(marker) {
		marker.addTo(this._el.marker_item_container);
		marker.on('markerclick', this._onMarkerClick, this);
		marker.on('added', this._onMarkerAdded, this);
	}
755207
function() {
        var options = this.options,
            items = this.items,
            container = this.container,
            itemsToShow = options.itemsToShow;

        if (!options.infinite) {
            return;
        }

        // Append the first items
        items.slice(0, itemsToShow)
            .clone()
            .addClass('is-cloned')
            .removeAttr('id')
            .removeAttr('role')
            .appendTo(container);

        // Prepend the last items
        items.slice(-itemsToShow)
            .clone()
            .addClass('is-cloned')
            .removeAttr('id')
            .removeAttr('role')
            .prependTo(container);

        // Refresh items list
        this.items = container.find('> li');
    }
603378
function () {
        var self = this;

        // Render any new items
        self.items().each(function (ctrl, index) {
          var containerElm;

          ctrl.parent(self);

          if (!ctrl.state.get('rendered')) {
            containerElm = self.getEl('body');

            // Insert or append the item
            if (containerElm.hasChildNodes() && index <= containerElm.childNodes.length - 1) {
              $(containerElm.childNodes[index]).before(ctrl.renderHtml());
            } else {
              $(containerElm).append(ctrl.renderHtml());
            }

            ctrl.postRender();
            ReflowQueue.add(ctrl);
          }
        });

        self._layout.applyClasses(self.items().filter(':visible'));
        self._lastRect = null;

        return self;
      }
370539
function afterHighlightedItemChange(e) {
        if (e.target.isMenu) {
            var el = this.el, menuItem = e.newVal;
            el.setAttribute('aria-activedescendant', menuItem && menuItem.el.id || '');
        }
    }
621022
function(){
    var ItemView;
    this.collection.each(function(item, index){
      ItemView = this.getItemView(item);
      this.addItemView(item, ItemView, index);
    }, this);
  }
8109
function () {
		var items = _.flatten(arguments);
		for (var i = 0, l = items.length; i < l; i++) {
			this.addItem(items[i], this.items.length);
		}
	}
1070535
function(slide) {
		slide.addTo(this._el.slider_item_container);
		slide.on('added', this._onSlideAdded, this);
		slide.on('background_change', this._onBackgroundChange, this);
	}
52677
function (items) {
        var self = this;

        self.items().set(self.create(items).concat(self.items().toArray()));

        return self.renderNew();
      }
414268
def put_nowait(self, item):
        
        self._parent._check_closing()
        with self._parent._sync_mutex:
            if self._parent._maxsize > 0:
                if self._parent._qsize() >= self._parent._maxsize:
                    raise AsyncQueueFull

            self._parent._put_internal(item)
            self._parent._notify_async_not_empty(threadsafe=False)
            self._parent._notify_sync_not_empty()
867510
function() {
			YAHOO.util.Event.addListener(this.el,"change", this.onAddNewItem, this, true);
			this.ddlist.itemRemovedEvt.subscribe(this.onItemRemoved, this, true);
			this.ddlist.listReorderedEvt.subscribe(this.fireUpdatedEvt, this, true);
		}