[Uml-devel] KDE/kdesdk/umbrello/umbrello/widgets

Ralf Habacker ralf.habacker at gmail.com
Tue Dec 13 14:30:05 UTC 2011


SVN commit 1268555 by habacker:

fixed ActivityWidget's method documentation locations and ordering according to class definition

 MM +186 -128  activitywidget.cpp  
 MM +14 -76    activitywidget.h  


--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/activitywidget.cpp #1268554:1268555
@@ -21,13 +21,20 @@
 #include <kinputdialog.h>
 
 // app includes
+#include "dialogs/activitydialog.h"
+#include "docwindow.h"
+#include "listpopupmenu.h"
 #include "uml.h"
 #include "umldoc.h"
-#include "docwindow.h"
 #include "umlview.h"
-#include "listpopupmenu.h"
-#include "dialogs/activitydialog.h"
 
+/**
+ * Creates a Activity widget.
+ *
+ * @param view              The parent of the widget.
+ * @param activityType      The type of activity.
+ * @param id                The ID to assign (-1 will prompt a new ID.)
+ */
 ActivityWidget::ActivityWidget(UMLView * view, ActivityType activityType, Uml::IDType id )
   : UMLWidget(view, id)
 {
@@ -36,10 +43,122 @@
     updateComponentSize();
 }
 
+/**
+ *  destructor
+ */
 ActivityWidget::~ActivityWidget()
 {
 }
 
+/**
+ * Returns the type of activity.
+ */
+ActivityWidget::ActivityType ActivityWidget::activityType() const
+{
+    return m_ActivityType;
+}
+
+/**
+ * Sets the type of activity.
+ */
+void ActivityWidget::setActivityType( ActivityType activityType )
+{
+    m_ActivityType = activityType;
+    updateComponentSize();
+    UMLWidget::m_bResizable = true;
+}
+
+/**
+ * Determines whether a toolbar button represents an Activity.
+ * CHECK: currently unused - can this be removed?
+ *
+ * @param tbb               The toolbar button enum input value.
+ * @param resultType        The ActivityType corresponding to tbb.
+ *                  This is only set if tbb is an Activity.
+ * @return  True if tbb represents an Activity.
+ */
+bool ActivityWidget::isActivity(WorkToolBar::ToolBar_Buttons tbb,
+                                ActivityType& resultType)
+{
+    bool status = true;
+    switch (tbb) {
+    case WorkToolBar::tbb_Initial_Activity:
+        resultType = Initial;
+        break;
+    case WorkToolBar::tbb_Activity:
+        resultType = Normal;
+        break;
+    case WorkToolBar::tbb_End_Activity:
+        resultType = End;
+        break;
+    case WorkToolBar::tbb_Final_Activity:
+        resultType = Final;
+        break;
+    case WorkToolBar::tbb_Branch:
+        resultType = Branch;
+        break;
+    default:
+        status = false;
+        break;
+    }
+    return status;
+}
+
+/**
+ * This method get the name of the preText attribute
+ */
+QString ActivityWidget::preconditionText()
+{
+    return preText;
+}
+
+/**
+ * This method set the name of the preText attribute
+ */
+void ActivityWidget::setPreconditionText(const QString& aPreText)
+{
+    preText=aPreText;
+    updateComponentSize();
+    adjustAssocs( getX(), getY() );
+}
+
+/**
+ * This method get the name of the postText attribute
+ */
+QString ActivityWidget::postconditionText()
+{
+    return postText;
+}
+
+ /**
+ * This method set the name of the postText attribute
+ */
+void ActivityWidget::setPostconditionText(const QString& aPostText)
+{
+    postText=aPostText;
+    updateComponentSize();
+    adjustAssocs( getX(), getY() );
+}
+
+/**
+ * Show a properties dialog for an ActivityWidget.
+ */
+void ActivityWidget::showProperties()
+{
+    DocWindow *docwindow = UMLApp::app()->docWindow();
+    docwindow->updateDocumentation(false);
+
+    QPointer<ActivityDialog> dialog = new ActivityDialog(m_pView, this);
+    if (dialog->exec() && dialog->getChangesMade()) {
+        docwindow->showDocumentation(this, true);
+        UMLApp::app()->document()->setModified(true);
+    }
+    delete dialog;
+}
+
+/**
+ * Overrides the standard paint event.
+ */
 void ActivityWidget::draw(QPainter & p, int offsetX, int offsetY)
 {
     int w = width();
@@ -171,6 +290,42 @@
         drawSelected(&p, offsetX, offsetY);
 }
 
+/**
+ * Loads the widget from the "activitywidget" XMI element.
+ */
+bool ActivityWidget::loadFromXMI( QDomElement & qElement )
+{
+    if( !UMLWidget::loadFromXMI( qElement ) )
+        return false;
+    m_Text = qElement.attribute( "activityname", "" );
+    m_Doc = qElement.attribute( "documentation", "" );
+    preText = qElement.attribute( "precondition", "" );
+    postText = qElement.attribute( "postcondition", "" );
+
+    QString type = qElement.attribute( "activitytype", "1" );
+    setActivityType( (ActivityType)type.toInt() );
+
+    return true;
+}
+
+/**
+ * Saves the widget to the "activitywidget" XMI element.
+ */
+void ActivityWidget::saveToXMI( QDomDocument & qDoc, QDomElement & qElement )
+{
+    QDomElement activityElement = qDoc.createElement( "activitywidget" );
+    UMLWidget::saveToXMI( qDoc, activityElement );
+    activityElement.setAttribute( "activityname", m_Text );
+    activityElement.setAttribute( "documentation", m_Doc );
+    activityElement.setAttribute( "precondition", preText );
+    activityElement.setAttribute( "postcondition", postText );
+    activityElement.setAttribute( "activitytype", m_ActivityType );
+    qElement.appendChild( activityElement );
+}
+
+/**
+ * Overrides Method from UMLWidget.
+ */
 void ActivityWidget::constrain(int& width, int& height)
 {
     if (m_ActivityType == Normal || m_ActivityType == Invok || m_ActivityType == Param) {
@@ -204,6 +359,34 @@
     }
 }
 
+/**
+ * Captures any popup menu signals for menus it created.
+ */
+void ActivityWidget::slotMenuSelection(QAction* action)
+{
+    bool ok = false;
+    QString name = m_Text;
+
+    ListPopupMenu::MenuType sel = m_pMenu->getMenuType(action);
+    switch( sel ) {
+    case ListPopupMenu::mt_Rename:
+        name = KInputDialog::getText( i18n("Enter Activity Name"), i18n("Enter the name of the new activity:"), m_Text, &ok );
+        if( ok && name.length() > 0 )
+            m_Text = name;
+        break;
+
+    case ListPopupMenu::mt_Properties:
+        showProperties();
+        break;
+
+    default:
+        UMLWidget::slotMenuSelection(action);
+    }
+}
+
+/**
+ * Overrides method from UMLWidget
+ */
 QSize ActivityWidget::calculateSize()
 {
     int width, height;
@@ -241,130 +424,5 @@
     return QSize(width, height);
 }
 
-ActivityWidget::ActivityType ActivityWidget::activityType() const
-{
-    return m_ActivityType;
-}
-
-void ActivityWidget::setActivityType( ActivityType activityType )
-{
-    m_ActivityType = activityType;
-    updateComponentSize();
-    UMLWidget::m_bResizable = true;
-}
-
-void ActivityWidget::slotMenuSelection(QAction* action)
-{
-    bool ok = false;
-    QString name = m_Text;
-
-    ListPopupMenu::MenuType sel = m_pMenu->getMenuType(action);
-    switch( sel ) {
-    case ListPopupMenu::mt_Rename:
-        name = KInputDialog::getText( i18n("Enter Activity Name"), i18n("Enter the name of the new activity:"), m_Text, &ok );
-        if( ok && name.length() > 0 )
-            m_Text = name;
-        break;
-
-    case ListPopupMenu::mt_Properties:
-        showProperties();
-        break;
-
-    default:
-        UMLWidget::slotMenuSelection(action);
-    }
-}
-
-void ActivityWidget::showProperties()
-{
-    DocWindow *docwindow = UMLApp::app()->docWindow();
-    docwindow->updateDocumentation(false);
-
-    QPointer<ActivityDialog> dialog = new ActivityDialog(m_pView, this);
-    if (dialog->exec() && dialog->getChangesMade()) {
-        docwindow->showDocumentation(this, true);
-        UMLApp::app()->document()->setModified(true);
-    }
-    delete dialog;
-}
-
-bool ActivityWidget::isActivity(WorkToolBar::ToolBar_Buttons tbb,
-                                ActivityType& resultType)
-{
-    bool status = true;
-    switch (tbb) {
-    case WorkToolBar::tbb_Initial_Activity:
-        resultType = Initial;
-        break;
-    case WorkToolBar::tbb_Activity:
-        resultType = Normal;
-        break;
-    case WorkToolBar::tbb_End_Activity:
-        resultType = End;
-        break;
-    case WorkToolBar::tbb_Final_Activity:
-        resultType = Final;
-        break;
-    case WorkToolBar::tbb_Branch:
-        resultType = Branch;
-        break;
-    default:
-        status = false;
-        break;
-    }
-    return status;
-}
-
-void ActivityWidget::saveToXMI( QDomDocument & qDoc, QDomElement & qElement )
-{
-    QDomElement activityElement = qDoc.createElement( "activitywidget" );
-    UMLWidget::saveToXMI( qDoc, activityElement );
-    activityElement.setAttribute( "activityname", m_Text );
-    activityElement.setAttribute( "documentation", m_Doc );
-    activityElement.setAttribute( "precondition", preText );
-    activityElement.setAttribute( "postcondition", postText );
-    activityElement.setAttribute( "activitytype", m_ActivityType );
-    qElement.appendChild( activityElement );
-}
-
-bool ActivityWidget::loadFromXMI( QDomElement & qElement )
-{
-    if( !UMLWidget::loadFromXMI( qElement ) )
-        return false;
-    m_Text = qElement.attribute( "activityname", "" );
-    m_Doc = qElement.attribute( "documentation", "" );
-    preText = qElement.attribute( "precondition", "" );
-    postText = qElement.attribute( "postcondition", "" );
-
-    QString type = qElement.attribute( "activitytype", "1" );
-    setActivityType( (ActivityType)type.toInt() );
-
-    return true;
-}
-
-void ActivityWidget::setPreconditionText(const QString& aPreText)
-{
-    preText=aPreText;
-    updateComponentSize();
-    adjustAssocs( getX(), getY() );
-}
-
-QString ActivityWidget::preconditionText()
-{
-    return preText;
-}
-
-void ActivityWidget::setPostconditionText(const QString& aPostText)
-{
-    postText=aPostText;
-    updateComponentSize();
-    adjustAssocs( getX(), getY() );
-}
-
-QString ActivityWidget::postconditionText()
-{
-    return postText;
-}
-
 #include "activitywidget.moc"
 
--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/activitywidget.h #1268554:1268555
@@ -1,10 +1,11 @@
 /***************************************************************************
+ *
  *   This program is free software; you can redistribute it and/or modify  *
  *   it under the terms of the GNU General Public License as published by  *
  *   the Free Software Foundation; either version 2 of the License, or     *
  *   (at your option) any later version.                                   *
  *                                                                         *
- *   copyright (C) 2002-2009                                               *
+ *   copyright (C) 2002-2011                                               *
  *   Umbrello UML Modeller Authors <uml-devel at uml.sf.net>                  *
  ***************************************************************************/
 
@@ -48,91 +49,34 @@
         Param
     };
 
-    /**
-     * Creates a Activity widget.
-     *
-     * @param view              The parent of the widget.
-     * @param activityType      The type of activity.
-     * @param id                The ID to assign (-1 will prompt a new ID.)
-     */
     explicit ActivityWidget( UMLView * view, ActivityType activityType = Normal, Uml::IDType id = Uml::id_None );
-
-    /**
-     *  destructor
-     */
     virtual ~ActivityWidget();
 
-    /**
-     * Overrides the standard paint event.
-     */
-    void draw(QPainter & p, int offsetX, int offsetY);
-
-    /**
-     * Overrides Method from UMLWidget.
-     */
-    void constrain(int& width, int& height);
-
-    /**
-     * Returns the type of activity.
-     */
     ActivityType activityType() const;
-
-    /**
-     * Sets the type of activity.
-     */
     void setActivityType( ActivityType activityType );
 
-    /**
-     * Show a properties dialog for an ActivityWidget.
-     */
-    void showProperties();
-
-    /**
-     * Determines whether a toolbar button represents an Activity.
-     * CHECK: currently unused - can this be removed?
-     *
-     * @param tbb               The toolbar button enum input value.
-     * @param resultType        The ActivityType corresponding to tbb.
-     *                  This is only set if tbb is an Activity.
-     * @return  True if tbb represents an Activity.
-     */
     static bool isActivity( WorkToolBar::ToolBar_Buttons tbb,
                             ActivityType& resultType );
 
-    /**
-     * Saves the widget to the "activitywidget" XMI element.
-     */
-    void saveToXMI( QDomDocument & qDoc, QDomElement & qElement );
+    QString preconditionText();
+    void setPreconditionText(const QString&);
 
-    /**
-     * Loads the widget from the "activitywidget" XMI element.
-     */
-    bool loadFromXMI( QDomElement & qElement );
+    QString postconditionText();
+    void setPostconditionText(const QString&);
 
-    /**
-     * This method set the name of the preText attribute
-     */
-     void setPreconditionText(const QString&);
+    void showProperties();
 
-    /**
-     * This method get the name of the preText attribute
-     */
-     QString preconditionText();
+    void draw(QPainter & p, int offsetX, int offsetY);
 
-     /**
-     * This method set the name of the postText attribute
-     */
-     void setPostconditionText(const QString&);
+    bool loadFromXMI( QDomElement & qElement );
+    void saveToXMI( QDomDocument & qDoc, QDomElement & qElement );
 
-   /**
-     * This method get the name of the postText attribute
-     */
-     QString postconditionText();
+    void constrain(int& width, int& height);
 
+public Q_SLOTS:
+    void slotMenuSelection(QAction* action);
+
 protected:
-    /**
-     * Overrides method from UMLWidget
-     */
     QSize calculateSize();
 
     /**
@@ -146,12 +90,6 @@
      */
     bool m_NormalActivityType;
 
-public slots:
-
-    /**
-     * Captures any popup menu signals for menus it created.
-     */
-    void slotMenuSelection(QAction* action);
 };
 
 #endif




More information about the umbrello-devel mailing list