Bug 88117 - An abstract class can't provide interface in component diagram
Summary: An abstract class can't provide interface in component diagram
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Umbrello Development Group
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-08-26 11:55 UTC by Lea Viljanen
Modified: 2005-05-26 11:36 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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 )) {