From 7fdf733a64670fceefc3ded35cfa581e1c458179 Mon Sep 17 00:00:00 2001 From: Einav Weiss Keidar Date: Tue, 20 Mar 2018 14:45:40 +0200 Subject: Adding Prettier and fixing up eslint version Issue-ID: SDC-1094 Change-Id: Ie83ad95a03899345dd90235daf0323cbe3bc6afd Signed-off-by: Einav Weiss Keidar --- .../asdc/sequencer/components/editor/Editor.jsx | 248 ++++++++++----------- 1 file changed, 123 insertions(+), 125 deletions(-) (limited to 'dox-sequence-diagram-ui/src/main/webapp/lib/ecomp/asdc/sequencer/components/editor/Editor.jsx') diff --git a/dox-sequence-diagram-ui/src/main/webapp/lib/ecomp/asdc/sequencer/components/editor/Editor.jsx b/dox-sequence-diagram-ui/src/main/webapp/lib/ecomp/asdc/sequencer/components/editor/Editor.jsx index 00c8f7c47c..087bc8029f 100644 --- a/dox-sequence-diagram-ui/src/main/webapp/lib/ecomp/asdc/sequencer/components/editor/Editor.jsx +++ b/dox-sequence-diagram-ui/src/main/webapp/lib/ecomp/asdc/sequencer/components/editor/Editor.jsx @@ -26,149 +26,147 @@ import Source from './components/source/Source'; * Editor view, aggregating the designer, the code editor, the toolbar. */ class Editor extends React.Component { + // /////////////////////////////////////////////////////////////////////////////////////////////// - // /////////////////////////////////////////////////////////////////////////////////////////////// + /** + * Construct React view. + * @param props properties. + * @param context context. + */ + constructor(props, context) { + super(props, context); - /** - * Construct React view. - * @param props properties. - * @param context context. - */ - constructor(props, context) { - super(props, context); + this.application = Common.assertNotNull(props.application); + this.demo = this.application.getOptions().demo; - this.application = Common.assertNotNull(props.application); - this.demo = this.application.getOptions().demo; + // Bindings. - // Bindings. + this.selectMessage = this.selectMessage.bind(this); + this.selectLifeline = this.selectLifeline.bind(this); - this.selectMessage = this.selectMessage.bind(this); - this.selectLifeline = this.selectLifeline.bind(this); - - this.onMouseDown = this.onMouseDown.bind(this); - this.onMouseUp = this.onMouseUp.bind(this); - this.onMouseMove = this.onMouseMove.bind(this); - } + this.onMouseDown = this.onMouseDown.bind(this); + this.onMouseUp = this.onMouseUp.bind(this); + this.onMouseMove = this.onMouseMove.bind(this); + } - // /////////////////////////////////////////////////////////////////////////////////////////////// + // /////////////////////////////////////////////////////////////////////////////////////////////// - /** - * Select message by ID. - * @param id message ID. - */ - selectMessage(id) { - if (this.designer) { - this.designer.selectMessage(id); + /** + * Select message by ID. + * @param id message ID. + */ + selectMessage(id) { + if (this.designer) { + this.designer.selectMessage(id); + } } - } - // /////////////////////////////////////////////////////////////////////////////////////////////// + // /////////////////////////////////////////////////////////////////////////////////////////////// - /** - * Select lifeline by ID. - * @param id lifeline ID. - */ - selectLifeline(id) { - if (this.designer) { - this.designer.selectLifeline(id); + /** + * Select lifeline by ID. + * @param id lifeline ID. + */ + selectLifeline(id) { + if (this.designer) { + this.designer.selectLifeline(id); + } } - } - - // /////////////////////////////////////////////////////////////////////////////////////////////// - - /** - * Record that we're dragging. - */ - onMouseDown() { - if (this.editor) { - this.resize = { - initialWidth: this.editor.offsetWidth, - initialPageX: undefined, - }; + + // /////////////////////////////////////////////////////////////////////////////////////////////// + + /** + * Record that we're dragging. + */ + onMouseDown() { + if (this.editor) { + this.resize = { + initialWidth: this.editor.offsetWidth, + initialPageX: undefined + }; + } } - } - - // /////////////////////////////////////////////////////////////////////////////////////////////// - - /** - * Record that we're not dragging. - */ - onMouseUp() { - this.resize = undefined; - } - - // /////////////////////////////////////////////////////////////////////////////////////////////// - - /** - * Record mouse movement. - */ - onMouseMove(event) { - if (this.resize) { - if (this.editor) { - if (this.resize.initialPageX) { - const deltaX = event.pageX - this.resize.initialPageX; - const newWidth = this.resize.initialWidth + deltaX; - const newWidthBounded = Math.min(800, Math.max(400, newWidth)); - this.editor.style.width = `${newWidthBounded}px`; - } else { - this.resize.initialPageX = event.pageX; + + // /////////////////////////////////////////////////////////////////////////////////////////////// + + /** + * Record that we're not dragging. + */ + onMouseUp() { + this.resize = undefined; + } + + // /////////////////////////////////////////////////////////////////////////////////////////////// + + /** + * Record mouse movement. + */ + onMouseMove(event) { + if (this.resize) { + if (this.editor) { + if (this.resize.initialPageX) { + const deltaX = event.pageX - this.resize.initialPageX; + const newWidth = this.resize.initialWidth + deltaX; + const newWidthBounded = Math.min( + 800, + Math.max(400, newWidth) + ); + this.editor.style.width = `${newWidthBounded}px`; + } else { + this.resize.initialPageX = event.pageX; + } + } } - } } - } - - // /////////////////////////////////////////////////////////////////////////////////////////////// - - /** - * Render editor. - */ - render() { - - Logger.info('Editor.jsx - render()'); - - return ( - -
{ this.editor = r; }} - > - - - -
- - { - if (r) { - this.designer = r.getDecoratedComponentInstance(); - } else { - this.designer = null; - } - }} - /> -
- -
-
-
-
- -
-
-
- ); - } + + // /////////////////////////////////////////////////////////////////////////////////////////////// + + /** + * Render editor. + */ + render() { + Logger.info('Editor.jsx - render()'); + + return ( +
{ + this.editor = r; + }}> + + +
+ + { + if (r) { + this.designer = r.getDecoratedComponentInstance(); + } else { + this.designer = null; + } + }} + /> +
+ +
+
+
+
+ +
+
+ ); + } } /** Element properties. */ Editor.propTypes = { - application: PropTypes.object.isRequired, + application: PropTypes.object.isRequired }; export default Editor; - -- cgit 1.2.3-korg