1
////////////////////////////////////////////////////////////////////////////////
3
// This file is part of Toolkit for Conceptual Modeling (TCM).
4
// (c) copyright 1998, Vrije Universiteit Amsterdam.
5
// Author: Frank Dehne (frank@cs.vu.nl).
7
// TCM is free software; you can redistribute it and/or modify
8
// it under the terms of the GNU General Public License as published by
9
// the Free Software Foundation; either version 2 of the License, or
10
// (at your option) any later version.
12
// TCM is distributed in the hope that it will be useful,
13
// but WITHOUT ANY WARRANTY; without even the implied warranty of
14
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
// GNU General Public License for more details.
17
// You should have received a copy of the GNU General Public License
18
// along with TCM; if not, write to the Free Software
19
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
21
////////////////////////////////////////////////////////////////////////////////
22
#include "tripleclassbox.h"
23
#include "stringlistnode2.h"
25
const int TripleClassBox::TRIPLECLASSBOX_WIDTH = 76;
26
const int TripleClassBox::TRIPLECLASSBOX_HEIGHT = 66;
28
TripleClassBox::TripleClassBox(ShapeView *v, Grafport *g,
29
int x, int y, int w, int h): TripleBox(v, g, x, y, w, h) {
30
SetSeparatorLineStyle(LineStyle::SOLID);
31
SetSeparator2LineStyle(LineStyle::SOLID);
32
labelDescription = "Attribute";
33
label2Description = "Operation";
36
TripleClassBox::TripleClassBox(const Box &s): TripleBox(s) {
37
labelDescription = "Attribute";
38
label2Description = "Operation";
39
SetSeparatorLineStyle(LineStyle::SOLID);
40
SetSeparator2LineStyle(LineStyle::SOLID);
42
AdjustSizes(GetName()->GetString());
45
TripleClassBox::TripleClassBox(const TripleBox &s): TripleBox(s) {
46
labelDescription = "Attribute";
47
label2Description = "Operation";
49
AdjustSizes(GetName()->GetString());
52
bool TripleClassBox::SetAssocSubject(AssocList *al) {
53
if (!TripleBox::SetAssocSubject(al))
55
if (check(GetSubject() &&
56
(GetSubject()->GetClassType()==Code::CLASS_NODE ||
57
GetSubject()->GetClassType()==Code::SSD_CLASS_NODE)))
63
void TripleClassBox::SetTextShape() {
64
TripleBox::SetTextShape();
66
GetLabels2()->clear();
67
if (!check(GetSubject()) ||
68
(GetSubject()->GetClassType() != Code::CLASS_NODE &&
69
GetSubject()->GetClassType() != Code::SSD_CLASS_NODE))
71
StringListNode2 *node = (StringListNode2 *)GetSubject();
72
unsigned numItems = node->NrStrings();
73
for (unsigned i=0; i<numItems; i++) {
74
TextShape *et = new TextShape(GetView(), GetGrafport(), this);
76
et->SetAlignment(TextAlign::LEFT);
77
et->SetDescription(&labelDescription);
78
et->SetString(node->GetString(i));
80
et->SetFont(GetName()->GetFont());
81
et->SetColor(GetName()->GetColor());
84
numItems = node->NrStrings2();
85
for (unsigned j=0; j<numItems; j++) {
86
TextShape *et = new TextShape(GetView(), GetGrafport(), this);
88
et->SetAlignment(TextAlign::LEFT);
89
et->SetDescription(&label2Description);
90
et->SetString(node->GetString2(j));
92
et->SetFont(GetName()->GetFont());
93
et->SetColor(GetName()->GetColor());
94
GetLabels2()->add(et);
96
// CalcPositionLabels();