umbrello API Documentation

AssociationWidget Class Reference

This class represents an association inside a diagram. This class represents an association inside a diagram. Bugs and comments to uml-devel@lists.sf.net or http://bugs.kde.org. More...

#include <associationwidget.h>

Inheritance diagram for AssociationWidget:

WidgetBase LinkWidget List of all members.

Public Types

enum  Region {
  Error = 0, West, North, East,
  South, NorthWest, NorthEast, SouthEast,
  SouthWest, Center
}
 Enumeration used for stating where a line is on a widget. More...

Public Slots

void slotMenuSelection (int sel)
 Handles the selection from the popup menu.
void slotRemovePopupMenu ()
 This slot is entered when an event has occurred on the views display, most likely a mouse event.
void slotClearAllSelected ()
 Handles any signals that tells everyone not to be selected.
void slotAttributeRemoved (UMLClassifierListItem *obj)
 Connected to UMLClassifier::attributeRemoved() in case this AssociationWidget is linked to a classifer's attribute type.
void syncToModel ()
 Synchronize this widget from the UMLAssociation.

Public Member Functions

 AssociationWidget (UMLView *view)
 Constructor.
 AssociationWidget (UMLView *view, UMLWidget *WidgetA, Uml::Association_Type Type, UMLWidget *WidgetB, UMLAssociation *umlassoc=NULL)
 Constructor.
virtual ~AssociationWidget ()
 Deconstructor.
AssociationWidgetoperator= (AssociationWidget &Other)
 Overrides the assignment operator.
bool operator== (AssociationWidget &Other)
 Overrides the equality test operator.
bool operator!= (AssociationWidget &Other)
 Overrides the != operator.
bool activate ()
 Activates the AssociationWidget after a load.
void setWidget (UMLWidget *widget, Uml::Role_Type role)
 Set the widget of the given role.
FloatingTextWidgetgetMultiWidget (Uml::Role_Type role)
 Return the multiplicity FloatingTextWidget widget of the given role.
QString getMulti (Uml::Role_Type role) const
 Return the given role's multiplicity text.
FloatingTextWidgetgetNameWidget ()
 Read property of FloatingTextWidget* m_pName.
QString getName () const
 Returns the m_pName's text.
FloatingTextWidgetgetRoleWidget (Uml::Role_Type role)
 Return the given role's FloatingTextWidget object.
FloatingTextWidgetgetTextWidgetByRole (Uml::Text_Role tr)
 Return the FloatingTextWidget object indicated by the given Text_Role.
QString getRoleName (Uml::Role_Type role) const
 Return the given role's FloatingTextWidget widget text.
QString getRoleDoc (Uml::Role_Type role) const
 Returns the given role's documentation.
void setName (const QString &strRole)
 Sets the text in the FloatingTextWidget widget representing the Name of this association.
void setMulti (const QString &strMulti, Uml::Role_Type role)
 Sets the text in the FloatingTextWidget representing the multiplicity at the given side of the association.
Uml::Visibility getVisibility (Uml::Role_Type role) const
 Gets the visibility on the given role of the association.
void setVisibility (Uml::Visibility visibility, Uml::Role_Type role)
 Sets the visibility on the given role of the association.
Uml::Changeability_Type getChangeability (Uml::Role_Type role) const
 Gets the changeability on the the given end of the Association.
void setChangeability (Uml::Changeability_Type value, Uml::Role_Type role)
 Sets the changeability on the the given end of the Association.
Uml::IDType getWidgetID (Uml::Role_Type role) const
 Gets the ID of the given role widget.
UMLWidgetgetWidget (Uml::Role_Type role)
 Gets the given role widget.
bool setWidgets (UMLWidget *widgetA, Uml::Association_Type assocType, UMLWidget *widgetB)
 Sets the associated widgets.
bool checkAssoc (UMLWidget *widgetA, UMLWidget *widgetB)
 Returns true if this association associates widgetA to widgetB, otherwise it returns false.
bool contains (UMLWidget *widget)
 Returns true if the Widget is either at the starting or ending side of the association.
bool isCollaboration ()
 Returns true if this AssociationWidget represents a collaboration message.
Uml::Association_Type getAssocType () const
 Gets the association's type.
void setAssocType (Uml::Association_Type type)
 Sets the association's type.
QString toString ()
 Returns a QString object representing this AssociationWidget.
bool isActivated ()
 Read property of bool m_bActivated.
void setActivated (bool active)
 Set the m_bActivated flag of a widget but does not perform the activate method.
void setSelected (bool _select=true)
 Sets the state of whether the widget is selected.
bool getSelected () const
 Returns the state of whether the widget is selected.
LinePathgetLinePath ()
 Returns a pointer to the association widget's line path.
void widgetMoved (UMLWidget *widget, int x, int y)
 Adjusts the ending point of the association that connects to Widget.
void saveIdealTextPositions ()
 Auxiliary method for widgetMoved(): Saves all ideally computed floatingtext positions before doing any kind of change.
void calculateNameTextSegment ()
 Calculates the m_unNameLineSegment value according to the new NameText topleft corner PT.
void mouseDoubleClickEvent (QMouseEvent *me)
 Adds a break point (if left mouse button).
void mousePressEvent (QMouseEvent *me)
 Sets the association to be selected.
void mouseReleaseEvent (QMouseEvent *me)
 Displays the right mouse buttom menu if right button is pressed.
void mouseMoveEvent (QMouseEvent *me)
 Moves the break point being dragged.
bool onAssociation (const QPoint &point)
 Returns true if the given point is on the Association.
bool onAssocClassLine (const QPoint &point)
 Returns true if the given point is on the connecting line to the association class.
void createAssocClassLine ()
 Creates the association class connecting line.
void createAssocClassLine (ClassifierWidget *classifierWidget, int linePathSegmentIndex)
 Creates the association class connecting line using the specified ClassifierWidget.
void selectAssocClassLine (bool sel=true)
 Renders the association class connecting line selected.
void moveMidPointsBy (int x, int y)
 Moves all the mid points (all expcept start /end ) by the given amount.
void moveEntireAssoc (int x, int y)
 Moves the entire association by the given offset.
QRect getAssocLineRectangle ()
 Returns the bounding rectangle of all segments of the association.
QFont getFont () const
 Return the first font found being used by any child widget.
void setLineColor (const QColor &colour)
 Overrides the method from WidgetBase.
void setLineWidth (uint width)
 Overrides the method from WidgetBase.
void lwSetFont (QFont font)
 Set all 'owned' child widgets to this font.
FloatingTextWidgetgetChangeWidget (Uml::Role_Type role)
 Return the given role's changeability FloatingTextWidget widget.
void setRoleName (const QString &strRole, Uml::Role_Type role)
 Sets the text to the FloatingTextWidget that display the Role text of this association.
void setRoleDoc (const QString &doc, Uml::Role_Type role)
 Set the documentation on the given role.
UMLClassifiergetOperationOwner ()
 Overrides operation from LinkWidget.
UMLOperationgetOperation ()
 Implements operation from LinkWidget.
void setOperation (UMLOperation *op)
 Implements operation from LinkWidget.
QString getCustomOpText ()
 Overrides operation from LinkWidget.
void setCustomOpText (const QString &opText)
 Overrides operation from LinkWidget.
void setMessageText (FloatingTextWidget *ft)
 Overrides operation from LinkWidget.
UMLAssociationgetAssociation () const
 Returns the UMLAssociation representation of this object.
UMLAttributegetAttribute () const
 Returns the UMLAttribute representation of this object.
void setText (FloatingTextWidget *ft, const QString &text)
 Sets the text of the FloatingTextWidget identified by the ft's Text_Role.
void resetTextPositions ()
 Calls setTextPosition() on all the labels.
void constrainTextPos (int &textX, int &textY, int textWidth, int textHeight, Uml::Text_Role tr)
 Constrains the FloatingTextWidget X and Y values supplied.
bool showDialog ()
 Shows the association properties dialog and updates the corresponding texts if its execution is successful.
void setIndex (int index, Uml::Role_Type role)
 Sets the Association line index for the given role.
int getIndex (Uml::Role_Type role) const
 Returns the Association line index for the given role.
void setTotalCount (int count, Uml::Role_Type role)
 Sets the total count on the Association region.
int getTotalCount (Uml::Role_Type role) const
 Returns the total count on the Association region.
void setTotalCount (int count)
 Sets the total count on the Association region for widgetB.
void setSeqNumAndOp (const QString &seqNum, const QString &op)
 Overrides operation from LinkWidget.
UMLClassifiergetSeqNumAndOp (QString &seqNum, QString &op)
 Overrides operation from LinkWidget.
void calculateEndingPoints ()
 Calculates and sets the first and last point in the association's LinePath.
void removeAssocClassLine ()
 Remove dashed connecting line for association class.
void computeAssocClassLine ()
 Compute the end points of m_pAssocClassLine in case this association has an attached association class.
void setUMLObject (UMLObject *obj)
 Overriding the method from WidgetBase because we need to do something extra in case this AssociationWidget represents an attribute of a classifier.
void saveToXMI (QDomDocument &qDoc, QDomElement &qElement)
 Saves this widget to the <assocwidget> XMI element.
bool loadFromXMI (QDomElement &qElement)
 Loads this widget from the <assocwidget> XMI element.
bool loadFromXMI (QDomElement &qElement, const UMLWidgetList &widgets, const MessageWidgetList *pMessages=NULL)
 Same as above, but uses the supplied widgetList for resolving the role A and role B widgets.
void cleanup ()
 Cleans up all the association's data in the related widgets.

Detailed Description

This class represents an association inside a diagram. This class represents an association inside a diagram. Bugs and comments to uml-devel@lists.sf.net or http://bugs.kde.org.

Associations exist not only between UML objects. For example, when a Note is attached to a UML object, the Note itself is not a UML object. This class supports both kinds of associations. An association where one or both roles are not a UML object is called a "pure widget association".

An AssociationWidget where both roles are UML objects has a corresponding UMLAssociation. The UMLAssociation can be retrieved using the getAssociation method. A pure widget association does not have a corresponding UMLAssociation. The getAssociation method returns NULL in this case.

Author:
Gustavo Madrigal

Definition at line 55 of file associationwidget.h.


Member Enumeration Documentation

enum AssociationWidget::Region
 

Enumeration used for stating where a line is on a widget.

Definition at line 61 of file associationwidget.h.


Constructor & Destructor Documentation

AssociationWidget::AssociationWidget UMLView view  ) 
 

Constructor.

Parameters:
view The parent view of this widget.

Definition at line 53 of file associationwidget.cpp.

References WidgetBase::init().

AssociationWidget::AssociationWidget UMLView view,
UMLWidget WidgetA,
Uml::Association_Type  Type,
UMLWidget WidgetB,
UMLAssociation umlassoc = NULL
 

Constructor.

Parameters:
view The parent view of this widget.
WidgetA Pointer the role A widget for the association.
Type The Association_Type for this association.
WidgetB Pointer the role B widget for the association.
umlassoc Pointer the underlying UMLAssociation (if applicable.)

Definition at line 60 of file associationwidget.cpp.

References calculateEndingPoints(), UMLDoc::findAssociation(), UMLView::generateCollaborationId(), WidgetBase::init(), isCollaboration(), setActivated(), setAssocType(), setName(), and setWidget().

AssociationWidget::~AssociationWidget  )  [virtual]
 

Deconstructor.

Definition at line 123 of file associationwidget.cpp.


Member Function Documentation

AssociationWidget & AssociationWidget::operator= AssociationWidget Other  ) 
 

Overrides the assignment operator.

Definition at line 126 of file associationwidget.cpp.

References UMLWidget::m_bActivated.

bool AssociationWidget::operator== AssociationWidget Other  ) 
 

Overrides the equality test operator.

Definition at line 180 of file associationwidget.cpp.

References getAssocType(), WidgetBase::getBaseType(), ObjectWidget::getLocalID(), getName(), getWidget(), and getWidgetID().

bool AssociationWidget::operator!= AssociationWidget Other  ) 
 

Overrides the != operator.

Definition at line 224 of file associationwidget.cpp.

bool AssociationWidget::activate  ) 
 

Activates the AssociationWidget after a load.

Returns:
true for success

Definition at line 545 of file associationwidget.cpp.

References FloatingTextWidget::activate(), LinePath::activate(), calculateEndingPoints(), calculateNameTextSegment(), createAssocClassLine(), UMLDoc::findObjectById(), UMLView::findWidget(), getAssocType(), UMLAssociation::getAssocType(), UMLObject::getBaseType(), FloatingTextWidget::getText(), UMLView::getType(), getVisibility(), getWidgetID(), setAssocType(), LinePath::setAssocType(), FloatingTextWidget::setLink(), FloatingTextWidget::setRole(), setUMLObject(), and setWidget().

Referenced by UMLView::activate().

void AssociationWidget::setWidget UMLWidget widget,
Uml::Role_Type  role
 

Set the widget of the given role.

Parameters:
widget Pointer to the UMLWidget.
role Role for which to set the widget.

Definition at line 3261 of file associationwidget.cpp.

References getAssociation(), UMLObject::getBaseType(), and UMLAssociation::setObject().

Referenced by activate(), AssociationWidget(), UMLView::createAutoAssociations(), loadFromXMI(), and setWidgets().

FloatingTextWidget * AssociationWidget::getMultiWidget Uml::Role_Type  role  ) 
 

Return the multiplicity FloatingTextWidget widget of the given role.

Returns:
Pointer to the multiplicity FloatingTextWidget object.

Definition at line 243 of file associationwidget.cpp.

Referenced by UMLView::copyAsImage().

QString AssociationWidget::getMulti Uml::Role_Type  role  )  const
 

Return the given role's multiplicity text.

Returns:
Text of the given role's multiplicity widget.

Definition at line 247 of file associationwidget.cpp.

References FloatingTextWidget::getText().

Referenced by getSeqNumAndOp(), setMessageText(), and showDialog().

FloatingTextWidget * AssociationWidget::getNameWidget  ) 
 

Read property of FloatingTextWidget* m_pName.

Returns:
Pointer to the FloatingTextWidget name widget.

Definition at line 254 of file associationwidget.cpp.

QString AssociationWidget::getName  )  const
 

Returns the m_pName's text.

Returns:
Text of the FloatingTextWidget name widget.

Definition at line 259 of file associationwidget.cpp.

References FloatingTextWidget::getText().

Referenced by UMLView::addWidget(), getCustomOpText(), getSeqNumAndOp(), operator==(), setMessageText(), showDialog(), and toString().

FloatingTextWidget * AssociationWidget::getRoleWidget Uml::Role_Type  role  ) 
 

Return the given role's FloatingTextWidget object.

Returns:
Pointer to the role's FloatingTextWidget widget.

Definition at line 265 of file associationwidget.cpp.

Referenced by UMLView::copyAsImage().

FloatingTextWidget * AssociationWidget::getTextWidgetByRole Uml::Text_Role  tr  ) 
 

Return the FloatingTextWidget object indicated by the given Text_Role.

Returns:
Pointer to the text role's FloatingTextWidget widget.

Definition at line 273 of file associationwidget.cpp.

QString AssociationWidget::getRoleName Uml::Role_Type  role  )  const
 

Return the given role's FloatingTextWidget widget text.

Returns:
The name set at the FloatingTextWidget.

Definition at line 296 of file associationwidget.cpp.

References FloatingTextWidget::getText().

Referenced by UMLView::findAssocWidget(), and showDialog().

QString AssociationWidget::getRoleDoc Uml::Role_Type  role  )  const
 

Returns the given role's documentation.

Definition at line 302 of file associationwidget.cpp.

References UMLObject::getBaseType(), and UMLAssociation::getRoleDoc().

Referenced by showDialog().

void AssociationWidget::setName const QString &  strRole  ) 
 

Sets the text in the FloatingTextWidget widget representing the Name of this association.

Definition at line 309 of file associationwidget.cpp.

References UMLView::addWidget(), getAssociation(), UMLView::removeWidget(), UMLWidget::setActivated(), FloatingTextWidget::setLink(), UMLObject::setName(), and FloatingTextWidget::setText().

Referenced by AssociationWidget(), FloatingTextWidget::handleRename(), loadFromXMI(), setCustomOpText(), setSeqNumAndOp(), setText(), showDialog(), slotMenuSelection(), syncToModel(), and AssocGenPage::updateObject().

void AssociationWidget::setMulti const QString &  strMulti,
Uml::Role_Type  role
 

Sets the text in the FloatingTextWidget representing the multiplicity at the given side of the association.

Definition at line 371 of file associationwidget.cpp.

References getAssociation(), UMLObject::getBaseType(), and UMLAssociation::setMulti().

Referenced by FloatingTextWidget::handleRename(), loadFromXMI(), setSeqNumAndOp(), setText(), showDialog(), slotMenuSelection(), syncToModel(), and AssocRolePage::updateObject().

Uml::Visibility AssociationWidget::getVisibility Uml::Role_Type  role  )  const
 

Gets the visibility on the given role of the association.

Definition at line 426 of file associationwidget.cpp.

References getAssociation(), getAttribute(), UMLObject::getVisibility(), and UMLAssociation::getVisibility().

Referenced by activate(), setRoleName(), setVisibility(), and showDialog().

void AssociationWidget::setVisibility Uml::Visibility  visibility,
Uml::Role_Type  role
 

Sets the visibility on the given role of the association.

Definition at line 436 of file associationwidget.cpp.

References getAssociation(), getAttribute(), UMLObject::getBaseType(), getVisibility(), UMLObject::setVisibility(), UMLAssociation::setVisibility(), and UMLAttribute::toString().

Referenced by loadFromXMI(), showDialog(), syncToModel(), and AssocRolePage::updateObject().

Changeability_Type AssociationWidget::getChangeability Uml::Role_Type  role  )  const
 

Gets the changeability on the the given end of the Association.

Definition at line 456 of file associationwidget.cpp.

References UMLObject::getBaseType(), and UMLAssociation::getChangeability().

Referenced by setChangeability(), and showDialog().

void AssociationWidget::setChangeability Uml::Changeability_Type  value,
Uml::Role_Type  role
 

Sets the changeability on the the given end of the Association.

Definition at line 464 of file associationwidget.cpp.

References UMLAssociation::ChangeabilityToString(), getAssociation(), UMLObject::getBaseType(), getChangeability(), and UMLAssociation::setChangeability().

Referenced by FloatingTextWidget::handleRename(), loadFromXMI(), showDialog(), syncToModel(), and AssocRolePage::updateObject().

Uml::IDType AssociationWidget::getWidgetID Uml::Role_Type  role  )  const
 

Gets the ID of the given role widget.

Definition at line 875 of file associationwidget.cpp.

References UMLObject::getBaseType(), UMLObject::getID(), and UMLAssociation::getObjectId().

Referenced by activate(), UMLView::findAssocWidget(), operator==(), and saveToXMI().

UMLWidget * AssociationWidget::getWidget Uml::Role_Type  role  ) 
 

Gets the given role widget.

Returns:
Pointer to the role's UMLWidget.

Definition at line 677 of file associationwidget.cpp.

Referenced by AssocRules::allowAssociation(), getOperationOwner(), getSeqNumAndOp(), UMLView::getWidgetAssocs(), mouseReleaseEvent(), operator==(), UMLView::selectAssociations(), setAssocType(), and UMLView::updateContainment().

bool AssociationWidget::setWidgets UMLWidget widgetA,
Uml::Association_Type  assocType,
UMLWidget widgetB
 

Sets the associated widgets.

Parameters:
widgetA Pointer the role A widget for the association.
assocType The Association_Type for this association.
widgetB Pointer the role B widget for the association.

Definition at line 681 of file associationwidget.cpp.

References calculateEndingPoints(), setAssocType(), and setWidget().

bool AssociationWidget::checkAssoc UMLWidget widgetA,
UMLWidget widgetB
 

Returns true if this association associates widgetA to widgetB, otherwise it returns false.

Parameters:
widgetA Pointer the role A widget to check.
widgetB Pointer the role B widget to check.
Returns:
True if widgetA and widgetB are associated.

Definition at line 701 of file associationwidget.cpp.

bool AssociationWidget::contains UMLWidget widget  ) 
 

Returns true if the Widget is either at the starting or ending side of the association.

Returns:
True if widget plays role A or B in this assoc.

Definition at line 828 of file associationwidget.cpp.

Referenced by UMLView::removeAssociations().

bool AssociationWidget::isCollaboration  ) 
 

Returns true if this AssociationWidget represents a collaboration message.

Definition at line 832 of file associationwidget.cpp.

References getAssocType().

Referenced by AssociationWidget(), getOperationOwner(), mouseReleaseEvent(), setMessageText(), and slotMenuSelection().

Association_Type AssociationWidget::getAssocType  )  const
 

Gets the association's type.

Returns:
This AssociationWidget's Association_Type.

Definition at line 837 of file associationwidget.cpp.

References UMLAssociation::getAssocType(), and UMLObject::getBaseType().

Referenced by activate(), AssocRules::allowAssociation(), UMLView::findAssocWidget(), isCollaboration(), mouseReleaseEvent(), operator==(), setRoleName(), slotMenuSelection(), toString(), and UMLView::updateContainment().

void AssociationWidget::setAssocType Uml::Association_Type  type  ) 
 

Sets the association's type.

Parameters:
type The Association_Type to set.

Definition at line 845 of file associationwidget.cpp.

References AssocRules::allowMultiplicity(), AssocRules::allowRole(), getAssociation(), WidgetBase::getBaseType(), UMLObject::getBaseType(), getWidget(), LinePath::setAssocType(), UMLAssociation::setAssocType(), and setRoleDoc().

Referenced by activate(), AssociationWidget(), UMLView::createAutoAssociations(), loadFromXMI(), setWidgets(), and AssocGenPage::updateObject().

QString AssociationWidget::toString  ) 
 

Returns a QString object representing this AssociationWidget.

Returns:
Textual representation of the AssociationWidget.

Definition at line 891 of file associationwidget.cpp.

References getAssocType(), getName(), and UMLAssociation::m_pRole.

bool AssociationWidget::isActivated  ) 
 

Read property of bool m_bActivated.

Returns:
True if this AssociationWidget has been activated.

Definition at line 1181 of file associationwidget.cpp.

void AssociationWidget::setActivated bool  active  ) 
 

Set the m_bActivated flag of a widget but does not perform the activate method.

Parameters:
active The flag status to set.

Definition at line 1186 of file associationwidget.cpp.

Referenced by AssociationWidget(), UMLView::createAutoAssociations(), and UMLView::updateContainment().

void AssociationWidget::setSelected bool  _select = true  ) 
 

Sets the state of whether the widget is selected.

Parameters:
_select The state of whether the widget is selected.

Definition at line 2972 of file associationwidget.cpp.

References selectAssocClassLine(), and LinePath::setSelected().

Referenced by UMLView::getDiagram(), mouseMoveEvent(), mousePressEvent(), mouseReleaseEvent(), UMLView::selectAssociations(), and slotClearAllSelected().

bool AssociationWidget::getSelected  )  const [inline]
 

Returns the state of whether the widget is selected.

Returns:
Returns the state of whether the widget is selected.

Definition at line 301 of file associationwidget.h.

Referenced by UMLWidget::adjustUnselectedAssocs(), UMLView::copyAsImage(), and UMLWidgetController::mouseMoveEvent().

LinePath* AssociationWidget::getLinePath  )  [inline]
 

Returns a pointer to the association widget's line path.

Definition at line 308 of file associationwidget.h.

void AssociationWidget::widgetMoved UMLWidget widget,
int  x,
int  y
 

Adjusts the ending point of the association that connects to Widget.

Parameters:
widget Pointer to the widget that was moved.
x New X coordinate of the widget.
y New Y coordinate of the widget.

Definition at line 1274 of file associationwidget.cpp.

References calculateEndingPoints(), LinePath::count(), WidgetBase::getBaseType(), LinePath::getPoint(), UMLWidget::getSelected(), UMLDoc::loading(), and LinePath::setPoint().

Referenced by UMLWidget::adjustAssocs(), and UMLWidget::adjustUnselectedAssocs().

void AssociationWidget::saveIdealTextPositions  ) 
 

Auxiliary method for widgetMoved(): Saves all ideally computed floatingtext positions before doing any kind of change.

This is necessary because a single invocation of calculateEndingPoints() modifies the LinePath ending points on ALL AssociationWidgets. This means that if we don't save the old ideal positions then they are irretrievably lost as soon as calculateEndingPoints() is invoked.

Definition at line 1263 of file associationwidget.cpp.

Referenced by UMLWidget::adjustAssocs(), and UMLWidget::adjustUnselectedAssocs().

void AssociationWidget::calculateNameTextSegment  )  [virtual]
 

Calculates the m_unNameLineSegment value according to the new NameText topleft corner PT.

It iterates through all LinePath's segments and for each one calculates the sum of PT's distance to the start point + PT's distance to the end point. The segment with the smallest sum will be the RoleTextSegment (if this segment moves then the RoleText will move with it). It sets m_unNameLineSegment to the start point of the chosen segment.

Overrides operation from LinkWidget (i.e. this method is also required by FloatingTextWidget.)

Reimplemented from LinkWidget.

Definition at line 1961 of file associationwidget.cpp.

References LinePath::count(), and LinePath::getPoint().

Referenced by activate(), mouseDoubleClickEvent(), and moveEntireAssoc().

void AssociationWidget::mouseDoubleClickEvent QMouseEvent *  me  ) 
 

Adds a break point (if left mouse button).

Definition at line 917 of file associationwidget.cpp.

References calculateNameTextSegment(), computeAssocClassLine(), LinePath::count(), LinePath::getPoint(), LinePath::insertPoint(), LinePath::isPoint(), LinePath::onLinePath(), LinePath::removePoint(), UMLDoc::setModified(), LinePath::setSelected(), and LinePath::update().

Referenced by ToolBarStateArrow::mouseDoubleClickAssociation().

void AssociationWidget::mousePressEvent QMouseEvent *  me  ) 
 

Sets the association to be selected.

Definition at line 2168 of file associationwidget.cpp.

References onAssocClassLine(), selectAssocClassLine(), and setSelected().

Referenced by ToolBarStateArrow::mousePressAssociation().

void AssociationWidget::mouseReleaseEvent QMouseEvent *  me  ) 
 

Displays the right mouse buttom menu if right button is pressed.

Definition at line 2188 of file associationwidget.cpp.

References AssocRules::allowMultiplicity(), AssocRules::allowRole(), LinePath::count(), getAssocType(), WidgetBase::getBaseType(), LinePath::getPoint(), getWidget(), isCollaboration(), onAssocClassLine(), LinePath::removePoint(), setSelected(), and slotMenuSelection().

Referenced by ToolBarStateArrow::mouseReleaseAssociation().

void AssociationWidget::mouseMoveEvent QMouseEvent *  me  ) 
 

Moves the break point being dragged.

Definition at line 2497 of file associationwidget.cpp.

References WidgetBase::getBaseType(), UMLWidget::getHeight(), LinePath::getPoint(), UMLView::getWidgetAt(), UMLWidget::getWidth(), UMLWidget::getX(), UMLWidget::getY(), LinePath::insertPoint(), LinePath::onLinePath(), UMLView::resizeCanvasToItems(), setSelected(), UMLWidget::setX(), UMLWidget::setY(), UMLView::snappedX(), and UMLView::snappedY().

Referenced by ToolBarStateArrow::mouseMoveAssociation().

bool AssociationWidget::onAssociation const QPoint &  point  ) 
 

Returns true if the given point is on the Association.

Definition at line 3021 of file associationwidget.cpp.

References onAssocClassLine(), and LinePath::onLinePath().

Referenced by ToolBarState::getAssociationAt().

bool AssociationWidget::onAssocClassLine const QPoint &  point  ) 
 

Returns true if the given point is on the connecting line to the association class.

Returns false if there is no association class attached, or if the given point is not on the connecting line.

Definition at line 3009 of file associationwidget.cpp.

Referenced by mousePressEvent(), mouseReleaseEvent(), and onAssociation().

void AssociationWidget::createAssocClassLine  ) 
 

Creates the association class connecting line.

Definition at line 2097 of file associationwidget.cpp.

References computeAssocClassLine(), WidgetBase::getLineColor(), WidgetBase::getLineWidth(), and UMLWidget::setPen().

Referenced by activate(), createAssocClassLine(), and ToolBarStateAssociation::mouseReleaseAssociation().

void AssociationWidget::createAssocClassLine ClassifierWidget classifierWidget,
int  linePathSegmentIndex
 

Creates the association class connecting line using the specified ClassifierWidget.

Parameters:
classifierWidget The ClassifierWidget to use.
linePathSegmentIndex The index of the segment where the association class is created.

Definition at line 2106 of file associationwidget.cpp.

References createAssocClassLine(), and ClassifierWidget::setClassAssocWidget().

void AssociationWidget::selectAssocClassLine bool  sel = true  ) 
 

Renders the association class connecting line selected.

Definition at line 2142 of file associationwidget.cpp.

Referenced by mousePressEvent(), removeAssocClassLine(), and setSelected().

void AssociationWidget::moveMidPointsBy int  x,
int  y
 

Moves all the mid points (all expcept start /end ) by the given amount.

Definition at line 3040 of file associationwidget.cpp.

References LinePath::count(), LinePath::getPoint(), and LinePath::setPoint().

Referenced by moveEntireAssoc().

void AssociationWidget::moveEntireAssoc int  x,
int  y
 

Moves the entire association by the given offset.

Definition at line 3054 of file associationwidget.cpp.

References calculateEndingPoints(), calculateNameTextSegment(), moveMidPointsBy(), and resetTextPositions().

Referenced by UMLView::activate(), and UMLWidgetController::mouseMoveEvent().

QRect AssociationWidget::getAssocLineRectangle  ) 
 

Returns the bounding rectangle of all segments of the association.

Definition at line 3062 of file associationwidget.cpp.

References LinePath::count(), LinePath::getPen(), and LinePath::getPoint().

Referenced by UMLView::getDiagramRect().

QFont AssociationWidget::getFont  )  const
 

Return the first font found being used by any child widget.

(They could be different fonts, so this is a slightly misleading method.)

Definition at line 2442 of file associationwidget.cpp.

Referenced by slotMenuSelection().

void AssociationWidget::setLineColor const QColor &  colour  )  [virtual]
 

Overrides the method from WidgetBase.

Reimplemented from WidgetBase.

Definition at line 2465 of file associationwidget.cpp.

References LinePath::setLineColor(), and WidgetBase::setLineColor().

void AssociationWidget::setLineWidth uint  width  )  [virtual]
 

Overrides the method from WidgetBase.

Reimplemented from WidgetBase.

Definition at line 2470 of file associationwidget.cpp.

References LinePath::setLineWidth(), and WidgetBase::setLineWidth().

void AssociationWidget::lwSetFont QFont  font  )  [virtual]
 

Set all 'owned' child widgets to this font.

Implements LinkWidget.

Definition at line 2419 of file associationwidget.cpp.

References UMLWidget::setFont().

Referenced by slotMenuSelection().

FloatingTextWidget * AssociationWidget::getChangeWidget Uml::Role_Type  role  ) 
 

Return the given role's changeability FloatingTextWidget widget.

Definition at line 269 of file associationwidget.cpp.

Referenced by UMLView::copyAsImage().

void AssociationWidget::setRoleName const QString &  strRole,
Uml::Role_Type  role
 

Sets the text to the FloatingTextWidget that display the Role text of this association.

For this function to work properly, the associated widget should already be set.

Definition at line 380 of file associationwidget.cpp.

References getAssociation(), getAssocType(), UMLObject::getBaseType(), getVisibility(), UMLAssociation::m_pRole, and UMLAssociation::setRoleName().

Referenced by FloatingTextWidget::handleRename(), loadFromXMI(), setText(), showDialog(), slotMenuSelection(), syncToModel(), and AssocRolePage::updateObject().

void AssociationWidget::setRoleDoc const QString &  doc,
Uml::Role_Type  role
 

Set the documentation on the given role.

Definition at line 405 of file associationwidget.cpp.

References getAssociation(), UMLObject::getBaseType(), and UMLAssociation::setRoleDoc().

Referenced by loadFromXMI(), setAssocType(), showDialog(), and AssocRolePage::updateObject().

UMLClassifier * AssociationWidget::getOperationOwner  )  [virtual]
 

Overrides operation from LinkWidget.

Required by FloatingTextWidget.

Reimplemented from LinkWidget.

Definition at line 3226 of file associationwidget.cpp.

References WidgetBase::getUMLObject(), getWidget(), and isCollaboration().

UMLOperation * AssociationWidget::getOperation  )  [virtual]
 

Implements operation from LinkWidget.

Motivated by FloatingTextWidget.

Implements LinkWidget.

Definition at line 3214 of file associationwidget.cpp.

void AssociationWidget::setOperation UMLOperation op  )  [virtual]
 

Implements operation from LinkWidget.

Motivated by FloatingTextWidget.

Implements LinkWidget.

Definition at line 3218 of file associationwidget.cpp.

References setMessageText().

QString AssociationWidget::getCustomOpText  )  [virtual]
 

Overrides operation from LinkWidget.

Required by FloatingTextWidget.

Implements LinkWidget.

Definition at line 3257 of file associationwidget.cpp.

References getName().

void AssociationWidget::setCustomOpText const QString &  opText  )  [virtual]
 

Overrides operation from LinkWidget.

Required by FloatingTextWidget.

Implements LinkWidget.

Definition at line 3253 of file associationwidget.cpp.

References setName().

void AssociationWidget::setMessageText FloatingTextWidget ft  )  [virtual]
 

Overrides operation from LinkWidget.

Required by FloatingTextWidget.

Parameters:
ft The text widget which to update.

Implements LinkWidget.

Definition at line 412 of file associationwidget.cpp.

References getMulti(), getName(), LinkWidget::getOperationText(), and isCollaboration().

Referenced by setOperation().

UMLAssociation * AssociationWidget::getAssociation  )  const
 

Returns the UMLAssociation representation of this object.

Returns:
Pointer to the UMLAssociation that is represented by this AsociationWidget.

Definition at line 228 of file associationwidget.cpp.

References UMLObject::getBaseType().

Referenced by getVisibility(), loadFromXMI(), saveToXMI(), setAssocType(), setChangeability(), setMulti(), setName(), setRoleDoc(), setRoleName(), setVisibility(), setWidget(), and syncToModel().

UMLAttribute * AssociationWidget::getAttribute  )  const
 

Returns the UMLAttribute representation of this object.

Returns:
Pointer to the UMLAttribute that is represented by this AsociationWidget.

Definition at line 234 of file associationwidget.cpp.

References UMLObject::getBaseType().

Referenced by getVisibility(), setVisibility(), and syncToModel().

void AssociationWidget::setText FloatingTextWidget ft,
const QString &  text
[virtual]
 

Sets the text of the FloatingTextWidget identified by the ft's Text_Role.

Overrides operation from LinkWidget. Required by FloatingTextWidget.

Implements LinkWidget.

Definition at line 522 of file associationwidget.cpp.

References setMulti(), setName(), and setRoleName().

Referenced by DocWindow::newDocumentation(), and DocWindow::showDocumentation().

void AssociationWidget::resetTextPositions  )  [virtual]
 

Calls setTextPosition() on all the labels.

Overrides operation from LinkWidget.

Reimplemented from LinkWidget.

Definition at line 3174 of file associationwidget.cpp.

Referenced by moveEntireAssoc(), and slotMenuSelection().

void AssociationWidget::constrainTextPos int &  textX,
int &  textY,
int  textWidth,
int  textHeight,
Uml::Text_Role  tr
[virtual]
 

Constrains the FloatingTextWidget X and Y values supplied.

Implements the abstract operation from LinkWidget.

Parameters:
textX Candidate X value (may be modified by the constraint.)
textY Candidate Y value (may be modified by the constraint.)
textWidth Width of the text.
textHeight Height of the text.
tr Uml::Text_Role of the text.

Implements LinkWidget.

Definition at line 1822 of file associationwidget.cpp.

References LinePath::count(), and LinePath::getPoint().

bool AssociationWidget::showDialog  )  [virtual]
 

Shows the association properties dialog and updates the corresponding texts if its execution is successful.

Returns true for success.

Reimplemented from LinkWidget.

Definition at line 2252 of file associationwidget.cpp.

References getChangeability(), WidgetBase::getDoc(), getMulti(), getName(), getRoleDoc(), getRoleName(), getVisibility(), setChangeability(), WidgetBase::setDoc(), setMulti(), setName(), setRoleDoc(), setRoleName(), and setVisibility().

Referenced by slotMenuSelection().

void AssociationWidget::setIndex int  index,
Uml::Role_Type  role
 

Sets the Association line index for the given role.

Definition at line 3198 of file associationwidget.cpp.

int AssociationWidget::getIndex Uml::Role_Type  role  )  const
 

Returns the Association line index for the given role.

Definition at line 3202 of file associationwidget.cpp.

void AssociationWidget::setTotalCount int  count,
Uml::Role_Type  role
 

Sets the total count on the Association region.

Definition at line 3206 of file associationwidget.cpp.

int AssociationWidget::getTotalCount Uml::Role_Type  role  )  const
 

Returns the total count on the Association region.

Definition at line 3210 of file associationwidget.cpp.

void AssociationWidget::setTotalCount int  count  ) 
 

Sets the total count on the Association region for widgetB.

void AssociationWidget::setSeqNumAndOp const QString &  seqNum,
const QString &  op
[virtual]
 

Overrides operation from LinkWidget.

Required by FloatingTextWidget.

Parameters:
seqNum The new sequence number string to set.
op The new operation string to set.

Implements LinkWidget.

Definition at line 3239 of file associationwidget.cpp.

References setMulti(), and setName().

UMLClassifier * AssociationWidget::getSeqNumAndOp QString &  seqNum,
QString &  op
[virtual]
 

Overrides operation from LinkWidget.

Required by FloatingTextWidget.

Parameters:
seqNum Return this AssociationWidget's sequence number string.
op Return this AssociationWidget's operation string.

Implements LinkWidget.

Definition at line 3245 of file associationwidget.cpp.

References getMulti(), getName(), WidgetBase::getUMLObject(), and getWidget().

void AssociationWidget::calculateEndingPoints  ) 
 

Calculates and sets the first and last point in the association's LinePath.

Each point is a middle point of its respective UMLWidget's bounding rectangle. This method picks which sides to use for the association.

Definition at line 1050 of file associationwidget.cpp.

References computeAssocClassLine(), LinePath::count(), UMLWidget::getHeight(), LinePath::getPoint(), UMLWidget::getWidth(), UMLWidget::getX(), UMLWidget::getY(), LinePath::insertPoint(), and LinePath::setStartEndPoints().

Referenced by activate(), AssociationWidget(), UMLView::createAutoAssociations(), moveEntireAssoc(), setWidgets(), UMLView::updateContainment(), and widgetMoved().

void AssociationWidget::removeAssocClassLine  ) 
 

Remove dashed connecting line for association class.

Definition at line 2085 of file associationwidget.cpp.

References selectAssocClassLine(), and ClassifierWidget::setClassAssocWidget().

Referenced by cleanup(), slotMenuSelection(), and ClassifierWidget::~ClassifierWidget().

void AssociationWidget::computeAssocClassLine  ) 
 

Compute the end points of m_pAssocClassLine in case this association has an attached association class.

Definition at line 2120 of file associationwidget.cpp.

References LinePath::getPoint().

Referenced by ClassifierWidget::adjustAssocs(), calculateEndingPoints(), createAssocClassLine(), and mouseDoubleClickEvent().

void AssociationWidget::setUMLObject UMLObject obj  )  [virtual]
 

Overriding the method from WidgetBase because we need to do something extra in case this AssociationWidget represents an attribute of a classifier.

Reimplemented from WidgetBase.

Definition at line 3103 of file associationwidget.cpp.

References WidgetBase::setUMLObject(), and slotAttributeRemoved().

Referenced by activate(), UMLView::createAutoAssociations(), and loadFromXMI().

void AssociationWidget::saveToXMI QDomDocument &  qDoc,
QDomElement &  qElement
[virtual]
 

Saves this widget to the <assocwidget> XMI element.

Reimplemented from WidgetBase.

Definition at line 3270 of file associationwidget.cpp.

References getAssociation(), WidgetBase::getID(), UMLObject::getID(), getWidgetID(), and LinePath::saveToXMI().

Referenced by UMLDrag::setUMLDataClip4().

bool AssociationWidget::loadFromXMI QDomElement &  qElement  )  [virtual]
 

Loads this widget from the <assocwidget> XMI element.

Reimplemented from WidgetBase.

Definition at line 3576 of file associationwidget.cpp.

References UMLView::getMessageList(), and UMLView::getWidgetList().

Referenced by UMLDrag::decodeClip4().

bool AssociationWidget::loadFromXMI QDomElement &  qElement,
const UMLWidgetList &  widgets,
const MessageWidgetList *  pMessages = NULL
 

Same as above, but uses the supplied widgetList for resolving the role A and role B widgets.

(The other loadFromXMI() queries the UMLView for these widgets.) Required for clipboard operations.

Definition at line 3327 of file associationwidget.cpp.

References UMLDoc::createUMLAssociation(), UMLDoc::findObjectById(), Widget_Utils::findWidget(), getAssociation(), UMLAssociation::getAssocType(), UMLObject::getBaseType(), LinePath::getPoint(), FloatingTextWidget::getText(), WidgetBase::getUMLObject(), FloatingTextWidget::isTextValid(), FloatingTextWidget::loadFromXMI(), LinePath::loadFromXMI(), UMLAssociation::nrof_parent_widgets, UMLWidget::setActivated(), setAssocType(), setChangeability(), ClassifierWidget::setClassAssocWidget(), WidgetBase::setDoc(), FloatingTextWidget::setLink(), setMulti(), setName(), setRoleDoc(), setRoleName(), setUMLObject(), setVisibility(), and setWidget().

void AssociationWidget::cleanup  ) 
 

Cleans up all the association's data in the related widgets.

Definition at line 706 of file associationwidget.cpp.

References LinePath::cleanup(), UMLObject::getBaseType(), UMLWidget::removeAssoc(), removeAssocClassLine(), and UMLView::removeWidget().

void AssociationWidget::slotMenuSelection int  sel  )  [slot]
 

Handles the selection from the popup menu.

Definition at line 2280 of file associationwidget.cpp.

References getAssocType(), getFont(), FloatingTextWidget::getText(), isCollaboration(), lwSetFont(), removeAssocClassLine(), UMLView::removeAssocInViewAndDoc(), UMLView::removeWidget(), resetTextPositions(), UMLView::selectionSetLineColor(), UMLDoc::setModified(), setMulti(), setName(), setRoleName(), UMLView::setStartedCut(), showDialog(), UMLApp::slotEditCopy(), UMLApp::slotEditCut(), UMLApp::slotEditPaste(), and FloatingTextWidget::slotMenuSelection().

Referenced by mouseReleaseEvent(), and slotRemovePopupMenu().

void AssociationWidget::slotRemovePopupMenu  )  [slot]
 

This slot is entered when an event has occurred on the views display, most likely a mouse event.

Before it sends out that mouse event all children should make sure that they don't have a menu active or there could be more than one popup menu displayed.

Definition at line 3027 of file associationwidget.cpp.

References slotMenuSelection().

void AssociationWidget::slotClearAllSelected  )  [slot]
 

Handles any signals that tells everyone not to be selected.

Definition at line 3036 of file associationwidget.cpp.

References setSelected().

void AssociationWidget::slotAttributeRemoved UMLClassifierListItem obj  )  [slot]
 

Connected to UMLClassifier::attributeRemoved() in case this AssociationWidget is linked to a classifer's attribute type.

Parameters:
obj The UMLAttribute removed.

Definition at line 3119 of file associationwidget.cpp.

References UMLView::removeAssoc().

Referenced by setUMLObject().

void AssociationWidget::syncToModel  )  [slot]
 

Synchronize this widget from the UMLAssociation.

Definition at line 1190 of file associationwidget.cpp.

References getAssociation(), getAttribute(), UMLAssociation::getChangeability(), UMLAssociation::getMulti(), UMLObject::getName(), UMLAssociation::getRoleName(), UMLAssociation::getVisibility(), UMLObject::getVisibility(), setChangeability(), setMulti(), setName(), setRoleName(), and setVisibility().

Referenced by UMLView::createAutoAssociations().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for umbrello Version 3.1.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Jun 26 08:08:03 2007 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003