X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.slc.webapp%2Fsrc%2Fmain%2Fwebapp%2Fargeo-ria-lib%2Fslc%2Fclass%2Forg%2Fargeo%2Fslc%2Fria%2Fexecution%2FValue.js;h=b5944a019ab09ac17b5d7309ecaa5ebdf1c9358d;hb=859114a86e3d1073b7b7aba89cee4224b8e897bf;hp=1e7f861c0cbf04909553c82e6d5d3a5b0f5674ff;hpb=5d508f933c34996d13c04b3a8d4fb3701f233482;p=gpl%2Fargeo-slc.git diff --git a/org.argeo.slc.webapp/src/main/webapp/argeo-ria-lib/slc/class/org/argeo/slc/ria/execution/Value.js b/org.argeo.slc.webapp/src/main/webapp/argeo-ria-lib/slc/class/org/argeo/slc/ria/execution/Value.js index 1e7f861c0..b5944a019 100644 --- a/org.argeo.slc.webapp/src/main/webapp/argeo-ria-lib/slc/class/org/argeo/slc/ria/execution/Value.js +++ b/org.argeo.slc.webapp/src/main/webapp/argeo-ria-lib/slc/class/org/argeo/slc/ria/execution/Value.js @@ -13,22 +13,40 @@ qx.Class.define("org.argeo.slc.ria.execution.Value", { check : "String", init : "" }, + /** + * The type of this value, for the moment "primitive" and "ref" are supported + */ specType : { check : "String", init : "" }, + /** + * Subtype, depending on the "type". + */ specSubType : { check : "String" }, + /** + * Whether it is a parameter or not + */ parameter : { check : "Boolean" }, + /** + * Whether it is frozen on the server, i.e. disabled in the form + */ frozen : { check : "Boolean" }, + /** + * Should not be editable nor seeable, thus hidden + */ hidden : { check : "Boolean" }, + /** + * The real value + */ value : { nullable : true }, @@ -62,8 +80,8 @@ qx.Class.define("org.argeo.slc.ria.execution.Value", { if(child.nodeName == "slc:primitive-spec-attribute"){ this.setSpecType("primitive"); this.setSpecSubType(org.argeo.ria.util.Element.getSingleNodeText(child, "@type")); - if(org.argeo.ria.util.Element.getSingleNodeText(child, "slc:value")){ - this.setValue(org.argeo.ria.util.Element.getSingleNodeText(child, "slc:value")); + if(org.argeo.ria.util.Element.getSingleNodeText(child, ".")){ + this.setValue(org.argeo.ria.util.Element.getSingleNodeText(child, ".")); } }else if(child.nodeName == "slc:ref-spec-attribute"){ this.setSpecType("ref"); @@ -76,15 +94,35 @@ qx.Class.define("org.argeo.slc.ria.execution.Value", { }); } }, + + /** + * Create an XML Representation of this value + * @return {String} The XML String + */ + toAttributeXml : function(){ + var valueTag = ''; + var specAttribute = ''; + if(this.getSpecType() == "primitive"){ + valueTag = (this.getValue()?this.getValue():''); + specAttribute = ''+valueTag+''; + }else if(this.getSpecType() == "ref"){ + valueTag = (this.getValue()?''+this.getValue()+'':''); + specAttribute = ''+valueTag+''; + } + return ''+specAttribute+''; + }, - _applyXmlValue : function(xmlNode){ - var xpath; + toValueXml : function(){ + var valueTag = ''; + var specAttribute = ''; if(this.getSpecType() == "primitive"){ - xpath = "slc:primitive-value/slc:value"; + valueTag = this.getValue(); + specAttribute = ''+valueTag+''; }else if(this.getSpecType() == "ref"){ - xpath = "slc:ref-value/slc:label"; + valueTag = ''+this.getValue()+''; + specAttribute = ''+valueTag+''; } - this.setValue(org.argeo.ria.util.Element.getSingleNodeText(xmlNode, xpath)); + return ''+specAttribute+''; } }