DataTreeTable::DataTreeTable(const int pId, Wt::WContainerWidget *parent) { /* addColumn("Size", 80); addColumn("Type", 110); addColumn("Modified", 110); header(1)->setStyleClass("fsize"); header(2)->setStyleClass("date"); header(3)->setStyleClass("date"); */ /* org::esb::sql::Connection con(org::esb::config::Config::getProperty("db.connection")); org::esb::sql::Statement pstmt=con.createStatement("select * from files where parent=0"); org::esb::sql::ResultSet rs=pstmt.executeQuery(); */ // if(rs.next()) DataTreeTableNode *root=new DataTreeTableNode("",0,0,false); DataTreeTableNode *files=new DataTreeTableNode("Files"); DataTreeTableNode *versions=new DataTreeTableNode("Versions"); DataTreeTableNode *profiles=new DataTreeTableNode("Profiles"); root->addChildNode(files); root->addChildNode(versions); root->addChildNode(profiles); setTreeRoot(root,""); treeRoot()->setImagePack("icons/"); treeRoot()->expand(); // tree()->itemSelectionChanged.connect(SLOT(this,DataTreeTable::dataSelected)); }
void rbt_insert(struct rbt* tree, int vruntime, struct _sthread *thread){ struct node *add_item = create_node(tree, vruntime, thread); if(rbt_is_empty(tree)) { add_item->color = BLACK; tree->root = add_item; tree->first = tree->root; return; } struct node *current_node = tree->root; if(vruntime == tree->root->vruntime) add_thread(current_node, add_item); else if(vruntime < current_node->vruntime) insert_node_left(tree, current_node->left, current_node, add_item); else insert_node_right(tree, current_node->right, current_node, add_item); correctDoubleRed(tree, add_item); treeRoot(tree); lower(tree); }
void WTreeTable::setTree(WTree *root, const WString& h) { WContainerWidget *parent = dynamic_cast<WContainerWidget *>(tree_->parent()); delete tree_; parent->addWidget(tree_ = root); header(0)->setText(h); tree_->resize(WLength(100, WLength::Percentage), WLength::Auto); treeRoot()->setTable(this); }
void WTreeTable::setTree(std::unique_ptr<WTree> root, const WString& h) { WContainerWidget *parent = dynamic_cast<WContainerWidget *>(tree_->parent()); parent->removeWidget(tree_); tree_ = root.get(); parent->addWidget(std::move(root)); header(0)->setText(h); tree_->resize(WLength(100, LengthUnit::Percentage), WLength::Auto); treeRoot()->setTable(this); }
static void treeDup (tree_t* tp, int J) { int M = treeSize(tp); int L = treeRoot(tp); int LL = prevRoot(tp); int i, LS = L + (J-1)*M - 1; for (i = L; i <= LS; i++) { if ((i-L)%M == 0) tp->p[i+M] = LL; else tp->p[i+M] = tp->p[i] + M; } tp->top = LS + M; }
void WTreeTable::addColumn(const WString& header, const WLength& width) { if (treeRoot()) throw WException("WTreeTable::addColumn(): must be called before " "setTreeRoot()"); std::unique_ptr<WText> t(new WText(header)); t->resize(width, WLength::Auto); t->setInline(false); t->setFloatSide(Side::Left); headerContainer_->addWidget(std::move(t)); columnWidths_.push_back(width); }
struct _sthread *rbt_remove(struct rbt *tree, int vruntime) { struct node *delete_node = rbt_find(tree, vruntime); struct node *y; struct node *x; struct _sthread *thread; if(delete_node == NULL){ printf("Node with vruntime = %d doesn't exist\n", vruntime); return NULL; } if (delete_node->queue->first->next != NULL) return queue_remove(delete_node->queue); if(delete_node->left == tree->nil || delete_node->right == tree->nil) y = delete_node; else { y = sucessor(tree, delete_node); if(!(y->color == RED || !black_leef(tree, y))) y = predecessor(tree, delete_node); } if (y->left != tree->nil) x = y->left; else x = y->right; x->parent = y->parent; if (y->parent == tree->nil) tree->root = x; else { if (y == y->parent->left) y->parent->left = x; else y->parent->right = x; } if(y != delete_node){ substitute(tree, delete_node, y); if (isRoot(tree, y)) tree->root = y; } if (y == tree->first){ if (y->parent == tree->nil && y->right != tree->nil) tree->first = minimum(tree, y->right); else tree->first = x->parent; } if(y->color == BLACK) delete_fixup(tree, x); treeRoot(tree); lower(tree); thread = queue_remove(y->queue); destroy_node(y); return thread; }