Unverified Commit baef0cdc authored by Evan W. Patton's avatar Evan W. Patton Committed by Jeffrey I. Schiller

Implement per-component tooltips on collison

Change-Id: I5778d0ddad1a34c1019645478fb6061d88acea10
parent 468b72a6
...@@ -569,7 +569,7 @@ ...@@ -569,7 +569,7 @@
<pathelement location="${gwt.sdk}/validation-api-1.0.0.GA-sources.jar" /> <pathelement location="${gwt.sdk}/validation-api-1.0.0.GA-sources.jar" />
</classpath> </classpath>
<jvmarg value="-Xss2M"/> <!-- increase if you see a StackOverflowError --> <jvmarg value="-Xss2M"/> <!-- increase if you see a StackOverflowError -->
<jvmarg value="-Xmx1G"/> <jvmarg value="-Xmx2G"/>
<jvmarg line="${XstartOnFirstThread}"/> <jvmarg line="${XstartOnFirstThread}"/>
<jvmarg value="-Dfile.encoding=UTF-8" /> <jvmarg value="-Dfile.encoding=UTF-8" />
<arg line="-war"/> <arg line="-war"/>
......
...@@ -283,10 +283,11 @@ Blockly.Blocks.component_event = { ...@@ -283,10 +283,11 @@ Blockly.Blocks.component_event = {
this.setParameterOrientation(horizParams); this.setParameterOrientation(horizParams);
var tooltipDescription; var tooltipDescription;
if (eventType) { if (eventType) {
tooltipDescription = componentDb.getInternationalizedEventDescription(eventType.name, eventType.description); tooltipDescription = componentDb.getInternationalizedEventDescription(this.getTypeName(), eventType.name,
eventType.description);
} }
else { else {
tooltipDescription = componentDb.getInternationalizedEventDescription(this.eventName); tooltipDescription = componentDb.getInternationalizedEventDescription(this.getTypeName(), this.eventName);
} }
this.setTooltip(tooltipDescription); this.setTooltip(tooltipDescription);
this.setPreviousStatement(false, null); this.setPreviousStatement(false, null);
...@@ -309,6 +310,10 @@ Blockly.Blocks.component_event = { ...@@ -309,6 +310,10 @@ Blockly.Blocks.component_event = {
this.rendered = oldRendered; this.rendered = oldRendered;
}, },
getTypeName: function() {
return this.typeName === 'Form' ? 'Screen' : this.typeName;
},
// [lyn, 10/24/13] Allow switching between horizontal and vertical display of arguments // [lyn, 10/24/13] Allow switching between horizontal and vertical display of arguments
// Also must create flydown params and DO input if they don't exist. // Also must create flydown params and DO input if they don't exist.
...@@ -418,11 +423,10 @@ Blockly.Blocks.component_event = { ...@@ -418,11 +423,10 @@ Blockly.Blocks.component_event = {
} }
}, },
helpUrl : function() { helpUrl : function() {
var mode = this.typeName === "Form" ? "Screen" : this.typeName; var url = Blockly.ComponentBlock.EVENTS_HELPURLS[this.getTypeName()];
var url = Blockly.ComponentBlock.EVENTS_HELPURLS[mode];
if (url && url[0] == '/') { if (url && url[0] == '/') {
var parts = url.split('#'); var parts = url.split('#');
parts[1] = this.typeName + '.' + this.eventName; parts[1] = this.getTypeName() + '.' + this.eventName;
url = parts.join('#'); url = parts.join('#');
} }
return url; return url;
...@@ -599,18 +603,14 @@ Blockly.Blocks.component_event = { ...@@ -599,18 +603,14 @@ Blockly.Blocks.component_event = {
Blockly.Blocks.component_method = { Blockly.Blocks.component_method = {
category : 'Component', category : 'Component',
helpUrl : function() { helpUrl : function() {
var mode = this.typeName === "Form" ? "Screen" : this.typeName; var url = Blockly.ComponentBlock.METHODS_HELPURLS[this.getTypeName()];
var url = Blockly.ComponentBlock.METHODS_HELPURLS[mode];
if (url && url[0] == '/') { if (url && url[0] == '/') {
var parts = url.split('#'); var parts = url.split('#');
parts[1] = this.typeName + '.' + this.methodName; parts[1] = this.getTypeName() + '.' + this.methodName;
url = parts.join('#'); url = parts.join('#');
} }
return url; return url;
}, },
init: function() {
this.genericComponentInput = Blockly.Msg.LANG_COMPONENT_BLOCK_GENERIC_METHOD_TITLE_FOR_COMPONENT;
},
mutationToDom : function() { mutationToDom : function() {
...@@ -728,9 +728,10 @@ Blockly.Blocks.component_method = { ...@@ -728,9 +728,10 @@ Blockly.Blocks.component_method = {
var tooltipDescription; var tooltipDescription;
if (methodTypeObject) { if (methodTypeObject) {
tooltipDescription = componentDb.getInternationalizedMethodDescription(methodTypeObject.name, methodTypeObject.description); tooltipDescription = componentDb.getInternationalizedMethodDescription(this.getTypeName(), methodTypeObject.name,
methodTypeObject.description);
} else { } else {
tooltipDescription = componentDb.getInternationalizedMethodDescription(this.typeName); tooltipDescription = componentDb.getInternationalizedMethodDescription(this.getTypeName(), this.methodName);
} }
this.setTooltip(tooltipDescription); this.setTooltip(tooltipDescription);
...@@ -780,6 +781,10 @@ Blockly.Blocks.component_method = { ...@@ -780,6 +781,10 @@ Blockly.Blocks.component_method = {
this.rendered = oldRendered; this.rendered = oldRendered;
}, },
getTypeName: function() {
return this.typeName === 'Form' ? 'Screen' : this.typeName;
},
// Rename the block's instanceName, type, and reset its title // Rename the block's instanceName, type, and reset its title
rename : function(oldname, newname) { rename : function(oldname, newname) {
if (this.instanceName == oldname) { if (this.instanceName == oldname) {
...@@ -957,11 +962,10 @@ Blockly.Blocks.component_set_get = { ...@@ -957,11 +962,10 @@ Blockly.Blocks.component_set_get = {
category : 'Component', category : 'Component',
//this.blockType = 'getter', //this.blockType = 'getter',
helpUrl : function() { helpUrl : function() {
var mode = this.typeName === "Form" ? "Screen" : this.typeName; var url = Blockly.ComponentBlock.PROPERTIES_HELPURLS[this.getTypeName()];
var url = Blockly.ComponentBlock.PROPERTIES_HELPURLS[mode];
if (url && url[0] == '/') { if (url && url[0] == '/') {
var parts = url.split('#'); var parts = url.split('#');
parts[1] = this.typeName + '.' + this.propertyName; parts[1] = this.getTypeName() + '.' + this.propertyName;
url = parts.join('#'); url = parts.join('#');
} }
return url; return url;
...@@ -1026,7 +1030,8 @@ Blockly.Blocks.component_set_get = { ...@@ -1026,7 +1030,8 @@ Blockly.Blocks.component_set_get = {
} }
var tooltipDescription; var tooltipDescription;
if (this.propertyName) { if (this.propertyName) {
tooltipDescription = componentDb.getInternationalizedPropertyDescription(this.propertyName, this.propertyObject.description); tooltipDescription = componentDb.getInternationalizedPropertyDescription(this.getTypeName(), this.propertyName,
this.propertyObject.description);
} else { } else {
tooltipDescription = Blockly.Msg.UNDEFINED_BLOCK_TOOLTIP; tooltipDescription = Blockly.Msg.UNDEFINED_BLOCK_TOOLTIP;
} }
...@@ -1042,7 +1047,8 @@ Blockly.Blocks.component_set_get = { ...@@ -1042,7 +1047,8 @@ Blockly.Blocks.component_set_get = {
thisBlock.propertyObject = thisBlock.getPropertyObject(selection); thisBlock.propertyObject = thisBlock.getPropertyObject(selection);
thisBlock.setTypeCheck(); thisBlock.setTypeCheck();
if (thisBlock.propertyName) { if (thisBlock.propertyName) {
thisBlock.setTooltip(componentDb.getInternationalizedPropertyDescription(thisBlock.propertyName, thisBlock.propertyObject.description)); thisBlock.setTooltip(componentDb.getInternationalizedPropertyDescription(thisBlock.getTabCatcherElement(),
thisBlock.propertyName, thisBlock.propertyObject.description));
} else { } else {
thisBlock.setTooltip(Blockly.Msg.UNDEFINED_BLOCK_TOOLTIP); thisBlock.setTooltip(Blockly.Msg.UNDEFINED_BLOCK_TOOLTIP);
} }
...@@ -1135,6 +1141,10 @@ Blockly.Blocks.component_set_get = { ...@@ -1135,6 +1141,10 @@ Blockly.Blocks.component_set_get = {
this.rendered = oldRendered; this.rendered = oldRendered;
}, },
getTypeName: function() {
return this.typeName === 'Form' ? 'Screen' : this.typeName;
},
setTypeCheck : function() { setTypeCheck : function() {
var inputOrOutput = Blockly.Blocks.Utilities.OUTPUT; var inputOrOutput = Blockly.Blocks.Utilities.OUTPUT;
...@@ -1304,8 +1314,7 @@ Blockly.Blocks.component_component_block = { ...@@ -1304,8 +1314,7 @@ Blockly.Blocks.component_component_block = {
category : 'Component', category : 'Component',
helpUrl : function() { helpUrl : function() {
var mode = this.typeName === "Form" ? "Screen" : this.typeName; return Blockly.ComponentBlock.HELPURLS[this.getTypeName()];
return Blockly.ComponentBlock.HELPURLS[mode];
}, // TODO: fix }, // TODO: fix
mutationToDom : function() { mutationToDom : function() {
...@@ -1329,6 +1338,11 @@ Blockly.Blocks.component_component_block = { ...@@ -1329,6 +1338,11 @@ Blockly.Blocks.component_component_block = {
this.setOutput(true, [this.typeName,"COMPONENT"]); this.setOutput(true, [this.typeName,"COMPONENT"]);
this.errors = [{name:"checkIfUndefinedBlock"},{name:"checkComponentNotExistsError"}]; this.errors = [{name:"checkIfUndefinedBlock"},{name:"checkComponentNotExistsError"}];
}, },
getTypeName: function() {
return this.typeName === 'Form' ? 'Screen' : this.typeName;
},
// Renames the block's instanceName, type, and reset its title // Renames the block's instanceName, type, and reset its title
rename : function(oldname, newname) { rename : function(oldname, newname) {
if (this.instanceName == oldname) { if (this.instanceName == oldname) {
......
...@@ -360,30 +360,38 @@ Blockly.ComponentDatabase.prototype.populateTypes = function(componentInfos) { ...@@ -360,30 +360,38 @@ Blockly.ComponentDatabase.prototype.populateTypes = function(componentInfos) {
} }
}; };
Blockly.ComponentDatabase.PROPDESC = /PropertyDescriptions$/;
Blockly.ComponentDatabase.METHODDESC = /MethodDescrptions$/;
Blockly.ComponentDatabase.EVENTDESC = /EventDescriptions$/;
/** /**
* Populate the tranlsations for components. * Populate the tranlsations for components.
* @param translations * @param translations
*/ */
Blockly.ComponentDatabase.prototype.populateTranslations = function(translations) { Blockly.ComponentDatabase.prototype.populateTranslations = function(translations) {
var newkey;
for (var key in translations) { for (var key in translations) {
if (translations.hasOwnProperty(key)) { if (translations.hasOwnProperty(key)) {
var parts = key.split('-', 2); var parts = key.split('-', 2);
if (parts[0] == 'COMPONENT') { if (parts[0] === 'COMPONENT') {
this.i18nComponentTypes_[parts[1]] = translations[key]; this.i18nComponentTypes_[parts[1]] = translations[key];
} else if (parts[0] == 'PROPERTY') { } else if (parts[0] === 'PROPERTY') {
this.i18nPropertyNames_[parts[1]] = translations[key]; this.i18nPropertyNames_[parts[1]] = translations[key];
} else if (parts[0] == 'EVENT') { } else if (parts[0] === 'EVENT') {
this.i18nEventNames_[parts[1]] = translations[key]; this.i18nEventNames_[parts[1]] = translations[key];
} else if (parts[0] == 'METHOD') { } else if (parts[0] === 'METHOD') {
this.i18nMethodNames_[parts[1]] = translations[key]; this.i18nMethodNames_[parts[1]] = translations[key];
} else if (parts[0] == 'PARAM') { } else if (parts[0] === 'PARAM') {
this.i18nParamNames_[parts[1]] = translations[key]; this.i18nParamNames_[parts[1]] = translations[key];
} else if (parts[0] == 'EVENTDESC') { } else if (parts[0] === 'EVENTDESC') {
newkey = parts[1].replace(Blockly.ComponentDatabase.EVENTDESC, '');
this.i18nEventDescriptions_[parts[1]] = translations[key]; this.i18nEventDescriptions_[parts[1]] = translations[key];
} else if (parts[0] == 'METHDESC') { } else if (parts[0] === 'METHODDESC') {
this.i18nMethodDescriptions_[parts[1]] = translations[key]; newkey = parts[1].replace(Blockly.ComponentDatabase.METHODDESC, '');
} else if (parts[0] == 'PROPDESC') { this.i18nMethodDescriptions_[newkey] = translations[key];
this.i18nPropertyDescriptions_[parts[1]] = translations[key]; } else if (parts[0] === 'PROPDESC') {
newkey = parts[1].replace(Blockly.ComponentDatabase.PROPDESC, '');
this.i18nPropertyDescriptions_[newkey] = translations[key];
} }
} }
} }
...@@ -521,8 +529,8 @@ Blockly.ComponentDatabase.prototype.getInternationalizedEventName = function(nam ...@@ -521,8 +529,8 @@ Blockly.ComponentDatabase.prototype.getInternationalizedEventName = function(nam
* @param {?string=name} opt_default Optional default value (default: name parameter) * @param {?string=name} opt_default Optional default value (default: name parameter)
* @returns {string} The localized string if available, otherwise the unlocalized name. * @returns {string} The localized string if available, otherwise the unlocalized name.
*/ */
Blockly.ComponentDatabase.prototype.getInternationalizedEventDescription = function(name, opt_default) { Blockly.ComponentDatabase.prototype.getInternationalizedEventDescription = function(component, name, opt_default) {
return this.i18nEventDescriptions_[name] || opt_default || name; return this.i18nEventDescriptions_[component + '.' + name] || this.i18nEventDescriptions_[name] || opt_default || name;
}; };
/** /**
...@@ -541,8 +549,8 @@ Blockly.ComponentDatabase.prototype.getInternationalizedMethodName = function(na ...@@ -541,8 +549,8 @@ Blockly.ComponentDatabase.prototype.getInternationalizedMethodName = function(na
* @param {?string=name} opt_default Optional default value (default: name parameter) * @param {?string=name} opt_default Optional default value (default: name parameter)
* @returns {string} The localized string if available, otherwise the unlocalized name. * @returns {string} The localized string if available, otherwise the unlocalized name.
*/ */
Blockly.ComponentDatabase.prototype.getInternationalizedMethodDescription = function(name, opt_default) { Blockly.ComponentDatabase.prototype.getInternationalizedMethodDescription = function(component, name, opt_default) {
return this.i18nMethodDescriptions_[name] || opt_default || name; return this.i18nMethodDescriptions_[component + '.' + name] || this.i18nMethodDescriptions_[name] || opt_default || name;
}; };
/** /**
...@@ -571,6 +579,6 @@ Blockly.ComponentDatabase.prototype.getInternationalizedPropertyName = function( ...@@ -571,6 +579,6 @@ Blockly.ComponentDatabase.prototype.getInternationalizedPropertyName = function(
* @param {?string=name} opt_default Optional default value (default: name parameter) * @param {?string=name} opt_default Optional default value (default: name parameter)
* @returns {string} The localized string if available, otherwise the unlocalized name. * @returns {string} The localized string if available, otherwise the unlocalized name.
*/ */
Blockly.ComponentDatabase.prototype.getInternationalizedPropertyDescription = function(name, opt_default) { Blockly.ComponentDatabase.prototype.getInternationalizedPropertyDescription = function(component, name, opt_default) {
return this.i18nPropertyDescriptions_[name] || opt_default || name; return this.i18nPropertyDescriptions_[component + '.' + name] || this.i18nPropertyDescriptions_[name] || opt_default || name;
}; };
...@@ -61,7 +61,7 @@ page.open('src/demos/yail/yail_testing_index.html', function(status) { ...@@ -61,7 +61,7 @@ page.open('src/demos/yail/yail_testing_index.html', function(status) {
'METHOD-TranslatedMethod': 'SuccessfulMethod', 'METHOD-TranslatedMethod': 'SuccessfulMethod',
'PROPERTY-TranslatedProperty': 'SuccessfulProperty', 'PROPERTY-TranslatedProperty': 'SuccessfulProperty',
'EVENTDESC-TranslatedEvent': 'Successfully translated event test.', 'EVENTDESC-TranslatedEvent': 'Successfully translated event test.',
'METHDESC-TranslatedMethod': 'Successfully translated method test.', 'METHODDESC-TranslatedMethod': 'Successfully translated method test.',
'PROPDESC-TranslatedProperty': 'Successfully translated property test.' 'PROPDESC-TranslatedProperty': 'Successfully translated property test.'
}); });
......
...@@ -841,6 +841,14 @@ public abstract class ComponentProcessor extends AbstractProcessor { ...@@ -841,6 +841,14 @@ public abstract class ComponentProcessor extends AbstractProcessor {
return "Form".equals(componentTypeName) ? "Screen" : componentTypeName; return "Form".equals(componentTypeName) ? "Screen" : componentTypeName;
} }
protected String getName() {
if (name.equals("Form")) {
return "Screen";
} else {
return name;
}
}
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment