diff --git a/src/components/dialog/edit-widget.js b/src/components/dialog/edit-widget.js index d23c3a5..696675b 100644 --- a/src/components/dialog/edit-widget.js +++ b/src/components/dialog/edit-widget.js @@ -119,6 +119,10 @@ class EditWidgetDialog extends Component { this.validateForm(id)} handleChange={(e, index) => this.handleChange(e, index)} />, this.validateForm(id)} handleChange={(e, index) => this.handleChange(e, index)} /> ) + } else if (this.props.widget.type === 'Box') { + dialogControls.push( + this.validateForm(id)} handleChange={(e, index) => this.handleChange(e, index)} /> + ) } } diff --git a/src/components/widget-box.js b/src/components/widget-box.js new file mode 100644 index 0000000..b917b65 --- /dev/null +++ b/src/components/widget-box.js @@ -0,0 +1,33 @@ +/** + * File: widget-box.js + * Author: Ricardo Hernandez-Montoya + * Date: 25.04.2017 + * Copyright: 2017, Institute for Automation of Complex Power Systems, EONERC + * This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential. + * Unauthorized copying of this file, via any medium is strictly prohibited. + **********************************************************************************/ + +import React, { Component } from 'react'; + +import EditWidgetColorControl from './dialog/edit-widget-color-control'; + +class WidgetBox extends Component { + render() { + + let colors = EditWidgetColorControl.ColorPalette; + + let colorStyle = { + borderColor: colors[this.props.widget.border_color] + } + + return ( +
+
+ { } +
+
+ ); + } +} + +export default WidgetBox; diff --git a/src/components/widget-factory.js b/src/components/widget-factory.js index 6414180..59c49d6 100644 --- a/src/components/widget-factory.js +++ b/src/components/widget-factory.js @@ -101,6 +101,14 @@ class WidgetFactory { widget.width = 200; widget.height = 150; break; + case 'Box': + widget.minWidth = 50; + widget.minHeight = 50; + widget.width = 100; + widget.height = 100; + widget.border_color = 0; + widget.z = 0; + break; default: widget.width = 100; widget.height = 100; diff --git a/src/containers/visualization.js b/src/containers/visualization.js index 7766c05..8490f95 100644 --- a/src/containers/visualization.js +++ b/src/containers/visualization.js @@ -349,6 +349,7 @@ class Visualization extends Component { + } diff --git a/src/containers/widget.js b/src/containers/widget.js index 89323b1..b72311c 100644 --- a/src/containers/widget.js +++ b/src/containers/widget.js @@ -27,6 +27,7 @@ import WidgetButton from '../components/widget-button'; import WidgetNumberInput from '../components/widget-number-input'; import WidgetSlider from '../components/widget-slider'; import WidgetGauge from '../components/widget-gauge'; +import WidgetBox from '../components/widget-box'; import '../styles/widgets.css'; @@ -146,6 +147,8 @@ class Widget extends Component { element = this.props.onWidgetStatusChange(w, this.props.index) } /> } else if (widget.type === 'Gauge') { element = + } else if (widget.type === 'Box') { + element = } let widgetClasses = classNames({ diff --git a/src/styles/widgets.css b/src/styles/widgets.css index 394b3d0..19ce5f4 100644 --- a/src/styles/widgets.css +++ b/src/styles/widgets.css @@ -441,4 +441,12 @@ div[class*="-widget"] label { .table-widget td, .table-widget th { text-align: center; } -/* End table widget*/ \ No newline at end of file +/* End table widget*/ + +/* Begin box widget */ +.box-widget .border { + width: 100%; + height: 100%; + border: 2px solid; +} +/* End box widget */ \ No newline at end of file