2 import React from 'react';
3 import _template from 'lodash/template';
4 import _merge from 'lodash/merge';
7 import Common from '../../common/Common';
8 import Logger from '../../common/Logger';
9 import Popup from './components/popup/Popup';
14 export default class Diagram extends React.Component {
16 // ///////////////////////////////////////////////////////////////////////////////////////////////
19 * Construct React view.
20 * @param props properties.
21 * @param context context.
23 constructor(props, context) {
24 super(props, context);
26 this.application = Common.assertNotNull(props.application);
27 this.options = this.application.getOptions().diagram;
36 diagram: _template(require('./templates/diagram.html')),
37 lifeline: _template(require('./templates/lifeline.html')),
38 message: _template(require('./templates/message.html')),
39 occurrence: _template(require('./templates/occurrence.html')),
40 fragment: _template(require('./templates/fragment.html')),
41 title: _template(require('./templates/title.html')),
44 this.handleResize = this.handleResize.bind(this);
47 // ///////////////////////////////////////////////////////////////////////////////////////////////
54 this.svg.select('').text(n);
57 // ///////////////////////////////////////////////////////////////////////////////////////////////
60 * Get SVG from diagram.
64 const svg = this.svg.node().outerHTML;
65 return svg.replace('<svg ', '<svg xmlns="http://www.w3.org/2000/svg" ');
68 // ///////////////////////////////////////////////////////////////////////////////////////////////
71 * Select message by ID.
72 * @param id message ID.
75 const sel = this.svg.selectAll('g.asdcs-diagram-message-container');
76 sel.classed('asdcs-active', false);
77 sel.selectAll('rect.asdcs-diagram-message-bg').attr('filter', null);
79 const parent = this.svg.select(`g.asdcs-diagram-message-container[data-id="${id}"]`);
80 parent.classed('asdcs-active', true);
81 parent.selectAll('rect.asdcs-diagram-message-bg').attr('filter', 'url(#asdcsSvgHighlight)');
83 this._showNotesPopup(id);
86 // ///////////////////////////////////////////////////////////////////////////////////////////////
89 * Select lifeline by ID.
90 * @param id lifeline ID.
93 const sel = this.svg.selectAll('g.asdcs-diagram-lifeline-container');
94 sel.classed('asdcs-active', false);
95 sel.selectAll('rect').attr('filter', null);
97 const parent = this.svg.select(`g.asdcs-diagram-lifeline-container[data-id="${id}"]`);
98 parent.selectAll('rect').attr('filter', 'url(#asdcsSvgHighlight)');
99 parent.classed('asdcs-active', true);
103 // ///////////////////////////////////////////////////////////////////////////////////////////////
106 * Handle resize, including initial sizing.
110 const height = this.wrapper.offsetHeight;
111 const width = this.wrapper.offsetWidth;
112 if (this.state.height !== height || this.state.width !== width) {
113 this.setState({ height, width });
118 // ///////////////////////////////////////////////////////////////////////////////////////////////
121 * (Re)render diagram.
125 const model = this.application.getModel();
126 const modelJSON = model.unwrap();
127 const name = modelJSON.diagram.metadata.name;
128 const options = this.application.getOptions();
129 const titleHeight = options.diagram.title.height;
130 const titleClass = (titleHeight && titleHeight > 0) ? `height:${titleHeight}` : 'asdcs-hidden';
133 <div className="asdcs-diagram">
134 <div className={`asdcs-diagram-name ${titleClass}`}>{name}</div>
135 <div className="asdcs-diagram-svg" ref={(r) => { this.wrapper = r; }}></div>
136 <Popup visible={false} ref={(r) => { this.popup = r; }} />
141 // ///////////////////////////////////////////////////////////////////////////////////////////////
147 // ///////////////////////////////////////////////////////////////////////////////////////////////
152 componentDidMount() {
153 window.addEventListener('resize', this.handleResize);
163 // ///////////////////////////////////////////////////////////////////////////////////////////////
165 componentWillUnmount() {
166 window.removeEventListener('resize', this.handleResize);
169 // ///////////////////////////////////////////////////////////////////////////////////////////////
174 componentDidUpdate() {
178 // ///////////////////////////////////////////////////////////////////////////////////////////////
181 * Redraw SVG diagram. So far it's fast enough that it doesn't seem to matter whether
182 * it's completely redrawn.
187 const svgparams = _merge({}, this.options.svg);
188 this.wrapper.innerHTML = this.templates.diagram(svgparams);
189 this.svg = d3.select(this.wrapper).select('svg');
192 if (this.state.height === 0) {
194 // We'll get a resize event, and the height will be non-zero when it's actually time.
199 if (this.state.height && this.state.width) {
200 const margin = this.options.svg.margin;
203 const height = this.state.height + (margin * 2);
204 const width = this.state.width + (margin * 2);
205 const viewBox = `${x} ${y} ${width} ${height}`;
206 this.svg.attr('viewBox', viewBox);
210 // If we've already rendered, then save the current scale/translate so that we
211 // can reapply it after rendering.
213 const gContentSelection = this.svg.selectAll('g.asdcs-diagram-content');
214 if (gContentSelection.size() === 1) {
215 const transform = gContentSelection.attr('transform');
217 this.savedTransform = transform;
221 // Empty the document. We're starting again.
223 this.svg.selectAll('.asdcs-diagram-content').remove();
225 // Extract the model.
227 const model = this.application.getModel();
231 const modelJSON = model.unwrap();
233 // Extract dimension options.
235 const header = this.options.lifelines.header;
236 const spacing = this.options.lifelines.spacing;
238 // Make separate container elements so that we can control Z order.
240 const gContent = this.svg.append('g').attr('class', 'asdcs-diagram-content');
241 const gLifelines = gContent.append('g').attr('class', 'asdcs-diagram-lifelines');
242 const gCanvas = gContent.append('g').attr('class', 'asdcs-diagram-canvas');
243 gCanvas.append('g').attr('class', 'asdcs-diagram-occurrences');
244 gCanvas.append('g').attr('class', 'asdcs-diagram-fragments');
245 gCanvas.append('g').attr('class', 'asdcs-diagram-messages');
247 // Lifelines -----------------------------------------------------------------------------------
249 const actorsById = {};
250 const positionsByMessageId = {};
251 const lifelines = [];
252 for (const actor of modelJSON.diagram.lifelines) {
253 const x = (header.width / 2) + (lifelines.length * spacing.horizontal);
254 Diagram._processLifeline(actor, x);
255 lifelines.push({ x, actor });
256 actorsById[actor.id] = actor;
259 // Messages ------------------------------------------------------------------------------------
261 // Analyze occurrence information.
263 const occurrences = model.analyzeOccurrences();
264 const fragments = model.analyzeFragments();
265 let y = this.options.lifelines.header.height + spacing.vertical;
266 let messageIndex = 0;
267 for (const step of modelJSON.diagram.steps) {
269 positionsByMessageId[step.message.id] = positionsByMessageId[step.message.id] || {};
270 positionsByMessageId[step.message.id].y = y;
271 this._drawMessage(gCanvas, step.message, y, actorsById,
272 positionsByMessageId, ++messageIndex, occurrences, fragments);
274 y += spacing.vertical;
277 // ---------------------------------------------------------------------------------------------
279 // Draw the actual (dashed) lifelines in a background <g>.
281 this._drawLifelines(gLifelines, lifelines, y);
283 // Initialize mouse event handlers.
285 this._initMouseEvents(gLifelines, gCanvas);
289 const bb = gContent.node().getBBox();
290 this._initZoom(gContent, bb.width, bb.height);
293 // ///////////////////////////////////////////////////////////////////////////////////////////////
294 // ///////////////////////////////////////////////////////////////////////////////////////////////
295 // ///////////////////////////////////////////////////////////////////////////////////////////////
296 // ///////////////////////////////////////////////////////////////////////////////////////////////
297 // ///////////////////////////////////////////////////////////////////////////////////////////////
298 // ///////////////////////////////////////////////////////////////////////////////////////////////
299 // ///////////////////////////////////////////////////////////////////////////////////////////////
300 // ///////////////////////////////////////////////////////////////////////////////////////////////
301 // ///////////////////////////////////////////////////////////////////////////////////////////////
302 // ///////////////////////////////////////////////////////////////////////////////////////////////
305 * Draw message into SVG canvas.
306 * @param gCanvas container.
307 * @param message message to be rendered.
308 * @param y current y position.
309 * @param actorsById actor lookup.
310 * @param positionsByMessageId x- and y-position of each message.
311 * @param messageIndex where we are in the set of messages to be rendered.
312 * @param oData occurrences info.
313 * @param fData fragments info.
316 _drawMessage(gCanvas, message, y, actorsById, positionsByMessageId,
317 messageIndex, oData, fData) {
319 Common.assertNotNull(oData);
321 const request = message.type === 'request';
322 const fromActor = request ? actorsById[message.from] : actorsById[message.to];
323 const toActor = request ? actorsById[message.to] : actorsById[message.from];
326 Logger.warn(`Cannot draw message ${JSON.stringify(message)}: 'from' not found.`);
331 Logger.warn(`Cannot draw message ${JSON.stringify(message)}: 'to' not found.`);
335 // Occurrences. --------------------------------------------------------------------------------
337 if (message.occurrence) {
338 Logger.debug(`Found occurrence for ${message.name}: ${JSON.stringify(message.occurrence)}`);
340 const activeTo = Diagram._calcActive(oData, toActor.id);
341 this._drawOccurrence(gCanvas, oData, positionsByMessageId, fromActor, message.id);
342 this._drawOccurrence(gCanvas, oData, positionsByMessageId, toActor, message.id);
343 const activeFrom = Diagram._calcActive(oData, fromActor.id);
345 // Messages. -----------------------------------------------------------------------------------
347 const gMessages = gCanvas.select('g.asdcs-diagram-messages');
349 // Save positions for later.
351 const positions = positionsByMessageId[message.id];
352 positions.x0 = fromActor.x;
353 positions.x1 = toActor.x;
357 const leftToRight = fromActor.x < toActor.x;
358 const loopback = (message.to === message.from);
359 const x1 = this._calcMessageX(activeTo, toActor.x, true, leftToRight);
360 const x0 = loopback ? x1 : this._calcMessageX(activeFrom, fromActor.x, false, leftToRight);
367 messagePath = `M${x1},${y}`;
368 messagePath = `${messagePath} L${x1 + 200},${y}`;
369 messagePath = `${messagePath} L${x1 + 200},${y + 50}`;
370 messagePath = `${messagePath} L${x1},${y + 50}`;
373 // Between lifelines.
375 messagePath = `M${x0},${y}`;
376 messagePath = `${messagePath} L${x1},${y}`;
379 const styles = Diagram._getMessageStyles(message);
381 // Split message over lines.
383 const messageWithPrefix = `${messageIndex}. ${message.name}`;
384 const maxLines = this.options.messages.label.maxLines;
385 const wrapWords = this.options.messages.label.wrapWords;
386 const wrapLines = this.options.messages.label.wrapLines;
387 const messageLines = Common.tokenize(messageWithPrefix, wrapWords, wrapLines, maxLines);
389 const messageTxt = this.templates.message({
392 marker: styles.marker,
393 dasharray: styles.dasharray,
394 labels: messageLines,
401 const messageEl = Common.txt2dom(messageTxt);
402 const gMessage = gMessages.append('g');
403 Common.dom2svg(messageEl, gMessage);
405 // Set the background's bounding box to that of the text,
406 // so that they fit snugly.
408 const labelBB = gMessage.select('.asdcs-diagram-message-label').node().getBBox();
409 gMessage.select('.asdcs-diagram-message-label-bg')
410 .attr('x', labelBB.x)
411 .attr('y', labelBB.y)
412 .attr('height', labelBB.height)
413 .attr('width', labelBB.width);
415 // Fragments. ----------------------------------------------------------------------------------
417 const fragment = fData[message.id];
420 // It ends on this message.
422 this._drawFragment(gCanvas, fragment, positionsByMessageId);
427 // ///////////////////////////////////////////////////////////////////////////////////////////////
430 * Draw a single occurrence.
431 * @param gCanvas container.
432 * @param oData occurrence data.
433 * @param positionsByMessageId map of y positions by message ID.
434 * @param actor wrapper containing lifeline ID (.id), position (.x) and name (.name).
435 * @param messageId message identifier.
438 _drawOccurrence(gCanvas, oData, positionsByMessageId, actor, messageId) {
440 Common.assertType(oData, 'Object');
441 Common.assertType(positionsByMessageId, 'Object');
442 Common.assertType(actor, 'Object');
443 Common.assertType(messageId, 'String');
445 const gOccurrences = gCanvas.select('g.asdcs-diagram-occurrences');
447 const oOptions = this.options.lifelines.occurrences;
448 const oWidth = oOptions.width;
449 const oHalfWidth = oWidth / 2;
450 const oForeshortening = oOptions.foreshortening;
451 const oMarginTop = oOptions.marginTop;
452 const oMarginBottom = oOptions.marginBottom;
453 const o = oData[actor.id];
455 const active = Diagram._calcActive(oData, actor.id);
457 const x = (actor.x - oHalfWidth) + (active * oWidth);
458 const positions = positionsByMessageId[messageId];
459 const y = positions.y;
464 if (o.start[messageId]) {
466 // Starting, but drawing nothing until we find the end.
468 o.active.push(messageId);
471 } else if (active > 0) {
473 const startMessageId = o.stop[messageId];
474 if (startMessageId) {
476 // OK, it ends here. Draw the occurrence box.
479 const foreshorteningY = active * oForeshortening;
480 const startY = positionsByMessageId[startMessageId].y;
481 const height = ((oMarginTop + oMarginBottom) + (y - startY)) - (foreshorteningY * 2);
483 x: (actor.x - oHalfWidth) + ((active - 1) * oWidth),
484 y: ((startY - oMarginTop) + foreshorteningY),
489 const occurrenceTxt = this.templates.occurrence(oProps);
490 const occurrenceEl = Common.txt2dom(occurrenceTxt);
491 Common.dom2svg(occurrenceEl, gOccurrences.append('g'));
500 // Seems this is a singleton occurrence. We just draw a wee box around it.
502 const height = (oMarginTop + oMarginBottom);
503 const occurrenceProperties = { x, y: y - oMarginTop, height, width: oWidth };
504 const defaultTxt = this.templates.occurrence(occurrenceProperties);
505 const defaultEl = Common.txt2dom(defaultTxt);
506 Common.dom2svg(defaultEl, gOccurrences.append('g'));
511 // ///////////////////////////////////////////////////////////////////////////////////////////////
514 * Draw box(es) around fragment(s).
515 * @param gCanvas container.
516 * @param fragment fragment definition, corresponding to its final (stop) message.
517 * @param positionsByMessageId message dimensions.
520 _drawFragment(gCanvas, fragment, positionsByMessageId) {
522 const optFragments = this.options.fragments;
523 const gFragments = gCanvas.select('g.asdcs-diagram-fragments');
524 const p1 = positionsByMessageId[fragment.stop];
525 if (p1 && fragment.start && fragment.start.length > 0) {
527 for (const start of fragment.start) {
529 const message = this.application.getModel().getMessageById(start);
530 const bounds = this._calcFragmentBounds(message, fragment, positionsByMessageId);
533 const maxLines = this.options.fragments.label.maxLines;
534 const wrapWords = this.options.fragments.label.wrapWords;
535 const wrapLines = this.options.fragments.label.wrapLines;
536 const lines = Common.tokenize(message.fragment.guard, wrapWords, wrapLines, maxLines);
540 x: bounds.x0 - optFragments.leftMargin,
541 y: bounds.y0 - optFragments.topMargin,
542 height: (bounds.y1 - bounds.y0) + optFragments.heightMargin,
543 width: (bounds.x1 - bounds.x0) + optFragments.widthMargin,
544 operator: (message.fragment.operator || 'alt'),
548 const fragmentTxt = this.templates.fragment(params);
549 const fragmentEl = Common.txt2dom(fragmentTxt);
550 const gFragment = gFragments.append('g');
551 Common.dom2svg(fragmentEl, gFragment);
553 const labelBB = gFragment.select('.asdcs-diagram-fragment-guard').node().getBBox();
554 gFragment.select('.asdcs-diagram-fragment-guard-bg')
555 .attr('x', labelBB.x)
556 .attr('y', labelBB.y)
557 .attr('height', labelBB.height)
558 .attr('width', labelBB.width);
561 Logger.warn(`Bad fragment: ${JSON.stringify(fragment)}`);
567 // ///////////////////////////////////////////////////////////////////////////////////////////////
569 _calcFragmentBounds(startMessage, fragment, positionsByMessageId) {
571 const steps = this.application.getModel().unwrap().diagram.steps;
572 const bounds = { x0: 99999, x1: 0, y0: 99999, y1: 0 };
573 let foundStart = false;
574 let foundStop = false;
575 for (const step of steps) {
576 const message = step.message;
578 if (message.id === startMessage.id) {
581 if (foundStart && !foundStop) {
582 const positions = positionsByMessageId[message.id];
584 bounds.x0 = Math.min(bounds.x0, Math.min(positions.x0, positions.x1));
585 bounds.y0 = Math.min(bounds.y0, positions.y);
586 bounds.x1 = Math.max(bounds.x1, Math.max(positions.x0, positions.x1));
587 bounds.y1 = Math.max(bounds.y1, positions.y);
589 // This probably means it hasn't been recorded yet, which is fine, because
590 // we draw fragments from where they END.
595 if (message.id === fragment.stop) {
605 // ///////////////////////////////////////////////////////////////////////////////////////////////
608 * Draw all lifelines.
609 * @param gLifelines lifelines container.
610 * @param lifelines lifelines definitions.
614 _drawLifelines(gLifelines, lifelines, y) {
616 const maxLines = this.options.lifelines.header.maxLines;
617 const wrapWords = this.options.lifelines.header.wrapWords;
618 const wrapLines = this.options.lifelines.header.wrapLines;
620 for (const lifeline of lifelines) {
621 const lines = Common.tokenize(lifeline.actor.name, wrapWords, wrapLines, maxLines);
622 const lifelineTxt = this.templates.lifeline({
628 headerHeight: this.options.lifelines.header.height,
629 headerWidth: this.options.lifelines.header.width,
630 id: lifeline.actor.id,
633 const lifelineEl = Common.txt2dom(lifelineTxt);
634 Common.dom2svg(lifelineEl, gLifelines.append('g'));
638 // ///////////////////////////////////////////////////////////////////////////////////////////////
641 * Initialize all mouse events.
642 * @param gLifelines lifelines container.
643 * @param gCanvas top-level canvas container.
646 _initMouseEvents(gLifelines, gCanvas) {
649 const source = 'asdcs';
650 const origin = `${window.location.protocol}//${window.location.host}`;
653 gLifelines.selectAll('.asdcs-diagram-lifeline-selectable')
654 .on('mouseenter', function f() {
655 timer = setTimeout(() => {
656 self.application.selectLifeline(d3.select(this.parentNode).attr('data-id'));
659 .on('mouseleave', () => {
661 self.application.selectLifeline();
663 .on('click', function f() {
664 const id = d3.select(this.parentNode).attr('data-id');
665 window.postMessage({ source, id, type: 'lifeline' }, origin);
668 gLifelines.selectAll('.asdcs-diagram-lifeline-heading-box')
669 .on('mouseenter', function f() {
670 timer = setTimeout(() => {
671 self.application.selectLifeline(d3.select(this.parentNode).attr('data-id'));
674 .on('mouseleave', () => {
676 self.application.selectLifeline();
678 .on('click', function f() {
679 const id = d3.select(this.parentNode).attr('data-id');
680 window.postMessage({ source, id, type: 'lifelineHeader' }, origin);
683 gCanvas.selectAll('.asdcs-diagram-message-selectable')
684 .on('mouseenter', function f() {
685 self.events.message = { x: d3.event.pageX, y: d3.event.pageY };
686 timer = setTimeout(() => {
687 self.application.selectMessage(d3.select(this.parentNode).attr('data-id'));
690 .on('mouseleave', () => {
691 delete self.events.message;
693 self.application.selectMessage();
695 .on('click', function f() {
696 const id = d3.select(this.parentNode).attr('data-id');
697 window.postMessage({ source, id, type: 'message' }, origin);
702 // ///////////////////////////////////////////////////////////////////////////////////////////////
705 * Get CSS classes to be applied to a message, according to whether request/response
706 * or synchronous/asynchronous.
707 * @param message message being rendered.
708 * @returns CSS class name(s).
711 static _getMessageStyles(message) {
713 let marker = 'asdcsDiagramArrowSolid';
715 let css = 'asdcs-diagram-message';
716 if (message.type === 'request') {
717 css = `${css} asdcs-diagram-message-request`;
719 css = `${css} asdcs-diagram-message-response`;
720 marker = 'asdcsDiagramArrowOpen';
721 dasharray = '30, 10';
724 if (message.asynchronous) {
725 css = `${css} asdcs-diagram-message-asynchronous`;
726 marker = 'asdcsDiagramArrowOpen';
728 css = `${css} asdcs-diagram-message-synchronous`;
731 return { css, marker, dasharray };
734 // ///////////////////////////////////////////////////////////////////////////////////////////////
737 * Initialize or reinitialize zoom. This sets the initial zoom in the case of
738 * a re-rendering, and initializes the eventhandling in all cases.
740 * It does some fairly risky parsing of the 'transform' attribute, assuming that it
741 * can contain scale() and translate(). But only the zoom handler and us are writing
742 * the transform values, so that's probably OK.
744 * @param gContent container.
745 * @param width diagram width.
746 * @param height diagram height.
749 _initZoom(gContent, width, height) {
751 const zoomed = function zoomed() {
752 gContent.attr('transform',
753 `translate(${d3.event.translate})scale(${d3.event.scale})`);
756 const viewWidth = this.state.width || this.options.svg.width;
757 const viewHeight = this.state.height || this.options.svg.height;
758 const scaleMinimum = this.options.svg.scale.minimum;
759 const scaleWidth = viewWidth / width;
760 const scaleHeight = viewHeight / height;
762 let scale = scaleMinimum;
763 if (this.options.svg.scale.width) {
764 scale = Math.max(scale, scaleWidth);
766 if (this.options.svg.scale.height) {
767 scale = Math.min(scale, scaleHeight);
770 scale = Math.max(scale, scaleMinimum);
772 let translate = [0, 0];
773 if (this.savedTransform) {
774 const s = this.savedTransform;
775 const scaleStart = s.indexOf('scale(');
776 if (scaleStart !== -1) {
777 scale = parseFloat(s.substring(scaleStart + 6, s.length - 1));
779 const translateStart = s.indexOf('translate(');
780 if (translateStart !== -1) {
781 const spec = s.substring(translateStart + 10, s.indexOf(')', translateStart));
782 const tokens = spec.split(',');
783 translate = [parseFloat(tokens[0]), parseFloat(tokens[1])];
786 gContent.attr('transform', this.savedTransform);
788 gContent.attr('transform', `scale(${scale})`);
791 const zoom = d3.behavior.zoom()
793 .scaleExtent([scaleMinimum, 10])
794 .translate(translate)
799 // ///////////////////////////////////////////////////////////////////////////////////////////////
802 * Hide from the linter the fact that we're modifying the lifeline.
803 * @param lifeline to be updated with X position.
804 * @param x X position.
807 static _processLifeline(lifeline, x) {
808 const actor = lifeline;
809 actor.id = actor.id || actor.name;
813 // ///////////////////////////////////////////////////////////////////////////////////////////////
816 * Derive active occurrences for lifeline.
817 * @param oData occurrences data.
818 * @param lifelineId lifeline to be analyzed.
822 static _calcActive(oData, lifelineId) {
823 const o = oData[lifelineId];
826 active = o.active.length;
831 // ///////////////////////////////////////////////////////////////////////////////////////////////
834 * Derive the X position of an occurrence on a lifeline, taking into account how
835 * many occurrences are active.
836 * @param active active count.
837 * @param x lifeline X position; basis for offset.
838 * @param arrow whether this is the arrow (to) end.
839 * @param leftToRight whether this message goes left-to-right.
840 * @returns {*} calculated X position for occurrence left-hand side.
843 _calcMessageX(active, x, arrow, leftToRight) {
844 const width = this.options.lifelines.occurrences.width;
845 const halfWidth = width / 2;
846 const active0 = Math.max(0, active - 1);
847 let calculated = x + (active0 * width);
851 calculated -= halfWidth;
853 calculated += halfWidth;
856 // Start (NOT ARROW).
858 calculated += halfWidth;
860 calculated -= halfWidth;
867 // ///////////////////////////////////////////////////////////////////////////////////////////////
870 * Show popup upon hovering over a messages that has associated notes.
874 _showNotesPopup(id) {
877 const message = this.application.getModel().getMessageById(id);
878 if (message && message.notes && message.notes.length > 0 && this.events.message) {
879 this.popup.setState({
881 left: this.events.message.x - 50,
882 top: this.events.message.y + 20,
883 notes: message.notes[0],
887 this.popup.setState({ visible: false, notes: '' });
894 Diagram.propTypes = {
895 application: React.PropTypes.object.isRequired,