Bug 147061 - Add option for switching off automatic drawing attribute associations in class diagram
Summary: Add option for switching off automatic drawing attribute associations in clas...
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Other
: NOR wishlist
Target Milestone: ---
Assignee: Umbrello Development Group
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-06-21 22:09 UTC by vanandel
Modified: 2013-11-06 17:34 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: 4.0.0


Attachments
.xmi file that illustrates bug where multiple composition links are added by adding a new class to the diagram. (183.41 KB, application/x-uml)
2007-06-21 22:18 UTC, vanandel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description vanandel 2007-06-21 22:09:23 UTC
Version:           1.5.72 (using KDE 3.5.4, Fink/Mac OS X)
Compiler:          Target: i686-apple-darwin8
OS:                Darwin (i386) release 8.9.1

I'm creating a class diagram, using class information read from existing C++ header files.  When I select a class from the list in the "Logical View" ( left hand side of the application), and drag it to the existing class diagram, 4 or 5 "composition" links are created between classes.  

The same behavior occurs when I create a new class by right clicking in the "class diagram" window - multiple 0..1 composition links are created between existing classes in the diagram.

This bug occurs in 1.5.71 and in the SVN version I checked out (678580).   When I try to open the .xmi file with umbrello 1.5.4, my class diagram isn't shown.
Comment 1 vanandel 2007-06-21 22:18:25 UTC
Created attachment 20922 [details]
.xmi file that illustrates bug where multiple composition links are added by adding a new class to the diagram.
Comment 2 Oliver Kellogg 2007-07-02 21:26:05 UTC
If a Class1 has an attribute with the type of a Class2 then when dragging both
classes to the diagram Umbrello automatically creates an AssociationWidget
between the two classes.
Is this what is bothering you?
Comment 3 vanandel 2007-07-06 16:51:24 UTC
No, a whole set of extraneous connections get drawn when I create a new class.  Please use the sample .xmi file I attached to see this bug.  If I create new classes from scratch, it doesn't happen, but if I import classes from existing header files, multiple composition links are added when I add a new class.
Comment 4 Oliver Kellogg 2007-07-17 07:33:45 UTC
When creating a new class from scratch, this does not happen.

So I assume you mean you want to switch off the attribute associations
that are automatically drawn when dragging a class from the listview
to the diagram area.

Indeed this would be a useful addition to the Diagram Properties ->
Classes Display Options (on trunk - can't do it on the 3.5 branch
because that is l10n frozen.)
Comment 5 Oliver Kellogg 2007-07-18 00:16:07 UTC
SVN commit 689217 by okellogg:

Add showAttribAssocs to Settings::OptionState.classState
FEATURE:147061


 M  +1 -0      ChangeLog.2  
 M  +7 -0      umbrello/dialogs/classoptionspage.cpp  
 M  +2 -1      umbrello/dialogs/classoptionspage.h  
 M  +2 -2      umbrello/dialogs/umlviewdialog.cpp  
 M  +1 -0      umbrello/optionstate.h  
 M  +5 -0      umbrello/umbrello.kcfg  
 M  +2 -0      umbrello/uml.cpp  
 M  +4 -1      umbrello/umlview.cpp  


--- trunk/KDE/kdesdk/umbrello/ChangeLog.2 #689216:689217
@@ -30,3 +30,4 @@
         * Input / Output / Constant Pins.
 * RMB LogicalView->New->Class in treeview creates TWO classes (144537)
 * New code generator for D language
+* Add option for automatic drawing attribute associations in class diagram (147061)
--- trunk/KDE/kdesdk/umbrello/umbrello/dialogs/classoptionspage.cpp #689216:689217
@@ -45,6 +45,7 @@
     m_pShowStereotypeCB = NULL;
     m_pShowAttsCB = NULL;
     m_pShowAttSigCB = NULL;
+    m_pShowAttribAssocsCB = NULL;
     m_pDrawAsCircleCB = NULL;
 }
 
@@ -154,6 +155,10 @@
     m_pShowStereotypeCB -> setChecked(m_options->classState.showStereoType);
     visibilityLayout -> addWidget(m_pShowStereotypeCB, 2, 1);
 
+    m_pShowAttribAssocsCB = new QCheckBox(i18n("&Attribute associations"), m_pVisibilityGB);
+    m_pShowAttribAssocsCB -> setChecked(m_options->classState.showAttribAssocs);
+    visibilityLayout -> addWidget(m_pShowAttribAssocsCB, 3, 1);
+
 }
 
 void ClassOptionsPage::updateUMLWidget() {
@@ -188,6 +193,8 @@
     if (m_pShowStereotypeCB)
         m_options->classState.showStereoType = m_pShowStereotypeCB->isChecked();
     m_options->classState.showPackage = m_pShowPackageCB->isChecked();
+    if (m_pShowAttribAssocsCB)
+        m_options->classState.showAttribAssocs = m_pShowAttribAssocsCB->isChecked();
     if (m_pShowAttSigCB)
         m_options->classState.showAttSig = m_pShowAttSigCB->isChecked();
     m_options->classState.showOpSig = m_pShowOpSigCB->isChecked();
--- trunk/KDE/kdesdk/umbrello/umbrello/dialogs/classoptionspage.h #689216:689217
@@ -92,7 +92,8 @@
     QCheckBox * m_pShowVisibilityCB, * m_pShowAttSigCB;
     QCheckBox * m_pShowOpSigCB, * m_pShowAttsCB, * m_pShowOpsCB;
     QCheckBox * m_pShowStereotypeCB, * m_pShowPackageCB;
-    QCheckBox* m_pDrawAsCircleCB;
+    QCheckBox * m_pShowAttribAssocsCB;
+    QCheckBox * m_pDrawAsCircleCB;
 
     /**
      * The classifier widget to represent in the dialog page.
--- trunk/KDE/kdesdk/umbrello/umbrello/dialogs/umlviewdialog.cpp #689216:689217
@@ -113,9 +113,9 @@
     pageDisplayItem->setIcon( KIcon( DesktopIcon( "document-properties") ));
     addPage( pageDisplayItem);
 
-    QHBoxLayout * m_pOptionsLayout = new QHBoxLayout( newPage );
+    QHBoxLayout * pOptionsLayout = new QHBoxLayout( newPage );
     m_pOptionsPage = new ClassOptionsPage( newPage, &m_options );
-    m_pOptionsLayout -> addWidget( m_pOptionsPage );
+    pOptionsLayout -> addWidget( m_pOptionsPage );
 }
 
 void UMLViewDialog::setupColorPage() {
--- trunk/KDE/kdesdk/umbrello/umbrello/optionstate.h #689216:689217
@@ -62,6 +62,7 @@
     bool showAttSig;
     bool showOpSig;
     bool showPackage;
+    bool showAttribAssocs;
     Uml::Visibility defaultAttributeScope;
     Uml::Visibility defaultOperationScope;
 };
--- trunk/KDE/kdesdk/umbrello/umbrello/umbrello.kcfg #689216:689217
@@ -154,6 +154,11 @@
          <whatisthis>Show Stereotypes</whatisthis>
          <default>true</default>
        </entry>
+       <entry name="showAttribAssocs" type="Bool">
+         <label>Show Attribute Associations</label>
+         <whatisthis>Show Attribute Associations</whatisthis>
+         <default>true</default>
+       </entry>
        <entry name="showAttSig" type="Bool">
          <label>Show Attribute Signature</label>
          <whatisthis>Show Attribute Signature</whatisthis>
--- trunk/KDE/kdesdk/umbrello/umbrello/uml.cpp #689216:689217
@@ -695,6 +695,7 @@
     UmbrelloSettings::setShowAttSig(  optionState.classState.showAttSig );
     UmbrelloSettings::setShowOpSig( optionState.classState.showOpSig );
     UmbrelloSettings::setShowPackage(  optionState.classState.showPackage );
+    UmbrelloSettings::setShowAttribAssocs(  optionState.classState.showAttribAssocs );
     UmbrelloSettings::setDefaultAttributeScope( optionState.classState.defaultAttributeScope);
     UmbrelloSettings::setDefaultOperationScope( optionState.classState.defaultOperationScope);
 
@@ -1349,6 +1350,7 @@
     optionState.classState.showAttSig =  UmbrelloSettings::showAttSig();
     optionState.classState.showOpSig =  UmbrelloSettings::showOpSig();
     optionState.classState.showPackage =  UmbrelloSettings::showPackage();
+    optionState.classState.showAttribAssocs =  UmbrelloSettings::showAttribAssocs();
     optionState.classState.defaultAttributeScope = UmbrelloSettings::defaultAttributeScope();
     optionState.classState.defaultOperationScope = UmbrelloSettings::defaultOperationScope();
 
--- trunk/KDE/kdesdk/umbrello/umbrello/umlview.cpp #689216:689217
@@ -2227,7 +2227,7 @@
 }
 
 void UMLView::createAutoAttributeAssociations(UMLWidget *widget) {
-    if (widget == NULL || m_Type != Uml::dt_Class)
+    if (widget == NULL || m_Type != Uml::dt_Class || !m_Options.classState.showAttribAssocs)
         return;
 
     // Pseudocode:
@@ -3108,6 +3108,7 @@
     viewElement.setAttribute( "showopsig", m_Options.classState.showOpSig );
     viewElement.setAttribute( "showops", m_Options.classState.showOps );
     viewElement.setAttribute( "showpackage", m_Options.classState.showPackage );
+    viewElement.setAttribute( "showattribassocs", m_Options.classState.showAttribAssocs );
     viewElement.setAttribute( "showscope", m_Options.classState.showVisibility );
     viewElement.setAttribute( "showstereotype", m_Options.classState.showStereoType );
     //misc
@@ -3202,6 +3203,8 @@
     m_Options.classState.showOps = (bool)temp.toInt();
     temp = qElement.attribute( "showpackage", "0" );
     m_Options.classState.showPackage = (bool)temp.toInt();
+    temp = qElement.attribute( "showattribassocs", "0" );
+    m_Options.classState.showAttribAssocs = (bool)temp.toInt();
     temp = qElement.attribute( "showscope", "0" );
     m_Options.classState.showVisibility = (bool)temp.toInt();
     temp = qElement.attribute( "showstereotype", "0" );
Comment 6 Ralf Habacker 2013-11-06 17:34:29 UTC
set version-fixed-in from 4.0.0 changelog