RemoteSearchPlugin.js
2.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/**
* Project : AMDA-NG
* Name : RemoteSearchPlug.js
* @plugin amdaUI.InteractiveIntervalPlug
* @extends Ext.AbstractPlugin
* @ptype interactiveIntervalPlugin
* @brief Plot interactive session UI (View)
* @author Myriam
* @version $Id: RemoteSearchPlugin.js 1130 2012-12-18 16:45:54Z elena $
********************************************************************************
* FT Id : Date : Name - Description
*******************************************************************************
* :
*/
Ext.define('amdaUI.RemoteSearchPlugin', {
extend: 'Ext.AbstractPlugin',
alias: 'plugin.remoteSearchPlugin',
moduleId : 'up-win',
win : null,
constructor: function(config) {
Ext.apply(this, config);
this.callParent(arguments);
},
init: function(cmp) {
this.hostCmp = cmp;
this.hostCmp.on({
open: this.onOpen,
scope: this});
},
onDestroy : function() {
this.win = null;
},
onOpen: function(url) {
//TODO just reloa dtree
if (this.win) this.win.destroy();
if (!this.win) {
this.win = new Ext.Window({
id: 'remoteSearch-win',
width: 310,
height: 500,
title: url,
layout: 'fit',
constrain: true,
ghost: false,
items: this.getTree(url),
listeners: {
scope: this,
beforeclose: function(){
// Ext.PluginManager.unregister(this);
}
},
getConstrainVector: function(constrainTo){
var me = this;
if (me.constrain || me.constrainHeader) {
constrainTo = constrainTo || (me.floatParent && me.floatParent.getTargetEl()) || me.container || me.el.getScopeParent();
return (me.constrainHeader ? me.header.el : me.el).getConstrainVector(constrainTo);
}
}
});
this.win.on('destroy', this.onDestroy, this);
// Ext.PluginManager.register(this);
this.win.show();
}
},
getTree : function(url) {
var store = Ext.create('Ext.data.TreeStore', {
model: 'amdaModel.AmdaNode',
root: {
text: url,
nodeType : 'url',
expanded: true
} ,
listeners: {
scope : this,
beforeload: function(store, operation){
store.proxy.extraParams = {
nodeType: 'url',
baseId: url
}}
}
});
var tree = Ext.create('Ext.tree.Panel', {
store: store,
listeners : {
scope : this,
itemdblclick: function(view, record, item, index, event){
event.stopEvent();
var form = this.hostCmp.down('form').next().getForm();
form.getFields().getAt(1).setValue(record.internalId); // internalId ??
this.win.destroy();
}
}
});
return tree;
}
});