* Load fse stuff from menu.json. Will use form 0..n

This commit is contained in:
Bryan Ashby 2015-06-27 15:32:29 -06:00
parent e7e9070414
commit 670bf0fd6e
4 changed files with 51 additions and 53 deletions

View File

@ -1006,6 +1006,10 @@ MultiLineEditTextView2.prototype.setText = function(text) {
}; };
MultiLineEditTextView2.prototype.getData = function() {
return this.getOutputText(0, this.textLines.length, true);
};
var HANDLED_SPECIAL_KEYS = [ var HANDLED_SPECIAL_KEYS = [
'up', 'down', 'left', 'right', 'up', 'down', 'left', 'right',
'home', 'end', 'home', 'end',

View File

@ -161,7 +161,7 @@ function ViewController(options) {
this.setViewPropertiesFromMCIConf = function(view, conf) { this.setViewPropertiesFromMCIConf = function(view, conf) {
function setViewProp(propName, setter) { function setViewProp(propName, setter) {
if(conf[propName]) { if(!_.isUndefined(conf[propName])) {
var propValue; var propValue;
var propAsset = asset.getViewPropertyAsset(conf[propName]); var propAsset = asset.getViewPropertyAsset(conf[propName]);
if(propAsset) { if(propAsset) {
@ -182,7 +182,7 @@ function ViewController(options) {
propValue = conf[propName]; propValue = conf[propName];
} }
if(propValue) { if(!_.isUndefined(propValue)) {
if(setter) { if(setter) {
setter(propValue); setter(propValue);
} else { } else {
@ -323,7 +323,6 @@ ViewController.prototype.attachClientEvents = function() {
} }
this.client.on('key press', this.clientKeyPressHandler); this.client.on('key press', this.clientKeyPressHandler);
//this.client.on('special key', this.clientSpecialKeyHandler);
this.attached = true; this.attached = true;
}; };
@ -334,7 +333,6 @@ ViewController.prototype.detachClientEvents = function() {
} }
this.client.removeListener('key press', this.clientKeyPressHandler); this.client.removeListener('key press', this.clientKeyPressHandler);
//this.client.removeListener('special key', this.clientSpecialKeyHandler);
for(var id in this.views) { for(var id in this.views) {
this.views[id].removeAllListeners(); this.views[id].removeAllListeners();
@ -584,6 +582,7 @@ ViewController.prototype.loadFromMenuConfig = function(options, cb) {
} }
self.on('submit', function formSubmit(formData) { self.on('submit', function formSubmit(formData) {
Log.trace( { formData : self.getLogFriendlyFormData(formData) }, 'Form submit'); Log.trace( { formData : self.getLogFriendlyFormData(formData) }, 'Form submit');
// //

View File

@ -54,59 +54,22 @@ function FullScreenEditorModule(options) {
}; };
this.mciReadyHandlerNetMail = function(mciData) { this.mciReadyHandlerNetMail = function(mciData) {
var vc = self.addViewController('main', new ViewController( { client : self.client } )); var mainVc = self.addViewController('main', new ViewController( { client : self.client } ));
// :TODO: This can probably come from the normal mci configuration...
// additional mci stuff could be in config{} block. This should all be easily user-defined
var mciConfig = {
ET1 : {
width : 20,
text : 'Hello, World'
},
ET2 : {
width : 10,
text : 'This is a longer string',
},
MT3 : {
width : 79,
height : 17,
focus : true,
text : 'Ermergerd!\nHuzzah!'
}
var menuLoadOpts = {
callingMenu : self,
mciMap : mciData.main.mciMap,
formId : 0,
}; };
var initialFocusedId = 3; // editor mainVc.loadFromMenuConfig(menuLoadOpts, function viewsReady(err) {
});
};
async.waterfall( this.menuMethods = {
[ editorEscPressed : function(formData, extraArgs) {
function createViews(callback) {
vc.createViewsFromMCI(mciData.main.mciMap, function viewsCreated(err) {
callback(err);
});
},
function applyThemeCustomization(callback) {
console.log('applyThemeCustomization...')
// :TODO: menuUtil.applyThemeCustomization() ...
// this should update local hard coded mci stuff for example to change colors, widths, blah blah
callback(null);
},
function applyViewConfiguration(callback) {
console.log('applyViewConfiguration...')
vc.applyViewConfig( { mci : mciConfig }, function configApplied(err, info) { }
callback(err);
});
},
function drawAllViews(callback) {
vc.redrawAll(initialFocusedId);
callback(null);
},
function setInitialFocus(callback) {
vc.switchFocus(initialFocusedId); // editor
}
]
);
}; };
} }

View File

@ -436,6 +436,38 @@
"options" : { "cls" : true }, "options" : { "cls" : true },
"config" : { "config" : {
"editorType" : "netMail" "editorType" : "netMail"
},
"form" : {
"0" : {
"ET1ET2MT3" : {
"mci" : {
"ET1" : {
"width" : 20,
"text" : "FIXME: to"
},
"ET2" : {
"width" : 20,
"text" : "FIXME: from"
},
"MT3" : {
"width" : 79,
"height" : 17,
"focus" : true,
"text" : "",
"submit" : [ "escape" ]
}
},
"submit" : {
// :TODO: It may be nice to have a way to submit without data - e.g. we just care about the key press.
"3" : [
{
"value" : 3,
"action" : "@method:editorEscPressed"
}
]
}
}
}
} }
} }