Ejemplo n.º 1
0
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);
    }
  }
}
Ejemplo n.º 2
0
BasicDialog::BasicDialog(BasicData * nd, QString s,
			 const QStringList & default_stereotypes,
			 QSize & sz, bool unnamed)
    : Q3TabDialog(0, 0, FALSE, Qt::WDestructiveClose), data(nd), previous_size(sz) {
  nd->get_browser_node()->edit_start();
  
  if (nd->get_browser_node()->is_writable()) {
    setOkButton(TR("OK"));
    setCancelButton(TR("Cancel"));
  }
  else {
    setOkButton(QString::null);
    setCancelButton(TR("Close"));
  }

  setCaption(TR(s + " dialog"));
  
  bool visit = !hasOkButton();
  
  // general tab
  
  BrowserNode * bn = data->get_browser_node();
  Q3Grid * grid = new Q3Grid(2, this);
  grid->setMargin(5);
  grid->setSpacing(5);

  if (unnamed)
    edname = 0;
  else {
    new QLabel(TR("name : "), grid);
    edname = new LineEdit(bn->get_name(), grid);
    edname->setReadOnly(visit);
  }    
  new QLabel(TR("stereotype : "), grid);
  edstereotype = new Q3ComboBox(!visit, grid);
  edstereotype->insertItem(toUnicode(data->get_stereotype()));
  if (! visit) {
    edstereotype->insertStringList(default_stereotypes);
    edstereotype->insertStringList(ProfiledStereotypes::defaults(bn->get_type()));
    edstereotype->setAutoCompletion(completion());
  }
  edstereotype->setCurrentItem(0);
  QSizePolicy sp = edstereotype->sizePolicy();
  sp.setHorData(QSizePolicy::Expanding);
  edstereotype->setSizePolicy(sp);
  
  Q3VBox * vtab = new Q3VBox(grid);
  new QLabel(TR("description :"), vtab);
  if (! visit)
    connect(new SmallPushButton(TR("Editor"), vtab), SIGNAL(clicked()),
	    this, SLOT(edit_description()));
  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");
  
  // USER : list key - value
  
  grid = new Q3Grid(2, this);
  grid->setMargin(5);
  grid->setSpacing(5);
  
  kvtable = new KeyValuesTable(bn, grid, visit);
  addTab(grid, TR("Properties"));
  
  open_dialog(this);
}
Ejemplo n.º 3
0
TransitionDialog::TransitionDialog(TransitionData * r)
    : TabDialog(0, 0, true, Qt::WA_DeleteOnClose), rel(r)
{
    r->browser_node->edit_start();

    if (r->browser_node->is_writable()) {
        setOkButton(tr("OK"));
        setCancelButton(tr("Cancel"));
    }
    else {
        setOkButton(QString());
        setCancelButton(tr("Close"));
    }

    setWindowTitle(tr("Transition dialog"));
    visit = !hasOkButton();

    BrowserNode * bn = rel->browser_node;
    GridBox * grid;

    //
    // general tab
    //

    grid = new GridBox(2, this);
    umltab = grid;
    grid->setMargin(5);
    grid->setSpacing(5);

    grid->addWidget(new QLabel(tr("name : "), grid));
    grid->addWidget(edname = new LineEdit(bn->get_name(), grid));
    edname->setReadOnly(visit);

    grid->addWidget(new QLabel(tr("stereotype : "), grid));
    grid->addWidget(edstereotype = new QComboBox(grid));
    edstereotype->setEditable(!visit);
    edstereotype->addItem(toUnicode(rel->get_stereotype()));

    if (!visit) {
        //edstereotype->addItems(rel->get_start()->default_stereotypes(type));
        edstereotype->setAutoCompletion(completion());
        edstereotype->addItems(ProfiledStereotypes::defaults(UmlTransition));
    }

    edstereotype->setCurrentIndex(0);
    QSizePolicy sp = edstereotype->sizePolicy();
    sp.setHorizontalPolicy(QSizePolicy::Expanding);
    edstereotype->setSizePolicy(sp);

    if (r->get_start_node() != r->get_end_node())
        internal_cb = 0;
    else {
        grid->addWidget(new QLabel(grid));
        grid->addWidget(internal_cb = new QCheckBox(tr("internal"), grid));
        internal_cb->setChecked(r->internal());
    }

    VVBox * vtab;
    grid->addWidget(vtab = new VVBox(grid));
    vtab->addWidget(new QLabel(tr("description :"), vtab));

    if (! visit)
    {
        SmallPushButton* sButton;
        connect(sButton = new SmallPushButton(tr("Editor"), vtab), SIGNAL(clicked()),
                this, SLOT(edit_description()));
        vtab->addWidget(sButton);
    }

    grid->addWidget(comment = new MultiLineEdit(grid));
    comment->setReadOnly(visit);
    comment->setText(bn->get_comment());
    //comment->setFont(font);

    addTab(grid, "Uml");

    // UML / OCL
    init_tab(ocltab, uml, rel->uml, "Ocl", SLOT(edit_uml_trigger()),
             SLOT(edit_uml_guard()), SLOT(edit_uml_expr()), TRUE);

    // CPP
    init_tab(cppTab, cpp, rel->cpp, "C++", SLOT(edit_cpp_trigger()),
             SLOT(edit_cpp_guard()), SLOT(edit_cpp_expr()),
             GenerationSettings::cpp_get_default_defs());

    // Java
    init_tab(javatab, java, rel->java, "Java", SLOT(edit_java_trigger()),
             SLOT(edit_java_guard()), SLOT(edit_java_expr()),
             GenerationSettings::java_get_default_defs());

    // 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"));

    //

    connect(this, SIGNAL(currentChanged(QWidget *)),
            this, SLOT(change_tabs(QWidget *)));

    open_dialog(this);
}
Ejemplo n.º 4
0
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);
}
Ejemplo n.º 5
0
ExpansionRegionDialog::ExpansionRegionDialog(ExpansionRegionData * nd)
    : TabDialog(0, 0, FALSE, Qt::WA_DeleteOnClose), data(nd)
{
    nd->browser_node->edit_start();

    if (nd->browser_node->is_writable()) {
        setOkButton(TR("OK"));
        setCancelButton(TR("Cancel"));
    }
    else {
        setOkButton(QString());
        setCancelButton(TR("Close"));
    }

    setWindowTitle(TR("Expansion Region dialog"));

    bool visit = !hasOkButton();

    // general tab

    BrowserNode * bn = data->get_browser_node();
    GridBox * grid = new GridBox(2, this);

    umltab = grid;
    grid->setMargin(5);
    grid->setSpacing(5);

    grid->addWidget(new QLabel(TR("name : "), grid));
    grid->addWidget(edname = new LineEdit(bn->get_name(), grid));
    edname->setReadOnly(visit);

    grid->addWidget(new QLabel(TR("stereotype : "), grid));
    grid->addWidget(edstereotype = new QComboBox(grid));
    edstereotype->setEditable(!visit);
    edstereotype->addItem(toUnicode(data->get_stereotype()));

    if (! visit) {
        edstereotype->addItems(BrowserExpansionRegion::default_stereotypes());
        edstereotype->addItems(ProfiledStereotypes::defaults(UmlExpansionRegion));
        edstereotype->setAutoCompletion(completion());
    }

    edstereotype->setCurrentIndex(0);
    QSizePolicy sp = edstereotype->sizePolicy();
    sp.setHorizontalPolicy(QSizePolicy::Expanding);
    edstereotype->setSizePolicy(sp);

    HHBox * htab;

    grid->addWidget(new QLabel(TR("mode :"), grid));
    grid->addWidget(htab = new HHBox(grid));
    htab->addWidget(edmode = new QComboBox(htab));

    UmlExpansionKind m = data->get_mode();

    edmode->addItem(stringify(m));

    if (! visit) {
        if (m != UmlParallel)
            edmode->addItem(stringify(UmlParallel));

        if (m != UmlIterative)
            edmode->addItem(stringify(UmlIterative));

        if (m != UmlStream)
            edmode->addItem(stringify(UmlStream));
    }

    htab->addWidget(new QLabel("  ", htab));
    htab->addWidget(must_isolate_cb = new QCheckBox(TR("must isolate"), htab));

    if (data->must_isolate)
        must_isolate_cb->setChecked(TRUE);

    must_isolate_cb->setDisabled(visit);
    htab->addWidget(new QLabel("", htab));

    VVBox * vtab;
    grid->addWidget(vtab = new VVBox(grid));
    vtab->addWidget(new QLabel(TR("description :"), vtab));

    SmallPushButton* b;
    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");

    // 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"));

    //

    connect(this, SIGNAL(currentChanged(QWidget *)),
            this, SLOT(change_tabs(QWidget *)));

    open_dialog(this);
}
Ejemplo n.º 6
0
ActivityDialog::ActivityDialog(ActivityData * d)
    : TabDialog(0, 0, FALSE, Qt::WA_DeleteOnClose), activity(d)
{
    d->browser_node->edit_start();

    if (d->browser_node->is_writable()) {
        setOkButton(tr("OK"));
        setCancelButton(tr("Cancel"));
    }
    else {
        setOkButton(QString());
        setCancelButton(tr("Close"));
    }

    setWindowTitle(tr("Activity dialog"));
    visit = !hasOkButton();

    BrowserNode * bn = activity->browser_node;
    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));
    edname->setReadOnly(visit);

    grid->addWidget(new QLabel(tr("stereotype : "), grid));
    grid->addWidget(edstereotype = new QComboBox(grid));
    edstereotype->setEditable(!visit);
    edstereotype->addItem(toUnicode(activity->get_stereotype()));

    if (!visit) {
        edstereotype->addItems(BrowserActivity::default_stereotypes());
        edstereotype->addItems(ProfiledStereotypes::defaults(UmlActivity));
        edstereotype->setAutoCompletion(completion());
    }

    edstereotype->setCurrentIndex(0);
    QSizePolicy sp = edstereotype->sizePolicy();
    sp.setHorizontalPolicy(QSizePolicy::Expanding);
    edstereotype->setSizePolicy(sp);

    SmallPushButton* sButton;
    connect(sButton = new SmallPushButton(tr("specification :"), grid), SIGNAL(clicked()),
            this, SLOT(menu_specification()));
    grid->addWidget(sButton);
    grid->addWidget(edspecification = new QComboBox(grid));
    edspecification->setSizePolicy(sp);

    if (visit) {
        if (activity->get_specification() == 0)
            edspecification->addItem("");
        else
            edspecification->addItem(activity->get_specification()->full_name(TRUE));
    }
    else {
        edspecification->addItem("");
        edspecification->setAutoCompletion(completion());
        BrowserOperation::instances(opers);
        opers.full_names(list);
        edspecification->addItems(list);
        edspecification->setCurrentIndex((activity->get_specification() == 0)
                                         ? 0
                                         : opers.indexOf(activity->get_specification()) + 1);
    }

    grid->addWidget(new QLabel(grid));
    BButtonGroup * bg;
    grid->addWidget(bg =
            new BButtonGroup(3, Qt::Horizontal, QString(), grid));

    bg->addWidget(readonly_cb = new QCheckBox(tr("read only"), bg));

    if (activity->read_only)
        readonly_cb->setChecked(TRUE);

    readonly_cb->setDisabled(visit);

    bg->addWidget(singlexec_cb = new QCheckBox(tr("single execution"), bg));

    if (activity->single_execution)
        singlexec_cb->setChecked(TRUE);

    singlexec_cb->setDisabled(visit);

    bg->addWidget(active_cb = new QCheckBox(tr("active"), bg));

    if (activity->is_active)
        active_cb->setChecked(TRUE);

    active_cb->setDisabled(visit);

    VVBox * vtab;
    grid->addWidget(vtab = new VVBox(grid));
    vtab->addWidget(new QLabel(tr("description :"), vtab));

    if (! visit)
    {
        connect(sButton = new SmallPushButton(tr("Editor"), vtab), SIGNAL(clicked()),
                this, SLOT(edit_description()));
    vtab->addWidget(sButton);
    }

    grid->addWidget(comment = new MultiLineEdit(grid));
    comment->setReadOnly(visit);
    comment->setText(bn->get_comment());
    //comment->setFont(font);

    grid->addWidget(vtab = new VVBox(grid));
    vtab->addWidget(new QLabel(tr("constraint :"), vtab));

    if (! visit) {
        connect(sButton = new SmallPushButton(tr("Editor"), vtab), SIGNAL(clicked()),
                this, SLOT(edit_constraint()));
        vtab->addWidget(sButton);
    }


    grid->addWidget(constraint = new MultiLineEdit(grid));
    constraint->setReadOnly(visit);
    constraint->setText(activity->constraint);
    //constraint->setFont(font);

    addTab(grid, "Uml");

    // UML / OCL
    init_tab(uml, activity->uml_condition, "Ocl", TRUE);

    // CPP
    init_tab(cpp, activity->cpp_condition, "C++",
             GenerationSettings::cpp_get_default_defs());

    // Java
    init_tab(java, activity->java_condition, "Java",
             GenerationSettings::java_get_default_defs());

    // 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"));

    //

    connect(this, SIGNAL(currentChanged(QWidget *)),
            this, SLOT(change_tabs(QWidget *)));

    open_dialog(this);
}
Ejemplo n.º 7
0
ActivityPartitionDialog::ActivityPartitionDialog(ActivityPartitionData * d)
    : Q3TabDialog(0, 0, FALSE, Qt::WDestructiveClose), data(d)
{
    d->browser_node->edit_start();

    if (d->browser_node->is_writable()) {
        setOkButton(TR("OK"));
        setCancelButton(TR("Cancel"));
    }
    else {
        setOkButton(QString());
        setCancelButton(TR("Close"));
    }

    setCaption(TR("Activity Partition dialog"));

    bool visit = !hasOkButton();

    // general tab

    BrowserNode * bn = data->get_browser_node();
    Q3Grid * grid = new Q3Grid(2, this);

    umltab = grid;
    grid->setMargin(5);
    grid->setSpacing(5);

    new QLabel(TR("name : "), grid);
    edname = new LineEdit(bn->get_name(), grid);
    edname->setReadOnly(visit);

    new QLabel(TR("stereotype : "), grid);
    edstereotype = new Q3ComboBox(!visit, grid);
    edstereotype->insertItem(toUnicode(data->get_stereotype()));

    if (! visit) {
        edstereotype->insertStringList(BrowserActivityPartition::default_stereotypes());
        edstereotype->insertStringList(ProfiledStereotypes::defaults(UmlActivityPartition));
        edstereotype->setAutoCompletion(completion());
    }

    edstereotype->setCurrentItem(0);
    QSizePolicy sp = edstereotype->sizePolicy();
    sp.setHorData(QSizePolicy::Expanding);
    edstereotype->setSizePolicy(sp);

    connect(new SmallPushButton(TR("represents :"), grid), SIGNAL(clicked()),
            this, SLOT(menu_represents()));
    edrepresents = new Q3ComboBox(FALSE, grid);

    if ((data->represents != 0) && !data->represents->deletedp()) {
        represented = data->represents;
        edrepresents->insertItem(*(data->represents->pixmap(0)),
                                 data->represents->full_name(TRUE));
    }
    else {
        represented = 0;
        edrepresents->insertItem("");
    }

    if (! visit)
        edrepresents->insertItem("");

    edrepresents->setCurrentItem(0);
    edrepresents->setSizePolicy(sp);

    Q3HBox * htab;

    new QLabel(grid);
    htab = new Q3HBox(grid);
    new QLabel("  ", htab);
    dimension_cb = new QCheckBox(TR("is dimension"), htab);

    if (data->is_dimension)
        dimension_cb->setChecked(TRUE);

    dimension_cb->setDisabled(visit);
    new QLabel("", htab);
    external_cb = new QCheckBox(TR("is external"), htab);

    if (data->is_external)
        external_cb->setChecked(TRUE);

    external_cb->setDisabled(visit);
    new QLabel("", htab);

    Q3VBox * vtab = new Q3VBox(grid);
    new QLabel(TR("description :"), vtab);

    if (! visit)
        connect(new SmallPushButton(TR("Editor"), vtab), SIGNAL(clicked()),
                this, SLOT(edit_description()));

    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");

    // USER : list key - value

    grid = new Q3Grid(2, this);
    grid->setMargin(5);
    grid->setSpacing(5);

    kvtable = new KeyValuesTable(bn, grid, visit);
    addTab(grid, TR("Properties"));

    //

    connect(this, SIGNAL(currentChanged(QWidget *)),
            this, SLOT(change_tabs(QWidget *)));

    open_dialog(this);
}
Ejemplo n.º 8
0
FlowDialog::FlowDialog(FlowData * d)
    : Q3TabDialog(0, 0, FALSE, Qt::WDestructiveClose), flow(d)
{
    d->browser_node->edit_start();

    if (d->browser_node->is_writable()) {
        setOkButton(TR("OK"));
        setCancelButton(TR("Cancel"));
    }
    else {
        setOkButton(QString());
        setCancelButton(TR("Close"));
    }

    setCaption(TR("Flow dialog"));
    visit = !hasOkButton();

    BrowserNode * bn = flow->browser_node;
    Q3Grid * grid;

    //
    // general tab
    //

    grid = new Q3Grid(2, this);
    umltab = grid;
    grid->setMargin(5);
    grid->setSpacing(5);

    new QLabel(TR("name : "), grid);
    edname = new LineEdit(bn->get_name(), grid);
    edname->setReadOnly(visit);

    new QLabel(TR("stereotype : "), grid);
    edstereotype = new Q3ComboBox(!visit, grid);
    edstereotype->insertItem(toUnicode(flow->get_stereotype()));

    if (!visit) {
        edstereotype->insertStringList(BrowserFlow::default_stereotypes());
        edstereotype->insertStringList(ProfiledStereotypes::defaults(UmlFlow));
        edstereotype->setAutoCompletion(completion());
    }

    edstereotype->setCurrentItem(0);
    QSizePolicy sp = edstereotype->sizePolicy();
    sp.setHorData(QSizePolicy::Expanding);
    edstereotype->setSizePolicy(sp);

    Q3VBox * vtab = new Q3VBox(grid);
    new QLabel(TR("description :"), vtab);

    if (! visit)
        connect(new SmallPushButton(TR("Editor"), vtab), SIGNAL(clicked()),
                this, SLOT(edit_description()));

    comment = new MultiLineEdit(grid);
    comment->setReadOnly(visit);
    comment->setText(bn->get_comment());

    addTab(grid, "Uml");

    // UML / OCL
    init_tab(uml, flow->uml, "Ocl", SLOT(edit_uml_guard()),
             SLOT(edit_uml_selection()), SLOT(edit_uml_transformation()),
             TRUE);

    // CPP
    init_tab(cpp, flow->cpp, "C++", SLOT(edit_cpp_guard()),
             SLOT(edit_cpp_selection()), SLOT(edit_cpp_transformation()),
             GenerationSettings::cpp_get_default_defs());

    // Java
    init_tab(java, flow->java, "Java", SLOT(edit_java_guard()),
             SLOT(edit_java_selection()), SLOT(edit_java_transformation()),
             GenerationSettings::java_get_default_defs());

    // USER : list key - value

    grid = new Q3Grid(2, this);
    grid->setMargin(5);
    grid->setSpacing(5);

    kvtable = new KeyValuesTable(bn, grid, visit);
    addTab(grid, TR("Properties"));

    //

    connect(this, SIGNAL(currentChanged(QWidget *)),
            this, SLOT(change_tabs(QWidget *)));

    open_dialog(this);
}
Ejemplo n.º 9
0
UseCaseDialog::UseCaseDialog(UseCaseData * u)
    : QTabDialog(0, 0, FALSE, WDestructiveClose), uc(u) {
  BrowserNode * bn = u->browser_node;
  
  bn->edit_start();
  
  if (bn->is_writable()) {
    setOkButton(TR("OK"));
    setCancelButton(TR("Cancel"));
  }
  else {
    setOkButton(QString::null);
    setCancelButton(TR("Close"));
  }

  setCaption(TR("Use Case dialog"));
  
  bool visit = !hasOkButton();
  
  // general tab
  
  QGrid * grid = new QGrid(2, this);
  grid->setMargin(5);
  grid->setSpacing(5);

  new QLabel(TR("name : "), grid);
  edname = new LineEdit(bn->get_name(), grid);
  edname->setReadOnly(visit);

  new QLabel(TR("stereotype : "), grid);
  edstereotype = new QComboBox(!visit, grid);
  edstereotype->insertItem(toUnicode(uc->get_stereotype()));
  if (! visit) {
    edstereotype->insertStringList(BrowserUseCase::default_stereotypes());
    edstereotype->insertStringList(ProfiledStereotypes::defaults(UmlUseCase));
    edstereotype->setAutoCompletion(completion());
  }
  edstereotype->setCurrentItem(0);
  QSizePolicy sp = edstereotype->sizePolicy();
  sp.setHorData(QSizePolicy::Expanding);
  edstereotype->setSizePolicy(sp);
  
  new QLabel(TR("extension \npoints : "), grid);
  extension_points = new MultiLineEdit(grid);
  extension_points->setReadOnly(visit);
  extension_points->setText(uc->get_extension_points());
  QFont font = extension_points->font();
  if (! hasCodec())
    font.setFamily("Courier");
  font.setFixedPitch(TRUE);
  extension_points->setFont(font);

  QVBox * vtab = new QVBox(grid);
  new QLabel(TR("description :"), vtab);
  if (! visit)
    connect(new SmallPushButton(TR("Editor"), vtab), SIGNAL(clicked()),
	    this, SLOT(edit_description()));
  comment = new MultiLineEdit(grid);
  comment->setReadOnly(visit);
  comment->setText(bn->get_comment());
  comment->setFont(font);
  
  addTab(grid, "Uml");
  
  // USER : list key - value
  
  grid = new QGrid(2, this);
  grid->setMargin(5);
  grid->setSpacing(5);
  
  kvtable = new KeyValuesTable(bn, grid, visit);
  addTab(grid, TR("Properties"));
  
  open_dialog(this);
}
Ejemplo n.º 10
0
SimpleRelationDialog::SimpleRelationDialog(SimpleRelationData * r)
    : QTabDialog(0, 0, FALSE, WDestructiveClose), rel(r) {  
  r->browser_node->edit_start();
  
  if (r->browser_node->is_writable()) {
    setOkButton(TR("OK"));
    setCancelButton(TR("Cancel"));
  }
  else {
    setOkButton(QString::null);
    setCancelButton(TR("Close"));
  }

  bool visit = !hasOkButton();
  
  // general tab
  
  BrowserNode * bn = rel->get_browser_node();
  QGrid * grid = new QGrid(2, this);
  grid->setMargin(5);
  grid->setSpacing(5);

  switch (rel->get_type()) {
  case UmlInherit:
    setCaption(TR("Generalisation dialog"));
    break;
  case UmlDependOn:
    setCaption(TR("Dependency dialog"));
    break;
  default:
    setCaption(TR("unknown relation dialog"));
    break;
  }
  
  new QLabel(TR("from : "), grid);
  new QLabel(rel->get_start_node()->full_name(TRUE), grid);
  new QLabel(TR("to : "), grid);
  new QLabel(rel->get_end_node()->full_name(TRUE), grid);
  
  new QLabel(TR("stereotype : "), grid);
  edstereotype = new QComboBox(!visit, grid);
  edstereotype->insertItem(toUnicode(rel->get_stereotype()));
  if (! visit) {
    edstereotype->insertStringList(rel->get_start_node()
				   ->default_stereotypes(rel->get_type(),
							 rel->get_end_node()));
    edstereotype->insertStringList(ProfiledStereotypes::defaults(UmlRelations));
    edstereotype->setAutoCompletion(completion());
  }
  edstereotype->setCurrentItem(0);
  QSizePolicy sp = edstereotype->sizePolicy();
  sp.setHorData(QSizePolicy::Expanding);
  edstereotype->setSizePolicy(sp);
  
  QVBox * vtab = new QVBox(grid);
  new QLabel(TR("description :"), vtab);
  if (! visit)
    connect(new SmallPushButton(TR("Editor"), vtab), SIGNAL(clicked()),
	    this, SLOT(edit_description()));
  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");
  
  // USER : list key - value
  
  grid = new QGrid(2, this);
  grid->setMargin(5);
  grid->setSpacing(5);
  
  kvtable = new KeyValuesTable(bn, grid, visit);
  addTab(grid, TR("Properties"));
  
  open_dialog(this);
}