umbrello API Documentation

MessageWidget Class Reference

Used to display a message on a sequence diagram. Displays a message. More...

#include <messagewidget.h>

Inheritance diagram for MessageWidget:

UMLWidget LinkWidget WidgetBase List of all members.

Public Slots

void slotWidgetMoved (Uml::IDType id)
 Captures when another widget moves if it is link to it that signal.
void slotMenuSelection (int sel)
 Captures any popup menu signals for menus it created.

Signals

void sigMessageMoved ()
 emitted when the message widget is moved up or down slots into ObjectWidget::slotMessageMoved()

Public Member Functions

 MessageWidget (UMLView *view, ObjectWidget *a, ObjectWidget *b, int y, Uml::Sequence_Message_Type sequenceMessageType, Uml::IDType id=Uml::id_None)
 Constructs a MessageWidget.
 MessageWidget (UMLView *view, Uml::Sequence_Message_Type sequenceMessageType, Uml::IDType id=Uml::id_None)
 Constructs a MessageWidget.
void init ()
 Initializes key variables of the class.
virtual ~MessageWidget ()
 Standard deconstructor.
void setSequenceNumber (const QString &sequenceNumber)
 Write property of QString m_SequenceNumber.
QString getSequenceNumber () const
 Read property of QString m_SequenceNumber.
Uml::Sequence_Message_Type getSequenceMessageType () const
 Returns whether the message is synchronous or asynchronous.
bool contains (ObjectWidget *w)
 Check to see if the given ObjectWidget is involved in the message.
ObjectWidgetgetWidget (Uml::Role_Type role)
 Returns the related widget on the given side.
void setWidget (ObjectWidget *ow, Uml::Role_Type role)
 Sets the related widget on the given side.
FloatingTextWidgetgetFloatingTextWidget ()
 Returns the text widget it is related to.
void setFloatingTextWidget (FloatingTextWidget *f)
 Sets the text widget it is related to.
void lwSetFont (QFont font)
 Implements operation from LinkWidget.
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.
void setText (FloatingTextWidget *ft, const QString &newText)
 Overrides operation from LinkWidget.
void setSeqNumAndOp (const QString &seqNum, const QString &op)
 Overrides operation from LinkWidget.
UMLClassifiergetSeqNumAndOp (QString &seqNum, QString &op)
 Overrides operation from LinkWidget.
void calculateWidget ()
 Calculate the geometry of the widget.
bool activate (IDChangeLog *Log=0)
 Activates a MessageWidget.
void calculateDimensions ()
 Calculates the size of the widget by calling calculateDimenstionsSynchronous(), calculateDimenstionsAsynchronous(), or calculateDimensionsCreation().
void calculateDimensionsSynchronous ()
 Calculates and sets the size of the widget for a synchronous message.
void calculateDimensionsAsynchronous ()
 Calculates and sets the size of the widget for an asynchronous message.
void calculateDimensionsCreation ()
 Calculates and sets the size of the widget for a creation message.
void draw (QPainter &p, int offsetX, int offsetY)
 Calls drawSynchronous() or drawAsynchronous().
void drawSynchronous (QPainter &p, int offsetX, int offsetY)
 Draws the calling arrow with filled in arrowhead, the timeline box and the returning arrow with a dashed line and stick arrowhead.
void drawAsynchronous (QPainter &p, int offsetX, int offsetY)
 Draws a solid arrow line and a stick arrow head.
void drawCreation (QPainter &p, int offsetX, int offsetY)
 Draws a solid arrow line and a stick arrow head to the edge of the target object widget instead of to the sequence line.
void setTextPosition ()
 Sets the text position relative to the sequence message.
void constrainTextPos (int &textX, int &textY, int textWidth, int textHeight, Uml::Text_Role tr)
 Constrains the FloatingTextWidget X and Y values supplied.
void cleanup ()
 Used to cleanup any other widget it may need to delete.
void setSelected (bool _select)
 Sets the state of whether the widget is selected.
int getMinY ()
 Returns the minimum height this widget should be set at on a sequence diagrams.
int getMaxY ()
 Returns the maximum height this widget should be set at on a sequence diagrams.
int onWidget (const QPoint &p)
 Overrides operation from UMLWidget.
void saveToXMI (QDomDocument &qDoc, QDomElement &qElement)
 Saves to the <messagewidget> XMI element.
bool loadFromXMI (QDomElement &qElement)
 Loads from the <messagewidget> XMI element.

Protected Member Functions

void setLinkAndTextPos ()
 Shortcut for calling m_pFText->setLink() followed by this->setTextPosition().
int constrainX (int textX, int textWidth, Uml::Text_Role tr)
 Returns the textX arg with constraints applied.
void updateResizability ()
 Update the UMLWidget::m_bResizable flag according to the charactersitics of this message.

Static Protected Member Functions

static void drawArrow (QPainter &p, int x, int y, int w, Qt::ArrowType direction, bool useDottedLine=false)
 Draw an arrow pointing in the given direction.
static void drawSolidArrowhead (QPainter &p, int x, int y, Qt::ArrowType direction)
 Draw a solid (triangular) arrowhead pointing in the given direction.

Protected Attributes

QString m_SequenceNumber
QString m_CustomOp
Uml::Sequence_Message_Type m_sequenceMessageType
 Whether the message is synchronous or asynchronous.

Friends

class MessageWidgetController

Detailed Description

Used to display a message on a sequence diagram. Displays a message.

The message could be between two objects or a message that calls itself on an object. This class will only display the line that is required and the text will be setup by the FloatingTextWidget widget that is passed in the constructor. A message can be synchronous (calls a method and gains control back on return, as happens in most programming languages) or asynchronous (calls a method and gains back control immediately).

Author:
Paul Hensgen
See also:
UMLWidget

ObjectWidget

FloatingTextWidget Bugs and comments to uml-devel@lists.sf.net or http://bugs.kde.org

Definition at line 41 of file messagewidget.h.


Constructor & Destructor Documentation

MessageWidget::MessageWidget UMLView view,
ObjectWidget a,
ObjectWidget b,
int  y,
Uml::Sequence_Message_Type  sequenceMessageType,
Uml::IDType  id = Uml::id_None
 

Constructs a MessageWidget.

Parameters:
view The parent to this class.
a The role A widget for this message.
b The role B widget for this message.
y The vertical position to display this message.
sequenceMessageType Whether synchronous or asynchronous
id A unique id used for deleting this object cleanly. The default (-1) will prompt generation of a new ID.

Definition at line 32 of file messagewidget.cpp.

References activate(), calculateWidget(), UMLWidget::getHeight(), getMaxY(), getMinY(), init(), m_sequenceMessageType, ObjectWidget::setY(), and updateResizability().

MessageWidget::MessageWidget UMLView view,
Uml::Sequence_Message_Type  sequenceMessageType,
Uml::IDType  id = Uml::id_None
 

Constructs a MessageWidget.

Parameters:
view The parent to this class.
id The ID to assign (-1 will prompt a new ID.)

Definition at line 54 of file messagewidget.cpp.

References init(), and m_sequenceMessageType.

MessageWidget::~MessageWidget  )  [virtual]
 

Standard deconstructor.

Definition at line 70 of file messagewidget.cpp.


Member Function Documentation

void MessageWidget::init  ) 
 

Initializes key variables of the class.

Reimplemented from UMLWidget.

Definition at line 60 of file messagewidget.cpp.

References WidgetBase::setBaseType().

Referenced by MessageWidget().

void MessageWidget::setSequenceNumber const QString &  sequenceNumber  ) 
 

Write property of QString m_SequenceNumber.

Definition at line 500 of file messagewidget.cpp.

Referenced by setSeqNumAndOp().

QString MessageWidget::getSequenceNumber  )  const
 

Read property of QString m_SequenceNumber.

Definition at line 504 of file messagewidget.cpp.

Uml::Sequence_Message_Type MessageWidget::getSequenceMessageType  )  const [inline]
 

Returns whether the message is synchronous or asynchronous.

Definition at line 92 of file messagewidget.h.

References m_sequenceMessageType.

Referenced by FloatingTextWidgetController::moveWidgetBy().

bool MessageWidget::contains ObjectWidget w  ) 
 

Check to see if the given ObjectWidget is involved in the message.

Parameters:
w The ObjectWidget to check for.
Returns:
true - if is contained, false - not contained.

Definition at line 384 of file messagewidget.cpp.

ObjectWidget * MessageWidget::getWidget Uml::Role_Type  role  ) 
 

Returns the related widget on the given side.

Returns:
The ObjectWidget we are related to.

Definition at line 726 of file messagewidget.cpp.

Referenced by FloatingTextWidgetController::moveWidgetBy(), and UMLView::selectWidgets().

void MessageWidget::setWidget ObjectWidget ow,
Uml::Role_Type  role
 

Sets the related widget on the given side.

Parameters:
ow The ObjectWidget we are related to.

Definition at line 721 of file messagewidget.cpp.

References updateResizability().

FloatingTextWidget* MessageWidget::getFloatingTextWidget  )  [inline]
 

Returns the text widget it is related to.

Returns:
The text widget we are related to.

Definition at line 123 of file messagewidget.h.

Referenced by UMLView::addWidget(), and ToolBarStateMessages::setSecondWidget().

void MessageWidget::setFloatingTextWidget FloatingTextWidget f  )  [inline]
 

Sets the text widget it is related to.

Parameters:
f The text widget we are related to.

Definition at line 132 of file messagewidget.h.

void MessageWidget::lwSetFont QFont  font  )  [virtual]
 

Implements operation from LinkWidget.

Required by FloatingTextWidget.

Implements LinkWidget.

Definition at line 508 of file messagewidget.cpp.

References UMLWidget::setFont().

UMLClassifier * MessageWidget::getOperationOwner  )  [virtual]
 

Overrides operation from LinkWidget.

Required by FloatingTextWidget.

Reimplemented from LinkWidget.

Definition at line 512 of file messagewidget.cpp.

References WidgetBase::getUMLObject().

UMLOperation * MessageWidget::getOperation  )  [virtual]
 

Implements operation from LinkWidget.

Motivated by FloatingTextWidget.

Implements LinkWidget.

Definition at line 520 of file messagewidget.cpp.

Referenced by getSeqNumAndOp(), and saveToXMI().

void MessageWidget::setOperation UMLOperation op  )  [virtual]
 

Implements operation from LinkWidget.

Motivated by FloatingTextWidget.

Implements LinkWidget.

Definition at line 524 of file messagewidget.cpp.

References setMessageText().

Referenced by activate().

QString MessageWidget::getCustomOpText  )  [virtual]
 

Overrides operation from LinkWidget.

Required by FloatingTextWidget.

Implements LinkWidget.

Definition at line 532 of file messagewidget.cpp.

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

Overrides operation from LinkWidget.

Required by FloatingTextWidget.

Implements LinkWidget.

Definition at line 536 of file messagewidget.cpp.

References FloatingTextWidget::setMessageText().

void MessageWidget::setMessageText FloatingTextWidget ft  )  [virtual]
 

Overrides operation from LinkWidget.

Required by FloatingTextWidget.

Parameters:
ft The text widget which to update.

Implements LinkWidget.

Definition at line 482 of file messagewidget.cpp.

References LinkWidget::getOperationText(), and setTextPosition().

Referenced by calculateWidget(), and setOperation().

void MessageWidget::setText FloatingTextWidget ft,
const QString &  newText
[virtual]
 

Overrides operation from LinkWidget.

Required by FloatingTextWidget.

Parameters:
ft The text widget which to update.
newText The new text to set.

Implements LinkWidget.

Definition at line 490 of file messagewidget.cpp.

References UMLApp::getDocument(), and UMLDoc::setModified().

Referenced by activate().

void MessageWidget::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 495 of file messagewidget.cpp.

References setSequenceNumber().

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

Overrides operation from LinkWidget.

Required by FloatingTextWidget.

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

Implements LinkWidget.

Definition at line 541 of file messagewidget.cpp.

References getOperation(), WidgetBase::getUMLObject(), and UMLOperation::toString().

void MessageWidget::calculateWidget  ) 
 

Calculate the geometry of the widget.

Definition at line 352 of file messagewidget.cpp.

References calculateDimensions(), setMessageText(), UMLWidget::setX(), and UMLWidget::setY().

Referenced by MessageWidget(), and slotWidgetMoved().

bool MessageWidget::activate IDChangeLog Log = 0  )  [virtual]
 

Activates a MessageWidget.

Connects its m_pOw[] pointers to UMLObjects and also send signals about its FloatingTextWidget.

Reimplemented from UMLWidget.

Definition at line 409 of file messagewidget.cpp.

References calculateDimensions(), UMLClassifier::findChildObjectById(), UMLView::findWidget(), FloatingTextWidget::getText(), WidgetBase::getUMLObject(), UMLView::resetPastePoint(), UMLWidget::setActivated(), UMLWidget::setFont(), setLinkAndTextPos(), setOperation(), setText(), sigMessageMoved(), UMLWidget::sigWidgetMoved(), slotWidgetMoved(), and updateResizability().

Referenced by MessageWidget().

void MessageWidget::calculateDimensions  ) 
 

Calculates the size of the widget by calling calculateDimenstionsSynchronous(), calculateDimenstionsAsynchronous(), or calculateDimensionsCreation().

Definition at line 554 of file messagewidget.cpp.

References UMLWidget::adjustAssocs(), calculateDimensionsAsynchronous(), calculateDimensionsCreation(), calculateDimensionsSynchronous(), UMLWidget::getX(), UMLWidget::getY(), and m_sequenceMessageType.

Referenced by activate(), and calculateWidget().

void MessageWidget::calculateDimensionsSynchronous  ) 
 

Calculates and sets the size of the widget for a synchronous message.

Definition at line 569 of file messagewidget.cpp.

References UMLWidget::getWidth(), UMLWidget::getX(), and UMLWidget::setSize().

Referenced by calculateDimensions().

void MessageWidget::calculateDimensionsAsynchronous  ) 
 

Calculates and sets the size of the widget for an asynchronous message.

Definition at line 602 of file messagewidget.cpp.

References UMLWidget::getWidth(), UMLWidget::getX(), and UMLWidget::setSize().

Referenced by calculateDimensions().

void MessageWidget::calculateDimensionsCreation  ) 
 

Calculates and sets the size of the widget for a creation message.

Definition at line 635 of file messagewidget.cpp.

References UMLWidget::getHeight(), UMLWidget::getWidth(), UMLWidget::getX(), UMLWidget::getY(), and UMLWidget::setSize().

Referenced by calculateDimensions().

void MessageWidget::draw QPainter &  p,
int  offsetX,
int  offsetY
[virtual]
 

Calls drawSynchronous() or drawAsynchronous().

Implements UMLWidget.

Definition at line 81 of file messagewidget.cpp.

References drawAsynchronous(), drawCreation(), drawSynchronous(), m_sequenceMessageType, and UMLWidget::setPen().

void MessageWidget::drawSynchronous QPainter &  p,
int  offsetX,
int  offsetY
 

Draws the calling arrow with filled in arrowhead, the timeline box and the returning arrow with a dashed line and stick arrowhead.

Definition at line 129 of file messagewidget.cpp.

References drawArrow(), UMLWidget::drawSelected(), drawSolidArrowhead(), UMLWidget::getHeight(), UMLWidget::getWidth(), UMLWidget::getX(), and UMLWidget::getY().

Referenced by draw().

void MessageWidget::drawAsynchronous QPainter &  p,
int  offsetX,
int  offsetY
 

Draws a solid arrow line and a stick arrow head.

Definition at line 184 of file messagewidget.cpp.

References drawArrow(), UMLWidget::drawSelected(), UMLWidget::getHeight(), UMLWidget::getWidth(), UMLWidget::getX(), and UMLWidget::getY().

Referenced by draw().

void MessageWidget::drawCreation QPainter &  p,
int  offsetX,
int  offsetY
 

Draws a solid arrow line and a stick arrow head to the edge of the target object widget instead of to the sequence line.

Definition at line 227 of file messagewidget.cpp.

References drawArrow(), UMLWidget::drawSelected(), UMLWidget::getWidth(), UMLWidget::getX(), and UMLWidget::getY().

Referenced by draw().

void MessageWidget::setTextPosition  ) 
 

Sets the text position relative to the sequence message.

Definition at line 277 of file messagewidget.cpp.

References constrainX(), FloatingTextWidget::getDisplayText(), UMLWidget::getHeight(), FloatingTextWidget::getRole(), UMLWidget::getWidth(), UMLWidget::getX(), UMLWidget::getY(), UMLWidget::setX(), UMLWidget::setY(), and UMLWidget::updateComponentSize().

Referenced by setLinkAndTextPos(), setMessageText(), ToolBarStateMessages::setSecondWidget(), and slotWidgetMoved().

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

Constrains the FloatingTextWidget X and Y values supplied.

Overrides 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 314 of file messagewidget.cpp.

References constrainX(), getMaxY(), and getMinY().

void MessageWidget::cleanup  )  [virtual]
 

Used to cleanup any other widget it may need to delete.

Reimplemented from UMLWidget.

Definition at line 662 of file messagewidget.cpp.

References UMLWidget::cleanup(), ObjectWidget::messageRemoved(), UMLView::removeWidget(), and sigMessageMoved().

void MessageWidget::setSelected bool  _select  )  [virtual]
 

Sets the state of whether the widget is selected.

Parameters:
_select True if the widget is selected.

Reimplemented from UMLWidget.

Definition at line 679 of file messagewidget.cpp.

References FloatingTextWidget::getDisplayText(), UMLWidget::getSelected(), and UMLWidget::setSelected().

int MessageWidget::getMinY  ) 
 

Returns the minimum height this widget should be set at on a sequence diagrams.

Takes into account the widget positions it is related to.

Definition at line 692 of file messagewidget.cpp.

References UMLWidget::getHeight(), UMLWidget::getY(), and m_sequenceMessageType.

Referenced by constrainTextPos(), MessageWidget(), and slotWidgetMoved().

int MessageWidget::getMaxY  ) 
 

Returns the maximum height this widget should be set at on a sequence diagrams.

Takes into account the widget positions it is related to.

Definition at line 708 of file messagewidget.cpp.

References ObjectWidget::getEndLineY().

Referenced by constrainTextPos(), MessageWidget(), and slotWidgetMoved().

int MessageWidget::onWidget const QPoint &  p  )  [virtual]
 

Overrides operation from UMLWidget.

Parameters:
p Point to be checked.
Returns:
Non-zero if the point is on a part of the MessageWidget. NB In case of a synchronous message, the empty space between call line and return line does not count, i.e. if the point is located in that space the function returns 0.

Reimplemented from UMLWidget.

Definition at line 256 of file messagewidget.cpp.

References UMLWidget::getHeight(), UMLWidget::getWidth(), UMLWidget::getX(), UMLWidget::getY(), m_sequenceMessageType, and UMLWidget::onWidget().

Referenced by ToolBarState::getMessageAt().

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

Saves to the <messagewidget> XMI element.

Reimplemented from UMLWidget.

Definition at line 730 of file messagewidget.cpp.

References WidgetBase::getID(), UMLObject::getID(), getOperation(), FloatingTextWidget::getText(), and m_sequenceMessageType.

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

Loads from the <messagewidget> XMI element.

Reimplemented from UMLWidget.

Definition at line 752 of file messagewidget.cpp.

References LinkWidget::getOperationText(), FloatingTextWidget::loadFromXMI(), and m_sequenceMessageType.

void MessageWidget::setLinkAndTextPos  )  [protected]
 

Shortcut for calling m_pFText->setLink() followed by this->setTextPosition().

Definition at line 327 of file messagewidget.cpp.

References FloatingTextWidget::setLink(), and setTextPosition().

Referenced by activate(), and slotMenuSelection().

int MessageWidget::constrainX int  textX,
int  textWidth,
Uml::Text_Role  tr
[protected]
 

Returns the textX arg with constraints applied.

Auxiliary to setTextPosition() and constrainTextPos().

Definition at line 293 of file messagewidget.cpp.

References UMLWidget::getWidth(), and UMLWidget::getX().

Referenced by constrainTextPos(), and setTextPosition().

void MessageWidget::drawArrow QPainter &  p,
int  x,
int  y,
int  w,
Qt::ArrowType  direction,
bool  useDottedLine = false
[static, protected]
 

Draw an arrow pointing in the given direction.

The arrow head is not solid, i.e. it is made up of two lines like so: ---> The direction can be either Qt::LeftArrow or Qt::RightArrow.

Definition at line 108 of file messagewidget.cpp.

References UMLWidget::setPen().

Referenced by drawAsynchronous(), drawCreation(), and drawSynchronous().

void MessageWidget::drawSolidArrowhead QPainter &  p,
int  x,
int  y,
Qt::ArrowType  direction
[static, protected]
 

Draw a solid (triangular) arrowhead pointing in the given direction.

The direction can be either Qt::LeftArrow or Qt::RightArrow.

Definition at line 97 of file messagewidget.cpp.

Referenced by drawSynchronous().

void MessageWidget::updateResizability  )  [protected]
 

Update the UMLWidget::m_bResizable flag according to the charactersitics of this message.

Definition at line 73 of file messagewidget.cpp.

References m_sequenceMessageType.

Referenced by activate(), MessageWidget(), and setWidget().

void MessageWidget::slotWidgetMoved Uml::IDType  id  )  [virtual, slot]
 

Captures when another widget moves if it is link to it that signal.

Parameters:
id The id of object behind the widget.

Reimplemented from UMLWidget.

Definition at line 362 of file messagewidget.cpp.

References calculateWidget(), ObjectWidget::getLocalID(), getMaxY(), getMinY(), UMLView::getSelectCount(), UMLWidget::getY(), and setTextPosition().

Referenced by activate().

void MessageWidget::slotMenuSelection int  sel  )  [virtual, slot]
 

Captures any popup menu signals for menus it created.

Parameters:
sel The command which has to be executed.

Reimplemented from UMLWidget.

Definition at line 391 of file messagewidget.cpp.

References UMLView::getWidgetList(), UMLWidget::setFont(), and setLinkAndTextPos().

void MessageWidget::sigMessageMoved  )  [signal]
 

emitted when the message widget is moved up or down slots into ObjectWidget::slotMessageMoved()

Referenced by activate(), cleanup(), and MessageWidgetController::resizeWidget().


Member Data Documentation

Uml::Sequence_Message_Type MessageWidget::m_sequenceMessageType [protected]
 

Whether the message is synchronous or asynchronous.

Definition at line 372 of file messagewidget.h.

Referenced by calculateDimensions(), draw(), getMinY(), getSequenceMessageType(), loadFromXMI(), MessageWidget(), MessageWidgetController::moveWidgetBy(), onWidget(), saveToXMI(), and updateResizability().


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:05 2007 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003