]>
git.argeo.org Git - gpl/argeo-slc.git/blob - server/org.argeo.slc.ria/src/argeo-ria-lib/slc/class/org/argeo/slc/ria/execution/Value.js
2 * Wrapper for SlcValue object
4 qx
.Class
.define("org.argeo.slc.ria.execution.Value", {
6 extend
: qx
.core
.Object
,
10 * Name of this Execution Flow
17 * The type of this value, for the moment "primitive" and "ref" are supported
24 * Subtype, depending on the "type".
30 * Whether it is a parameter or not
36 * Whether it is frozen on the server, i.e. disabled in the form
42 * Should not be editable nor seeable, thus hidden
54 * Castor representation of the object
57 apply
: "_applyXmlSpecNode"
68 construct : function(){
74 * Init the object from an XML representation
75 * @param xmlNode {Node} Castor representation of this object
77 _applyXmlSpecNode : function(xmlNode
){
78 this.setKey(org
.argeo
.ria
.util
.Element
.getSingleNodeText(xmlNode
, "@key"));
79 var childs
= xmlNode
.childNodes
;
80 for(var i
=0;i
<childs
.length
;i
++){
81 var child
= childs
[i
];
82 if(child
.nodeType
!= 1) continue;
83 if(child
.nodeName
== "slc:primitive-spec-attribute"){
84 this.setSpecType("primitive");
85 this.setSpecSubType(org
.argeo
.ria
.util
.Element
.getSingleNodeText(child
, "@type")||"");
86 if(org
.argeo
.ria
.util
.Element
.getSingleNodeText(child
, ".")){
87 this.setValue(org
.argeo
.ria
.util
.Element
.getSingleNodeText(child
, "."));
89 }else if(child
.nodeName
== "slc:ref-spec-attribute"){
90 this.setSpecType("ref");
91 this.setSpecSubType(org
.argeo
.ria
.util
.Element
.getSingleNodeText(child
, "@targetClassName")||"");
92 var choices
= org
.argeo
.ria
.util
.Element
.selectNodes(child
, "slc:choices/slc:ref-value-choice");
94 for(var k
=0;k
<choices
.length
;k
++){
95 var choice
= choices
[k
];
96 var name
= org
.argeo
.ria
.util
.Element
.getSingleNodeText(choice
, "@name");
97 var description
= org
.argeo
.ria
.util
.Element
.getSingleNodeText(choice
, "slc:description");
98 refList
.push([name
, (description
||"")]);
100 this.setRefList(refList
);
103 parameter
: (org
.argeo
.ria
.util
.Element
.getSingleNodeText(child
, "@isParameter")=="true"?true:false),
104 frozen
: (org
.argeo
.ria
.util
.Element
.getSingleNodeText(child
, "@isFrozen")=="true"?true:false),
105 hidden
: (org
.argeo
.ria
.util
.Element
.getSingleNodeText(child
, "@isHidden")=="true"?true:false)
110 toValueXml : function(){
112 var specAttribute
= '';
113 if(this.getSpecType() == "primitive"){
114 valueTag
= this.getValue();
115 specAttribute
= '<slc:primitive-value type="'+this.getSpecSubType()+'">'+valueTag
+'</slc:primitive-value>';
116 }else if(this.getSpecType() == "ref"){
117 specAttribute
= '<slc:ref-value ref="'+this.getValue()+'" type="beanName" />';
119 return '<slc:value key="'+this.getKey()+'">'+specAttribute
+'</slc:value>';