send in a list of data
 sorting will only happen if data passed using set_content
 NOTE: why doesn't set_content take in columns
 @param [Array / Tabular] data to be displayed
772135
def set_content list, columns=nil
        if list.is_a? Canis::Tabular
          @list = list
        elsif list.is_a? Array
          @list = list
        else
          raise "set_content expects Array not #{list.class}"
        end
        if @table_row_sorter
          @table_row_sorter.model=@list
        else
          @table_row_sorter = TableRowSorter.new @list
        end
        # adding columns setting here 2011-10-16 
        self.columns = columns if columns
        @current_index = @_header_adjustment # but this is set when columns passed
        @toprow = 0
        @second_time = false # so that reestimation of column_widths
        @repaint_required = true
        @recalc_required = true # is this used, if not remove TODO
        self
      end
196684
public void setWrappedData(Object data) {
        if (data == null) {
            inner = null;
            arrayFromInner = null;
            setRowIndex(-1);
        } else {
            inner = (Collection<E>) data;            
            arrayFromInner = (E[]) new Object[inner.size()];
            inner.toArray(arrayFromInner);
            setRowIndex(0);
        }
    }
139143
private void sortData() {
        sortedList.clear();
        for (DataPoint dataPoint : DATA_LIST) {
            sortedList.add(dataPoint.getValue());
        }
        Collections.sort(sortedList);
    }
907044
public void setContent(String data) {

        if (data == null) {
            data = "";
        }

        encodeInfo = "";

        switch (inputDataType) {
            case GS1:
                content = Gs1.verify(data, FNC1_STRING);
                readable = data.replace('[', '(').replace(']', ')');
                break;
            case HIBC:
                content = hibcProcess(data);
                break;
            default:
                content = data;
                break;
        }

        if (content.isEmpty() && !emptyContentAllowed) {
            throw new OkapiException("No input data");
        }

        encode();
        plotSymbol();
        mergeVerticalBlocks();
    }
195518
function send(data) {
                verifyState(this);

                if (!/^(get|head)$/i.test(this.method)) {
                    var contentType = getHeader(this.requestHeaders, "Content-Type");
                    if (this.requestHeaders[contentType]) {
                        var value = this.requestHeaders[contentType].split(";");
                        this.requestHeaders[contentType] = value[0] + ";charset=utf-8";
                    } else if (!(data instanceof FormData)) {
                        this.requestHeaders["Content-Type"] = "text/plain;charset=utf-8";
                    }

                    this.requestBody = data;
                }

                this.errorFlag = false;
                this.sendFlag = this.async;
                this.readyStateChange(FakeXMLHttpRequest.OPENED);

                if (typeof this.onSend == "function") {
                    this.onSend(this);
                }

                this.dispatchEvent(new sinon.Event("loadstart", false, false, this));
            }
1182096
public function sort(array $data)
    {
        foreach ($data['item'] as $position => $item) {
            $page = $this->find($item['id']);

            $sortData = $this->getSortData($position + 1, $item);

            $page->update($sortData);

            if ($data['moved'] == $item['id']) {
                $this->fireResetChildrenUriEvent($page);
            }
        }
        $this->forgetCache();
    }
584820
public function setData(array $data = [])
    {
        $this->default = empty($data);

        $this->data = array_replace([
            static::VISIBLE_COLUMNS => [],
            static::MAX_PER_PAGE    => null,
            static::CONFIG          => null,
            static::PAGE_NUM        => null,
            static::SORT            => null,
            static::ADD_FILTER      => null,
            static::REMOVE_FILTER   => null,
            static::IDENTIFIERS     => [],
            static::ALL             => null,
            static::BATCH           => null,
            static::ACTION          => null,
            static::EXPORT          => null,
            static::FORMAT          => null,
            static::PROFILE         => [],
        ], $data);
    }
1004634
def display_set(self, typ, data, columns):
        
        self.display_section("%s (%d)" % (self._get_name(typ), len(data)))
        headers = tuple(map(self._get_name, columns))
        fmt = self.mk_set_headers(data, columns)
        self.display_headers(fmt, headers)

        for each in data:
            row = tuple(self._get_val(each, k) for k, v in each.items())
            self._print(fmt % row)

        self._print("\n")
332599
function addData($data, $col_id = 0, $row_id = 0) {
        foreach ($data as $row) {
            if ($row === self::CONSOLE_TABLE_HORIZONTAL_RULE) {
                $this->_data[$row_id] = self::CONSOLE_TABLE_HORIZONTAL_RULE;
                $row_id++;
                continue;
            }
            $starting_col = $col_id;
            foreach ($row as $cell) {
                $this->_data[$row_id][$starting_col++] = $cell;
            }
            $this->_updateRowsCols();
            $this->_max_cols = max($this->_max_cols, $starting_col);
            $row_id++;
        }
    }
1121966
private function SetObjData($_table, $_fields, $_data)
    {
        $this->table = $_table;
        $this->fields = $_fields;
        $this->data[] = array();

        if (isset($_data[0]) and is_array($_data[0])) {
            for ($i=0; $i<count($_data); $i++) {
                foreach ($this->fields as $field) {
                    if (isset($_data[$i][$field]) and !$this->IsFieldLocked($field)) {
                        $this->data[$i][$field] = $this->Escape($_data[$i][$field]);
                    }
                }
            }
        } else {
            foreach ($this->fields as $field) {
                if (isset($_data[$field]) and !$this->IsFieldLocked($field)) {
                    $this->data[0][$field] = $this->Escape($_data[$field]);
                }
            }
        }
    }
668416
def tabulate(tabular_data, headers=(), tablefmt="simple",
             floatfmt=_DEFAULT_FLOATFMT, numalign="decimal", stralign="left",
             missingval=_DEFAULT_MISSINGVAL, showindex="default",
             disable_numparse=False):
    
    if tabular_data is None:
        tabular_data = []
    list_of_lists, headers = _normalize_tabular_data(
        tabular_data, headers, showindex=showindex)

    # empty values in the first column of RST tables should be escaped (issue #82)
    # "" should be escaped as "\\ " or ".."
    if tablefmt == 'rst':
        list_of_lists, headers = _rst_escape_first_column(
            list_of_lists, headers)

    # optimization: look for ANSI control codes once,
    # enable smart width functions only if a control code is found
    plain_text = '\t'.join(['\t'.join(map(_text_type, headers))] +
                           ['\t'.join(map(_text_type, row)) for row in list_of_lists])

    has_invisible = re.search(_invisible_codes, plain_text)
    enable_widechars = wcwidth is not None and WIDE_CHARS_MODE
    if tablefmt in multiline_formats and _is_multiline(plain_text):
        tablefmt = multiline_formats.get(tablefmt, tablefmt)
        is_multiline = True
    else:
        is_multiline = False
    width_fn = _choose_width_fn(has_invisible, enable_widechars, is_multiline)

    # format rows and columns, convert numeric values to strings
    cols = list(izip_longest(*list_of_lists))
    numparses = _expand_numparse(disable_numparse, len(cols))
    coltypes = [_column_type(col, numparse=np) for col, np in
                zip(cols, numparses)]
    if isinstance(floatfmt, basestring):  # old version
        # just duplicate the string to use in each column
        float_formats = len(cols) * [floatfmt]
    else:  # if floatfmt is list, tuple etc we have one per column
        float_formats = list(floatfmt)
        if len(float_formats) < len(cols):
            float_formats.extend(
                (len(cols) - len(float_formats)) * [_DEFAULT_FLOATFMT])
    if isinstance(missingval, basestring):
        missing_vals = len(cols) * [missingval]
    else:
        missing_vals = list(missingval)
        if len(missing_vals) < len(cols):
            missing_vals.extend(
                (len(cols) - len(missing_vals)) * [_DEFAULT_MISSINGVAL])
    cols = [[_format(v, ct, fl_fmt, miss_v, has_invisible) for v in c]
            for c, ct, fl_fmt, miss_v in zip(cols, coltypes, float_formats, missing_vals)]

    # align columns
    aligns = [numalign if ct in [int, float] else stralign for ct in coltypes]
    minwidths = [
        width_fn(h) + MIN_PADDING for h in headers] if headers else [0] * len(cols)
    cols = [_align_column(c, a, minw, has_invisible, enable_widechars, is_multiline)
            for c, a, minw in zip(cols, aligns, minwidths)]

    if headers:
        # align headers and add headers
        t_cols = cols or [['']] * len(headers)
        t_aligns = aligns or [stralign] * len(headers)
        minwidths = [max(minw, max(width_fn(cl) for cl in c))
                     for minw, c in zip(minwidths, t_cols)]
        headers = [_align_header(h, a, minw, width_fn(h), is_multiline, width_fn)
                   for h, a, minw in zip(headers, t_aligns, minwidths)]
        rows = list(zip(*cols))
    else:
        minwidths = [max(width_fn(cl) for cl in c) for c in cols]
        rows = list(zip(*cols))

    if not isinstance(tablefmt, TableFormat):
        tablefmt = _table_formats.get(tablefmt, _table_formats["simple"])

    return _format_table(tablefmt, headers, rows,
                         minwidths, aligns, is_multiline)
1343630
def set_content(self, data):
        
        content = self._get_content(data, 'content')

        if content == '':
            content = self._get_content(data, 'summary_detail')

        if content == '':
            if data.get('description'):
                content = data.get('description')

        return content
647172
def load(data)
      data.each do |key, value|
        check_key!(key)
        set(key, value)
      end
    end
1134939
public void setData (Object[] data)
    {
        _data.clear();
        Collections.addAll(_data, data);
        _model.fireTableDataChanged();
    }
573418
function setData(data) {
    let output = [];

    // Clone so that we have our own reference
    data = JSON.parse(JSON.stringify(data));
    
    // Calculate the total height that the scrollbar should be based on the root nodes
    // and all of the items that have been expanded so far.
    let totalHeight = 0;
    forEachExpansion(_(this).expansions, (expansion) => {
        totalHeight += expansion.children;
    });

    updateViewDimensions.call(this, totalHeight);

    // Apply the offsets to the items which is used to keep track of expansions.
    // By ensuring the data has the offset applied to them, we can calculate from
    // here exactly which items are above us and which ones are below us when we 
    // look at the position of the virtual scrollbar.
    for (let i = 0; i < data.length; i++) {
        for (let j = 0; j < data[i].items.length; j++) {
            let item = data[i].items[j];
            item.original = JSON.parse(JSON.stringify(item));
            item.offset = _(this).request[i].offset + j;
            item.parent = data[i].parent;
        }
    }

    // The response from the server should be in a heirarchical structure.
    // This means that we can iterate over this array, and the further we are in the array
    // the deeper the level we're in. 
    //
    // Eg. [null, 1, 1, 2, 3, 3]
    data.forEach((response) => {
        let index = output.findIndex((obj) => {
            return obj.id === response.parent;
        });

        if (index > -1) {
            // If the parent exists, we insert the items directly below it.
            output = output.slice(0, index + 1)
                        .concat(response.items)
                        .concat(output.slice(index + 1));
        } else {
            // If the parent doesn't exist, we prepend. We prepend because of this scenario:
            //
            //       Item 1.1.1
            //    Item 1.2
            //    Item 1.3
            //    Item 1.4
            // Item 2
            // Item 3
            // 
            // In this scenario, we've expanded Item 1, but because it doesn't exist in the output
            // we can only assume it's directly above us. We've also expanded Item 1.1, and again
            // because it's parent isn't visible, and because we know the data is in a heirarchical 
            // structure, we can prepend it.
            output = response.items.concat(output);
        }
    });


    if (_(this).items.length === 0 || _(this).diffMode === 'hard') {
        // Wipe out all of the current items since we don't need them anymore.
        // Easier code wise to just re-instantiate everything and doesn't impact performance.
        while (_(this).items.length) {
            _(this).items.pop().el.remove();
        }


        // Once we've figured out the output, start rendering them
        output.forEach((data) => {
            let item = createItem.call(this, data);
            _(this).view.content.appendChild(item.el);
            _(this).items.push(item);
        });
    } else if (_(this).diffMode === 'soft') {
        // First check what's common, and run updates.
        // We'll also discover what isn't common and therefore track them for removal.
        let removals = [];
        let updated = [];
        _(this).items.forEach((item, index) => {
            let found = false;
            for (let i = 0; i < output.length; i++) {
                if (output[i].id === item.id) {
                    renderItem.call(this, item.el, output[i], true);
                    updated.push(i);
                    found = true;
                    break;
                }
            } 

            if (!found) {
                removals.push(index);
            }
        });

        // Lock the scroll events and track scroll position.
        // When we're adding and removing items, they can adjust
        // the scroll position. So after we made the updates we
        // need to restore the scroll position.
        let oldScrollTop = _(this).view.scrollbar.scrollTop;
        _(this).scrollLocked = true;

        // Remove the items.
        for (let i = removals.length - 1; i >= 0; i--) {
            let index = removals[i];
            _(this).items[index].el.remove();
            _(this).items.splice(index, 1);
        }

        // Insert all of the new items.
        for (let i = 0; i < output.length; i++) {
            if (updated.indexOf(i) === -1) {
                let item = createItem.call(this, output[i]);
                 _(this).view.content.insertBefore(item.el, _(this).view.content.children[i]);
                 _(this).items.splice(i, 0, item);
            }
        }

        // TODO: This can cause a weird slow scrolling bug in Chrome when scrolling up.
        // Was triggered by console.log, could be a latency issue.
        _(this).view.scrollbar.scrollTop = oldScrollTop;
        _(this).scrollLocked = false;
    }
}
454028
function set_sort_order($sort_col, $sort_order = null)
    {
        if ($sort_col != null && ($this->coltypes[$sort_col] || in_array($sort_col, $this->coltypes))) {
            $this->sort_col = $sort_col;
        }
        if ($sort_order != null) {
            $this->sort_order = strtoupper($sort_order) == 'DESC' ? 'DESC' : 'ASC';
        }
    }
1229437
def data=(data)
      raise "not yet used"
      raise "Data nil or invalid" if data.nil? or data.size == 0
      delete_all
      @data = data
      tme = TreeModelEvent.new(0, @data.length-1,:ALL_COLUMNS,  self, :INSERT)
      fire_handler :TREE_MODEL_EVENT, tme
    end