blob: 91fb54483045edbd30bee97ecd38e85e0ddbfa6f [file] [log] [blame]
hebasta2535c762018-11-21 16:27:33 +01001/**
2 * The vc info panel
3 *
4 * The vc info panel displays information about the virtual corpus,
5 * for example the corpus statistic
6 *
7 * @author Helge Stallkamp
8 */
9
10define([
11 'panel',
Akronaa613222019-11-19 13:57:12 +010012 'view/vc/corpstatv'
hebasta2535c762018-11-21 16:27:33 +010013], function (panelClass, corpStatVClass) {
14
15 const d = document;
16
17 // Localization values
18 const loc = KorAP.Locale;
19 loc.SHOW_STAT= loc.SHOW_STAT || 'Statistics';
20 loc.VERB_SHOWSTAT = loc.VERB_SHOWSTAT || 'Corpus Statistics';
21
22 return {
23 create : function (vc) {
24 return Object.create(panelClass)._init(['vcinfo']).upgradeTo(this)._init(vc);
25 },
26
27 _init : function(vc){
28 this.vc = vc;
29 var actions = this.actions;
30 var that = this;
31 actions.add(loc.SHOW_STAT, [ 'statistic' ], function() {
32 that.addCorpStat();
33 });
34
35 return this;
36 },
37
38
39 /**
40 * Add corpus statistic view to panel
41 */
42 addCorpStat: function(){
43 if (this.statView === undefined || !this.statView.shown()) {
44 this.statView = corpStatVClass.create(this.vc, this);
45 this.add(this.statView);
hebastaa0282be2018-12-05 16:58:00 +010046 this.vc.oldvcQuery = KorAP.vc.toQuery();
hebasta2535c762018-11-21 16:27:33 +010047 }
48
49 },
50
hebastaa0282be2018-12-05 16:58:00 +010051 /**
52 * Reload corpus statistic
53 *
54 */
55 reloadCorpStat: function(){
56 this.statView.close();
57 this.addCorpStat();
58 }
hebasta2535c762018-11-21 16:27:33 +010059
60 }
61});