123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227 |
- XFormsTreeViewItem.prototype = new XFormsCaption;
- function XFormsTreeViewItem (strParentId, strId)
- {
- if (!strId)
- {
- return;
- }
-
- XFormsCaption.call(this, strParentId, ""/*strAlert*/, ""/*strHelp*/, ""/*strHint*/, ""/*strText*/, ""/*strAccesskey*/, false/*bAutoresize*/, ""/*strBind*/, ""/*strClass*/, false/*bDisabled*/, false/*bEllipsis*/, ""/*strFormat*/, strId, -1/*nNavindex*/, ""/*strRef*/, ""/*strRoundmode*/, -1/*nRoundposition*/, ""/*strStyle*/, "xforms:treeitem", "visible"/*strVisibility*/);
-
- this.checked;
- this.checkboxdisabled;
- this.depth;
- this.disabled;
- this.expanded;
- this.expandedImage;
- this.image;
- this.index;
- this.parentIndex;
- this.selectedImage;
- this.label = "";
- this.value = "";
- this.itemset;
- };
- XFormsTreeViewItem.prototype.init = function ()
- {
- XFormsCaption.prototype.init.call(this);
- };
- XFormsTreeViewItem.prototype.hasContained = function (heMember, nX)
- {
- if (null != heMember)
- {
- var nOffsetWidth = heMember.offsetWidth;
- var nOffsetX = heMember.offsetLeft;
-
- if ((nX >= nOffsetX && nX <= nOffsetX + nOffsetWidth))
- {
- return true;
- }
- }
- return false;
- };
- XFormsTreeViewItem.prototype.setSelect = function (bSelect)
- {
- var objCell = this.getRefElement();
-
- if (null == objCell)
- {
- return;
- }
- var strId = objCell.id;
-
- var xnParent = this.parent;
-
- var xlRefNode = xnParent.getRefNode();
- if (null != xlRefNode)
- {
- var xnRefNode = xlRefNode.item(0);
- if (null != xnRefNode)
- {
- var strNewValue = objCell.getValue();
-
- if (bSelect)
- {
- xnParent.value = strNewValue;
- XmlLib.setTextValue(xnRefNode, strNewValue);
- }
- }
- }
-
- var heSelectRow;
- var strFullRowSelect = xnParent.getAttribute("fullrowselect");
- var heSelectRow = objCell.getHtmlElement();
- if ("true" == strFullRowSelect)
- {
- heSelectRow = document.getElementById("HE_" + strId);
- }
- else
- {
- heSelectRow = document.getElementById("HE_" + strId + "_content");
- }
-
- if (bSelect)
- {
- HtmlLib.setStyle(heSelectRow, "color", "#FFFFFF");
- HtmlLib.setStyle(heSelectRow, "background-color", "#316AC5");
- }
- else
- {
- var strFontColor = xnParent.getAttribute("color");
- if ("" == strFontColor)
- {
- strFontColor = "#000000";
- }
- HtmlLib.setStyle(heSelectRow, "color", strFontColor);
- HtmlLib.setStyle(heSelectRow, "background-color", "");
- }
- };
- /**
- * getter, setter
- */
- XFormsTreeViewItem.prototype.getDepth = function ()
- {
- return this.depth;
- };
- XFormsTreeViewItem.prototype.setDepth = function (strDepth)
- {
- this.depth = strDepth;
- };
- XFormsTreeViewItem.prototype.getExpanded = function ()
- {
- return this.expaned;
- };
- XFormsTreeViewItem.prototype.setExpanded = function (strExpanded)
- {
- this.expanded = strExpaned;
- };
- XFormsTreeViewItem.prototype.getExpandedImage = function ()
- {
- return this.expandedImage;
- };
- XFormsTreeViewItem.prototype.setExpandedImage = function (strExpandedImage)
- {
- this.expandedImage = strExpandedImage;
- };
- XFormsTreeViewItem.prototype.getIndex = function ()
- {
- return this.index;
- };
- XFormsTreeViewItem.prototype.setIndex = function (strIndex)
- {
- this.index = strIndex;
- };
- XFormsTreeViewItem.prototype.getParentIndex = function ()
- {
- return this.parentIndex;
- };
- XFormsTreeViewItem.prototype.setParentIndex = function (strParentIndex)
- {
- this.parentIndex = strParentIndex;
- };
- XFormsTreeViewItem.prototype.getSelectedImage = function ()
- {
- return this.selectedImage;
- };
- XFormsTreeViewItem.prototype.setSelectedImage = function (strSelectedImage)
- {
- this.selectedImage = strSelectedImage;
- };
- XFormsTreeViewItem.prototype.setItemSet = function (objItemSet)
- {
- this.itemset = objItemSet;
- };
- XFormsTreeViewItem.prototype.getItemSet = function ()
- {
- return this.itemset;
- };
- XFormsTreeViewItem.prototype.setLabel = function (objLabel)
- {
- this.label = objLabel;
- };
- XFormsTreeViewItem.prototype.getLabel = function ()
- {
- return this.label;
- };
- XFormsTreeViewItem.prototype.setValue = function (objValue)
- {
- this.value = objValue;
- };
- XFormsTreeViewItem.prototype.getValue = function ()
- {
- return this.value;
- };
- XFormsTreeViewItem.prototype.setAttribute = function (strAttribute, strValue)
- {
- XFormsCaption.prototype.setAttribute.call(this, strAttribute, strValue);
- switch (strAttribute)
- {
- case "nodeset" :
- {
- if (null != this.parent)
- {
- this.parent.nodeset = strValue;
- }
- break;
- }
- }
- };
- XFormsTreeViewItem.create = function (strParentId, clAttribute)
- {
- var strId = clAttribute.item("id") ? clAttribute.item("id") : "";
-
- var objControl = new XFormsTreeViewItem(strParentId, strId);
-
- var arKeys = clAttribute.keys();
- for (var i=0; i<arKeys.length; i++)
- {
- objControl.setAttribute(arKeys[i], clAttribute.item(arKeys[i]));
- }
-
- return objControl;
- };
|