1 |
3c601d2d
|
shye0000
|
|
2 |
|
|
|
3 |
|
|
|
4 |
|
|
|
5 |
|
|
|
6 |
|
|
|
7 |
|
|
|
8 |
|
|
|
9 |
|
|
|
10 |
|
|
|
11 |
|
|
|
12 |
|
|
|
13 |
|
|
|
14 |
|
|
|
15 |
|
|
|
16 |
|
|
|
17 |
|
|
|
18 |
|
|
|
19 |
|
|
|
20 |
|
|
|
21 |
|
|
|
22 |
|
|
|
23 |
|
|
|
24 |
|
|
|
25 |
|
|
Ext.namespace('sitools.user.view.modules.datasetExplorerOchart');
|
26 |
|
|
Ext.define( 'sitools.user.view.modules.datasetExplorerOchart.DatasetExplorerOchartViewSimple', {
|
27 |
|
|
extend: 'Ext.panel.Panel',
|
28 |
|
|
alias: 'widget.datasetExplorerOchartViewSimple',
|
29 |
|
|
|
30 |
|
|
layout:{ type: 'fit' },
|
31 |
|
|
border : false,
|
32 |
|
|
requires: [
|
33 |
|
|
'sitools.user.modules.OChartDragDrop',
|
34 |
|
|
'sitools.user.view.modules.datasetExplorerOchart.OChart'
|
35 |
|
|
],
|
36 |
|
|
autoDestroyStore: true,
|
37 |
|
|
|
38 |
|
|
initComponent: function(){
|
39 |
|
|
var me = this;
|
40 |
|
|
if(!me.store){
|
41 |
|
|
Ext.apply(me, {
|
42 |
|
|
store : me.buildStore()
|
43 |
|
|
});
|
44 |
|
|
}
|
45 |
|
|
|
46 |
|
|
me.chartConfig = me.chartConfig || {};
|
47 |
|
|
|
48 |
|
|
Ext.applyIf(me.chartConfig,{
|
49 |
|
|
xtype: 'ochart',
|
50 |
|
|
autoScroll : true,
|
51 |
|
|
simpleSelect: true,
|
52 |
|
|
rootVisible: false,
|
53 |
|
|
store: me.store,
|
54 |
|
|
plugins : [
|
55 |
|
|
{
|
56 |
|
|
ptype : 'ochartdragdrop',
|
57 |
|
|
allowParentInserts: true,
|
58 |
|
|
containerScroll: true,
|
59 |
|
|
ddGroup: 'ochart-dd'
|
60 |
|
|
}
|
61 |
|
|
],
|
62 |
|
|
|
63 |
|
|
listeners: {
|
64 |
|
|
scope: me,
|
65 |
|
|
additem: me.onAddItem,
|
66 |
|
|
removeitem: me.onRemoveItem,
|
67 |
|
|
itemdblclick: me.onItemDblClick
|
68 |
|
|
}
|
69 |
|
|
});
|
70 |
|
|
|
71 |
|
|
Ext.apply(me, {
|
72 |
|
|
items: me.chartConfig
|
73 |
|
|
});
|
74 |
|
|
me.callParent(arguments);
|
75 |
|
|
},
|
76 |
|
|
|
77 |
|
|
buildStore: function() {
|
78 |
|
|
var store = Ext.create('sitools.user.view.modules.datasetExplorerOchart.NodesStore');
|
79 |
|
|
return store;
|
80 |
|
|
},
|
81 |
|
|
|
82 |
|
|
onRender: function(){
|
83 |
|
|
|
84 |
|
|
var chart = this.down('ochart' );
|
85 |
|
|
|
86 |
|
|
console.log(chart);
|
87 |
|
|
chart.lineWeight =2;
|
88 |
|
|
chart.lineColor = '#888888';
|
89 |
|
|
chart.levelSpacing =20;
|
90 |
|
|
chart.nodeSpacing = 10;
|
91 |
|
|
chart.readOnly = true;
|
92 |
|
|
chart.rootVisible = true;
|
93 |
|
|
chart.allowContainerDrop = false;
|
94 |
|
|
chart.toolsVisible = true;
|
95 |
|
|
|
96 |
|
|
this.callParent(arguments);
|
97 |
|
|
},
|
98 |
|
|
|
99 |
|
|
afterRender: function(){
|
100 |
|
|
var me = this;
|
101 |
|
|
var view = me.up('#mainView');
|
102 |
|
|
|
103 |
|
|
|
104 |
|
|
|
105 |
|
|
|
106 |
|
|
|
107 |
|
|
|
108 |
|
|
|
109 |
|
|
|
110 |
|
|
me.view = view;
|
111 |
|
|
me.callParent(arguments);
|
112 |
|
|
},
|
113 |
|
|
|
114 |
|
|
onDestroy: function(){
|
115 |
|
|
var me = this,
|
116 |
|
|
view = me.view;
|
117 |
|
|
me.mun(view,'changelineweight', me.onChangeLineWeight, me);
|
118 |
|
|
me.mun(view,'changelinecolor', me.onChangeLineColor, me);
|
119 |
|
|
me.mun(view,'changelevelspace', me.onChangeLevelSpace, me);
|
120 |
|
|
me.mun(view,'changeitemspace', me.onChangeItemSpace, me);
|
121 |
|
|
me.mun(view,'changereadonly', me.onChangeReadOnly, me);
|
122 |
|
|
me.mun(view,'changerootvisible', me.onChangeRootVisible, me);
|
123 |
|
|
me.mun(view,'changecontainerdrop', me.onChangeContainerDrop, me);
|
124 |
|
|
me.mun(view,'changetools', me.onChangeTools, me);
|
125 |
|
|
me.view = null;
|
126 |
|
|
if(me.autoDestroyStore){
|
127 |
|
|
me.store.destroyStore();
|
128 |
|
|
}
|
129 |
|
|
me.store = null;
|
130 |
|
|
me.callParent(arguments);
|
131 |
|
|
},
|
132 |
|
|
|
133 |
|
|
onItemDblClick: function(view, record, item, index, e){
|
134 |
|
|
if(view.readOnly) return;
|
135 |
|
|
|
136 |
|
|
Ext.Msg.prompt('Edit Node', 'Type the node name',function(btn, text){
|
137 |
|
|
if(btn == 'ok'){
|
138 |
|
|
record.set('text',text);
|
139 |
|
|
}
|
140 |
|
|
}, window, false, record.get('text'));
|
141 |
|
|
},
|
142 |
|
|
|
143 |
|
|
onAddItem: function (view, record, where, nodeEl){
|
144 |
|
|
Ext.Msg.prompt('New Node', 'Type the node name',function(btn, text){
|
145 |
|
|
if(btn == 'ok'){
|
146 |
|
|
var newrec = {text: text, leaf: true};
|
147 |
|
|
switch(where){
|
148 |
|
|
case 'before':
|
149 |
|
|
var parent = record.parentNode;
|
150 |
|
|
newrec = parent.insertBefore(newrec, record);
|
151 |
|
|
break;
|
152 |
|
|
case 'after':
|
153 |
|
|
var node = record.nextSibling;
|
154 |
|
|
var parent = record.parentNode;
|
155 |
|
|
newrec = parent.insertBefore(newrec, node);
|
156 |
|
|
break;
|
157 |
|
|
case 'child':
|
158 |
|
|
newrec = record.appendChild(newrec);
|
159 |
|
|
record.expand(function(){view.focusNode(newrec);});
|
160 |
|
|
break;
|
161 |
|
|
}
|
162 |
|
|
}
|
163 |
|
|
});
|
164 |
|
|
},
|
165 |
|
|
|
166 |
|
|
onRemoveItem: function(view, record, nodeEl){
|
167 |
|
|
Ext.Msg.confirm('Remove Item', 'Do you really want\'s remove this items?',function(btn, text){
|
168 |
|
|
if(btn == 'yes'){
|
169 |
|
|
record.remove();
|
170 |
|
|
}
|
171 |
|
|
});
|
172 |
|
|
},
|
173 |
|
|
|
174 |
|
|
onChangeLineWeight: function(panel, weight){
|
175 |
|
|
var chart = this.down('ochart');
|
176 |
|
|
chart.lineWeight = weight;
|
177 |
|
|
chart.refresh();
|
178 |
|
|
},
|
179 |
|
|
|
180 |
|
|
onChangeLineColor: function(panel, color){
|
181 |
|
|
var chart = this.down('ochart' );
|
182 |
|
|
chart.lineColor = '#' + color;
|
183 |
|
|
chart.refresh();
|
184 |
|
|
},
|
185 |
|
|
|
186 |
|
|
onChangeLevelSpace: function(panel, space){
|
187 |
|
|
var chart = this.down('ochart');
|
188 |
|
|
chart.levelSpacing = space;
|
189 |
|
|
chart.refresh();
|
190 |
|
|
},
|
191 |
|
|
|
192 |
|
|
onChangeItemSpace: function(panel, space){
|
193 |
|
|
var chart = this.down('ochart');
|
194 |
|
|
chart.nodeSpacing = space;
|
195 |
|
|
chart.refresh();
|
196 |
|
|
},
|
197 |
|
|
|
198 |
|
|
onChangeReadOnly: function(panel, value){
|
199 |
|
|
var chart = this.down('ochart');
|
200 |
|
|
chart.readOnly = value;
|
201 |
|
|
},
|
202 |
|
|
|
203 |
|
|
onChangeRootVisible: function(panel, value){
|
204 |
|
|
var chart = this.down('ochart');
|
205 |
|
|
chart.rootVisible = value;
|
206 |
|
|
chart.refresh();
|
207 |
|
|
},
|
208 |
|
|
|
209 |
|
|
onChangeContainerDrop: function(panel, value){
|
210 |
|
|
var chart = this.down('ochart');
|
211 |
|
|
chart.allowContainerDrop = value;
|
212 |
|
|
},
|
213 |
|
|
|
214 |
|
|
onChangeTools: function(panel, value){
|
215 |
|
|
var chart = this.down('ochart');
|
216 |
|
|
chart.toolsVisible = value;
|
217 |
|
|
},
|
218 |
|
|
|
219 |
|
|
|
220 |
|
|
|
221 |
|
|
|
222 |
|
|
|
223 |
|
|
_getSettings: function () {
|
224 |
|
|
return {
|
225 |
|
|
preferencesPath: "/modules",
|
226 |
|
|
preferencesFileName: this.id
|
227 |
|
|
};
|
228 |
|
|
}
|
229 |
|
|
|
230 |
|
|
} ); |