PlotIntervalRefPlug.js
3.22 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
/**
* Project : AMDA-NG
* Name : PlotIntervalRefPlug.js
* @plugin amdaPlotComp.PlotIntervalRefPlug
* @extends Ext.util.Observable
* @ptype plotIntervalRefPlugin
* @brief Shows references for Interval
* @author Furkan
* @version $Id: PlotIntervalRefPlug.js
********************************************************************************
* FT Id : Date : Name - Description
*******************************************************************************
* :
*/
Ext.define('amdaPlotComp.PlotIntervalRefPlug', {
extend: 'Ext.util.Observable',
alias: 'plugin.plotIntervalRefPlugin',
id: 'plot-intervalref-plug',
win: null,
form: null,
interactiveId: '',
actionDone: '',
durationDone: 0,
constructor: function (config) {
Ext.apply(this, config);
this.callParent(arguments);
},
onDestroy: function () {
this.win = null;
},
init: function (cmp) {
this.hostCmp = cmp;
},
/**
* creation of the window
*/
show: function (interactiveId, links, xPos, yPos) {
if (!this.win) {
this.win = new Ext.Window({
id: 'plot-intervalref-win-' + this.hostCmp.ownerCt.getId(), // Plot window ID
width: 265,
x: 0, y: 0,
baseCls: 'x-panel',
title: 'Catalogue references',
layout: 'fit',
constrain: true,
collapsible: true,
resizable: false,
ghost: false,
renderTo: this.hostCmp.ownerCt.body,
items: this.getFormConfig(links),
listeners: {
scope: this,
beforeclose: function () {
this.hostCmp.panelImage.stopZoom();
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.interactiveId = interactiveId;
this.win.show();
this.win.setPosition(xPos, yPos - 250);
},
close: function () {
if (this.win == null)
return;
this.win.close();
},
/**
* Main form
*/
getFormConfig: function (links) {
this.form = new Ext.form.FormPanel({
frame: true,
width: 265,
height: 80,
layout: {
type: 'vbox',
pack: 'start',
align: 'stretch'
},
fieldDefaults: {
labelWidth: 60
},
items: [
{
xtype: 'fieldcontainer',
layout: 'hbox',
fieldLabel: 'Select the reference from the list',
labelAlign: 'top',
bodyStyle: { background: '#dfe8f6' },
border: false,
items: [
{
xtype: 'combo',
name: 'referencelink',
store: links,
editable: false,
width: 250,
value: 'References',
triggerAction: 'all'
}
],
}],
buttons: [
{
text: 'Open in new tab',
scope: this,
handler: function () {
var referencelink = this.form.getForm().findField('referencelink');
window.open(referencelink.getValue(), "_blank");
}
}
]
});
return this.form;
}
});