def beginFrame(self, lobject, label, steps=1): """ Begins a frame with the upper left corner at lobject column and the current line. The specified label is shown in the upper left corner. Args: lobject -- left most object to contain in the frame. Corresponding UMLGraph operation: begin_frame(left_object,name,label_text); """ if steps: self.step(steps) name = self.genPicName() template = 'begin_frame({0},{1},"{2}");' buf = template.format(lobject.picName(), name, picEscapeString(label)) self.addTransaction(buf) return name
def lconstraintBelow(self, label): """ same as lconstraint, but it will be shown below the current line instead of above. Corresponding UMLGraph operation: lconstraint_below(object,label); """ template = 'lconstraint_below({0},"{1}");' buf = template.format(self.picName(), picEscapeString(label)) self.addTransaction(buf)
def picObjectInit(self): """ Defines an object with the given name, labeled on the diagram as specified. Corresponding UMLGraph operation: object(name, label); """ template = 'object({0},"{1}");' buf = template.format(self.picName(), picEscapeString(self.label)) self.parent.addTransaction(buf)
def rmessage(self, target, response): """ Draws a return message between two objects, with the given label. Can also be written as rmessage. Corresponding UMLGraph operation: return_message(from_object,to_object,label) """ template = 'rmessage({0},{1},"{2}");' buf = template.format(self.picName(), target.picName(), picEscapeString(response)) self.parent.addTransaction(buf)
def oconstraint(self, label): """ Displays an object constraint (typically given inside curly braces) for the last object defined. Args: label -- constraint text Corresponding UMLGraph operation: oconstraint(label); """ template = 'oconstraint("{0}");' buf = template.format(picEscapeString(label)) self.addTransaction(buf)
def cmessage(self, target, targetLabel): """ Has from_object create the to_object, labeled with object_label. The message is labeled with the <<create>> stereotype. Corresponding UMLGraph operation: create_message(from_object,to_object,object_label); """ target.label = targetLabel template = 'cmessage({0},{1},"{2}");' buf = template.format(self.picName(), target.picName(), picEscapeString(targetLabel)) self.parent.addTransaction(buf)
def lconstraint(self, label): """ Displays a constraint label (typically given inside curly braces) for the given object. The constraint will appear on the right of the object's lifeline at the time it appears. Can also be used to place an message label on the left of a message arrow, rather than its center. Can also be written as lconstraint. Corresponding UMLGraph operation: lconstraint(object,label); """ template = 'lconstraint({0},"{1}");' buf = template.format(self.picName(), picEscapeString(label)) self.parent.addTransaction(buf)
def message(self, target, request): """ Draws a message between two objects, with the given label. Self messages (where an objects sends a message to itself) are supported. Corresponding UMLGraph operation: message(from_object,to_object,label) """ template = 'message({0},{1},"{2}");' buf = template.format(self.picName(), target.picName(), picEscapeString(request)) self.parent.addTransaction(buf)
def comment(self, obj, text, lineMovement="", boxSize=""): """ Display a comment about an object. Args: obj -- object to associate comment with text - string containing the comment text lineMovement - pic operation to adjust the comment position boxSize - pic operation to adjust the comment size Returns: name -- pic name of comment instance. Corresponding UMLGraph operation: comment(object,[name],[line_movement],[box_size] text); """ name = self.genPicName() bufList = [] bufList.append('comment(') bufList.append(obj.picName()) bufList.append(',') bufList.append(name) bufList.append(',') bufList.append(lineMovement) bufList.append(',') bufList.append(boxSize) bufList.append(' ') textList = text.splitlines() for line in textList: escapedLine = picEscapeString(line) bufList.append('"{0}"'.format(escapedLine)) bufList.append(');') self.addTransaction(''.join(bufList)) return name