Bug 88117

Summary: An abstract class can't provide interface in component diagram
Product: [Applications] umbrello Reporter: Lea Viljanen <ladybug>
Component: generalAssignee: Umbrello Development Group <umbrello-devel>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Lea Viljanen 2004-08-26 11:55:04 UTC
Version:           1.3.0 (using KDE KDE 3.2.1)
Installed from:    Compiled From Sources
OS:                Linux

Documentation says that "Components can have interfaces (i.e. abstract classes with operations) that allow associations between components". However, a component does not accept an association with an abstract class (with only abstract operations), it requires an interface class.

This is somewhat problematic in Java, where some things are better done as abstract classes.
For example if the class wants to extend java.util.Observable, this automatically rules out being an
interface. Of course one could work around that, but I still feel this is a bug. If this is intentional
behaviour, some changes in documentation would be in order.
Comment 1 Oliver Kellogg 2005-05-26 11:36:08 UTC
SVN commit 418324 by okellogg:

BUG:88117 - Allow abstract class as interface in component diagram.


 M  +2 -2      ChangeLog  
 M  +15 -7     umbrello/umlview.cpp  


--- trunk/KDE/kdesdk/umbrello/ChangeLog #418323:418324
@@ -2,10 +2,10 @@
 
 * Association classes
 * Externalization of folders (i.e. submodel files)
-* Change interface into class and vice versa (if no attributes)
+* Change interface into class and vice versa (if abstract and no attributes)
 
 * Bugs fixed / wishes implemented (see http://bugs.kde.org)
-57588 79433 87252 105564
+57588 79433 87252 88117 105564
 
 Version 1.4.1 (maintenance release)
 
--- trunk/KDE/kdesdk/umbrello/umbrello/umlview.cpp #418323:418324
@@ -513,11 +513,14 @@
 			}
 		}
 		break;
-	case ot_Class: // CORRECT?
+	case ot_Class:
 		//see if we really want an object widget or class widget
-		if(getType() == dt_Class) {
+		if (m_Type == dt_Class || m_Type == dt_Component) {
 			UMLClassifier *c = static_cast<UMLClassifier*>(o);
-			newWidget = new ClassifierWidget(this, c);
+			ClassifierWidget *cw = new ClassifierWidget(this, c);
+			if (m_Type == dt_Component)
+				cw->setDrawAsCircle(true);
+			newWidget = cw;
 		} else {
 			ObjectWidget *ow = new ObjectWidget(this, o, getLocalID() );
 			if (m_Type == dt_Sequence) {
@@ -637,10 +640,15 @@
 		e->accept(false);
 		return;
 	}
-	if (diagramType == dt_Component &&
-	    (ot != ot_Interface && ot != ot_Component && ot != ot_Artifact)) {
-		e->accept(false);
-		return;
+	if (diagramType == dt_Component) {
+		if (ot != ot_Interface && ot != ot_Component && ot != ot_Artifact && ot != ot_Class) {
+			e->accept(false);
+			return;
+		}
+		if (ot == ot_Class && !temp->getAbstract()) {
+			e->accept(false);
+			return;
+		}
 	}
 	if (diagramType == dt_EntityRelationship &&
 	    (ot != ot_Entity )) {