partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

PreferenceEditor.js (1604B)


      1 Ext.define('PartKeepr.Components.Preferences.PreferenceEditor', {
      2     extend: 'Ext.form.Panel',
      3     trackResetOnLoad: true,
      4     bodyPadding: 10,
      5     saveText: i18n("Save"),
      6     cancelText: i18n("Cancel"),
      7     layout: 'anchor',
      8     change: false,
      9     border: false,
     10     scrollable: true,
     11     autoScroll: true,
     12     defaults: {
     13         anchor: '100%',
     14         labelWidth: 150
     15     },
     16     enableButtons: true,
     17     titleProperty: 'name',
     18 
     19     initComponent: function ()
     20     {
     21         if (this.enableButtons) {
     22             this.saveButton = Ext.create("Ext.button.Button", {
     23                 text: this.saveText,
     24                 iconCls: 'fugue-icon disk',
     25                 handler: Ext.bind(this.onSave, this)
     26             });
     27 
     28             this.cancelButton = Ext.create("Ext.button.Button", {
     29                 text: this.cancelText,
     30                 iconCls: 'web-icon cancel',
     31                 handler: Ext.bind(this.onCancelEdit, this)
     32             });
     33 
     34             this.bottomToolbar = Ext.create("Ext.toolbar.Toolbar", {
     35                 enableOverflow: true,
     36                 margin: '10px',
     37                 defaults: {minWidth: 100},
     38                 dock: 'bottom',
     39                 ui: 'footer',
     40                 items: [this.saveButton, this.cancelButton]
     41             });
     42 
     43             Ext.apply(this, {
     44                 dockedItems: [this.bottomToolbar]
     45             });
     46         }
     47 
     48         this.callParent();
     49     },
     50     onCancelEdit: function ()
     51     {
     52         this.fireEvent("editorClose", this);
     53     },
     54     onSave: function ()
     55     {
     56         console.log("You need to override PreferenceEditor::onSave");
     57     }
     58 });