[Uml-devel] branches/KDE/3.5/kdesdk/umbrello/umbrello

Daniel Calviño Sánchez danxuliu at gmail.com
Mon Jul 3 03:07:34 UTC 2006


SVN commit 557369 by danxuliu:

Fixes to some issues changing interface into class and vice versa.
BUG:79433

 M  +27 -10    classifierwidget.cpp  
 M  +16 -5     classifierwidget.h  


--- branches/KDE/3.5/kdesdk/umbrello/umbrello/classifierwidget.cpp #557368:557369
@@ -300,7 +300,7 @@
     if (!m_pObject) {
         return UMLWidget::calculateSize();
     }
-    if (m_bDrawAsCircle) {
+    if (getClassifier()->isInterface() && m_bDrawAsCircle) {
         return calculateAsCircleSize();
     }
 
@@ -453,18 +453,12 @@
 
     case ListPopupMenu::mt_ChangeToClass:
     case ListPopupMenu::mt_ChangeToClass_Selection:
-        WidgetBase::m_Type = Uml::wt_Class;
-        getClassifier()->setInterface(false);
-        updateComponentSize();
-        update();
+        changeToClass();
         break;
 
     case ListPopupMenu::mt_ChangeToInterface:
     case ListPopupMenu::mt_ChangeToInterface_Selection:
-        WidgetBase::m_Type = Uml::wt_Interface;
-        getClassifier()->setInterface(true);
-        updateComponentSize();
-        update();
+        changeToInterface();
         break;
 
     default:
@@ -530,7 +524,7 @@
     else
         p.setBrush( m_pView->viewport()->backgroundColor() );
 
-    if (m_bDrawAsCircle) {
+    if (getClassifier()->isInterface() && m_bDrawAsCircle) {
         drawAsCircle(p, offsetX, offsetY);
         return;
     }
@@ -727,6 +721,29 @@
     update();
 }
 
+void ClassifierWidget::changeToClass() {
+    WidgetBase::setBaseType(Uml::wt_Class);
+    getClassifier()->setInterface(false);
+
+    const Settings::OptionState& ops = m_pView->getOptionState();
+    m_bShowAttributes = ops.classState.showAtts;
+    m_bShowStereotype = ops.classState.showStereoType;
+
+    updateComponentSize();
+    update();
+}
+
+void ClassifierWidget::changeToInterface() {
+    WidgetBase::setBaseType(Uml::wt_Interface);
+    getClassifier()->setInterface(true);
+
+    m_bShowAttributes = false;
+    m_bShowStereotype = true;
+
+    updateComponentSize();
+    update();
+}
+
 void ClassifierWidget::saveToXMI(QDomDocument & qDoc, QDomElement & qElement) {
     QDomElement conceptElement;
     UMLClassifier *umlc = getClassifier();
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/classifierwidget.h #557368:557369
@@ -1,8 +1,3 @@
-/*
- *  copyright (C) 2004
- *  Umbrello UML Modeller Authors <uml-devel@ uml.sf.net>
- */
-
 /***************************************************************************
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
@@ -10,6 +5,8 @@
  *   the Free Software Foundation; either version 2 of the License, or     *
  *   (at your option) any later version.                                   *
  *                                                                         *
+ *  copyright (C) 2004-2006                                                *
+ *  Umbrello UML Modeller Authors <uml-devel@ uml.sf.net>                  *
  ***************************************************************************/
 
 #ifndef CLASSIFIERWIDGET_H
@@ -235,6 +232,20 @@
     void setDrawAsCircle(bool drawAsCircle);
 
     /**
+     * Changes this classifier from an interface to a class.
+     * Attributes and stereotype visibility is got from the view OptionState.
+     * This widget is also updated.
+     */
+    void changeToClass();
+
+    /**
+     * Changes this classifier from a class to an interface.
+     * Attributes are hidden and stereotype is shown.
+     * This widget is also updated.
+     */
+    void changeToInterface();
+
+    /**
      * Set the AssociationWidget when this ClassWidget acts as
      * an association class.
      */




More information about the umbrello-devel mailing list