void BrowserNodeList::search(BrowserNode * bn, UmlCode k, const QString & s, bool cs, bool even_deleted, bool for_name, bool for_stereotype) { Q3ListViewItem * child; for (child = bn->firstChild(); child != 0; child = child->nextSibling()) { if (even_deleted || !((BrowserNode *) child)->deletedp()) { BrowserNode * ch = (BrowserNode *) child; if (((k == UmlCodeSup) || ((k == UmlRelations) ? IsaRelation(ch->get_type()) : (ch->get_type() == k))) && (s.isEmpty() || (QString((for_name) ? ch->get_name() : ((for_stereotype) ? ch->get_stereotype() : ch->get_comment())) .find(s, 0, cs) != -1))) append((BrowserNode *) child); search((BrowserNode *) child, k, s, cs, even_deleted, for_name, for_stereotype); } } }
ClassInstanceDialog::ClassInstanceDialog(ClassInstanceData * i) : TabDialog(0, "class instance dialog", FALSE, Qt::WA_DeleteOnClose), inst(i), atbl(0), rtbl(0) { setWindowTitle(tr("Class instance dialog")); BrowserNode * bn = inst->get_browser_node(); bn->edit_start(); if (bn->is_writable()) { setOkButton(tr("OK")); setCancelButton(tr("Cancel")); } else { setOkButton(QString()); setCancelButton(tr("Close")); } visit = !hasOkButton(); GridBox * grid; // general tab grid = new GridBox(2, this); grid->setMargin(5); grid->setSpacing(5); grid->addWidget(new QLabel(tr("name : "), grid)); grid->addWidget(edname = new LineEdit(bn->get_name(), grid)); if (visit) edname->setReadOnly(TRUE); grid->addWidget(new QLabel(tr("stereotype :"), grid)); grid->addWidget(edstereotype = new QComboBox( grid)); edstereotype->setEditable(!visit); edstereotype->addItem(toUnicode(bn->get_stereotype())); if (! visit) { edstereotype->addItems(ProfiledStereotypes::defaults(UmlClassInstance)); edstereotype->setAutoCompletion(completion()); } SmallPushButton * b; grid->addWidget(b = new SmallPushButton(tr("class :"), grid)); connect(b, SIGNAL(clicked()), this, SLOT(menu_class())); grid->addWidget(edtype = new QComboBox(grid)); if (visit) { edtype->addItem(inst->get_class()->full_name()); nodes.append(inst->get_class()); } else { BrowserClass::instances(nodes); nodes.full_names(list); edtype->addItems(list); edtype->setCurrentIndex(nodes.indexOf(inst->get_class())); connect(edtype, SIGNAL(activated(int)), this, SLOT(type_changed(int))); } if (visit) cl_container = 0; else { cl_container = (BrowserNode *) bn->parent(); if ((cl_container != 0) && !cl_container->is_writable()) cl_container = 0; } VVBox * vtab; grid->addWidget(vtab = new VVBox(grid)); vtab->addWidget(new QLabel(tr("description :"), vtab)); if (! visit) { connect(b =new SmallPushButton(tr("Editor"), vtab), SIGNAL(clicked()), this, SLOT(edit_description())); vtab->addWidget(b); } grid->addWidget(comment = new MultiLineEdit(grid)); comment->setReadOnly(visit); comment->setText(bn->get_comment()); QFont font = comment->font(); if (! hasCodec()) font.setFamily("Courier"); font.setFixedPitch(TRUE); comment->setFont(font); addTab(grid, "Uml"); // attributes tab atbl = new MyTable(this); atbl->setColumnCount(3); //atbl->setSortingEnabled(true); atbl->setSelectionMode(QTableWidget::NoSelection); // single does not work atbl->verticalHeader()->setSectionsMovable(true); atbl->verticalHeader()->setSectionsMovable(true); atbl->setHorizontalHeaderLabel(0, tr(" Attribute ")); atbl->setHorizontalHeaderLabel(1, tr(" Class ")); atbl->setHorizontalHeaderLabel(2, tr(" Value ")); addTab(atbl, tr("Attributes")); // relation tab if (! inst->relations.isEmpty()) { rtbl = new RelTable(this, inst, visit); addTab(rtbl, tr("Relations")); } // USER : list key - value grid = new GridBox(2, this); grid->setMargin(5); grid->setSpacing(5); grid->addWidget(kvtable = new KeyValuesTable(bn, grid, visit)); addTab(grid, tr("Properties")); type_changed(edtype->currentIndex()); connect(m_tabWidget, SIGNAL(currentChanged(int)), this, SLOT(update_all_tabs(int))); open_dialog(this); }