void OutputItemContentWidget::update(const MongoQueryInfo &inf,const std::vector<MongoDocumentPtr> &documents)
    {
        _queryInfo = inf;
        _documents = documents;

        _header->paging()->setSkip(_queryInfo.skip);
        _header->paging()->setBatchSize(_queryInfo.batchSize);

        _text.clear();
        _isFirstPartRendered = false;
        markUninitialized();

        if (_bsonTable) {
            _stack->removeWidget(_bsonTable);
            delete _bsonTable;
            _bsonTable = NULL;
        }

        if (_bsonTreeview) {
            _stack->removeWidget(_bsonTreeview);
            delete _bsonTreeview;
            _bsonTreeview = NULL;
        }

        if (_textView) {
            _stack->removeWidget(_textView);
            delete _textView;
            _textView = NULL;
        }
        configureModel();
    }
    void OutputItemContentWidget::update(const std::vector<MongoDocumentPtr> &documents)
    {
        _documents = documents;
        _text.clear();
        _isFirstPartRendered = false;
        markUninitialized();

        if (_bsonTable) {
            _stack->removeWidget(_bsonTable);
            delete _bsonTable;
            _bsonTable = NULL;
        }

        if (_bsonTreeview) {
            _stack->removeWidget(_bsonTreeview);
            delete _bsonTreeview;
            _bsonTreeview = NULL;
        }

        if (_textView) {
            _stack->removeWidget(_textView);
            delete _textView;
            _textView = NULL;
        }
    }
    void OutputItemContentWidget::setup()
    {
        markUninitialized();

        _isFirstPartRendered = false;
        _log = NULL;
        _bson = NULL;
        _thread = NULL;

        setContentsMargins(0, 0, 0, 0);
        _stack = new QStackedWidget;

        QVBoxLayout *layout = new QVBoxLayout();
        layout->setContentsMargins(0, 0, 0, 0);
        layout->setSpacing(0);
        layout->addWidget(_stack);
        setLayout(layout);
    }
    void OutputItemContentWidget::update(const std::vector<MongoDocumentPtr> &documents)
    {
        _documents = documents;
        _sourceIsText = false;
        _isFirstPartRendered = false;
        markUninitialized();

        if (_bson) {
            _stack->removeWidget(_bson);
            delete _bson;
            _bson = NULL;
        }

        if (_log) {
            _stack->removeWidget(_log);
            delete _log;
            _log = NULL;
        }
    }
    void OutputItemContentWidget::update(const QString &text)
    {
        _text = text;
        _sourceIsText = true;
        _isFirstPartRendered = false;
        markUninitialized();

        if (_bson) {
            _stack->removeWidget(_bson);
            delete _bson;
            _bson = NULL;
        }

        if (_log) {
            _stack->removeWidget(_log);
            delete _log;
            _log = NULL;
        }
    }