Commit f370f158 authored by David Hoksza's avatar David Hoksza
Browse files

Fixed issues with annotator params not updating after adding or removal of...

Fixed issues with annotator params not updating after adding or removal of annotator in frontend + problems with params names after introduction of params tooltips.
parent 195709ec
......@@ -78,7 +78,7 @@ public class KeggAnnotator extends ElementAnnotator implements IExternalService
String.class,
"Space-delimited list of organisms codes for which homologous genes"
+ " (GENE section in the KEGG enzyme record) should be imported."
+ " Currently ATH (Arabidopsis Thaliana) is supported.");
+ " Currently only ATH (Arabidopsis Thaliana) is supported.");
this.addParameterDefinition(paramDef);
}
......@@ -230,7 +230,6 @@ public class KeggAnnotator extends ElementAnnotator implements IExternalService
String[] tairCodes = m.group(1).trim().split(" ");
for (String tairCode: tairCodes) {
tairCode = tairCode.split("\\(")[0]; //some codes are in the form AT1G08510(FATB)
logger.debug("Adding tair code " + tairCode);
result.add(createMiriamData(MiriamType.TAIR_LOCUS, tairCode));
}
}
......
......@@ -58,7 +58,7 @@ ChooseAnnotatorsDialog.prototype.createGui = function () {
};
function onChangeParameterValue(element, user){
var name = $(element).siblings(".minerva-annotator-param-name").text();
var name = $(element).siblings(".minerva-annotator-param-name")[0].childNodes[0].nodeValue;
var annotatorClassName = $(element).parent().parent().attr('name');
var data = new UserPreferences();
......@@ -84,8 +84,7 @@ ChooseAnnotatorsDialog.prototype.setElementType = function (elementType) {
var element = $("[name='annotatorListBox']", self.getElement())[0];
var annotatorsParams = $(".minerva-annotators-params", self.getElement())[0];
Functions.removeChildren(element);
Functions.removeChildren(annotatorsParams);
var selectElement = Functions.createElement({
type: "select",
className: "minerva-multi-select"
......@@ -94,8 +93,6 @@ ChooseAnnotatorsDialog.prototype.setElementType = function (elementType) {
var annotators = configuration.getElementAnnotators(elementType);
var selectedAnnotators = user.getPreferences().getElementAnnotators(elementType.className);
var existingAnnotatorsParameters = user.getPreferences().getAnnotatorsParameters();
for (var i = 0; i < annotators.length; i++) {
var annotator = annotators[i];
......@@ -103,95 +100,110 @@ ChooseAnnotatorsDialog.prototype.setElementType = function (elementType) {
for (var j = 0; j < selectedAnnotators.length; j++) {
if (annotator.getName() === selectedAnnotators[j]) {
selected = true;
var paramsDefs = annotator.getParametersDefinitions();
if (paramsDefs.length > 0) {
}
}
var option = new Option();
option.value = annotator.getClassName();
option.attributes.selected = selected;
option.innerHTML = "<div>" + annotator.getName() + "</div>";
selectElement.appendChild(option);
};
function createAnnotatorsParams(){
var existingAnnotatorsParameters = user.getPreferences().getAnnotatorsParameters();
Functions.removeChildren(annotatorsParams);
for (var i = 0; i < annotators.length; i++) {
var annotator = annotators[i];
for (var j = 0; j < selectedAnnotators.length; j++) {
if (annotator.getName() === selectedAnnotators[j]) {
annotatorsParams.appendChild(Functions.createElement({
type: "div",
className: "minerva-annotators-params-header",
content: '<div>Available parameters</div>'
}))
var annotatorParams = Functions.createElement({
type: "div",
className: "minerva-annotator-params",
name: annotator.getClassName()
});
var paramsDefs = annotator.getParametersDefinitions();
if (paramsDefs.length > 0) {
annotatorsParams.appendChild(Functions.createElement({
type: "div",
className: "minerva-annotators-params-header",
content: '<div>Available parameters</div>'
}))
annotatorParams.appendChild(Functions.createElement({
type: "div",
className: "minerva-annotator-params-header",
content: annotator.getName()
}));
for (var k = 0; k < paramsDefs.length; k++) {
var param = paramsDefs[k];
var paramElement = Functions.createElement({
var annotatorParams = Functions.createElement({
type: "div",
className: "minerva-annotator-param"
});
var paramName = Functions.createElement({
type: "div",
className: "minerva-annotator-param-name",
content: param.name
});
var toolTip = Functions.createElement({
type: "span",
className: "annotator-tooltip",
content: param.description
className: "minerva-annotator-params",
name: annotator.getClassName()
});
paramName.appendChild(toolTip)
paramElement.appendChild(paramName);
var paramValue;
var existingParamValue;
if (existingAnnotatorsParameters[annotator.getClassName()]) {
existingParamValue = existingAnnotatorsParameters[annotator.getClassName()][param.name]
}
if (param.type.indexOf("String") >= 0) {
paramValue = Functions.createElement({
type: "textarea",
onchange: function(){return onChangeParameterValue(this, user);}
annotatorParams.appendChild(Functions.createElement({
type: "div",
className: "minerva-annotator-params-header",
content: annotator.getName()
}));
for (var k = 0; k < paramsDefs.length; k++) {
var param = paramsDefs[k];
var paramElement = Functions.createElement({
type: "div",
className: "minerva-annotator-param"
});
if (existingParamValue) paramValue.value = existingParamValue;
} else if (param.type.indexOf("Integer") >= 0) {
paramValue = Functions.createElement({
type: "input",
inputType: "number",
onchange: function(){return onChangeParameterValue(this, user);}
var paramName = Functions.createElement({
type: "div",
className: "minerva-annotator-param-name",
content: param.name
});
if (existingParamValue) paramValue.value = existingParamValue;
} else if (param.type.indexOf("Boolean") >= 0) {
paramValue = Functions.createElement({
type: "input",
inputType: "checkbox",
onchange: function(){return onChangeParameterValue(this, user);}
var toolTip = Functions.createElement({
type: "span",
className: "annotator-tooltip",
content: param.description
});
paramValue.checked = (existingParamValue && existingParamValue === 'true');
} else {
throw new InvalidAlgorithmError("Unknown annotator parameter type");
}
paramElement.appendChild(paramValue);
annotatorParams.appendChild(paramElement);
paramName.appendChild(toolTip)
paramElement.appendChild(paramName);
var paramValue;
var existingParamValue;
if (existingAnnotatorsParameters[annotator.getClassName()]) {
existingParamValue = existingAnnotatorsParameters[annotator.getClassName()][param.name]
}
if (param.type.indexOf("String") >= 0) {
paramValue = Functions.createElement({
type: "textarea",
onchange: function(){return onChangeParameterValue(this, user);}
});
if (existingParamValue) paramValue.value = existingParamValue;
} else if (param.type.indexOf("Integer") >= 0) {
paramValue = Functions.createElement({
type: "input",
inputType: "number",
onchange: function(){return onChangeParameterValue(this, user);}
});
if (existingParamValue) paramValue.value = existingParamValue;
} else if (param.type.indexOf("Boolean") >= 0) {
paramValue = Functions.createElement({
type: "input",
inputType: "checkbox",
onchange: function(){return onChangeParameterValue(this, user);}
});
paramValue.checked = (existingParamValue && existingParamValue === 'true');
} else {
throw new InvalidAlgorithmError("Unknown annotator parameter type");
}
paramElement.appendChild(paramValue);
annotatorParams.appendChild(paramElement);
}
annotatorsParams.appendChild(annotatorParams);
}
}
}
};
annotatorsParams.appendChild(annotatorParams);
}
}
}
var option = new Option();
option.value = annotator.getClassName();
option.attributes.selected = selected;
option.innerHTML = "<div>" + annotator.getName() + "</div>";
selectElement.appendChild(option);
};
}
createAnnotatorsParams();
element.appendChild(selectElement);
new DualListbox(selectElement, {
......@@ -205,6 +217,8 @@ ChooseAnnotatorsDialog.prototype.setElementType = function (elementType) {
}
selectedAnnotators.push(annotator.getName());
createAnnotatorsParams();
var data = new UserPreferences();
var elementAnnotators = {};
......@@ -225,6 +239,8 @@ ChooseAnnotatorsDialog.prototype.setElementType = function (elementType) {
selectedAnnotators.splice(index, 1);
}
createAnnotatorsParams();
var data = new UserPreferences();
var elementAnnotators = {};
......
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