umbrello API Documentation

ObjectWidget Class Reference

Displays an instance UMLObject of a concept. Displays an instance of a Concept. More...

#include <objectwidget.h>

Inheritance diagram for ObjectWidget:

UMLWidget WidgetBase List of all members.

Public Slots

void slotMenuSelection (int sel)
 Handles a popup menu selection.
virtual void slotColorChanged (Uml::IDType viewID)
 Handles a color change signal.
void slotMessageMoved ()
 Called when a message widget with an end on this object has moved up or down.

Public Member Functions

 ObjectWidget (UMLView *view, UMLObject *o, Uml::IDType lid=Uml::id_None)
 Creates an ObjectWidget.
virtual ~ObjectWidget ()
 destructor
virtual void setX (int x)
 Sets the x-coordinate.
virtual void setY (int y)
 Sets the y-coordinate.
Uml::IDType getLocalID () const
 Returns the local ID for this object.
QString getInstanceName () const
 Returns the instance name.
void setInstanceName (const QString &name)
 Sets the instance name.
bool getMultipleInstance () const
 Returns whether object is representing a multi-object.
void setMultipleInstance (bool multiple)
 Sets whether representing a multi-instance object.
void setLocalID (Uml::IDType id)
 Sets the local id of the object.
bool activate (IDChangeLog *ChangeLog=0)
 Activate the object after serializing it from a QDataStream.
void draw (QPainter &p, int offsetX, int offsetY)
 Override default method.
virtual void moveEvent (QMoveEvent *)
 Overrides the standard operation.
void cleanup ()
 Used to cleanup any other widget it may need to delete.
void showProperties ()
 Show a properties dialog for an ObjectWidget.
bool getDrawAsActor () const
 Returns whether to draw as an Actor or not.
void setDrawAsActor (bool drawAsActor)
 Sets whether to draw as an Actor.
void setShowDestruction (bool bShow)
 Sets whether to show deconstruction on sequence line.
bool getShowDestruction () const
 Returns whether to show deconstruction on sequence line.
int topMargin ()
 Returns the top margin constant (Y axis value).
int getEndLineY ()
 Returns the end Y co-ord of the seq.
void messageAdded (MessageWidget *message)
 Add a message widget to the list.
void messageRemoved (MessageWidget *message)
 Remove a message widget from the list.
bool canTabUp ()
 Returns whether or not the widget can be moved vertically up.
bool messageOverlap (int y, MessageWidget *messageWidget)
 Returns whether a message is overlapping with another message.
SeqLineWidgetgetSeqLine ()
 Return the SeqLineWidget.
void saveToXMI (QDomDocument &qDoc, QDomElement &qElement)
 Saves to the <objectwidget> XMI element.
bool loadFromXMI (QDomElement &qElement)
 Loads from a <objectwidget> XMI element.

Protected Member Functions

QSize calculateSize ()
 Overrides method from UMLWidget.
void drawActor (QPainter &p, int offsetX, int offsetY)
 Draw the object as an actor.
void drawObject (QPainter &p, int offsetX, int offsetY)
 Draw the object as an object (default).
void tabUp ()
 Move the object up on a sequence diagram.
void tabDown ()
 Move the object down on a sequence diagram.

Protected Attributes

SeqLineWidgetm_pLine
QString m_InstanceName
 Instance name of object.
Uml::IDType m_nLocalID
 Local ID used on views.
bool m_bMultipleInstance
 Determines whether to draw an object as a multiple object instance.
bool m_bDrawAsActor
 Determines whether the object should be drawn as an Actor or an Object.
bool m_bShowDestruction
 Determines whether to show object destruction on sequence diagram line.

Detailed Description

Displays an instance UMLObject of a concept. Displays an instance of a Concept.

Author:
Paul Hensgen <phensgen@techie.com>
See also:
UMLWidget Bugs and comments to uml-devel@lists.sf.net or http://bugs.kde.org

Definition at line 35 of file objectwidget.h.


Constructor & Destructor Documentation

ObjectWidget::ObjectWidget UMLView view,
UMLObject o,
Uml::IDType  lid = Uml::id_None
 

Creates an ObjectWidget.

Parameters:
view The parent to this object.
o The object it will be representing.
lid The local id for the object.

Definition at line 40 of file objectwidget.cpp.

References UMLWidget::init(), and m_nLocalID.

ObjectWidget::~ObjectWidget  )  [virtual]
 

destructor

Definition at line 69 of file objectwidget.cpp.


Member Function Documentation

void ObjectWidget::setX int  x  )  [virtual]
 

Sets the x-coordinate.

Reimplements the method from UMLWidget.

Parameters:
x The x-coordinate to be set.

Reimplemented from UMLWidget.

Definition at line 174 of file objectwidget.cpp.

References moveEvent(), and UMLWidget::setX().

void ObjectWidget::setY int  y  )  [virtual]
 

Sets the y-coordinate.

Reimplements the method from UMLWidget.

Parameters:
y The y-coordinate to be set.

Reimplemented from UMLWidget.

Definition at line 179 of file objectwidget.cpp.

References moveEvent(), and UMLWidget::setY().

Referenced by MessageWidget::MessageWidget(), tabDown(), and tabUp().

Uml::IDType ObjectWidget::getLocalID  )  const [inline]
 

Returns the local ID for this object.

This ID is used so that many objects of the same UMLObject instance can be on the same diagram.

Returns:
The local ID.

Definition at line 75 of file objectwidget.h.

References m_nLocalID.

Referenced by UMLView::onWidgetLine(), AssociationWidget::operator==(), and MessageWidget::slotWidgetMoved().

QString ObjectWidget::getInstanceName  )  const [inline]
 

Returns the instance name.

Returns:
The instance name.

Reimplemented from UMLWidget.

Definition at line 84 of file objectwidget.h.

References m_InstanceName.

void ObjectWidget::setInstanceName const QString &  name  )  [inline]
 

Sets the instance name.

Parameters:
name The name to set the instance name to.

Reimplemented from UMLWidget.

Definition at line 93 of file objectwidget.h.

References m_InstanceName.

bool ObjectWidget::getMultipleInstance  )  const [inline]
 

Returns whether object is representing a multi-object.

Returns:
True if object is representing a multi-object.

Definition at line 102 of file objectwidget.h.

References m_bMultipleInstance.

void ObjectWidget::setMultipleInstance bool  multiple  ) 
 

Sets whether representing a multi-instance object.

Parameters:
multiple Object state. true- multi, false - single.

Definition at line 156 of file objectwidget.cpp.

References m_bMultipleInstance, and UMLWidget::updateComponentSize().

void ObjectWidget::setLocalID Uml::IDType  id  )  [inline]
 

Sets the local id of the object.

Parameters:
id The local id of the object.

Definition at line 118 of file objectwidget.h.

References m_nLocalID.

bool ObjectWidget::activate IDChangeLog ChangeLog = 0  )  [virtual]
 

Activate the object after serializing it from a QDataStream.

Reimplemented from UMLWidget.

Definition at line 165 of file objectwidget.cpp.

References m_bShowDestruction, moveEvent(), and SeqLineWidget::setupDestructionBox().

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

Override default method.

Implements UMLWidget.

Definition at line 71 of file objectwidget.cpp.

References drawActor(), drawObject(), UMLWidget::drawSelected(), m_bDrawAsActor, and UMLWidget::setPen().

Referenced by loadFromXMI().

void ObjectWidget::moveEvent QMoveEvent *   )  [virtual]
 

Overrides the standard operation.

Reimplemented from UMLWidget.

Definition at line 184 of file objectwidget.cpp.

References UMLWidget::getX(), UMLWidget::getY(), m_nLocalID, SeqLineWidget::setStartPoint(), and UMLWidget::sigWidgetMoved().

Referenced by activate(), setX(), setY(), slotMenuSelection(), tabDown(), and tabUp().

void ObjectWidget::cleanup  )  [virtual]
 

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

Reimplemented from UMLWidget.

Definition at line 203 of file objectwidget.cpp.

References UMLWidget::cleanup().

void ObjectWidget::showProperties  )  [virtual]
 

Show a properties dialog for an ObjectWidget.

Reimplemented from UMLWidget.

Definition at line 212 of file objectwidget.cpp.

References UMLApp::getDocument(), UMLApp::getDocWindow(), UMLDoc::setModified(), DocWindow::showDocumentation(), and DocWindow::updateDocumentation().

Referenced by slotMenuSelection().

bool ObjectWidget::getDrawAsActor  )  const [inline]
 

Returns whether to draw as an Actor or not.

Returns:
True if widget is drawn as an actor.

Definition at line 152 of file objectwidget.h.

References m_bDrawAsActor.

void ObjectWidget::setDrawAsActor bool  drawAsActor  ) 
 

Sets whether to draw as an Actor.

Parameters:
drawAsActor True if widget shall be drawn as an actor.

Definition at line 151 of file objectwidget.cpp.

References m_bDrawAsActor, and UMLWidget::updateComponentSize().

Referenced by Widget_Factory::createWidget().

void ObjectWidget::setShowDestruction bool  bShow  ) 
 

Sets whether to show deconstruction on sequence line.

Parameters:
bShow True if destruction on line shall be shown.

Definition at line 309 of file objectwidget.cpp.

References m_bShowDestruction.

bool ObjectWidget::getShowDestruction  )  const [inline]
 

Returns whether to show deconstruction on sequence line.

Returns:
True if destruction on sequence line is shown.

Definition at line 175 of file objectwidget.h.

References m_bShowDestruction.

Referenced by SeqLineWidget::setupDestructionBox().

int ObjectWidget::topMargin  ) 
 

Returns the top margin constant (Y axis value).

Returns:
Y coordinate of the space between the diagram top and the upper edge of the ObjectWidget.

Definition at line 299 of file objectwidget.cpp.

Referenced by canTabUp(), Widget_Factory::createWidget(), and tabUp().

int ObjectWidget::getEndLineY  ) 
 

Returns the end Y co-ord of the seq.

line.

Returns:
Y coordinate of the endpoint of the sequence line.

Definition at line 315 of file objectwidget.cpp.

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

Referenced by UMLView::getDiagramRect(), and MessageWidget::getMaxY().

void ObjectWidget::messageAdded MessageWidget message  ) 
 

Add a message widget to the list.

Parameters:
message Pointer to the MessageWidget to add.

Definition at line 324 of file objectwidget.cpp.

void ObjectWidget::messageRemoved MessageWidget message  ) 
 

Remove a message widget from the list.

Parameters:
message Pointer to the MessageWidget to remove.

Definition at line 334 of file objectwidget.cpp.

Referenced by MessageWidget::cleanup().

bool ObjectWidget::canTabUp  ) 
 

Returns whether or not the widget can be moved vertically up.

Returns:
True if widget can be moved upwards vertically.

Definition at line 303 of file objectwidget.cpp.

References UMLWidget::getY(), and topMargin().

bool ObjectWidget::messageOverlap int  y,
MessageWidget messageWidget
 

Returns whether a message is overlapping with another message.

Used by MessageWidget::draw() methods.

Parameters:
y The top of your message.
messageWidget A pointer to your message so it doesn't check against itself.

Definition at line 357 of file objectwidget.cpp.

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

SeqLineWidget * ObjectWidget::getSeqLine  ) 
 

Return the SeqLineWidget.

Returns a non NULL pointer if this ObjectWidget is part of a sequence diagram.

Definition at line 371 of file objectwidget.cpp.

Referenced by UMLView::onWidgetLine().

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

Saves to the <objectwidget> XMI element.

Reimplemented from UMLWidget.

Definition at line 375 of file objectwidget.cpp.

References m_bDrawAsActor, m_bMultipleInstance, m_bShowDestruction, m_InstanceName, and m_nLocalID.

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

Loads from a <objectwidget> XMI element.

Reimplemented from UMLWidget.

Definition at line 386 of file objectwidget.cpp.

References draw(), m_bDrawAsActor, m_bMultipleInstance, m_bShowDestruction, m_InstanceName, and m_nLocalID.

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

Handles a popup menu selection.

Reimplemented from UMLWidget.

Definition at line 82 of file objectwidget.cpp.

References UMLApp::getDocument(), m_InstanceName, moveEvent(), UMLDoc::setModified(), showProperties(), UMLWidget::slotMenuSelection(), tabDown(), tabUp(), and UMLWidget::updateComponentSize().

void ObjectWidget::slotColorChanged Uml::IDType  viewID  )  [virtual, slot]
 

Handles a color change signal.

Reimplemented from UMLWidget.

Definition at line 195 of file objectwidget.cpp.

References UMLView::getFillColor(), UMLView::getLineColor(), UMLWidget::setFillColour(), UMLWidget::setLineColor(), and UMLWidget::setPen().

void ObjectWidget::slotMessageMoved  )  [slot]
 

Called when a message widget with an end on this object has moved up or down.

Sets the bottom of the line to a nice position.

Definition at line 343 of file objectwidget.cpp.

References UMLWidget::getHeight(), UMLWidget::getY(), and SeqLineWidget::setEndOfLine().

QSize ObjectWidget::calculateSize  )  [protected, virtual]
 

Overrides method from UMLWidget.

Reimplemented from UMLWidget.

Definition at line 128 of file objectwidget.cpp.

References UMLWidget::getFontMetrics(), UMLObject::getName(), m_bDrawAsActor, m_bMultipleInstance, and m_InstanceName.

void ObjectWidget::drawActor QPainter &  p,
int  offsetX,
int  offsetY
[protected]
 

Draw the object as an actor.

Definition at line 254 of file objectwidget.cpp.

References UMLWidget::getFontMetrics(), UMLWidget::getName(), m_InstanceName, and UMLWidget::setPen().

Referenced by draw().

void ObjectWidget::drawObject QPainter &  p,
int  offsetX,
int  offsetY
[protected]
 

Draw the object as an object (default).

Definition at line 223 of file objectwidget.cpp.

References UMLWidget::getFont(), UMLWidget::getName(), UMLWidget::getUseFillColour(), m_bMultipleInstance, m_InstanceName, and UMLWidget::setPen().

Referenced by draw().

void ObjectWidget::tabUp  )  [protected]
 

Move the object up on a sequence diagram.

Definition at line 283 of file objectwidget.cpp.

References UMLWidget::adjustAssocs(), UMLWidget::getX(), UMLWidget::getY(), moveEvent(), setY(), and topMargin().

Referenced by slotMenuSelection().

void ObjectWidget::tabDown  )  [protected]
 

Move the object down on a sequence diagram.

Definition at line 292 of file objectwidget.cpp.

References UMLWidget::adjustAssocs(), UMLWidget::getX(), UMLWidget::getY(), moveEvent(), and setY().

Referenced by slotMenuSelection().


Member Data Documentation

QString ObjectWidget::m_InstanceName [protected]
 

Instance name of object.

Definition at line 293 of file objectwidget.h.

Referenced by calculateSize(), drawActor(), drawObject(), getInstanceName(), loadFromXMI(), saveToXMI(), setInstanceName(), and slotMenuSelection().

Uml::IDType ObjectWidget::m_nLocalID [protected]
 

Local ID used on views.

Needed as a it can represent a class that has many objects representing it.

Definition at line 299 of file objectwidget.h.

Referenced by getLocalID(), loadFromXMI(), moveEvent(), ObjectWidget(), saveToXMI(), and setLocalID().

bool ObjectWidget::m_bMultipleInstance [protected]
 

Determines whether to draw an object as a multiple object instance.

Definition at line 305 of file objectwidget.h.

Referenced by calculateSize(), drawObject(), getMultipleInstance(), loadFromXMI(), saveToXMI(), and setMultipleInstance().

bool ObjectWidget::m_bDrawAsActor [protected]
 

Determines whether the object should be drawn as an Actor or an Object.

Definition at line 311 of file objectwidget.h.

Referenced by calculateSize(), draw(), getDrawAsActor(), loadFromXMI(), saveToXMI(), and setDrawAsActor().

bool ObjectWidget::m_bShowDestruction [protected]
 

Determines whether to show object destruction on sequence diagram line.

Definition at line 317 of file objectwidget.h.

Referenced by activate(), getEndLineY(), getShowDestruction(), loadFromXMI(), saveToXMI(), and setShowDestruction().


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