Esempio n. 1
0
void BasicData::send_uml_def(ToolCom * com, BrowserNode * bn,
			     const QString & comment) {
  if (browser_node != 0) {
    BrowserNode * d = browser_node->get_associated();
    
    if (d != browser_node) {
      // may have an associated diagram/view
      if ((d != 0) && !d->deletedp())
	d->write_id(com);
      else
	com->write_id(0);
    }
  }
  
  com->write_string(stereotype);
  ((HaveKeyValueData *) bn)->send_def(com);
  com->write_string(comment);
  
  int api = com->api_format();
  
  if (api > 11) {
    com->write_bool(bn->markedp());
    if (api > 30)
      com->write_unsigned(bn->get_identifier());
  }
}
Esempio n. 2
0
void ReferenceDialog::mark_unmark()
{
    BrowserNode * bn = nodes.at(results->currentItem());

    bn->toggle_mark();  	// call update
    BrowserView::force_visible(bn);
}
Esempio n. 3
0
void PackageCanvas::prepare_for_move(bool on_resize) {
  if (! on_resize) {
    DiagramCanvas::prepare_for_move(on_resize);
    
    Q3CanvasItemList l = collisions(TRUE);
    Q3CanvasItemList::ConstIterator it;
    Q3CanvasItemList::ConstIterator end = l.end();
    DiagramItem * di;
    BrowserNode * p = get_bn();
  
    for (it = l.begin(); it != end; ++it) {
      if ((*it)->visible() && // at least not deleted
	  !(*it)->selected() &&
	  ((di = QCanvasItemToDiagramItem(*it)) != 0) &&
	  di->move_with_its_package()) {
	BrowserNode * bn = di->get_bn();
	
	do
	  bn = (BrowserNode *) bn->parent();
	while (bn->get_type() != UmlPackage);
	
	if (bn == p) {
	  the_canvas()->select(*it);
	  di->prepare_for_move(FALSE);
	}
      }
    }
  }
}
void BrowserOperation::post_duplicate()
{
    BrowserNode * x_of;
    void (BrowserOperation::*set_x_of)(BrowserNode *);

    if (get_of != 0) {
        x_of = get_of;
        get_of = 0;
        set_x_of = &BrowserOperation::set_get_of;
    }
    else if (set_of != 0) {
        x_of = set_of;
        set_of = 0;
        set_x_of = &BrowserOperation::set_set_of;
    }
    else
        return;

    // search for attribute/relation

    QString s = x_of->get_name();
    UmlCode k = x_of->get_type();
    BrowserNode * child;

    for (child = ((BrowserNode *)parent())->firstChild(); child != 0; child = child->nextSibling()) {
        if ((((BrowserNode *) child)->get_type() == k) &&
                ((BrowserNode *) child)->get_name() == s) {
            // this one
            (this->*set_x_of)((BrowserNode *) child);
            break;
        }
    }
}
Esempio n. 5
0
// have marked elements not yet drawn ?
static bool marked_not_yet_drawn(Q3PtrDict<DiagramItem> & drawn)
{
  const Q3PtrList<BrowserNode> & l = BrowserNode::marked_nodes();
  Q3PtrListIterator<BrowserNode> it(l);
  BrowserNode * bn;
      
  for (; (bn = it.current()) != 0; ++it) {
    UmlCode k = bn->get_type();
    
    switch (k) {
    default:
      if (!IsaSimpleRelation(k))
	break;
      // no break
    case UmlComponent:
    case UmlDeploymentNode:
    case UmlArtifact:
    case UmlPackage:
      if (drawn[bn->get_data()] == 0)
	return TRUE;
    }
  }
  
  return FALSE;
}
Esempio n. 6
0
// check inheritance
QString BrowserNode::check_inherit(const BrowserNode * new_parent) const {
  Q3PtrList<BrowserNode> all_parents;
  Q3PtrList<BrowserNode> notyet = parents();

  if (notyet.findRef(new_parent) != -1)
    return TR("already generalize / realize");
  
  notyet.append(new_parent);
  
  do {
    BrowserNode * cl = notyet.getFirst();
    
    notyet.removeFirst();
    if (cl == this)
      return TR("can't have circular generalization / realization");
    if (all_parents.findRef(cl) == -1) {
      all_parents.append(cl);
      
      Q3PtrList<BrowserNode> grand_parents = cl->parents();
      
      for (cl = grand_parents.first(); cl; cl = grand_parents.next())
	if (notyet.findRef(cl) == -1)
	  notyet.append(cl);
    }
  } while (! notyet.isEmpty());
  
  return 0;
}
Esempio n. 7
0
void ReferenceDialog::compute() {
  QApplication::setOverrideCursor(Qt::waitCursor);

  Q3PtrList<BrowserNode> l;
  BrowserNode * bn;
  
  nodes.clear();
  results->clear();
  target->referenced_by(l);
  for (bn = l.first(); bn; bn = l.next())
    nodes.append(bn);
  
  nodes.sort();
  
  // remove duplicats
  nodes.first();
  while ((bn = nodes.current()) != 0)
    if (bn == nodes.next())
      nodes.remove();
  
  QStringList names;
  
  nodes.full_names(names);
  
  QStringList::Iterator it;
  
  for (bn = nodes.first(), it = names.begin();
       bn;
       bn = nodes.next(), ++it)
    results->insertItem(*(bn->pixmap(0)), *it);
  
  selected((nodes.isEmpty()) ? -1 : 0);

  QApplication::restoreOverrideCursor();
}
Esempio n. 8
0
bool RelationData::undelete(QString & warning, QString & renamed,
                            BrowserRelation * rel, BooL & br_deleted)
{
    QString s;
    bool changed = FALSE;
    BrowserNode * parent = (BrowserNode *) rel->parent();

    if (is_a(rel)) {
        while (parent->wrong_child_name(a.role, type, FALSE, TRUE)) {
            changed = TRUE;
            a.role = "_" + a.role;
        }
    }
    else {
        while (parent->wrong_child_name(b.role, type, FALSE, TRUE)) {
            changed = TRUE;
            b.role = "_" + b.role;
        }
    }

    br_deleted = FALSE;
    undelete(warning, renamed);

    return changed;
}
void QuickEdit::SetupExtraNodeController()
{

    extraNodeController = QSharedPointer<ItemController<BrowserNode> >( new ItemController<BrowserNode>());
    extraNodeController->SetColumns(columns);
    ADD_GETSET(BrowserExtraMember, extraNodeController, columns.indexOf("name"), QVector<int>({Qt::DisplayRole,Qt::EditRole}),
               toString().toLatin1().constData, get_name, set_name);

    ADD_GETSET(BrowserExtraMember, extraNodeController, columns.indexOf("deleted"), QVector<int>({Qt::DisplayRole,Qt::EditRole}),
               toBool, deletedp, set_deleted);

    ADD_PIXMAP_GETTER(BrowserExtraMember, extraNodeController, columns.indexOf("name"), QVector<int>({Qt::DecorationRole}), pixmap);

    extraNodeController->AddFlagsFunctor
            (
                [&](const QModelIndex& index)
    {
        Qt::ItemFlags result;
        result |= Qt::ItemIsSelectable;
        if(!(index.column() *in(columns.indexOf("name"), columns.indexOf("deleted"))))
            return result;

        TreeItemInterface* iface = static_cast<TreeItemInterface*>(index.internalPointer());
        if(!iface)
            return result;
        BrowserNode* pointer = static_cast<BrowserNode*>(iface->InternalPointer());
        if(!pointer)
            return result;
        if(pointer->is_writable())
            result |= Qt::ItemIsEditable;
        result |=  Qt::ItemIsEnabled;
        return result;
    }
    );
}
Esempio n. 10
0
void AnnotationDialog::add_annotation()
{
    const int ndefault =
        sizeof(DefaultAnnotations) / sizeof(*DefaultAnnotations);
    int added_index = cb->currentItem();
    QString added;

    if (added_index < ndefault)
        added = DefaultAnnotations[added_index];
    else {
        BrowserNode * cl = annotations.at(added_index - ndefault);
        added = cl->get_name();

        // have member ?
        int n = 0;
        QString first_name;
        Q3ListViewItem * child;

        for (child = cl->firstChild(); child != 0; child = child->nextSibling()) {
            if (!((BrowserNode *) child)->deletedp()) {
                switch (((BrowserNode *) child)->get_type()) {
                case UmlClass:
                case UmlExtraMember:
                    break;

                default:
                    switch (++n) {
                    case 1:
                        first_name = ((BrowserNode *) child)->get_name();
                        break;

                    case 2:
                        added += "(" + first_name + QString("=, ")
                                 + ((BrowserNode *) child)->get_name() + "=";
                        break;

                    default:
                        added += QString(", ") + ((BrowserNode *) child)->get_name() + QString("=");
                    }
                }
            }
        }

        switch (n) {
        case 0:
            break;

        case 1:
            added += "()";
            break;

        default:
            added += ")";
        }
    }

    e->insert("@" + added + "\n");
    e->setFocus();
}
Esempio n. 11
0
void QuickEdit::AddOperation()
{
    QModelIndex current = ui->tvEditor->selectionModel()->currentIndex();
    if(!current.isValid())
        return;

    current = current.sibling(current.row(), 0);
    TreeItemInterface *itemAsInterface = static_cast<TreeItemInterface*>(current.internalPointer());
    BrowserNode* currentNode = static_cast<BrowserNode*>(itemAsInterface->InternalPointer());

    BrowserClass* classNode;

    int newItemPosition = 0;
    if(currentNode->TypeID()  == TypeIdentifier<BrowserClass>::id())
    {
        classNode = static_cast<BrowserClass*>(currentNode);
        newItemPosition = itemAsInterface->childCount();
    }
    else if(currentNode->TypeID()  == TypeIdentifier<BrowserOperation>::id() && current.parent().isValid())
    {
        itemAsInterface = static_cast<TreeItemInterface*>(current.parent().internalPointer());
        classNode = static_cast<BrowserClass*>(itemAsInterface->InternalPointer());
        newItemPosition = current.row()+1;
        current = current.parent();
    }
    else
        return;

    if(!classNode)
        return;
    BrowserOperation* newOperation = static_cast<BrowserOperation*>(classNode->addOperation());
    classNode->move(newOperation, currentNode);
    classNode->select_in_browser();
    QModelIndex parentIndex;
    TreeItemInterface* parent;
    if(treeModel->parent(current).isValid())
    {
        parentIndex = treeModel->parent(current);
        parentIndex = parentIndex.sibling(parentIndex.row(), 0);
        parent =  static_cast<TreeItemInterface*>(parentIndex.internalPointer());
    }
    else
        parent = treeModel->RootItem();
    int insertIndex = parent->GetIndexOfChild(itemAsInterface);
    QSharedPointer<TreeItemInterface> sharedOfOperation =  parent->GetChildren()[insertIndex];

    if(!treeModel->insertRows(newItemPosition-1, 1, current))
        return;

    if(!current.isValid())
        return;

    QModelIndex newItem = treeModel->index(newItemPosition-1,0,current);
    TreeItemInterface *newItemInterface = static_cast<TreeItemInterface*>(newItem.internalPointer());
    TreeItem<BrowserNode>* newItemAsNode = static_cast<TreeItem<BrowserNode>*>(newItemInterface);
    newItemAsNode->SetController(operationController);
    newItemAsNode->SetParent(sharedOfOperation);
    newItemAsNode->SetInternalData(newOperation);
}
Esempio n. 12
0
void PseudoStateDialog::menu_reference()
{
    Q3PopupMenu m(0);

    m.insertItem(TR("Choose"), -1);
    m.insertSeparator();

    int index = reflist.findIndex(edreference->currentText());

    if (index != -1)
        m.insertItem(TR("Select in browser"), 0);

    BrowserNode * bn = 0;

    if (! visit) {
        bn = BrowserView::selected_item();

        if ((bn != 0) &&
            !bn->deletedp() &&
            ((BrowserPseudoState *) pst->browser_node)->can_reference(bn))
            m.insertItem(TR("Choose pseudo state selected in browser"), 1);
        else
            bn = 0;
    }

    if ((index != -1) || (bn != 0)) {
        switch (m.exec(QCursor::pos())) {
        case 0:
            pseudostates.at(index)->select_in_browser();
            break;

        case 1: {
            QString s = bn->full_name(TRUE);

            if ((index = reflist.findIndex(s)) == -1) {
                // new state, may be created through an other dialog
                index = 0;
                QStringList::Iterator iter = reflist.begin();
                QStringList::Iterator iter_end = reflist.end();

                while ((iter != iter_end) && (*iter < s)) {
                    ++iter;
                    index += 1;
                }

                pseudostates.insert((unsigned) index, bn);
                reflist.insert(iter, s);
                edreference->insertItem(s, index + 1);
            }
        }

        edreference->setCurrentItem(index + 1);
        break;

        default:
            break;
        }
    }
}
Esempio n. 13
0
BrowserNode * DeploymentNodeCanvas::new_type() {
  BrowserNode * container = (BrowserNode *)
    the_canvas()->browser_diagram()->parent();
  
  return (container->is_writable())
    ? BrowserDeploymentNode::add_deploymentnode(container)
    : 0;
}
Esempio n. 14
0
BrowserNode * BrowserNode::get_container(UmlCode k) const {
  BrowserNode * p  = (BrowserNode *) this;
  
  while ((p != 0) && (p->get_type() != k))
    p = (BrowserNode *) p->parent();
  
  return p;
}
Esempio n. 15
0
void BrowserArtifact::prepare_update_lib() const
{
    all.memo_id_oid(get_ident(), original_id);
    for (BrowserNode * child = firstChild();
         child != 0;
         child = child->nextSibling())
        ((BrowserNode *) child)->prepare_update_lib();
}
Esempio n. 16
0
void ActivityDialog::menu_specification()
{
    Q3PopupMenu m(0);

    m.insertItem(TR("Choose"), -1);
    m.insertSeparator();

    int index = list.findIndex(edspecification->currentText().stripWhiteSpace());

    if (index != -1)
        m.insertItem(TR("Select in browser"), 0);

    BrowserNode * bn = 0;

    if (! visit) {
        bn = BrowserView::selected_item();

        if ((bn != 0) && (bn->get_type() == UmlOperation) && !bn->deletedp())
            m.insertItem(TR("Choose operation selected in browser"), 1);
        else
            bn = 0;
    }

    if ((index != -1) || (bn != 0)) {
        switch (m.exec(QCursor::pos())) {
        case 0:
            opers.at(index)->select_in_browser();
            break;

        case 1: {
            QString s = bn->full_name(TRUE);

            if ((index = list.findIndex(s)) == -1) {
                // new operation, may be created through an other dialog
                index = 0;
                QStringList::Iterator iter = list.begin();
                QStringList::Iterator iter_end = list.end();

                while ((iter != iter_end) && (*iter < s)) {
                    ++iter;
                    index += 1;
                }

                opers.insert((unsigned) index, bn);
                list.insert(iter, s);
                edspecification->insertItem(s, index + 1);
            }
        }

        edspecification->setCurrentItem(index + 1);
        break;

        default:
            break;
        }
    }
}
Esempio n. 17
0
ConstraintTable::ConstraintTable(QWidget * parent, ConstraintCanvas * c)
    : Q3Table(c->elements.count(), 4, parent)
{
    setSorting(true);
    setSelectionMode(NoSelection);
    setRowMovingEnabled(FALSE);

    horizontalHeader()->setLabel(0, TR("visible"));
    horizontalHeader()->setLabel(1, " ");
    horizontalHeader()->setLabel(2, TR("element"));
    horizontalHeader()->setLabel(3, TR("constraint"));
    setColumnStretchable(0, FALSE);
    setColumnStretchable(1, FALSE);

    int row;
    bool v = c->indicate_visible;
    Q3ValueList<BrowserNode *> & hv = c->hidden_visible;
    BrowserNodeList & elts = c->elements;
    BrowserNode * bn;
    QString yes = TR("  yes");
    QString empty;

    elts.sort();

    for (bn = elts.first(), row = 0; bn != 0; bn = elts.next(), row += 1) {
        if ((v) ? hv.findIndex(bn) != -1 : hv.findIndex(bn) == -1)
            setText(row, 0, yes);

        setPixmap(row, 1, *(bn->pixmap(0)));

        TableItem * ti;

        ti = new TableItem(this, Q3TableItem::Never, bn->full_name(TRUE));
        ti->setReplaceable(FALSE);
        setItem(row, 2, ti);

        QString s = toUnicode(bn->constraint());
        int n = s.count('\n');

        ti = new TableItem(this, Q3TableItem::Never, s);
        ti->setReplaceable(FALSE);
        setItem(row, 3, ti);

        if (n != 0) {
            // note : adjustRow(row) does nothing
            setRowHeight(row, rowHeight(row) * (n + 1));
        }
    }

    adjustColumn(0);
    adjustColumn(1);
    setColumnStretchable(2, TRUE);
    setColumnStretchable(3, TRUE);

    connect(this, SIGNAL(pressed(int, int, int, const QPoint &)),
            this, SLOT(button_pressed(int, int, int, const QPoint &)));
}
Esempio n. 18
0
void QuickEdit::AddParameter()
{
    QModelIndex current = ui->tvEditor->selectionModel()->currentIndex();
    if (!current.isValid())
        return;

    current = current.sibling(current.row(), 0);
    TreeItemInterface* itemAsInterface = static_cast<TreeItemInterface*>(current.internalPointer());
    BrowserNode* currentNode = static_cast<BrowserNode*>(itemAsInterface->InternalPointer());

    BrowserOperation* operationNode;

    if (currentNode->TypeID() == TypeIdentifier<BrowserOperation>::id())
    {
        operationNode = static_cast<BrowserOperation*>(currentNode);
    }
    else if (currentNode->TypeID() == TypeIdentifier<BrowserOperationAttribute>::id())
    {
        operationNode = static_cast<BrowserOperationAttribute*>(currentNode)->get_operation();
        itemAsInterface = itemAsInterface->parent();
        current = current.parent();
    }
    else
        return;

    OperationData* currentData = static_cast<OperationData*>(operationNode->get_data());
    int originalParamCount = currentData->nparams;
    currentData->set_n_params(originalParamCount + 1);
    QModelIndex parentIndex = current.parent();

    parentIndex = parentIndex.sibling(parentIndex.row(), 0);
    TreeItemInterface* parent = static_cast<TreeItemInterface*>(parentIndex.internalPointer());
    if (!parent)
        parent = treeModel->RootItem();
    int insertIndex = parent->GetIndexOfChild(itemAsInterface);
    auto sharedOfOperation = parent->GetChildren()[insertIndex];

    int newItemPosition = currentData->nparams;
    if (!treeModel->insertRows(sharedOfOperation->childCount(), 1, current))
        return;

    QSharedPointer<BrowserNode> param(new BrowserOperationAttribute(dummyView,
                                                                    static_cast<BrowserOperation*>(operationNode),
                                                                    currentData->params.last()));
    localNodeHolder.push_back(param);
    if (!current.isValid())
        return;
    QModelIndex newItem = treeModel->index(sharedOfOperation->childCount() - 1, 0, current);
    TreeItemInterface *newItemInterface = static_cast<TreeItemInterface*>(newItem.internalPointer());
    TreeItem<BrowserNode>* newItemAsNode = static_cast<TreeItem<BrowserNode>*>(newItemInterface);
    newItemAsNode->SetController(operationAttributeController);
    newItemAsNode->SetParent(sharedOfOperation);
    newItemAsNode->SetInternalData(param.data());
    operationNode->modified();
    OperationFuncs::recompute_param(operationNode, newItemPosition - 1, true);
}
Esempio n. 19
0
bool BrowserNode::toggle_show_stereotypes() {
  show_stereotypes = !show_stereotypes;

  BrowserNode * prj = BrowserView::get_project();
  
  if (prj != 0)
    prj->update_stereotype(TRUE);
  
  return show_stereotypes;
}
Esempio n. 20
0
void ReferenceDialog::mark_them() {
  BrowserNode * bn;
    
  for (bn = nodes.first(); bn != 0; bn = nodes.next()) {
    if (! bn->markedp()) {
      bn->toggle_mark();  	// call update
      BrowserView::force_visible(bn);
    }
  }
}
Esempio n. 21
0
void BasicDialog::accept() {
  if (!check_edits(edits) || !kvtable->check_unique())
    return;
    
  BrowserNode * bn = data->get_browser_node();

  if (edname != 0) {
    QString s = edname->text().stripWhiteSpace();

    if ((s != bn->get_name()) &&
	((BrowserNode *) bn->parent())->wrong_child_name(s, bn->get_type(),
							 bn->allow_spaces(),
							 bn->allow_empty())) {
      msg_critical(TR("Error"), edname->text() + TR("\n\nillegal name or already used"));
      return;
    }
    else
      bn->set_name(s);
  }

  bool newst = data->set_stereotype(fromUnicode(edstereotype->currentText().stripWhiteSpace()));
  
  bn->set_comment(comment->text());
  UmlWindow::update_comment_if_needed(bn);
    
  kvtable->update(bn);
  
  ProfiledStereotypes::modified(bn, newst);
  
  bn->package_modified();
  data->modified();
    
  Q3TabDialog::accept();
}
Esempio n. 22
0
void ConstraintTable::hide_inherited(ConstraintCanvas * c)
{
    BrowserNode * cl = c->cl->get_bn();
    BrowserNodeList & elts = c->elements;
    BrowserNode * bn;
    int row;
    QString yes = TR("  yes");
    QString empty;

    for (bn = elts.first(), row = 0; bn != 0; bn = elts.next(), row += 1)
        setText(row, 0,
                ((bn == cl) || (bn->parent() == cl)) ? yes : empty);
}
Esempio n. 23
0
void BrowserNode::unconsistent_fixed(const char * what, BrowserNode * newone) {  
  UnconsistencyFixedMsg += QString("<li>") + what + QString(" <i>") +
    quote(full_name()) + QString("</i> and <i>") + 
      quote(newone->full_name()) + QString("</i></li>\n");

  BrowserNode * bn = this;

  while (bn->get_type() != UmlPackage)
    bn = (BrowserNode *) bn->parent();

  if (ModifiedPackages.findRef(bn) == -1)
    ModifiedPackages.append(bn);
}
Esempio n. 24
0
// just check if the inheritance already exist
QString BrowserArtifact::check_inherit(const BrowserNode * new_parent) const
{
    BrowserNode * child;

    for (child = firstChild(); child != 0; child = child->nextSibling()) {
        BrowserNode * ch = ((BrowserNode *) child);

        if ((ch->get_type() == UmlInherit) &&
                ((((SimpleRelationData *) ch->get_data())->get_end_node())
                 == new_parent))
            return QObject::tr("already exist");
    }
    return (new_parent != this) ? QString() : QObject::tr("circular inheritance");
}
Esempio n. 25
0
void BrowserView::update_it()
{
    if (lbl == 0)
        lbl = new QLabel(parentWidget());

    int nold = 0;
    int ndel = 0;

    Q3DictIterator<BrowserNode> itd(nodes);

    for (; itd.current(); ++itd) {
        BrowserNode * bn = itd.current();

        switch (bn->get_state()) {
        case Old:
            nold += 1;
            break;

        case Deleted:
            ndel += 1;
            break;

        default:
            break;
        }
    }

    QString s;

    if (nold != 0) {
        need_update = TRUE;

        s = QString::number(nold) + " need update";

        if (ndel != 0)
            s += ", " + QString::number(ndel) + " deleted";

        if (cant_update)
            s += ", RO !";

        lbl->setText(s);
    }
    else
        lbl->setText("Up to date");

    lbl->show();

    triggerUpdate();
}
Esempio n. 26
0
void DecoratorDialog::add_decorator() {
  const int ndefault = 
    sizeof(DefaultDecorators)/sizeof(*DefaultDecorators);
  int added_index = cb->currentItem();
  QString added;
  
  if (added_index < ndefault)
    added = DefaultDecorators[added_index];
  else {
    BrowserNode * cl = decorators.at(added_index - ndefault);
    added = cl->get_name();
  }
  
  e->insert("@" + added + "\n");
  e->setFocus();
}
Esempio n. 27
0
void ActivityObjectDialog::accept()
{
    if (!check_edits(edits))
        return;

    BrowserNode * bn = data->browser_node;
    QString s = edname->text().stripWhiteSpace();

    bn->set_name(s);

    bool newst = data->set_stereotype(fromUnicode(edstereotype->currentText().stripWhiteSpace()));
    AType t;

    s = edtype->currentText().stripWhiteSpace();

    if (!s.isEmpty()) {
        int index = list.findIndex(s);

        if (index >= 0)
            t.type = (BrowserClass *) nodes.at(index);
        else
            t.explicit_type = s;
    }

    data->set_type(t);
    data->multiplicity =
        edmultiplicity->currentText().stripWhiteSpace();
    data->ordering = ordering(edordering->currentText());
    data->is_control = is_control_cb->isChecked();
    data->in_state = edin_state->text().stripWhiteSpace();
    data->uml_selection = eduml_selection->text().stripWhiteSpace();
    data->cpp_selection = edcpp_selection->text().stripWhiteSpace();
    data->java_selection = edjava_selection->text().stripWhiteSpace();

    bn->set_comment(comment->text());
    UmlWindow::update_comment_if_needed(bn);

    kvtable->updateNodeFromThis(bn);

    ProfiledStereotypes::modified(bn, newst);

    bn->modified();
    bn->package_modified();
    data->modified();

    Q3TabDialog::accept();
}
Esempio n. 28
0
void ClassDiagramView::menu(const QPoint& p) {
  Q3PopupMenu m(0);
  
  MenuFactory::createTitle(m, TR("Class diagram menu"));

  if ((((UmlCanvas *) canvas())->browser_diagram())->is_writable()) {
    BrowserNode * bn = BrowserView::selected_item();
    DiagramItemList items(canvas()->allItems());
    Q3PtrDict<DiagramItem> drawn;
    
    get_drawn(items, drawn);
    
    if ((bn != 0) && (bn->get_type() == UmlClassView)) {      
      if (not_yet_drawn(bn, drawn)) {
	m.insertItem(TR("Add classes of the selected class view"), 29);
	if (marked_not_yet_drawn(drawn))
	  m.insertItem(TR("Add marked elements"), 28);
	m.insertSeparator();
      }
    }
    else if (marked_not_yet_drawn(drawn)) {
      m.insertItem(TR("Add marked elements"), 28);
      m.insertSeparator();
    }
    
    switch (default_menu(m, 30)) {
    case EDIT_DRAWING_SETTING_CMD:
      ((BrowserClassDiagram *) ((UmlCanvas *) canvas())->browser_diagram())->edit_settings();
      break;
    case RELOAD_CMD:
      // pure drawing modifications are lost
      // mark the diagram modified because the undid modifications
      // may be saved in the file are not saved in memory
      load("Class");
      window()->package_modified();
      break;
    case 28:
      add_marked_elements(p, drawn);
      break;
    case 29:
      add_classview_classes(bn, p, drawn);
      break;
    }
  }
  else
    (void) default_menu(m, 30);
}
Esempio n. 29
0
// solve state and return TRUE if Young
bool BrowserNode::solve()
{
    if (state != Unknown)
        return (state == Young);

    // note : parent can't be 0
    BrowserNode * p = (BrowserNode *) parent();

    if ((p->state == Unknown) ? p->solve() : (p->state == Young)) {
        state = Young;
        return TRUE;
    }
    else {
        state = Deleted;
        return FALSE;
    }
}
Esempio n. 30
0
QList<std::function<bool (TreeItemInterface *)> > QuickEdit::CreateCheckList()
{
        QList<std::function<bool (TreeItemInterface *)> > result;
        if(!ui->leSearch->text().trimmed().isEmpty())
        {
            QString value = ui->leSearch->text();
            std::function<bool(TreeItemInterface*)> addressFilterFunc =  [value](TreeItemInterface* iface)
            {
                BrowserNode* data = static_cast<BrowserNode*>(iface->InternalPointer());
                QString name = data->get_name();
                bool match = data->get_name().contains(value, Qt::CaseInsensitive);
                return match;
            };
            result.append(addressFilterFunc);
        }
        return result;
}