hebasta | 2535c76 | 2018-11-21 16:27:33 +0100 | [diff] [blame] | 1 | /** |
| 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 | |
| 10 | define([ |
| 11 | 'panel', |
| 12 | 'view/corpstatv' |
| 13 | ], 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); |
hebasta | a0282be | 2018-12-05 16:58:00 +0100 | [diff] [blame^] | 46 | this.vc.oldvcQuery = KorAP.vc.toQuery(); |
hebasta | 2535c76 | 2018-11-21 16:27:33 +0100 | [diff] [blame] | 47 | } |
| 48 | |
| 49 | }, |
| 50 | |
hebasta | a0282be | 2018-12-05 16:58:00 +0100 | [diff] [blame^] | 51 | /** |
| 52 | * Reload corpus statistic |
| 53 | * |
| 54 | */ |
| 55 | reloadCorpStat: function(){ |
| 56 | this.statView.close(); |
| 57 | this.addCorpStat(); |
| 58 | } |
hebasta | 2535c76 | 2018-11-21 16:27:33 +0100 | [diff] [blame] | 59 | |
| 60 | } |
| 61 | }); |