Commit 28ce2479261c981f1104d3d291b3aa61ad734f94

Authored by Erdogan Furkan
1 parent c85f1120

Last modifications, hopefully

generic_data/defaultValues.json
... ... @@ -21,7 +21,7 @@
21 21 },
22 22 "font":{
23 23 "name":"sans-serif",
24   - "size":"8"
  24 + "size":8
25 25 },
26 26 "layout":{
27 27 "type":"vertical",
... ... @@ -41,7 +41,7 @@
41 41 },
42 42 "font":{
43 43 "name":"sans-serif",
44   - "size":"8"
  44 + "size":8
45 45 },
46 46 "backgroundColor":"none",
47 47 "status":{
... ... @@ -53,12 +53,12 @@
53 53 "scale":"linear",
54 54 "tickPosition":"outwards",
55 55 "color":"#000000",
56   - "thickness":"1",
  56 + "thickness":1,
57 57 "legend":{
58 58 "color":"#000000",
59 59 "font":{
60 60 "name":"sans-serif",
61   - "size":"8"
  61 + "size":8
62 62 }
63 63 },
64 64 "timeFormat":"dd/mm/yy",
... ... @@ -96,7 +96,7 @@
96 96 },
97 97 "font":{
98 98 "name":"sans-serif",
99   - "size":"8"
  99 + "size":8
100 100 }
101 101 },
102 102 "intervaltick":{
... ... @@ -109,7 +109,7 @@
109 109 },
110 110 "font":{
111 111 "name":"sans-serif",
112   - "size":"8"
  112 + "size":8
113 113 }
114 114 },
115 115 "errorbar":{
... ... @@ -158,7 +158,7 @@
158 158 "color":"#000000",
159 159 "font":{
160 160 "name":"sans-serif",
161   - "size":"8"
  161 + "size":8
162 162 }
163 163 }
164 164 },
... ... @@ -176,7 +176,7 @@
176 176 "yRelative":true,
177 177 "align":"left",
178 178 "color":"#000000",
179   - "font":{"name":"sans-serif","size":"8"}
  179 + "font":{"name":"sans-serif","size":8}
180 180 },
181 181 "curves":{
182 182 "line":{
... ...
generic_data/defaultValuesConfig.json
... ... @@ -115,15 +115,43 @@
115 115 ],
116 116  
117 117 "availableColorMaps": [
118   - { "key": "0", "value": "Blue Red" },
119   - { "key": "1", "value": "Default" },
120   - { "key": "2", "value": "Blue Yellow" },
121   - { "key": "3", "value": "Grayscale" },
122   - { "key": "4", "value": "AMDA Default" },
123   - { "key": "5", "value": "GeoWhite" },
124   - { "key": "6", "value": "GeoBlack" },
125   - { "key": "7", "value": "Violet Yellow" },
126   - { "key": "8", "value": "Red Blue 4" }
  118 + { "key": "0", "value": "Blue Red", "svgFile":"cmap1_blue_red.svg" },
  119 + { "key": "1", "value": "Default", "svgFile":"cmap1_default.svg"},
  120 + { "key": "2", "value": "Blue Yellow", "svgFile":"cmap1_blue_yellow.svg" },
  121 + { "key": "3", "value": "Grayscale", "svgFile":"cmap1_gray.svg" },
  122 + { "key": "4", "value": "AMDA Default", "svgFile":"cmap1_amda_default.svg" },
  123 + { "key": "5", "value": "GeoWhite", "svgFile":"cmap1_geowhite.svg" },
  124 + { "key": "6", "value": "GeoBlack", "svgFile":"cmap1_geoblack.svg" },
  125 + { "key": "7", "value": "Violet Yellow", "svgFile":"cmap1_dark_violet_yellow.svg" },
  126 + { "key": "8", "value": "Red Blue 4", "svgFile":"cmap1_red_blue.svg" },
  127 + { "key": "9", "value": "Acton", "svgFile":"cmap1_acton.svg" },
  128 + { "key": "11", "value": "Bamako", "svgFile":"cmap1_bamako.svg" },
  129 + { "key": "12", "value": "Batlow", "svgFile":"cmap1_batlow.svg" },
  130 + { "key": "13", "value": "BatlowK", "svgFile":"cmap1_batlowK.svg" },
  131 + { "key": "14", "value": "BatlowW", "svgFile":"cmap1_batlowW.svg" },
  132 + { "key": "15", "value": "Bilbao", "svgFile":"cmap1_bilbao.svg" },
  133 + { "key": "16", "value": "Buda", "svgFile":"cmap1_buda.svg" },
  134 + { "key": "17", "value": "Davos", "svgFile":"cmap1_davos.svg" },
  135 + { "key": "18", "value": "Devon", "svgFile":"cmap1_devon.svg" },
  136 + { "key": "19", "value": "GrayC", "svgFile":"cmap1_grayC.svg" },
  137 + { "key": "20", "value": "Hawaii", "svgFile":"cmap1_hawaii.svg" },
  138 + { "key": "21", "value": "Imola", "svgFile":"cmap1_imola.svg" },
  139 + { "key": "22", "value": "Lajolla", "svgFile":"cmap1_lajolla.svg" },
  140 + { "key": "23", "value": "Lapaz", "svgFile":"cmap1_lapaz.svg" },
  141 + { "key": "24", "value": "Nuuk", "svgFile":"cmap1_nuuk.svg" },
  142 + { "key": "25", "value": "Oslo", "svgFile":"cmap1_oslo.svg" },
  143 + { "key": "26", "value": "Tokyo", "svgFile":"cmap1_tokyo.svg" },
  144 + { "key": "27", "value": "Turku", "svgFile":"cmap1_turku.svg" },
  145 +
  146 + { "key": "28", "value": "Bam", "svgFile":"cmap1_div_bam.svg" },
  147 + { "key": "29", "value": "Berlin", "svgFile":"cmap1_div_berlin.svg" },
  148 + { "key": "30", "value": "Broc", "svgFile":"cmap1_div_broc.svg" },
  149 + { "key": "31", "value": "Cork", "svgFile":"cmap1_div_cork.svg" },
  150 + { "key": "32", "value": "Lisbon", "svgFile":"cmap1_div_lisbon.svg" },
  151 + { "key": "33", "value": "Roma", "svgFile":"cmap1_div_roma.svg" },
  152 + { "key": "34", "value": "Tofino", "svgFile":"cmap1_div_tofino.svg" },
  153 + { "key": "35", "value": "Vanimo", "svgFile":"cmap1_div_vanimo.svg" },
  154 + { "key": "36", "value": "vik", "svgFile":"cmap1_div_vik.svg" }
127 155 ],
128 156  
129 157 "availableColors": [
... ...
generic_data/defaultValuesLinks.json
... ... @@ -103,7 +103,7 @@
103 103 },
104 104 "plot.axis.colorMap":
105 105 {
106   - "type":"combobox",
  106 + "type":"colormap",
107 107 "store":"availableColorMaps"
108 108 },
109 109 "plot.serie.lines.style":
... ...
js/app/views/ColorMap.js 0 โ†’ 100644
... ... @@ -0,0 +1,72 @@
  1 +Ext.define('amdaUI.ColorMap', {
  2 + extend: 'Ext.form.ComboBox',
  3 + alias: 'widget.colormap',
  4 +
  5 +
  6 + data : [],
  7 +
  8 + constructor:function(config){
  9 + this.getData();
  10 + this.init(config);
  11 + this.callParent();
  12 + },
  13 +
  14 + getData:function(){
  15 + var me = this;
  16 + amdaDefaultConfigs.availableColorMaps.forEach(function(color){
  17 + me.data.push({key:color.key,name:color.value, iconUrl:'generic_data/colormaps/'+ color.svgFile})
  18 + });
  19 + },
  20 + init: function(config){
  21 + var me = this;
  22 + var size = (typeof config !== "undefined" && config.size) ? config.size : '12';
  23 + Ext.apply(this,{
  24 + xtype:'combobox',
  25 + name: (typeof config !== "undefined" && config.name) ? config.name:null,
  26 + fieldLabel: (typeof config !== "undefined" && config.fieldLabel) ? config.fieldLabel:null,
  27 + store: new Ext.data.Store({
  28 + fields: ['key','name', 'iconUrl'],
  29 + data: me.data
  30 + }),
  31 + displayField: 'name',
  32 + valueField: 'key',
  33 + tpl: '<tpl for="."><div class="x-boundlist-item"><span data-qtip="{name}"> \
  34 + <img src="{iconUrl}" class="svg-icon" style="height:'+size+'px;"> \
  35 + </span>\
  36 + </div></tpl>',
  37 + editable: false,
  38 + queryMode: 'local',
  39 + listeners: {
  40 + change: function (combo, newValue, oldValue, eOpts) {
  41 + var iconUrl="";
  42 + me.data.forEach(function(colorData){
  43 + if(colorData.key == newValue ){
  44 + iconUrl= colorData.iconUrl;
  45 + }
  46 + });
  47 + combo.inputEl.setStyle('background-image', 'url(' + iconUrl + ')');
  48 + combo.inputEl.setStyle('background-size', '100%');
  49 + combo.inputEl.setStyle('background-repeat', 'no-repeat');
  50 + combo.inputEl.setStyle('background-position', 'center');
  51 + combo.inputEl.setStyle('font-size', '0');
  52 + if(typeof me.up().object !== 'undefined')
  53 + me.up().object.set('axis-color-map', newValue);
  54 + },
  55 + click: {
  56 + element: 'el',
  57 + fn: function(e,t) {
  58 + var me = t,
  59 + text = me.getAttribute('amda_clicktip');
  60 + if (text) {
  61 + e.preventDefault();
  62 + AmdaAction.getInfo({name : text}, function(res,e) {
  63 + if (res.success) myDesktopApp.infoMsg(res.result);
  64 + });
  65 + }
  66 + }
  67 + },
  68 + scope:this
  69 + },
  70 + })
  71 + }
  72 +});
0 73 \ No newline at end of file
... ...
js/app/views/DefaultTreeGrid.js
... ... @@ -6,7 +6,8 @@ Ext.define(&#39;amdaUI.DefaultTreeGrid&#39;, {
6 6 'Ext.grid.*',
7 7 'Ext.tree.*',
8 8 'amdaModel.DefaultValuesModel',
9   - 'amdaUI.ColorPicker'
  9 + 'amdaUI.ColorPicker',
  10 + 'amdaUI.ColorMap'
10 11 ],
11 12 xtype: 'tree-grid',
12 13  
... ... @@ -25,6 +26,17 @@ Ext.define(&#39;amdaUI.DefaultTreeGrid&#39;, {
25 26 this.callParent();
26 27 },
27 28  
  29 + getFullParentName:function(record){
  30 + var parentNode = record;
  31 + var parameter ="";
  32 + while (parentNode.parentNode) {
  33 + parentNode = parentNode.parentNode;
  34 + if(parentNode.get('parameter'))
  35 + parameter = parentNode.get('parameter')+'.'.concat(parameter);
  36 + }
  37 + return parameter;
  38 + },
  39 +
28 40 extractData : function(node=null,parentName = '',) {
29 41 var me =this;
30 42 if(node === null){
... ... @@ -117,14 +129,8 @@ Ext.define(&#39;amdaUI.DefaultTreeGrid&#39;, {
117 129 // Do this to avoid memory leaks
118 130 editors.remove(editor);
119 131 }
120   - var parentNode = record;
121   - var parameter ="";
122   - while (parentNode.parentNode) {
123   - parentNode = parentNode.parentNode;
124   - if(parentNode.get('parameter'))
125   - parameter = parentNode.get('parameter')+'.'.concat(parameter);
126   - }
127   - option = amdaDefaultOptions[parameter+record.get('parameter')];
  132 +
  133 + var option = amdaDefaultOptions[me.getFullParentName(record)+record.get('parameter')];
128 134 var value = record.get('value');
129 135 var store = null;
130 136  
... ... @@ -143,7 +149,7 @@ Ext.define(&#39;amdaUI.DefaultTreeGrid&#39;, {
143 149 }
144 150 else if(value === true || value === false){
145 151 fieldType = 'combobox'
146   - store= [[true, 'true'], [false, 'false']];
  152 + store= [[true, 'True'], [false, 'False']];
147 153 }
148 154 else{
149 155 fieldType = isNaN(parseFloat(record.get('value'))) ? 'textfield' : 'numberfield';
... ... @@ -164,15 +170,34 @@ Ext.define(&#39;amdaUI.DefaultTreeGrid&#39;, {
164 170 sortable: true,
165 171 dataIndex: 'value',
166 172 align: 'center',
167   - renderer: function(value, meta) {
  173 + renderer: function(value, meta,record) {
168 174 if (me.isHexCode(value)){
169 175 value = value.substring(1, 7);
170 176 return '<div style="background-color:#' + value + '; margin-left: auto; \
171 177 margin-right: auto;width:15px;height:15px;"></div>';
172 178 }
173   - else{
174   - return value;
  179 + if( record.get('parameter') === 'colorMap'){
  180 + var iconUrl="";
  181 + var colorMap = Ext.create('amdaUI.ColorMap');
  182 + colorMap.data.forEach(function(colorData){
  183 + if(colorData.key == value ){
  184 + iconUrl= colorData.iconUrl;
  185 + }
  186 + });
  187 + return '<div style="background-image:url(' + iconUrl + ');background-size:100%;\
  188 + background-repeat:no-repeat; background-position:center; \
  189 + font-size:0;width:90px;height:15px;"></div>';
  190 + }
  191 +
  192 + var option = amdaDefaultOptions[me.getFullParentName(record)+record.get('parameter')];
  193 +
  194 + if(option){
  195 + Ext.each(option.store, function(line){
  196 + if (line.key === value)
  197 + value = line.value;
  198 + })
175 199 }
  200 + return value;
176 201 },
177 202 },{
178 203 text: 'Reset',
... ...
js/app/views/PlotComponents/PlotColorAxisForm.js
... ... @@ -10,67 +10,15 @@
10 10  
11 11 Ext.define('amdaPlotComp.PlotColorAxisForm', {
12 12 extend: 'amdaPlotComp.PlotBaseAxisForm',
  13 +
  14 + requires:['amdaUI.ColorMap'],
13 15  
14 16 showColorOption : false,
15 17 showTickGridOptions : false,
16 18  
17 19 getFormItems: function() {
18   - var data = [];
19   - amdaDefaultConfigs.availableColorMaps.forEach(function(color){
20   - data.push({key:color.key,name:color.value, iconUrl:'generic_data/colormaps/'+ color.svgFile})
21   - });
22   -
23   - var combo = new Ext.form.ComboBox({
24   - name: 'axis-color-map',
25   - fieldLabel: 'Color Map&nbsp;<img amda_clicktip="colourMaps" style="vertical-align:bottom" src="js/resources/images/16x16/info_mini.png"',
26   - store: new Ext.data.Store({
27   - fields: ['key','name', 'iconUrl'],
28   - data: data
29   - }),
30   - displayField: 'name',
31   - valueField: 'key',
32   - tpl: '<tpl for="."><div class="x-boundlist-item"><span data-qtip="{name}"> \
33   - <img src="{iconUrl}" class="svg-icon" style="height: 26px;"> \
34   - </span>\
35   - </div></tpl>',
36   - editable: false,
37   - queryMode: 'local',
38   - listeners: {
39   - change: function (combo, newValue, oldValue, eOpts) {
40   - var iconUrl="";
41   - data.forEach(function(colorData){
42   - if(colorData.key == newValue ){
43   - iconUrl= colorData.iconUrl;
44   - }
45   - });
46   - combo.inputEl.setStyle('background-image', 'url(' + iconUrl + ')');
47   - combo.inputEl.setStyle('background-size', '100%');
48   - combo.inputEl.setStyle('background-repeat', 'no-repeat');
49   - combo.inputEl.setStyle('background-position', 'center');
50   - combo.inputEl.setStyle('font-size', '0');
51   -
52   - this.object.set('axis-color-map', newValue);
53   - },
54   - click: {
55   - element: 'el',
56   - fn: function(e,t) {
57   - var me = t,
58   - text = me.getAttribute('amda_clicktip');
59   - if (text) {
60   - e.preventDefault();
61   - AmdaAction.getInfo({name : text}, function(res,e) {
62   - if (res.success) myDesktopApp.infoMsg(res.result);
63   - });
64   - }
65   - }
66   - },
67   - scope:this
68   - },
69   - });
70   -
71   -
72 20  
73   - var timeItems = [combo,
  21 + var timeItems = [Ext.create('amdaUI.ColorMap',{name: 'axis-color-map',fieldLabel: 'Color Map&nbsp;<img amda_clicktip="colourMaps" style="vertical-align:bottom" src="js/resources/images/16x16/info_mini.png"', size:26}),
74 22 this.addColorsPicker('axis-color-minval', 'Min. Val. Color', amdaDefaultConfigs.availableColorsNew, 'none'),
75 23 this.addColorsPicker('axis-color-maxval', 'Max. Val. Color', amdaDefaultConfigs.availableColorsNew, 'none')
76 24 ];
... ...