web-apps/apps/common/mobile/lib/controller/PopClip.js

73 lines
1.7 KiB
JavaScript
Raw Normal View History

2016-03-11 00:48:53 +00:00
Ext.define('Common.controller.PopClip', {
extend: 'Ext.app.Controller',
config: {
refs: {
popClip : 'popclip',
cutButton : '#id-btn-popclip-cut',
copyButton : '#id-btn-popclip-copy',
pasteButton : '#id-btn-popclip-paste'
},
control: {
cutButton : {
tap : 'onTapCutButton'
},
copyButton : {
tap : 'onTapCopyButton'
},
pasteButton : {
tap : 'onTapPasteButton'
}
}
},
init: function() {
},
launch: function() {
},
setApi: function(o) {
this.api = o;
},
setMode: function(mode){
var cutButton = this.getCutButton(),
copyButton = this.getCopyButton(),
pasteButton = this.getPasteButton(),
popclip = this.getPopClip();
if (mode === 'view') {
cutButton && cutButton.hide();
pasteButton && pasteButton.hide();
popclip && popclip.hide();
} else {
cutButton && cutButton.show();
pasteButton && pasteButton.show();
popclip && popclip.hide();
}
},
onTapCutButton: function() {
this.api && this.api.Cut();
var popclip = this.getPopClip();
popclip && popclip.hide();
},
onTapCopyButton: function() {
this.api && this.api.Copy();
var popclip = this.getPopClip();
popclip && popclip.hide();
},
onTapPasteButton: function() {
this.api && this.api.Paste();
var popclip = this.getPopClip();
popclip && popclip.hide();
}
});