Esempio n. 1
0
void RelTable::init_row(const SlotRel & sr, int row, QString a, bool visit)
{
    QString b = sr.value->get_name() + QString(":") +
            ((ClassInstanceData *) sr.value->get_data())->get_class()->get_name();

    setItem(row, 0, new TableItem(this, TableItem::Never,
                                  (sr.is_a) ? a : b, TableItem::TableItemType));

    RelationData * d = sr.rel;
    const char * s;

    s = d->get_role_b();
    setItem(row, 1, new TableItem(this, TableItem::Never, (s == 0) ? "" : s, TableItem::TableItemType));

    setItem(row, 2, new TableItem(this, TableItem::Never, stringify(d->get_type()), TableItem::TableItemType));

    s = d->get_role_a();
    setItem(row, 3, new TableItem(this, TableItem::Never, (s == 0) ? "" : s, TableItem::TableItemType));

    setItem(row, 4, new TableItem(this, TableItem::Never,
                                  (sr.is_a) ? b : a, TableItem::TableItemType));

    if (! visit)
        setText(row, 5, "");
}
Esempio n. 2
0
void UcClassCanvas::draw_all_depend_gene(UcClassCanvas * end) {
  Q3ListViewItem * child;
  Q3CanvasItemList all = canvas()->allItems();
  Q3CanvasItemList::Iterator cit;
  
  for (child = browser_node->firstChild(); child; child = child->nextSibling()) {
    if (dependencyOrGeneralization(((BrowserNode *) child)->get_type()) &&
	!((BrowserNode *) child)->deletedp()) {
      RelationData * def =
	((RelationData *) ((BrowserNode *) child)->get_data());

      if ((def->get_start_class() == browser_node) && 	// rel begins by this
	  ((end == 0) || (def->get_end_class() == end->browser_node)) &&
	  !has_relation(def)) {
	// adds it in case the other class is drawn
	BrowserClass * end_class = 
	  ((BrowserClass *) def->get_end_class());
	DiagramItem * di;
	
	if (end_class == browser_node)
	  di = this;
	else {	
	  di = 0;
	  for (cit = all.begin(); cit != all.end(); ++cit) {
	    DiagramItem * adi = QCanvasItemToDiagramItem(*cit);
	    
	    if ((adi != 0) &&		// an uml canvas item
		(adi->type() == UmlClass) &&
		(((UcClassCanvas *) adi)->browser_node == end_class) &&
		((((UcClassCanvas *) adi) == end) || (*cit)->visible())) {
	      // other class canvas find
	      di = adi;
	      break;
	    }
	  }
	}
	
	if (di != 0)
	  (new RelationCanvas(the_canvas(), this, di,
			      ((BrowserClass *) browser_node), 
			      def->get_type(), 0, -1.0, -1.0, def))
	    ->show();
      }
    }
  }
  
  if ((end == 0) &&
      !DrawingSettings::just_modified() &&
      !on_load_diagram()) {
    for (cit = all.begin(); cit != all.end(); ++cit) {
      DiagramItem * di = QCanvasItemToDiagramItem(*cit);
      
      if ((di != 0) &&	// an uml canvas item
	  (di->type() == UmlClass) &&
	  (((UcClassCanvas *) di) != this) &&
	  !((UcClassCanvas *) di)->browser_node->deletedp() &&
	  ((UcClassCanvas *) di)->visible())
	((UcClassCanvas *) di)->draw_all_depend_gene(this);
    }
  }
}