define(function(require, exports, module) { var ToolBar = require('../views/widgets/toolbar/toolbar'); function ToolbarAdapter(options) { this.pageId = options.pageId; this.container = options.container; this.menuButtons = options.menuButtons || []; this.actions = options.actions; this.buttons = []; this.toolbar = null; this.makeButtons(options.buttons) } ToolbarAdapter.prototype.init = function() { this.toolbar = new ToolBar({ container: this.container, buttons: this.buttons, actions: this.actions, menuButtons: this.menuButtons }); this.toolbar.init(); }; ToolbarAdapter.prototype.disable = function(fieldname) { this.toolbar.disable(fieldname); }; ToolbarAdapter.prototype.enable = function(fieldname) { this.toolbar.enable(fieldname); }; ToolbarAdapter.prototype.destroyButton = function(button) { this.toolbar.destroyButton(button); }; ToolbarAdapter.prototype.addMenuButtons = function(menuButtons, prevElement) { this.toolbar.addMenuButtons(menuButtons, prevElement) }; ToolbarAdapter.prototype.makeButtons = function(buttons) { var fixedButtons = [ // { // fieldname: 'cancel', // dispname: '退出', // icon: 'icon-cancel', // class: '', // hint: '退出', // opcode: 'cancel' // },{ // fieldname: 'print', // dispname: '打印', // icon: 'icon-print', // class: '', // hint: '打印', // opcode: 'print' // }, ]; this.buttons = fixedButtons.concat(buttons); } return ToolbarAdapter; });