コード例 #1
0
ファイル: List.js プロジェクト: vinisketch/VSToolkit
/**
 * @private
 */
function tabListRenderData (itemsSelectable)
{
  if (!this._model) { return; }
     
  var _list_items = this._list_items, _direct_access = this._direct_access,
    index, item, title,
    s, width, titles, i, items;
  if (!_list_items) { return; }
   
// remove all children
  this._freeListItems ();
  this.__direct_access_letters = [];
  
  vs_utils.removeAllElementChild (_list_items);
  if (_direct_access) vs_utils.removeAllElementChild (_direct_access);

  if (vs_utils.SUPPORT_3D_TRANSFORM)
    vs_utils.setElementTransform (_list_items, 'translate3d(0,0,0)');
  else
    vs_utils.setElementTransform (_list_items, 'translate(0,0)');

  var parentElement = _list_items.parentElement;
  parentElement.removeChild (_list_items);
  if (_direct_access) this.view.removeChild (_direct_access);
  
  index = 0;
  vs_utils.setElementVisibility (_list_items, false);
  var title_index = 0;
  while (index < this._model.length)
  {
    item = this._model.item (index);
    title = null;
    if (vs_utils.isString (item))
    {
      title = item; index ++;
      var elem = document.createElement ('div'),
        letter = title [0];
      vs_utils.setElementInnerText (elem, letter);
      this.__direct_access_letters.push (letter);
      elem._index_ = title_index++;
      if (_direct_access) _direct_access.appendChild (elem);
    }

    s = buildSection (this, title, index, itemsSelectable);
    _list_items.appendChild (s[0]);
    index = s[1];
  }
  parentElement.appendChild (_list_items);
  if (_direct_access) this.view.appendChild (_direct_access);
  _list_items.style.width = 'auto';
  vs_utils.setElementVisibility (_list_items, true);
};
コード例 #2
0
ファイル: List.js プロジェクト: vinisketch/VSToolkit
/**
 * @private
 */
function blockListRenderData (itemsSelectable)
{
  if (!this._model) { return; }
     
  var _list_items = this._list_items, index, item, title,
    s, width, titles, i, items;
  if (!_list_items) { return; }
   
// remove all children
  this._freeListItems ();
  
  vs_utils.removeAllElementChild (_list_items);

  if (vs_utils.SUPPORT_3D_TRANSFORM)
    vs_utils.setElementTransform (_list_items, 'translate3d(0,0,0)');
  else
    vs_utils.setElementTransform (_list_items, 'translate(0,0)');

  var parentElement = _list_items.parentElement;
  parentElement.removeChild (_list_items);
  
  index = 0;
  vs_utils.setElementVisibility (_list_items, false);
  
  while (index < this._model.length)
  {
    item = this._model.item (index);
    title = null;
    if (vs_utils.isString (item))
    {
      title = item; index ++;
    }

    s = buildSection (this, title, index, itemsSelectable);
    _list_items.appendChild (s[0]);
    index = s[1];
  }
  parentElement.appendChild (_list_items);
  {
    _list_items.style.width = 'auto';
  }
  vs_utils.setElementVisibility (_list_items, true);
};
コード例 #3
0
ファイル: List.js プロジェクト: vinisketch/VSToolkit
/**********************************************************************
        
        
*********************************************************************/

/**
 * @private
 */
function defaultListRenderData (itemsSelectable)
{
  if (!this._model) { return; }
     
  var _list_items = this._list_items, index, item, title,
    s, width, titles, i, items, listItem;
  if (!_list_items) { return; }
   
  // remove all children
  this._freeListItems ();
  
  vs_utils.removeAllElementChild (_list_items);
  
  if (vs_utils.SUPPORT_3D_TRANSFORM)
    vs_utils.setElementTransform (_list_items, 'translate3d(0,0,0)');
  else
    vs_utils.setElementTransform (_list_items, 'translate(0,0)');

  var parentElement = _list_items.parentElement;
  parentElement.removeChild (_list_items);
  
  index = 0;
  vs_utils.setElementVisibility (_list_items, false);
        
  while (index < this._model.length)
  {
    item = this._model.item (index);
    if (this.__template_class)
    {
      listItem = new this.__template_class () .init ();
    }
    else if (this.__template_obj)
    {
      listItem = this.__template_obj.clone ();
    }
    else
    {
      listItem = new DefaultListItem ().init ();
    }
    // model update management
    if (item instanceof vs_core.Model)
    {
      listItem.link (item);
    }
    else
    {
      listItem.configure (item);
    }
    listItem.index = index;

    if (itemsSelectable)
    {
      addPointerListener (listItem.view, POINTER_START, this);
    }
    _list_items.appendChild (listItem.view);
    this.__item_obs.push (listItem);
    listItem.__parent = this;
    index ++;
  }
  parentElement.appendChild (_list_items);
  _list_items.style.width = 'auto';

  vs_utils.setElementVisibility (_list_items, true);
};