Discussion:
Netbeans UML and Inheritance
Steve Petrie
2008-12-02 17:25:01 UTC
Permalink
[GV]

Since Java doesn't allow multiple inheritance, you can only do this in a

platform independent model and code generation is not supported.



[SP]

Like ncgsoftware, I am trying without success, to figure out how to do multiple inheritance in a UML class diagram.



* * *

* * *



The class diagram <generalization.PNG> that George attached to his posting, clearly shows multiple inheritance, between supertype <base> and two subtypes <other_1> and <other_2>.



Also, on the tutorial web page titled <UML: Creating Class Diagrams>,

under section <Depicting Links and Associations>, subsection <To Depict Generalization and Inheritance>:



http://www.netbeans.org/kb/docs/uml/class-diagram.html#inherit



the first two steps used to create a generalization relationship, between subtype class <ATM> and supertype class <EntryStation> are:



1 Click inside the ATM class element to open the Context Palette. Select the Generalization icon image of Generalization icon.



2. Click inside the ATM class element, and then click the EntryStation class element.

The Select Methods to Redefine dialog box appears.



HOWEVER, when I try to follow Step 1 with two classes <Class1> and <Class2> in my own NetBeans UML Platform-Independent Model class diagram, the behavior is quite different.



In trying to follow Step 1 above, the Context Palette does open when I click inside the <Class1> class element.



HOWEVER, as soon as I Select the Generalization icon image on the Context Palette, a new class <Unnamed> is created to the right of <Class1>, and class <Unnamed> is shown linked as the supertype to subtype class <Class1>. Please see attached diagram:



<Netbeans_UML_and_Inheritance__Class1_Unnamed__20081202.png>



When I then click inside <Class1>, in trying to continue to follow Step 2 of the turorial, the Context Palette just opens again.



It doesn't seem to make any difference, whether or not I have any operations defined for <Class1>.



* * *

* * *



It would appear that the UML plugin that I downloaded quite recently, provides different behavior than the UML plugin to which George and the UML tutorial are referring.



There is something a little suspicious that I have noticed. When I display the Project Properties for my UML project that I created as a Platform-Independent Model, the properties show a Java Project: field (greyed out) and a Java Project Source Package Folders list (also greyed out).



Perhaps somehow, there is a bug in the UML plugin, and the Platform-Independent Model type is not actually supported, and is getting quietly morphed into a Java-Platform Model?



* * *

* * *



Any suggestions George, ncgsoftware, or other UML users could make would be greatly appreciated!




Attachments:
Loading Image...
s***@netbeans.org
2008-12-04 06:26:44 UTC
Permalink
Post by Steve Petrie
[GV]
Since Java doesn't allow multiple inheritance, you can only do this in a
platform independent model and code generation is not supported.
[SP]
Like ncgsoftware, I am trying without success, to figure out how to do multiple inheritance in a UML class diagram.
* * *
* * *
The class diagram <generalization.PNG> that George attached to his posting, clearly shows multiple inheritance, between supertype <base> and two subtypes <other_1> and <other_2>.
Also, on the tutorial web page titled <UML: Creating Class Diagrams>,
http://www.netbeans.org/kb/docs/uml/class-diagram.html#inherit
1 Click inside the ATM class element to open the Context Palette. Select the Generalization icon image of Generalization icon.
2. Click inside the ATM class element, and then click the EntryStation class element.
The Select Methods to Redefine dialog box appears.
HOWEVER, when I try to follow Step 1 with two classes <Class1> and <Class2> in my own NetBeans UML Platform-Independent Model class diagram, the behavior is quite different.
In trying to follow Step 1 above, the Context Palette does open when I click inside the <Class1> class element.
We may need to add it to uml FAQ in uml wiki, and also correct Context
Palette article in netbeans help, it seems unclear how to use context
palette. this question arise from time to time "I select item in context
palette and got unexpected result".
Context palette do not support selection, it works as press&drag, i.e.
press item, drag to target object, release mouse button.
Post by Steve Petrie
<Netbeans_UML_and_Inheritance__Class1_Unnamed__20081202.png>
When I then click inside <Class1>, in trying to continue to follow Step 2 of the turorial, the Context Palette just opens again.
It doesn't seem to make any difference, whether or not I have any operations defined for <Class1>.
* * *
* * *
It would appear that the UML plugin that I downloaded quite recently, provides different behavior than the UML plugin to which George and the UML tutorial are referring.
Did you download it in 6.5 release installation?
Post by Steve Petrie
There is something a little suspicious that I have noticed. When I display the Project Properties for my UML project that I created as a Platform-Independent Model, the properties show a Java Project: field (greyed out) and a Java Project Source Package Folders list (also greyed out).
Even platform independent project support code generation even it do not
verify model online vs java rules. so it's ok.
Post by Steve Petrie
Perhaps somehow, there is a bug in the UML plugin, and the Platform-Independent Model type is not actually supported, and is getting quietly morphed into a Java-Platform Model?
I just tried 6.5 uml and was able to create two Generalizations from one
class.

Thanks, Sergey
Post by Steve Petrie
* * *
* * *
Any suggestions George, ncgsoftware, or other UML users could make would be greatly appreciated!
http://forums.netbeans.org//files/netbeans_uml_and_inheritance_class1_unnamed_20081202_111.png
Loading...