You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
99 lines
3.3 KiB
99 lines
3.3 KiB
/***************************************************************************
|
|
* *
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
* it under the terms of the GNU General Public License as published by *
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
* (at your option) any later version. *
|
|
* *
|
|
* copyright (C) 2003-2007 *
|
|
* Umbrello UML Modeller Authors <uml-devel@uml.sf.net> *
|
|
***************************************************************************/
|
|
|
|
// own header
|
|
#include "classifierlistitem.h"
|
|
|
|
// qt/kde includes
|
|
#include <kdebug.h>
|
|
#include <klocale.h>
|
|
|
|
// local includes
|
|
#include "classifier.h"
|
|
#include "uml.h"
|
|
#include "umldoc.h"
|
|
#include "model_utils.h"
|
|
#include "object_factory.h"
|
|
|
|
UMLClassifierListItem::UMLClassifierListItem(const UMLObject *tqparent,
|
|
const TQString& name, Uml::IDType id)
|
|
: UMLObject(tqparent, name, id) {
|
|
UMLObject *tqparentObj = const_cast<UMLObject*>(tqparent);
|
|
UMLClassifier *pc = dynamic_cast<UMLClassifier*>(tqparentObj);
|
|
if (pc)
|
|
UMLObject::setUMLPackage(pc);
|
|
}
|
|
|
|
UMLClassifierListItem::UMLClassifierListItem(const UMLObject *tqparent)
|
|
: UMLObject(tqparent) {
|
|
UMLObject *tqparentObj = const_cast<UMLObject*>(tqparent);
|
|
UMLClassifier *pc = dynamic_cast<UMLClassifier*>(tqparentObj);
|
|
if (pc)
|
|
UMLObject::setUMLPackage(pc);
|
|
}
|
|
|
|
UMLClassifierListItem::~UMLClassifierListItem() {
|
|
}
|
|
|
|
void UMLClassifierListItem::copyInto(UMLClassifierListItem *rhs) const
|
|
{
|
|
// Call the tqparent.
|
|
UMLObject::copyInto(rhs);
|
|
}
|
|
|
|
TQString UMLClassifierListItem::toString(Uml::Signature_Type /*sig*/) {
|
|
return getName();
|
|
}
|
|
|
|
UMLClassifier * UMLClassifierListItem::getType() const{
|
|
return static_cast<UMLClassifier*>(m_pSecondary);
|
|
}
|
|
|
|
TQString UMLClassifierListItem::getTypeName() const{
|
|
if (m_pSecondary == NULL)
|
|
return m_SecondaryId;
|
|
const UMLPackage *typePkg = m_pSecondary->getUMLPackage();
|
|
if (typePkg != NULL && typePkg != m_pUMLPackage)
|
|
return m_pSecondary->getFullyQualifiedName();
|
|
return m_pSecondary->getName();
|
|
}
|
|
|
|
void UMLClassifierListItem::setType(UMLObject *type) {
|
|
if (m_pSecondary != type) {
|
|
m_pSecondary = type;
|
|
UMLObject::emitModified();
|
|
}
|
|
}
|
|
|
|
void UMLClassifierListItem::setTypeName(const TQString &type) {
|
|
if (type.isEmpty() || type == "void") {
|
|
m_pSecondary = NULL;
|
|
m_SecondaryId = TQString();
|
|
return;
|
|
}
|
|
UMLDoc *pDoc = UMLApp::app()->getDocument();
|
|
m_pSecondary = pDoc->findUMLObject(type);
|
|
if (m_pSecondary == NULL) {
|
|
// Make data type for easily identified cases
|
|
if (Model_Utils::isCommonDataType(type) || type.tqcontains('*')) {
|
|
m_pSecondary = Object_Factory::createUMLObject(Uml::ot_Datatype, type);
|
|
kDebug() << "UMLClassifierListItem::setTypeName: "
|
|
<< "created datatype for " << type << endl;
|
|
} else {
|
|
m_SecondaryId = type;
|
|
}
|
|
}
|
|
UMLObject::emitModified();
|
|
}
|
|
|
|
|
|
#include "classifierlistitem.moc"
|