Commit e5b73e81aedabf4cc820ccf0360309cb35986da2
1 parent
15df8c68
addded behavior properties to datalet
Showing
10 changed files
with
113 additions
and
23 deletions
controllets/paper-card-controllet/paper-card-controllet.html
datalets/barchart-datalet/barchart-datalet.html
| @@ -165,6 +165,17 @@ Example: | @@ -165,6 +165,17 @@ Example: | ||
| 165 | suffix : { | 165 | suffix : { |
| 166 | type : String, | 166 | type : String, |
| 167 | value : "units" | 167 | value : "units" |
| 168 | + }, | ||
| 169 | + /** | ||
| 170 | + * It's the component behavior | ||
| 171 | + * | ||
| 172 | + * @attribute behavior | ||
| 173 | + * @type Object | ||
| 174 | + * @default {} | ||
| 175 | + */ | ||
| 176 | + behavior : { | ||
| 177 | + type : Object, | ||
| 178 | + value : {} | ||
| 168 | } | 179 | } |
| 169 | }, | 180 | }, |
| 170 | 181 | ||
| @@ -176,8 +187,8 @@ Example: | @@ -176,8 +187,8 @@ Example: | ||
| 176 | */ | 187 | */ |
| 177 | ready: function(){ | 188 | ready: function(){ |
| 178 | 189 | ||
| 179 | - var BarchartComponentBehavior = $.extend(true, {}, HighchartsComponentBehavior, BarchartBehavior); | ||
| 180 | - BarchartComponentBehavior.init(this); | 190 | + this.behavior = $.extend(true, {}, HighchartsComponentBehavior, BarchartBehavior); |
| 191 | + this.behavior.init(this); | ||
| 181 | } | 192 | } |
| 182 | }); | 193 | }); |
| 183 | </script> | 194 | </script> |
datalets/base-ajax-json-jsonpath-datalet/static/js/AjaxJsonJsonPathBehavior.js
| @@ -103,7 +103,6 @@ var AjaxJsonJsonPathBehavior = { | @@ -103,7 +103,6 @@ var AjaxJsonJsonPathBehavior = { | ||
| 103 | //Deal the fields with "'" char | 103 | //Deal the fields with "'" char |
| 104 | //this._component.fields = this._component.fields.replace(/#/g,"'"); | 104 | //this._component.fields = this._component.fields.replace(/#/g,"'"); |
| 105 | 105 | ||
| 106 | - | ||
| 107 | this._component.fields = JSON.parse(this._component.fields); | 106 | this._component.fields = JSON.parse(this._component.fields); |
| 108 | 107 | ||
| 109 | for(var i=0;i < this._component.fields.length; i++){ | 108 | for(var i=0;i < this._component.fields.length; i++){ |
datalets/column3Dchart-datalet/column3Dchart-datalet.html
| @@ -165,6 +165,17 @@ Example: | @@ -165,6 +165,17 @@ Example: | ||
| 165 | title: { | 165 | title: { |
| 166 | type: String, | 166 | type: String, |
| 167 | value: "Heading" | 167 | value: "Heading" |
| 168 | + }, | ||
| 169 | + /** | ||
| 170 | + * It's the component behavior | ||
| 171 | + * | ||
| 172 | + * @attribute behavior | ||
| 173 | + * @type Object | ||
| 174 | + * @default {} | ||
| 175 | + */ | ||
| 176 | + behavior : { | ||
| 177 | + type : Object, | ||
| 178 | + value : {} | ||
| 168 | } | 179 | } |
| 169 | }, | 180 | }, |
| 170 | 181 | ||
| @@ -175,9 +186,8 @@ Example: | @@ -175,9 +186,8 @@ Example: | ||
| 175 | * @method ready | 186 | * @method ready |
| 176 | */ | 187 | */ |
| 177 | ready: function(){ | 188 | ready: function(){ |
| 178 | - | ||
| 179 | - var column3DchartComponentBehavior = $.extend(true, {}, HighchartsComponentBehavior, column3DchartBehavior); | ||
| 180 | - column3DchartComponentBehavior.init(this); | 189 | + this.behavior = $.extend(true, {}, HighchartsComponentBehavior, column3DchartBehavior); |
| 190 | + this.behavior.init(this); | ||
| 181 | } | 191 | } |
| 182 | }); | 192 | }); |
| 183 | </script> | 193 | </script> |
datalets/columnchart-datalet/columnchart-datalet.html
| @@ -164,6 +164,17 @@ Example: | @@ -164,6 +164,17 @@ Example: | ||
| 164 | suffix : { | 164 | suffix : { |
| 165 | type : String, | 165 | type : String, |
| 166 | value : "units" | 166 | value : "units" |
| 167 | + }, | ||
| 168 | + /** | ||
| 169 | + * It's the component behavior | ||
| 170 | + * | ||
| 171 | + * @attribute behavior | ||
| 172 | + * @type Object | ||
| 173 | + * @default {} | ||
| 174 | + */ | ||
| 175 | + behavior : { | ||
| 176 | + type : Object, | ||
| 177 | + value : {} | ||
| 167 | } | 178 | } |
| 168 | }, | 179 | }, |
| 169 | 180 | ||
| @@ -174,8 +185,8 @@ Example: | @@ -174,8 +185,8 @@ Example: | ||
| 174 | * @method ready | 185 | * @method ready |
| 175 | */ | 186 | */ |
| 176 | ready: function(){ | 187 | ready: function(){ |
| 177 | - var ColumnchartComponentBehavior = $.extend(true, {}, HighchartsComponentBehavior, ColumnchartBehavior); | ||
| 178 | - ColumnchartComponentBehavior.init(this); | 188 | + this.behavior = $.extend(true, {}, HighchartsComponentBehavior, ColumnchartBehavior); |
| 189 | + this.behavior.init(this); | ||
| 179 | } | 190 | } |
| 180 | }); | 191 | }); |
| 181 | </script> | 192 | </script> |
datalets/datatable-datalet/datatable-datalet.html
| @@ -96,12 +96,27 @@ Example: | @@ -96,12 +96,27 @@ Example: | ||
| 96 | 96 | ||
| 97 | Polymer({ | 97 | Polymer({ |
| 98 | is : 'datatable-datalet' , | 98 | is : 'datatable-datalet' , |
| 99 | + | ||
| 100 | + properties: { | ||
| 101 | + /** | ||
| 102 | + * It's the component behavior | ||
| 103 | + * | ||
| 104 | + * @attribute behavior | ||
| 105 | + * @type Object | ||
| 106 | + * @default {} | ||
| 107 | + */ | ||
| 108 | + behavior : { | ||
| 109 | + type : Object, | ||
| 110 | + value : {} | ||
| 111 | + } | ||
| 112 | + }, | ||
| 113 | + | ||
| 99 | ready: function(){ | 114 | ready: function(){ |
| 100 | - var DatatableComponentBehavior = $.extend(true, {}, BaseDataletBehavior, WorkcycleBehavior, AjaxJsonJsonPathBehavior, DatatableBehavior); | ||
| 101 | - DatatableComponentBehavior.init(this); | 115 | + this.behavior = $.extend(true, {}, BaseDataletBehavior, WorkcycleBehavior, AjaxJsonJsonPathBehavior, DatatableBehavior); |
| 116 | + this.behavior.init(this); | ||
| 102 | } | 117 | } |
| 103 | - | ||
| 104 | }); | 118 | }); |
| 119 | + | ||
| 105 | </script> | 120 | </script> |
| 106 | </dom-module> | 121 | </dom-module> |
| 107 | 122 |
datalets/donutpie3dchart-datalet/donutpie3dchart-datalet.html
| @@ -70,7 +70,6 @@ Example: | @@ -70,7 +70,6 @@ Example: | ||
| 70 | DonutPie3DSeries[0].data.push(DonutPie3DArr); | 70 | DonutPie3DSeries[0].data.push(DonutPie3DArr); |
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | - var titleDataset = ""; | ||
| 74 | //Build Highchart element | 73 | //Build Highchart element |
| 75 | $(this._component.$.charts.$.container).highcharts({ | 74 | $(this._component.$.charts.$.container).highcharts({ |
| 76 | chart: { | 75 | chart: { |
| @@ -114,10 +113,24 @@ Example: | @@ -114,10 +113,24 @@ Example: | ||
| 114 | } | 113 | } |
| 115 | }; | 114 | }; |
| 116 | 115 | ||
| 117 | - var DonutPiechartComponentBehavior = $.extend(true, {}, HighchartsComponentBehavior, DonutPiechartBehavior); | ||
| 118 | 116 | ||
| 119 | DonutPiechartDatalet = Polymer({ | 117 | DonutPiechartDatalet = Polymer({ |
| 120 | is: 'donutpie3dchart-datalet', | 118 | is: 'donutpie3dchart-datalet', |
| 119 | + | ||
| 120 | + properties: { | ||
| 121 | + /** | ||
| 122 | + * It's the component behavior | ||
| 123 | + * | ||
| 124 | + * @attribute behavior | ||
| 125 | + * @type Object | ||
| 126 | + * @default {} | ||
| 127 | + */ | ||
| 128 | + behavior : { | ||
| 129 | + type : Object, | ||
| 130 | + value : {} | ||
| 131 | + } | ||
| 132 | + }, | ||
| 133 | + | ||
| 121 | /** | 134 | /** |
| 122 | * 'ready' callback extend the DonutPiechartComponentBehavior with HighchartsComponentBehavior and DonutPiechartBehavior | 135 | * 'ready' callback extend the DonutPiechartComponentBehavior with HighchartsComponentBehavior and DonutPiechartBehavior |
| 123 | * and run the Datalet workcycle. | 136 | * and run the Datalet workcycle. |
| @@ -125,7 +138,8 @@ Example: | @@ -125,7 +138,8 @@ Example: | ||
| 125 | * @method ready | 138 | * @method ready |
| 126 | */ | 139 | */ |
| 127 | ready: function(){ | 140 | ready: function(){ |
| 128 | - DonutPiechartComponentBehavior.init(this); | 141 | + this.behavior = $.extend(true, {}, HighchartsComponentBehavior, DonutPiechartBehavior); |
| 142 | + this.behavior.init(this); | ||
| 129 | } | 143 | } |
| 130 | }); | 144 | }); |
| 131 | </script> | 145 | </script> |
datalets/leafletjs-datalet/leafletjs-datalet.html
| @@ -108,7 +108,6 @@ Example: | @@ -108,7 +108,6 @@ Example: | ||
| 108 | is : 'leafletjs-datalet', | 108 | is : 'leafletjs-datalet', |
| 109 | 109 | ||
| 110 | properties : { | 110 | properties : { |
| 111 | - | ||
| 112 | /** | 111 | /** |
| 113 | * Store a reference to the leafletjs map object created in 'ready' callback | 112 | * Store a reference to the leafletjs map object created in 'ready' callback |
| 114 | * @attribute map | 113 | * @attribute map |
| @@ -119,7 +118,6 @@ Example: | @@ -119,7 +118,6 @@ Example: | ||
| 119 | type: Object, | 118 | type: Object, |
| 120 | value:null | 119 | value:null |
| 121 | }, | 120 | }, |
| 122 | - | ||
| 123 | /** | 121 | /** |
| 124 | * An Array with all the markers extracted from the dataset | 122 | * An Array with all the markers extracted from the dataset |
| 125 | * @attribute markers | 123 | * @attribute markers |
| @@ -129,6 +127,17 @@ Example: | @@ -129,6 +127,17 @@ Example: | ||
| 129 | { | 127 | { |
| 130 | type : Array, | 128 | type : Array, |
| 131 | value : [] | 129 | value : [] |
| 130 | + }, | ||
| 131 | + /** | ||
| 132 | + * It's the component behavior | ||
| 133 | + * | ||
| 134 | + * @attribute behavior | ||
| 135 | + * @type Object | ||
| 136 | + * @default {} | ||
| 137 | + */ | ||
| 138 | + behavior : { | ||
| 139 | + type : Object, | ||
| 140 | + value : {} | ||
| 132 | } | 141 | } |
| 133 | }, | 142 | }, |
| 134 | 143 | ||
| @@ -150,8 +159,8 @@ Example: | @@ -150,8 +159,8 @@ Example: | ||
| 150 | 159 | ||
| 151 | L.Icon.Default.imagePath = 'http://services.routetopa.eu/DEEalerProvider/COMPONENTS/datalets/leafletjs-datalet/leafletsjs/images'; | 160 | L.Icon.Default.imagePath = 'http://services.routetopa.eu/DEEalerProvider/COMPONENTS/datalets/leafletjs-datalet/leafletsjs/images'; |
| 152 | 161 | ||
| 153 | - var leafletjsComponentBehavior = $.extend(true, {}, BaseDataletBehavior, WorkcycleBehavior, AjaxJsonJsonPathBehavior, leafletjsBehavior); | ||
| 154 | - leafletjsComponentBehavior.init(this); | 162 | + this.behavior = $.extend(true, {}, BaseDataletBehavior, WorkcycleBehavior, AjaxJsonJsonPathBehavior, leafletjsBehavior); |
| 163 | + this.behavior.init(this); | ||
| 155 | } | 164 | } |
| 156 | }); | 165 | }); |
| 157 | </script> | 166 | </script> |
datalets/linechart-datalet/linechart-datalet.html
| @@ -156,6 +156,17 @@ Example: | @@ -156,6 +156,17 @@ Example: | ||
| 156 | suffix : { | 156 | suffix : { |
| 157 | type : String, | 157 | type : String, |
| 158 | value : "units" | 158 | value : "units" |
| 159 | + }, | ||
| 160 | + /** | ||
| 161 | + * It's the component behavior | ||
| 162 | + * | ||
| 163 | + * @attribute behavior | ||
| 164 | + * @type Object | ||
| 165 | + * @default {} | ||
| 166 | + */ | ||
| 167 | + behavior : { | ||
| 168 | + type : Object, | ||
| 169 | + value : {} | ||
| 159 | } | 170 | } |
| 160 | }, | 171 | }, |
| 161 | 172 | ||
| @@ -166,8 +177,8 @@ Example: | @@ -166,8 +177,8 @@ Example: | ||
| 166 | * @method ready | 177 | * @method ready |
| 167 | */ | 178 | */ |
| 168 | ready: function(){ | 179 | ready: function(){ |
| 169 | - var LinechartComponentBehavior = $.extend(true, {}, HighchartsComponentBehavior, LinechartBehavior); | ||
| 170 | - LinechartComponentBehavior.init(this); | 180 | + this.behavior = $.extend(true, {}, HighchartsComponentBehavior, LinechartBehavior); |
| 181 | + this.behavior.init(this); | ||
| 171 | } | 182 | } |
| 172 | }); | 183 | }); |
| 173 | </script> | 184 | </script> |
datalets/treemap-datalet/treemap-datalet.html
| @@ -197,12 +197,23 @@ Example: | @@ -197,12 +197,23 @@ Example: | ||
| 197 | name: { | 197 | name: { |
| 198 | type: String, | 198 | type: String, |
| 199 | value: "" | 199 | value: "" |
| 200 | + }, | ||
| 201 | + /** | ||
| 202 | + * It's the component behavior | ||
| 203 | + * | ||
| 204 | + * @attribute behavior | ||
| 205 | + * @type Object | ||
| 206 | + * @default {} | ||
| 207 | + */ | ||
| 208 | + behavior : { | ||
| 209 | + type : Object, | ||
| 210 | + value : {} | ||
| 200 | } | 211 | } |
| 201 | }, | 212 | }, |
| 202 | 213 | ||
| 203 | ready: function(){ | 214 | ready: function(){ |
| 204 | - var TreemapComponentBehavior = $.extend(true, {}, BaseDataletBehavior, WorkcycleBehavior, AjaxJsonJsonPathBehavior, TreemapBehavior); | ||
| 205 | - TreemapComponentBehavior.init(this); | 215 | + this.behavior = $.extend(true, {}, BaseDataletBehavior, WorkcycleBehavior, AjaxJsonJsonPathBehavior, TreemapBehavior); |
| 216 | + this.behavior.init(this); | ||
| 206 | } | 217 | } |
| 207 | 218 | ||
| 208 | }); | 219 | }); |