Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

* initial commit

git-svn-id: svn://svn.ajax.org/platform/source/trunk@15 3c3c2983-eddd-4584-88e6-321645f70290
  • Loading branch information...
commit a29d5e4cd07f7450391c2495becb9c0524f7d468 1 parent d4f6607
@mikeytest mikeytest authored
Showing with 26,846 additions and 0 deletions.
  1. +178 −0 components/_base/basebutton.js
  2. +567 −0 components/_base/basefastlist.js
  3. +661 −0 components/_base/baselist.js
  4. +111 −0 components/_base/basesimple.js
  5. +479 −0 components/_base/basetab.js
  6. +66 −0 components/bar.js
  7. +145 −0 components/browser.js
  8. +306 −0 components/button.js
  9. +201 −0 components/checkbox.js
  10. +55 −0 components/collection.js
  11. +350 −0 components/colorpicker.js
  12. +125 −0 components/container.js
  13. +1,444 −0 components/datagrid.js
  14. +89 −0 components/datastore.js
  15. +405 −0 components/dropdown.js
  16. +101 −0 components/errorbox.js
  17. +167 −0 components/fastlist.js
  18. +333 −0 components/fileuploadbox.js
  19. +90 −0 components/flash.js
  20. +88 −0 components/frame.js
  21. +237 −0 components/hbox.js
  22. +72 −0 components/htmlwrapper.js
  23. +133 −0 components/insert.js
  24. +123 −0 components/jslt.js
  25. +149 −0 components/label.js
  26. +418 −0 components/layoutbuilder.js
  27. +146 −0 components/lineselect.js
  28. +241 −0 components/list.js
  29. +960 −0 components/markupedit.js
  30. +141 −0 components/mediaflow/mfbrowser.js
  31. +157 −0 components/mediaflow/mfbutton.js
  32. +208 −0 components/mediaflow/mfcheckbox.js
  33. +186 −0 components/mediaflow/mfdisplay.js
  34. +348 −0 components/mediaflow/mfdropdown.js
  35. +451 −0 components/mediaflow/mflist.js
  36. +360 −0 components/mediaflow/mfmenu.js
  37. +191 −0 components/mediaflow/mfslider.js
  38. +398 −0 components/menu.js
  39. +672 −0 components/modalwindow.js
  40. +75 −0 components/pages.js
  41. +158 −0 components/palette.js
  42. +86 −0 components/picture.js
  43. +331 −0 components/portal.js
  44. +151 −0 components/progressbar.js
  45. +411 −0 components/radiobutton.js
  46. +187 −0 components/repeat.js
  47. +261 −0 components/richtexteditor.js
  48. +231 −0 components/rtehelper.js
  49. +126 −0 components/rtetemplateviewer.js
  50. +296 −0 components/slider.js
  51. +331 −0 components/sourceedit.js
  52. +352 −0 components/splitter.js
  53. +177 −0 components/state.js
  54. +146 −0 components/statusbar.js
  55. +765 −0 components/submitform.js
  56. +78 −0 components/tab.js
  57. +337 −0 components/text.js
  58. +808 −0 components/textbox.js
  59. +151 −0 components/tinymce.js
  60. +205 −0 components/toc.js
  61. +255 −0 components/toolbar.js
  62. +905 −0 components/tree.js
  63. +301 −0 components/workarea.js
  64. +123 −0 components/xslt.js
  65. +654 −0 core/application/actiontracker.js
  66. +247 −0 core/application/appsettings.js
  67. +174 −0 core/application/deskrun.js
  68. +1,324 −0 core/application/layout.js
  69. +977 −0 core/application/model.js
  70. +172 −0 core/application/remotesmartbinding.js
  71. +302 −0 core/application/scrollbar.js
  72. +339 −0 core/application/smartbinding.js
  73. +1,066 −0 core/application/xmldatabase.js
  74. +468 −0 core/application/xsdimplementation.js
  75. +73 −0 core/crypt/barrett.js
  76. +164 −0 core/crypt/base64.js
  77. +625 −0 core/crypt/bigint.js
  78. +550 −0 core/crypt/blowfish.js
  79. +269 −0 core/crypt/md4.js
  80. +260 −0 core/crypt/md5.js
  81. +146 −0 core/crypt/rsa.js
  82. +237 −0 core/crypt/sha1.js
Sorry, we could not display the entire diff because it was too big.
View
178 components/_base/basebutton.js
@@ -0,0 +1,178 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
+ */
+
+// #ifdef __JBASEBUTTON || __INC_ALL
+
+/**
+ * Baseclass of a Button component
+ *
+ * @constructor
+ * @baseclass
+ * @author Ruben Daniels
+ * @version %I%, %G%
+ * @since 0.8
+ */
+jpf.BaseButton = function(pHtmlNode){
+
+ /* ***************
+ Init
+ ****************/
+
+ this.refKeyDown = 0; // Number of keys pressed.
+ this.refMouseDown = 0; // Mouse button down?
+ this.mouseOver = false; // Mouse hovering over the button?
+ this.mouseLeft = false; // Has the mouse left the control since pressing the button.
+
+ /* ***********************
+ Keyboard Support
+ ************************/
+
+ this.keyHandler = function(key, ctrlKey, shiftKey, altKey, evnt){
+ switch (key) {
+ case 32:
+ case 13:
+ if (!evnt.repeat) { // Only when first pressed, not on autorepeat.
+ this.refKeyDown++;
+ return this.__updateState(evnt);
+ } else
+ return false;
+ }
+ }
+
+ this.keyUpHandler = function(key, ctrlKey, shiftKey, altKey, evnt){
+ switch (key) {
+ case 32:
+ case 13:
+ this.refKeyDown--;
+ if (this.refKeyDown + this.refMouseDown == 0 && !this.disabled) {
+ //if(this.oExt.onclick) this.oExt.onclick(evnt, true);
+ //else if(this.oExt.onmouseup)
+ this.oExt.onmouseup(evnt, true);
+ }
+ return this.__updateState(evnt);
+ }
+ }
+
+ this.states = {
+ "Out": 1,
+ "Over": 2,
+ "Down" :3
+ };
+
+ this.__updateState = function(e, strEvent) {
+ if (this.disabled) {
+ this.refKeyDown = 0;
+ this.refMouseDown = 0;
+ this.mouseOver = false;
+ return false;
+ } else {
+ if (this.refKeyDown > 0 || (this.refMouseDown > 0 && this.mouseOver)
+ || (this.isBoolean && this.value))
+ this.__setState ("Down", e, strEvent);
+ else if (this.mouseOver)
+ this.__setState ("Over", e, strEvent);
+ else
+ this.__setState ("Out", e, strEvent);
+ }
+ }
+
+ this.__setupEvents = function() {
+ this.oExt.onmousedown = function(e) {
+ this.host.refMouseDown = 1;
+ this.host.mouseLeft = false;
+ this.host.__updateState(e || event, "onmousedown");
+ };
+ this.oExt.onmouseup = function(e, force) {
+ if (!e) e = event;
+ if (e) e.cancelBubble = true;
+
+ if (!force && (!this.host.mouseOver || !this.host.refMouseDown))
+ return;
+
+ this.host.refMouseDown = 0;
+ this.host.__updateState (e, "onmouseup");
+
+ // If this is coming from a mouse click, we shouldn't have left the button.
+ if (this.host.disabled || (e && e.type == "click" && this.host.mouseLeft == true))
+ return false;
+
+ // If there are still buttons down, this is not a real click.
+ if (this.host.refMouseDown + this.host.refKeyDown)
+ return false;
+
+ if (this.host.__clickHandler && this.host.__clickHandler())
+ this.host.__updateState (e || event, "onclick");
+ else
+ this.host.dispatchEvent("onclick", {htmlEvent : e});
+
+ return false;
+ };
+
+ this.oExt.onmousemove = function(e) {
+ this.host.mouseOver = true;
+ this.host.__updateState (e || event, "onmouseover");
+ };
+
+ this.oExt.onmouseout = function(e) {
+ if(!e) e = event;
+
+ //Check if the mouse out is meant for us
+ var tEl = e.explicitOriginalTarget || e.toElement;
+ if(this == tEl || jpf.XMLDatabase.isChildOf(this, tEl))
+ return;
+
+ this.host.mouseOver = false;
+ this.host.refMouseDown = 0;
+ this.host.mouseLeft = true;
+ this.host.__updateState (e || event, "onmouseout");
+ };
+
+ if (jpf.hasClickFastBug)
+ this.oExt.ondblclick = this.oExt.onmouseup;
+ }
+
+ this.__destroy = function(){
+ this.oExt.onmousedown = this.oExt.onmouseup = this.oExt.onmouseover =
+ this.oExt.onmouseout = this.oExt.onclick = this.oExt.ondblclick = null;
+ }
+
+ this.__focus = function(){
+ if (!this.oExt) return;
+
+ this.__setStyleClass(this.oExt, this.baseCSSname + "Focus");
+ }
+
+ this.__blur = function(e){
+ if (!this.oExt) return; //FIREFOX BUG!
+ if (!e)
+ e = event;
+
+ this.__setStyleClass(this.oExt, "", [this.baseCSSname + "Focus"]);
+ this.refKeyDown = 0;
+ this.refMouseDown = 0;
+ this.mouseLeft =true;
+
+ if (e)
+ this.__updateState(e, "onblur");
+ }
+}
+
+// #endif
View
567 components/_base/basefastlist.js
@@ -0,0 +1,567 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
+ */
+
+// #ifdef __JBASEFASTLIST || __INC_ALL
+// #define __WITH_CACHE 1
+// #define __WITH_DATABINDING 1
+// #define __WITH_MULTISELECT 1
+// #define __WITH_PRESENTATION 1
+// #define __WITH_SCROLLBAR 1
+
+/**
+ * Baseclass of a Fastlist component
+ *
+ * @constructor
+ * @baseclass
+ * @author Ruben Daniels
+ * @version %I%, %G%
+ * @since 0.8
+ */
+jpf.BaseFastList = function(){
+ /* ********************************************************************
+ PROPERTIES
+ *********************************************************************/
+
+ //Options
+ //#ifdef __WITH_VALIDATION || __WITH_XFORMS
+ this.inherit(jpf.Validation); /** @inherits jpf.Validation */
+ //#endif
+ //#ifdef __WITH_XFORMS
+ this.inherit(jpf.XForms); /** @inherits jpf.XForms */
+ //#endif
+ this.focussable = true; // This object can get the focus
+ this.multiselect = true; // Initially Disable MultiSelect
+
+ // #ifdef __WITH_CSS_BINDS
+ this.dynCssClasses = [];
+ // #endif
+
+ this.__deInitNode = function(xmlNode, htmlNode){
+ if (!htmlNode) return;
+
+ //Remove htmlNodes from tree
+ htmlNode.parentNode.removeChild(htmlNode);
+ }
+
+ this.scrollTo = function(xmlNode, updateScrollbar){
+ this.lastScroll = xmlNode;
+
+ var xNodes = this.getTraverseNodes();
+ for (var j = xNodes.length - 1; j >= 0; j--) {
+ if (xNodes[j] == xmlNode)
+ break;
+ }
+
+ if (updateScrollbar) {
+ this.sb.setPosition(j / (xNodes.length - this.nodeCount), true);
+ }
+
+ var sNodes = {}, selNodes = this.getSelection();
+ for (var i = selNodes.length - 1; i >= 0; i--) {
+ sNodes[selNodes[i].getAttribute(jpf.XMLDatabase.xmlIdTag)] = true;
+ this.__deselect(document.getElementById(selNodes[i]
+ .getAttribute(jpf.XMLDatabase.xmlIdTag) + "|" + this.uniqueId));
+ }
+
+ var nodes = this.oInt.childNodes;
+ for(var id, i = 0; i < nodes.length; i++) {
+ if (nodes[i].nodeType != 1) continue;
+ xmlNode = xNodes[j++];
+
+ if (!xmlNode)
+ nodes[i].style.display = "none";
+ else {
+ nodes[i].setAttribute(jpf.XMLDatabase.htmlIdTag,
+ xmlNode.getAttribute(jpf.XMLDatabase.xmlIdTag)
+ + "|" + this.uniqueId);
+ this.__updateNode(xmlNode, nodes[i]);
+ nodes[i].style.display = "block"; // or inline
+
+ if (sNodes[xmlNode.getAttribute(jpf.XMLDatabase.xmlIdTag)])
+ this.__select(nodes[i]);
+ }
+ }
+ }
+
+ this.__updateNode = function(xmlNode, htmlNode){
+ //Update Identity (Look)
+ var elIcon = this.__getLayoutNode("Item", "icon", htmlNode);
+
+ if (elIcon) {
+ if (elIcon.nodeType == 1)
+ elIcon.style.backgroundImage = "url(" + this.iconPath
+ + this.applyRuleSetOnNode("icon", xmlNode) + ")";
+ else
+ elIcon.nodeValue = this.iconPath + this.applyRuleSetOnNode("icon", xmlNode);
+ } else {
+ var elImage = this.__getLayoutNode("Item", "image", htmlNode);//.style.backgroundImage = "url(" + this.applyRuleSetOnNode("image", xmlNode) + ")";
+ if (elImage) {
+ if (elImage.nodeType == 1)
+ elImage.style.backgroundImage = "url("
+ + this.applyRuleSetOnNode("image", xmlNode) + ")";
+ else
+ elImage.nodeValue = this.applyRuleSetOnNode("image", xmlNode);
+ }
+ }
+
+ //this.__getLayoutNode("Item", "caption", htmlNode).nodeValue = this.applyRuleSetOnNode("caption", xmlNode);
+ var elCaption = this.__getLayoutNode("Item", "caption", htmlNode);
+ if (elCaption) {
+ if (elCaption.nodeType == 1)
+ elCaption.innerHTML = this.applyRuleSetOnNode("caption", xmlNode);
+ else
+ elCaption.nodeValue = this.applyRuleSetOnNode("caption", xmlNode);
+ }
+
+ // #ifdef __WITH_CSS_BINDS
+ var cssClass = this.applyRuleSetOnNode("css", xmlNode);
+ if (cssClass || this.dynCssClasses.length) {
+ this.__setStyleClass(htmlNode, cssClass, this.dynCssClasses);
+ if (cssClass && !this.dynCssClasses.contains(cssClass))
+ this.dynCssClasses.push(cssClass);
+ }
+ // #endif
+ }
+
+ this.__moveNode = function(xmlNode, htmlNode){
+ if(!htmlNode) return;
+
+ var oPHtmlNode = htmlNode.parentNode;
+ var beforeNode = xmlNode.nextSibling
+ ? jpf.XMLDatabase.findHTMLNode(this.getNextTraverse(xmlNode), this)
+ : null;
+
+ oPHtmlNode.insertBefore(htmlNode, beforeNode);
+
+ //if(this.emptyMessage && !oPHtmlNode.childNodes.length) this.setEmpty(oPHtmlNode);
+ }
+
+ /* ***********************
+ Keyboard Support
+ ************************/
+ // #ifdef __WITH_KBSUPPORT
+
+ //Handler for a plane list
+ this.__keyHandler = function(key, ctrlKey, shiftKey, altKey){
+ if (!this.__selected) return;
+ //error after delete...
+
+ var jNode = this;
+ function selscroll(sel, scroll){
+ if (!jNode.__selected) {
+ jNode.scrollTo(scroll || sel, true);
+
+ if(ctrlKey)
+ jNode.setIndicator(sel);
+ else
+ jNode.select(sel, null, shiftKey);
+ }
+ }
+
+ switch(key){
+ case 13:
+ this.choose(this.__selected);
+ break;
+ case 32:
+ this.select(this.indicator, true);
+ break;
+ case 46:
+ //DELETE
+ if(this.disableremove) return;
+
+ this.remove(null, true);
+ break;
+ case 37:
+ //LEFT
+ var margin = jpf.compat.getBox(jpf.getStyle(this.__selected, "margin"));
+
+ if(!this.selected) return;
+ var node = this.getNextTraverseSelected(this.indicator || this.selected, false);
+ if (node) {
+ if(ctrlKey)
+ this.setIndicator(node);
+ else
+ this.select(node, null, shiftKey);
+
+ if (!this.__selected)
+ selscroll(node, this.getNextTraverse(this.lastScroll, true));
+ if (!this.__selected)
+ selscroll(node, node);
+ }
+ break;
+ case 38:
+ //UP
+ var margin = jpf.compat.getBox(jpf.getStyle(this.__selected, "margin"));
+
+ if (!this.selected && !this.indicator) return;
+
+ var hasScroll = this.oExt.scrollHeight > this.oExt.offsetHeight;
+ var items = Math.floor((this.oExt.offsetWidth
+ - (hasScroll ? 15 : 0)) / (this.__selected.offsetWidth
+ + margin[1] + margin[3]));
+ var node = this.getNextTraverseSelected(this.indicator
+ || this.selected, false, items);
+
+ if (node) {
+ if (ctrlKey)
+ this.setIndicator(node);
+ else
+ this.select(node, null, shiftKey);
+
+ if (!this.__selected)
+ selscroll(node, this.getNextTraverse(this.lastScroll, true));
+ if (!this.__selected)
+ selscroll(node, node);
+ }
+ break;
+ case 39:
+ //RIGHT
+ var margin = jpf.compat.getBox(jpf.getStyle(this.__selected, "margin"));
+
+ if (!this.selected) return;
+
+ var node = this.getNextTraverseSelected(this.indicator || this.selected, true);
+ if (node) {
+ if (ctrlKey)
+ this.setIndicator(node);
+ else
+ this.select(node, null, shiftKey);
+
+ if (!this.__selected)
+ selscroll(node, this.getNextTraverse(this.lastScroll, true));
+ if (!this.__selected)
+ selscroll(node, node);
+ }
+ break;
+ case 40:
+ //DOWN
+ var margin = jpf.compat.getBox(jpf.getStyle(this.__selected, "margin"));
+ if (!this.selected && !this.indicator) return;
+
+ var hasScroll = this.oExt.scrollHeight > this.oExt.offsetHeight;
+ var items = Math.floor((this.oExt.offsetWidth
+ - (hasScroll ? 15 : 0)) / (this.__selected.offsetWidth
+ + margin[1] + margin[3]));
+ var node = this.getNextTraverseSelected(this.indicator
+ || this.selected, true, items);
+ if (node) {
+ if (ctrlKey)
+ this.setIndicator(node);
+ else
+ this.select(node, null, shiftKey);
+
+ var s2 = this.getNextTraverseSelected(node, true, items);
+ if (s2 && !document.getElementById(s2.getAttribute(
+ jpf.XMLDatabase.xmlIdTag) + "|" + this.uniqueId)){
+ if (!this.__selected)
+ selscroll(node, this.getNextTraverse(this.lastScroll));
+ if (!this.__selected)
+ selscroll(node, node);
+ } else if(s2 == node) {
+ var nodes = this.getTraverseNodes();
+ if (!this.__selected)
+ selscroll(node, nodes[nodes.length-this.nodeCount + 1]);
+ if (!this.__selected)
+ selscroll(node, node);
+ }
+ }
+
+ //if(this.__selected.offsetTop + this.__selected.offsetHeight > this.oExt.scrollTop + this.oExt.offsetHeight - (hasScroll ? 10 : 0))
+ //this.oExt.scrollTop = this.__selected.offsetTop - this.oExt.offsetHeight + this.__selected.offsetHeight + 10 + (hasScroll ? 10 : 0);
+
+ break;
+ case 33:
+ //PGUP
+ if (!this.selected && !this.indicator) return;
+
+ var node = this.getNextTraverseSelected(this.indicator
+ || this.selected, false, this.nodeCount-1);//items*lines);
+ if (!node)
+ node = this.getFirstTraverseNode();
+
+ this.scrollTo(node, true);
+ if (node) {
+ if (ctrlKey)
+ this.setIndicator(node);
+ else
+ this.select(node, null, shiftKey);
+ }
+ break;
+ case 34:
+ //PGDN
+ if (!this.selected && !this.indicator)
+ return;
+ var node = this.getNextTraverseSelected(this.indicator
+ || this.selected, true, this.nodeCount-1);
+ if (!node)
+ node = this.getLastTraverseNode();
+
+ var xNodes = this.getTraverseNodes();
+ for (var j = xNodes.length - 1; j >= 0; j--)
+ if(xNodes[j] == node)
+ break;
+
+ if (j > xNodes.length - this.nodeCount - 1)
+ j = xNodes.length-this.nodeCount+1;
+ this.scrollTo(xNodes[j], true);
+ if (xNodes[j] != node)
+ node = xNodes[xNodes.length - 1];
+
+ if (node) {
+ if (ctrlKey)
+ this.setIndicator(node);
+ else
+ this.select(node, null, shiftKey);
+ }
+ break;
+ case 36:
+ //HOME
+ var xmlNode = this.getFirstTraverseNode();
+ this.scrollTo(xmlNode, true);
+ this.select(xmlNode, null, shiftKey);
+ //this.oInt.scrollTop = 0;
+ //Q.scrollIntoView(true);
+ break;
+ case 35:
+ //END
+ var nodes = this.getTraverseNodes(xmlNode || this.XMLRoot);//.selectNodes(this.ruleTraverse);
+ this.scrollTo(nodes[nodes.length - this.nodeCount+1], true);
+ this.select(nodes[nodes.length - 1], null, shiftKey);
+ //Q.scrollIntoView(true);
+ break;
+ default:
+ if (key == 65 && ctrlKey) {
+ this.selectAll();
+ } else if(this.bindingRules["caption"]){
+ //this should move to a onkeypress based function
+ if(!this.lookup || new Date().getTime()
+ - this.lookup.date.getTime() > 300)
+ this.lookup = {
+ str : "",
+ date : new Date()
+ };
+
+ this.lookup.str += String.fromCharCode(key);
+
+ var nodes = this.getTraverseNodes();
+ for (var i = 0; i < nodes.length; i++) {
+ if(this.applyRuleSetOnNode("caption", nodes[i])
+ .substr(0, this.lookup.str.length).toUpperCase()
+ == this.lookup.str) {
+ this.scrollTo(nodes[i], true);
+ this.select(nodes[i]);
+ return;
+ }
+ }
+
+ return;
+ }
+ break;
+ };
+
+ this.lookup = null;
+ return false;
+ }
+
+ // #endif
+
+ /* ***********************
+ DATABINDING
+ ************************/
+
+ this.nodes = [];
+
+ this.nodeCount = 0;
+ this.__add = function(xmlNode, Lid, xmlParentNode, htmlParentNode, beforeNode){
+ if (!this.oInt.childNodes.length)
+ this.nodeCount = 0;
+
+ //Check if more items should be added
+ if (this.nodeCount > 9) {//this.oInt.scrollHeight >= this.oInt.offsetHeight){
+ // || this.oInt.scrollWidth > this.oInt.offsetWidth
+ return false;
+ }
+ this.nodeCount++;
+
+ //Build Row
+ this.__getNewContext("Item");
+ var Item = this.__getLayoutNode("Item");
+ var elSelect = this.__getLayoutNode("Item", "select");
+ var elIcon = this.__getLayoutNode("Item", "icon");
+ var elImage = this.__getLayoutNode("Item", "image");
+ var elCheckbox = this.__getLayoutNode("Item", "checkbox");
+ var elCaption = this.__getLayoutNode("Item", "caption");
+
+ Item.setAttribute("id", Lid);
+
+ //elSelect.setAttribute("oncontextmenu", 'jpf.lookup(' + this.uniqueId + ').dispatchEvent("oncontextmenu", event);');
+ elSelect.setAttribute("ondblclick", 'jpf.lookup('
+ + this.uniqueId + ').choose()');
+ elSelect.setAttribute(this.itemSelectEvent || "onmousedown",
+ 'jpf.lookup(' + this.uniqueId
+ + ').select(this, event.ctrlKey, event.shiftKey)');
+ elSelect.setAttribute("onmouseover", 'jpf.lookup(' + this.uniqueId
+ + ').__setStyleClass(this, "hover");');
+ elSelect.setAttribute("onmouseout", 'jpf.lookup(' + this.uniqueId
+ + ').__setStyleClass(this, "", ["hover"]);');
+
+ //Setup Nodes Identity (Look)
+ if (elIcon) {
+ if (elIcon.nodeType == 1)
+ elIcon.setAttribute("style", "background-image:url("
+ + this.iconPath + this.applyRuleSetOnNode("icon", xmlNode) + ")");
+ else
+ elIcon.nodeValue = this.iconPath + this.applyRuleSetOnNode("icon", xmlNode);
+ } else if (elImage) {
+ if (elImage.nodeType == 1)
+ elImage.setAttribute("style", "background-image:url("
+ + this.applyRuleSetOnNode("image", xmlNode) + ")");
+ else
+ elImage.nodeValue = this.applyRuleSetOnNode("image", xmlNode);
+ }
+
+ if (elCaption)
+ jpf.XMLDatabase.setNodeValue(elCaption,
+ this.applyRuleSetOnNode("caption", xmlNode));
+
+ // #ifdef __WITH_CSS_BINDS
+ var cssClass = this.applyRuleSetOnNode("css", xmlNode);
+ if (cssClass) {
+ this.__setStyleClass(Item, cssClass);
+ if (cssClass)
+ this.dynCssClasses.push(cssClass);
+ }
+ // #endif
+
+ jpf.XMLDatabase.htmlImport(Item, htmlParentNode || this.oInt, beforeNode);
+ /*
+ if(htmlParentNode) jpf.XMLDatabase.htmlImport(Item, htmlParentNode || this.oInt, beforeNode);
+ else this.nodes.push(Item);
+ */
+ }
+
+ this.__fill = function(){
+ //jpf.XMLDatabase.htmlImport(this.nodes, this.oInt);
+ //this.nodes.length = 0;
+ //alert((this == prevMainBG) + ":" + this.oInt.outerHTML + ":" + this.XMLRoot.xml);
+
+ var jmlNode = this;
+ this.lastScroll = this.getFirstTraverseNode();
+ if (this.sb)
+ this.sb.attach(this.oExt, this.nodeCount,
+ this.getTraverseNodes().length, function(time, perc){
+ var nodes = jmlNode.getTraverseNodes();
+ jmlNode.scrollTo(nodes[Math.round((nodes.length-jmlNode.nodeCount+1)*perc)]);
+ });
+ }
+
+ /* ***********************
+ SELECT
+ ************************/
+
+ this.__calcSelectRange = function(xmlStartNode, xmlEndNode){
+ var r = [], loopNode = xmlStartNode;
+ while (loopNode && loopNode != xmlEndNode.nextSibling) {
+ if (this.applyRuleSetOnNode("select", loopNode, ".") !== false)
+ r.push(loopNode);
+ loopNode = loopNode.nextSibling;
+ }
+
+ if (r[r.length-1] != xmlEndNode) {
+ var r = [], loopNode = xmlStartNode;
+ while (loopNode && loopNode != xmlEndNode.previousSibling) {
+ if (this.applyRuleSetOnNode("select", loopNode, ".") !== false)
+ r.push(loopNode);
+ loopNode = loopNode.previousSibling;
+ };
+ }
+
+ return r;
+ }
+
+ this.__selectDefault = function(XMLRoot){
+ this.select(this.getTraverseNodes()[0]);
+ }
+
+ /**
+ * @inherits jpf.MultiSelect
+ * @inherits jpf.Cache
+ * @inherits jpf.Presentation
+ * @inherits jpf.DataBinding
+ */
+ this.inherit(jpf.MultiSelect, jpf.Cache, jpf.Presentation, jpf.DataBinding);
+
+ this.loadInlineData = function(x){
+ var hasIcon, strData = [], nodes = x.childNodes;
+
+ for (var i = nodes.length - 1; i >= 0; i--) {
+ if (nodes[i].nodeType != 1)
+ continue;
+ if (nodes[i][jpf.TAGNAME] != "item")
+ continue;
+
+ hasIcon = nodes[i].getAttribute("icon") || "icoAnything.gif";
+ strData.unshift("<item " + (hasIcon ? "icon='" + hasIcon + "'" : "")
+ + " value='" + (nodes[i].getAttributeNode("value")
+ ? nodes[i].getAttribute("value")
+ : nodes[i].firstChild.nodeValue) + "'>"
+ + nodes[i].firstChild.nodeValue + "</item>");
+ nodes[i].parentNode.removeChild(nodes[i]);
+ }
+
+ if (strData.length) {
+ var sNode = new jpf.SmartBinding(null, jpf.getObject("XMLDOM",
+ "<smartbindings xmlns='" + jpf.ns.jpf
+ + "'><bindings><caption select='text()' />"
+ + (hasIcon ? "<Icon select='@icon'/>" : "")
+ + "<value select='@value'/><traverse select='item' /></bindings><model><items>"
+ + strData.join("") + "</items></model></smartbindings>")
+ .documentElement);
+ jpf.JMLParser.addToSbStack(this.uniqueId, sNode);
+ }
+
+ if (x.childNodes.length)
+ jpf.JMLParser.parseChildren(x, null, this);
+ }
+
+ this.loadFillData = function(str){
+ var parts = str.split("-");
+ var start = parseInt(parts[0]);
+ var end = parseInt(parts[1]);
+
+ strData = [];
+ for (var i = start; i < end + 1; i++) {
+ strData.push("<item>" + (i + "").pad(Math.max(parts[0].length,
+ parts[1].length), "0") + "</item>");
+ }
+
+ if (strData.length) {
+ var sNode = new jpf.SmartBinding(null, jpf.getObject("XMLDOM",
+ "<smartbindings xmlns='" + jpf.ns.jpf
+ + "'><bindings><caption select='text()' /><value select='text()'/><traverse select='item' /></bindings><model><items>"
+ + strData.join("") + "</items></model></smartbindings>")
+ .documentElement);
+ jpf.JMLParser.addToSbStack(this.uniqueId, sNode);
+ }
+ }
+}
+
+// #endif
View
661 components/_base/baselist.js
@@ -0,0 +1,661 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
+ */
+
+// #ifdef __JBASELIST || __INC_ALL
+// #define __WITH_CACHE 1
+// #define __WITH_DATABINDING 1
+// #define __WITH_MULTISELECT 1
+// #define __WITH_PRESENTATION 1
+
+/**
+ * Baseclass of a List component
+ *
+ * @constructor
+ * @baseclass
+ * @author Ruben Daniels
+ * @version %I%, %G%
+ * @since 0.8
+ */
+jpf.BaseList = function(){
+ /* ********************************************************************
+ PROPERTIES
+ *********************************************************************/
+
+ //Options
+ //#ifdef __WITH_VALIDATION || __WITH_XFORMS
+ this.inherit(jpf.Validation); /** @inherits jpf.Validation */
+ //#endif
+ //#ifdef __WITH_XFORMS
+ this.inherit(jpf.XForms); /** @inherits jpf.XForms */
+ //#endif
+ this.focussable = true; // This object can get the focus
+ this.multiselect = true; // Initially Disable MultiSelect
+
+ // #ifdef __WITH_CSS_BINDS
+ this.dynCssClasses = [];
+ // #endif
+
+ this.__deInitNode = function(xmlNode, htmlNode){
+ if (!htmlNode) return;
+
+ //Remove htmlNodes from tree
+ htmlNode.parentNode.removeChild(htmlNode);
+ }
+
+ this.__updateNode = function(xmlNode, htmlNode, noModifier){
+ //Update Identity (Look)
+ var elIcon = this.__getLayoutNode("Item", "icon", htmlNode);
+
+ if (elIcon) {
+ if (elIcon.nodeType == 1)
+ elIcon.style.backgroundImage = "url(" + this.iconPath
+ + this.applyRuleSetOnNode("icon", xmlNode) + ")";
+ else
+ elIcon.nodeValue = this.iconPath
+ + this.applyRuleSetOnNode("icon", xmlNode);
+ } else {
+ var elImage = this.__getLayoutNode("Item", "image", htmlNode);//.style.backgroundImage = "url(" + this.applyRuleSetOnNode("image", xmlNode) + ")";
+ if (elImage) {
+ if (elImage.nodeType == 1)
+ elImage.style.backgroundImage = "url(" + this.mediaPath
+ + this.applyRuleSetOnNode("image", xmlNode) + ")";
+ else
+ elImage.nodeValue = this.mediaPath
+ + this.applyRuleSetOnNode("image", xmlNode);
+ }
+ }
+
+ //this.__getLayoutNode("Item", "caption", htmlNode).nodeValue = this.applyRuleSetOnNode("Caption", xmlNode);
+ var elCaption = this.__getLayoutNode("Item", "caption", htmlNode);
+ if (elCaption) {
+ if (elCaption.nodeType == 1)
+ elCaption.innerHTML = this.applyRuleSetOnNode("caption", xmlNode);
+ else
+ elCaption.nodeValue = this.applyRuleSetOnNode("caption", xmlNode);
+ }
+
+ htmlNode.title = this.applyRuleSetOnNode("title", xmlNode) || "";
+
+ // #ifdef __WITH_CSS_BINDS
+ var cssClass = this.applyRuleSetOnNode("css", xmlNode);
+ if (cssClass || this.dynCssClasses.length) {
+ this.__setStyleClass(htmlNode, cssClass, this.dynCssClasses);
+ if (cssClass && !this.dynCssClasses.contains(cssClass))
+ this.dynCssClasses.push(cssClass);
+ }
+ // #endif
+
+ if (!noModifier && this.__updateModifier)
+ this.__updateModifier(xmlNode, htmlNode);
+ }
+
+ this.__moveNode = function(xmlNode, htmlNode){
+ if (!htmlNode) return;
+
+ var oPHtmlNode = htmlNode.parentNode;
+ var beforeNode = xmlNode.nextSibling
+ ? jpf.XMLDatabase.findHTMLNode(this.getNextTraverse(xmlNode), this)
+ : null;
+
+ oPHtmlNode.insertBefore(htmlNode, beforeNode);
+
+ //if(this.emptyMessage && !oPHtmlNode.childNodes.length) this.setEmpty(oPHtmlNode);
+ }
+
+ /* ***********************
+ Keyboard Support
+ ************************/
+ // #ifdef __WITH_KBSUPPORT
+
+ //Handler for a plane list
+ /**
+ * @todo something goes wrong when selecting using space, doing mode="check"
+ */
+ this.__keyHandler = function(key, ctrlKey, shiftKey, altKey){
+ if (!this.__selected) return;
+ //error after delete...
+
+ switch (key) {
+ case 13:
+ this.select(this.indicator, true);
+ this.choose(this.__selected);
+ break;
+ case 32:
+ this.select(this.indicator, true);
+ break;
+ case 109:
+ case 46:
+ //DELETE
+ if (this.disableremove) return;
+
+ this.remove(null, this.mode != "check");
+ break;
+ case 37:
+ //LEFT
+ var margin = jpf.compat.getBox(jpf.getStyle(this.__selected, "margin"));
+
+ if (!this.selected && !this.indicator) return;
+
+ var node = this.getNextTraverseSelected(this.indicator || this.selected, false);
+ if (node) {
+ if (ctrlKey || this.ctrlSelect)
+ this.setIndicator(node);
+ else
+ this.select(node, null, shiftKey);
+ }
+
+ if (this.__selected.offsetTop < this.oExt.scrollTop)
+ this.oExt.scrollTop = this.__selected.offsetTop - margin[0];
+ break;
+ case 38:
+ //UP
+ var margin = jpf.compat.getBox(jpf.getStyle(this.__selected, "margin"));
+
+ if (!this.selected && !this.indicator)
+ return;
+
+ var hasScroll = this.oExt.scrollHeight > this.oExt.offsetHeight;
+ var items = Math.floor((this.oExt.offsetWidth
+ - (hasScroll ? 15 : 0)) / (this.__selected.offsetWidth
+ + margin[1] + margin[3]));
+ var node = this.getNextTraverseSelected(this.indicator
+ || this.selected, false, items);
+ if (node) {
+ if (ctrlKey || this.ctrlSelect)
+ this.setIndicator(node);
+ else
+ this.select(node, null, shiftKey);
+ }
+
+ if (this.__selected.offsetTop < this.oExt.scrollTop)
+ this.oExt.scrollTop = this.__selected.offsetTop - margin[0];
+ break;
+ case 39:
+ //RIGHT
+ var margin = jpf.compat.getBox(jpf.getStyle(this.__selected, "margin"));
+
+ if (!this.selected && !this.indicator) return;
+
+ var node = this.getNextTraverseSelected(this.indicator || this.selected, true);
+ if (node) {
+ if (ctrlKey || this.ctrlSelect)
+ this.setIndicator(node);
+ else
+ this.select(node, null, shiftKey);
+ }
+
+ if (this.__selected.offsetTop + this.__selected.offsetHeight
+ > this.oExt.scrollTop + this.oExt.offsetHeight)
+ this.oExt.scrollTop = this.__selected.offsetTop
+ - this.oExt.offsetHeight + this.__selected.offsetHeight
+ + margin[0];
+
+ break;
+ case 40:
+ //DOWN
+ var margin = jpf.compat.getBox(jpf.getStyle(this.__selected, "margin"));
+
+ if (!this.selected && !this.indicator) return;
+
+ var hasScroll = this.oExt.scrollHeight > this.oExt.offsetHeight;
+ var items = Math.floor((this.oExt.offsetWidth
+ - (hasScroll ? 15 : 0)) / (this.__selected.offsetWidth
+ + margin[1] + margin[3]));
+ var node = this.getNextTraverseSelected(this.indicator
+ || this.selected, true, items);
+ if (node) {
+ if (ctrlKey || this.ctrlSelect)
+ this.setIndicator(node);
+ else
+ this.select(node, null, shiftKey);
+ }
+
+ if (this.__selected.offsetTop + this.__selected.offsetHeight
+ > this.oExt.scrollTop + this.oExt.offsetHeight - (hasScroll ? 10 : 0))
+ this.oExt.scrollTop = this.__selected.offsetTop
+ - this.oExt.offsetHeight + this.__selected.offsetHeight
+ + 10 + (hasScroll ? 10 : 0);
+
+ break;
+ case 33:
+ //PGUP
+ var margin = jpf.compat.getBox(jpf.getStyle(this.__selected, "margin"));
+
+ if (!this.selected && !this.indicator) return;
+
+ var hasScrollY = this.oExt.scrollHeight > this.oExt.offsetHeight;
+ var hasScrollX = this.oExt.scrollWidth > this.oExt.offsetWidth;
+ var items = Math.floor((this.oExt.offsetWidth
+ - (hasScrollY ? 15 : 0)) / (this.__selected.offsetWidth
+ + margin[1] + margin[3]));
+ var lines = Math.floor((this.oExt.offsetHeight
+ - (hasScrollX ? 15 : 0)) / (this.__selected.offsetHeight
+ + margin[0] + margin[2]));
+ var node = this.getNextTraverseSelected(this.indicator
+ || this.selected, false, items*lines);
+ if (!node)
+ node = this.getFirstTraverseNode();
+ if (node) {
+ if (ctrlKey || this.ctrlSelect)
+ this.setIndicator(node);
+ else
+ this.select(node, null, shiftKey);
+ }
+
+ if (this.__selected.offsetTop < this.oExt.scrollTop)
+ this.oExt.scrollTop = this.__selected.offsetTop - margin[0];
+ break;
+ case 34:
+ //PGDN
+ var margin = jpf.compat.getBox(jpf.getStyle(this.__selected, "margin"));
+
+ if(!this.selected && !this.indicator) return;
+
+ var hasScrollY = this.oExt.scrollHeight > this.oExt.offsetHeight;
+ var hasScrollX = this.oExt.scrollWidth > this.oExt.offsetWidth;
+ var items = Math.floor((this.oExt.offsetWidth - (hasScrollY ? 15 : 0))
+ / (this.__selected.offsetWidth + margin[1] + margin[3]));
+ var lines = Math.floor((this.oExt.offsetHeight - (hasScrollX ? 15 : 0))
+ / (this.__selected.offsetHeight + margin[0] + margin[2]));
+ var node = this.getNextTraverseSelected(this.indicator
+ || this.selected, true, items * lines);
+ if (!node)
+ node = this.getLastTraverseNode();
+ if (node) {
+ if (ctrlKey || this.ctrlSelect)
+ this.setIndicator(node);
+ else
+ this.select(node, null, shiftKey);
+ }
+
+ if (this.__selected.offsetTop + this.__selected.offsetHeight
+ > this.oExt.scrollTop + this.oExt.offsetHeight - (hasScrollY ? 10 : 0))
+ this.oExt.scrollTop = this.__selected.offsetTop
+ - this.oExt.offsetHeight + this.__selected.offsetHeight
+ + 10 + (hasScrollY ? 10 : 0);
+ break;
+ case 36:
+ //HOME
+ this.select(this.getFirstTraverseNode(), false, shiftKey);
+ this.oInt.scrollTop = 0;
+ //Q.scrollIntoView(true);
+ break;
+ case 35:
+ //END
+ this.select(this.getLastTraverseNode(), false, shiftKey);
+ this.oInt.scrollTop = this.oInt.scrollHeight;
+ //Q.scrollIntoView(true);
+ break;
+ case 107:
+ //+
+ if (this.more)
+ this.startMore();
+ break;
+ default:
+ if (key == 65 && ctrlKey) {
+ this.selectAll();
+ } else if (this.bindingRules["caption"]) {
+ if (!this.XMLRoot) return;
+
+ //this should move to a onkeypress based function
+ if (!this.lookup || new Date().getTime()
+ - this.lookup.date.getTime() > 300)
+ this.lookup = {
+ str : "",
+ date : new Date()
+ };
+
+ this.lookup.str += String.fromCharCode(key);
+
+ var nodes = this.getTraverseNodes();
+ for (var v, i = 0; i < nodes.length; i++) {
+ v = this.applyRuleSetOnNode("caption", nodes[i]);
+ if (v && v.substr(0, this.lookup.str.length)
+ .toUpperCase() == this.lookup.str) {
+ if (!this.isSelected(nodes[i]))
+ this.select(nodes[i]);
+ if (this.__selected)
+ this.oInt.scrollTop = this.__selected.offsetTop
+ - (this.oInt.offsetHeight
+ - this.__selected.offsetHeight) / 2;
+ return;
+ }
+ }
+ return;
+ }
+ break;
+ };
+
+ this.lookup = null;
+ return false;
+ }
+
+ // #endif
+
+ /* ***********************
+ DATABINDING
+ ************************/
+
+ this.nodes = [];
+
+ this.__add = function(xmlNode, Lid, xmlParentNode, htmlParentNode, beforeNode){
+ //Build Row
+ this.__getNewContext("Item");
+ var Item = this.__getLayoutNode("Item");
+ var elSelect = this.__getLayoutNode("Item", "select");
+ var elIcon = this.__getLayoutNode("Item", "icon");
+ var elImage = this.__getLayoutNode("Item", "image");
+ var elCheckbox = this.__getLayoutNode("Item", "checkbox");
+ var elCaption = this.__getLayoutNode("Item", "caption");
+
+ Item.setAttribute("id", Lid);
+
+ //elSelect.setAttribute("oncontextmenu", 'jpf.lookup(' + this.uniqueId + ').dispatchEvent("oncontextmenu", event);');
+ elSelect.setAttribute("onmouseover", 'jpf.lookup(' + this.uniqueId
+ + ').__setStyleClass(this, "hover");');
+ elSelect.setAttribute("onmouseout", 'jpf.lookup(' + this.uniqueId
+ + ').__setStyleClass(this, "", ["hover"]);');
+
+ if (this.hasFeature(__RENAME__)) {
+ elSelect.setAttribute("ondblclick", 'var o = jpf.lookup(' + this.uniqueId + '); ' +
+ // #ifdef __WITH_RENAME
+ 'o.cancelRename();' +
+ // #endif
+ ' o.choose()');
+ elSelect.setAttribute(this.itemSelectEvent || "onmousedown",
+ 'var o = jpf.lookup(' + this.uniqueId
+ + ');if(!o.renaming && o.isFocussed() && jpf.XMLDatabase.isChildOf(o.__selected, this, true) && o.selected) this.dorename = true;o.select(this, event.ctrlKey, event.shiftKey)');
+ elSelect.setAttribute("onmouseup", 'if(this.dorename) jpf.lookup('
+ + this.uniqueId + ').startDelayedRename(event); this.dorename = false;');
+ } else {
+ elSelect.setAttribute("ondblclick", 'var o = jpf.lookup('
+ + this.uniqueId + '); o.choose()');
+ elSelect.setAttribute(this.itemSelectEvent
+ || "onmousedown", 'var o = jpf.lookup(' + this.uniqueId
+ + '); o.select(this, event.ctrlKey, event.shiftKey)');
+ }
+
+ //Setup Nodes Identity (Look)
+ if (elIcon) {
+ if (elIcon.nodeType == 1)
+ elIcon.setAttribute("style", "background-image:url("
+ + this.iconPath + this.applyRuleSetOnNode("icon", xmlNode)
+ + ")");
+ else
+ elIcon.nodeValue = this.iconPath
+ + this.applyRuleSetOnNode("icon", xmlNode);
+ } else if(elImage) {
+ if (elImage.nodeType == 1)
+ elImage.setAttribute("style", "background-image:url("
+ + this.mediaPath + this.applyRuleSetOnNode("image", xmlNode)
+ + ")");
+ else {
+ if (jpf.isSafariOld) { //HAAAAACCCCKKKKKK!!! this should be changed... blrgh..
+ var p = elImage.ownerElement.parentNode;
+ var img = p.appendChild(p.ownerDocument.createElement("img"));
+ img.setAttribute("src", this.mediaPath
+ + this.applyRuleSetOnNode("image", xmlNode));
+ } else {
+ elImage.nodeValue = this.mediaPath
+ + this.applyRuleSetOnNode("image", xmlNode);
+ }
+ }
+ }
+
+ if (elCaption) {
+ jpf.XMLDatabase.setNodeValue(elCaption,
+ this.applyRuleSetOnNode("caption", xmlNode));
+
+ //#ifdef __WITH_JML_BINDINGS
+ if (this.lastRule.getAttribute("parse") == "jml")
+ this.doJmlParsing = true;
+ //#endif
+ }
+ Item.setAttribute("title", this.applyRuleSetOnNode("title", xmlNode) || "");
+
+ // #ifdef __WITH_CSS_BINDS
+ var cssClass = this.applyRuleSetOnNode("css", xmlNode);
+ if (cssClass) {
+ this.__setStyleClass(Item, cssClass);
+ if (cssClass)
+ this.dynCssClasses.push(cssClass);
+ }
+ // #endif
+
+ if (this.__addModifier)
+ this.__addModifier(xmlNode, Item);
+
+ if (htmlParentNode)
+ jpf.XMLDatabase.htmlImport(Item, htmlParentNode, beforeNode);
+ else
+ this.nodes.push(Item);
+ }
+
+ this.__fill = function(){
+ if (this.more && !this.moreItem) {
+ this.__getNewContext("Item");
+ var Item = this.__getLayoutNode("Item");
+ var elCaption = this.__getLayoutNode("Item", "caption");
+ var elSelect = this.__getLayoutNode("Item", "select");
+
+ Item.setAttribute("class", "more");
+ elSelect.setAttribute("onmousedown", 'jpf.lookup(' + this.uniqueId
+ + ').__setStyleClass(this, "more_down");');
+ elSelect.setAttribute("onmouseout", 'jpf.lookup(' + this.uniqueId
+ + ').__setStyleClass(this, "", ["more_down"]);');
+ elSelect.setAttribute("onmouseup", 'jpf.lookup(' + this.uniqueId
+ + ').startMore(this)');
+
+ if (elCaption)
+ jpf.XMLDatabase.setNodeValue(elCaption,
+ this.jml.getAttribute("more").match(/Caption:(.*)(;|$)/)[1]);
+ this.nodes.push(Item);
+ }
+
+ jpf.XMLDatabase.htmlImport(this.nodes, this.oInt);
+ this.nodes.length = 0;
+
+ //#ifdef __WITH_JML_BINDINGS
+ if (this.doJmlParsing) {
+ var x = document.createElement("div");
+ while (this.oExt.childNodes.length)
+ x.appendChild(this.oExt.childNodes[0]);
+ Application.loadSubNode(x, this.oExt, null, null, true);
+ }
+ //#endif
+
+ if (this.more && !this.moreItem) {
+ this.moreItem = this.oInt.lastChild;
+ }
+ }
+
+ var lastAddedMore;
+ this.startMore = function(o){
+ this.__setStyleClass(o, "", ["more_down"]);
+
+ var addedNode = this.add();
+ this.select(addedNode, null, null, null, null, true);
+ this.oInt.appendChild(this.moreItem);
+
+ var undoLastAction = function(){
+ this.getActionTracker().undo(this.autoselect ? 2 : 1);
+
+ this.removeEventListener("oncancelrename", undoLastAction);
+ this.removeEventListener("onbeforerename", removeSetRenameEvent);
+ this.removeEventListener("onafterrename", afterRename);
+ }
+ var afterRename = function(){
+ //this.select(addedNode);
+ this.removeEventListener("onafterrename", afterRename);
+ };
+ var removeSetRenameEvent = function(e){
+ this.removeEventListener("oncancelrename", undoLastAction);
+ this.removeEventListener("onbeforerename", removeSetRenameEvent);
+
+ //There is already a choice with the same value
+ var xmlNode = this.findXmlNodeByValue(e.arguments[1]);
+ if (xmlNode || !e.arguments[1]) {
+ this.getActionTracker().undo(this.autoselect ? 2 : 1);
+ if (!this.isSelected(xmlNode))
+ this.select(xmlNode);
+ this.removeEventListener("onafterrename", afterRename);
+ return false;
+ }
+ };
+
+ this.addEventListener("oncancelrename", undoLastAction);
+ this.addEventListener("onbeforerename", removeSetRenameEvent);
+ this.addEventListener("onafterrename", afterRename);
+
+ if (this.mode == "radio") {
+ this.moreItem.style.display = "none";
+ if (lastAddedMore)
+ this.removeEventListener("onxmlupdate", lastAddedMore);
+ lastAddedMore = function(){
+ this.moreItem.style.display = addedNode.parentNode
+ ? "none"
+ : "block";
+ };
+ this.addEventListener("onxmlupdate", lastAddedMore);
+ }
+
+ this.startDelayedRename({}, 1);
+ }
+
+ /* ***********************
+ SELECT
+ ************************/
+
+ this.__calcSelectRange = function(xmlStartNode, xmlEndNode){
+ var r = [];
+ var nodes = this.getTraverseNodes();
+ for (var f = false, i = 0; i < nodes.length; i++) {
+ if (nodes[i] == xmlStartNode)
+ f = true;
+ if (f)
+ r.push(nodes[i]);
+ if (nodes[i] == xmlEndNode)
+ f = false;
+ }
+
+ if (!r.length || f) {
+ r = [];
+ for (var f = false, i = nodes.length - 1; i >= 0; i--) {
+ if (nodes[i] == xmlStartNode)
+ f = true;
+ if (f)
+ r.push(nodes[i]);
+ if (nodes[i] == xmlEndNode)
+ f = false;
+ }
+ }
+
+ return r;
+ }
+
+ this.__selectDefault = function(XMLRoot){
+ this.select(this.getTraverseNodes()[0]);
+ }
+
+ /**
+ * @inherits jpf.MultiSelect
+ * @inherits jpf.Cache
+ * @inherits jpf.Presentation
+ * @inherits jpf.DataBinding
+ */
+ this.inherit(jpf.MultiSelect, jpf.Cache, jpf.Presentation, jpf.DataBinding);
+
+ //Added XForms support
+
+ /**
+ * @private
+ *
+ * @allowchild item, choices
+ * @define item
+ * @attribute value
+ * @attribute icon
+ * @attribute image
+ * @allowchild [cdata], label
+ * @define choices
+ * @allowchild item
+ */
+ this.loadInlineData = function(x){
+ var value, caption, hasImage, hasIcon, strData = [],
+ nodes = ($xmlns(x, "choices", jpf.ns.jpf)[0] || x).childNodes;
+
+ for (var i = nodes.length - 1; i >= 0; i--) {
+ if (nodes[i].nodeType != 1) continue;
+ if (nodes[i][jpf.TAGNAME] != "item") continue;
+
+ hasIcon = nodes[i].getAttribute("icon") || "icoAnything.gif";
+ hasImage = nodes[i].getAttribute("image");
+ caption = jpf.getXmlValue(nodes[i], "label/text()|text()");// || (nodes[i].firstChild ? nodes[i].firstChild.nodeValue : "")
+ value = jpf.getXmlValue(nodes[i], "value/text()|@value|text()")
+ .replace(/'/g, ""); // hack
+
+ strData.unshift(
+ "<item " +
+ (hasImage ? "image='" + hasImage + "'" : (hasIcon ? "icon='" + hasIcon + "'" : "")) +
+ " value='" + value + "'>" + caption + "</item>");
+
+ nodes[i].parentNode.removeChild(nodes[i]);
+ }
+
+ if(strData.length){
+ var sNode = new jpf.SmartBinding(null, jpf.getObject("XMLDOM",
+ "<smartbindings xmlns='" + jpf.ns.jpf
+ + "'><bindings><caption select='text()' />"
+ + (hasImage ? "<image select='@image' />" : (hasIcon ? "<icon select='@icon'/>" : ""))
+ + "<value select='@value'/><traverse select='item' /></bindings><model><items>"
+ + strData.join("") + "</items></model></smartbindings>")
+ .documentElement);
+ jpf.JMLParser.addToSbStack(this.uniqueId, sNode);
+ }
+
+ if (x.childNodes.length)
+ jpf.JMLParser.parseChildren(x, null, this);
+ }
+
+ this.loadFillData = function(str){
+ var parts = str.split("-");
+ var start = parseInt(parts[0]);
+ var end = parseInt(parts[1]);
+
+ strData = [];
+ for (var i = start; i < end + 1; i++) {
+ strData.push("<item>" + (i + "")
+ .pad(Math.max(parts[0].length, parts[1].length), "0")
+ + "</item>");
+ }
+
+ if (strData.length) {
+ var sNode = new jpf.SmartBinding(null,
+ jpf.getObject("XMLDOM", "<smartbindings xmlns='"
+ + jpf.ns.jpf
+ + "'><bindings><caption select='text()' /><value select='text()'/><traverse select='item' /></bindings><model><items>"
+ + strData.join("") + "</items></model></smartbindings>")
+ .documentElement);
+ jpf.JMLParser.addToSbStack(this.uniqueId, sNode);
+ }
+ }
+}
+
+// #endif
View
111 components/_base/basesimple.js
@@ -0,0 +1,111 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
+ */
+// #ifdef __JBASESIMPLE || __INC_ALL
+// #define __WITH_PRESENTATION 1
+
+/**
+ * Baseclass of a Simple component
+ *
+ * @constructor
+ * @baseclass
+ * @author Ruben Daniels
+ * @version %I%, %G%
+ * @since 0.8
+ */
+jpf.BaseSimple = function(){
+ /* ***********************
+ Inheritance
+ ************************/
+ this.inherit(jpf.Presentation); /** @inherits jpf.Presentation */
+ // #ifdef __WITH_DATABINDING
+ this.inherit(jpf.DataBinding); /** @inherits jpf.DataBinding */
+ // #endif
+
+ /* ********************************************************************
+ PUBLIC METHODS
+ *********************************************************************/
+ this.getValue = function(){
+ return this.value;
+ }
+
+ /* ***********************
+ DRAGDROP
+ ************************/
+ // #ifdef __WITH_DRAGDROP
+
+ this.__showDragIndicator = function(sel, e){
+ var x = e.offsetX + 22;
+ var y = e.offsetY;
+
+ this.oDrag.startX = x;
+ this.oDrag.startY = y;
+
+
+ document.body.appendChild(this.oDrag);
+ //this.oDrag.getElementsByTagName("DIV")[0].innerHTML = this.selected.innerHTML;
+ //this.oDrag.getElementsByTagName("IMG")[0].src = this.selected.parentNode.parentNode.childNodes[1].firstChild.src;
+ var oInt = this.__getLayoutNode("Main", "caption", this.oDrag);
+ if (oInt.nodeType != 1)
+ oInt = oInt.parentNode;
+
+ oInt.innerHTML = this.applyRuleSetOnNode("caption", this.XMLRoot) || "";
+
+ return this.oDrag;
+ }
+
+ this.__hideDragIndicator = function(){
+ this.oDrag.style.display = "none";
+ }
+
+ this.__moveDragIndicator = function(e){
+ this.oDrag.style.left = (e.clientX - this.oDrag.startX
+ + document.documentElement.scrollLeft) + "px";
+ this.oDrag.style.top = (e.clientY - this.oDrag.startY
+ + document.documentElement.scrollTop) + "px";
+ }
+
+ this.__initDragDrop = function(){
+ this.oDrag = document.body.appendChild(this.oExt.cloneNode(true));
+
+ this.oDrag.style.zIndex = 1000000;
+ this.oDrag.style.position = "absolute";
+ this.oDrag.style.cursor = "default";
+ this.oDrag.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=50)";
+ this.oDrag.style.MozOpacity = 0.5;
+ this.oDrag.style.opacity = 0.5;
+ this.oDrag.style.display = "none";
+ }
+
+ this.__dragout = this.__dragover = this.__dragdrop = function(){};
+
+ this.inherit(jpf.DragDrop); /** @inherits jpf.DragDrop */
+ // #endif
+
+ /* *********
+ INIT
+ **********/
+ this.inherit(jpf.JmlNode); /** @inherits jpf.JmlNode */
+ this.setFormEl = function(formEl){
+ this.formEl = formEl;
+ }
+}
+
+//#endif
View
479 components/_base/basetab.js
@@ -0,0 +1,479 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
+ */
+
+// #ifdef __JBASETAB || __INC_ALL
+// #define __WITH_PRESENTATION 1
+
+/**
+ * Baseclass of a Paged component
+ *
+ * @constructor
+ * @baseclass
+ * @allowchild page
+ * @author Ruben Daniels
+ * @version %I%, %G%
+ * @since 0.8
+ */
+jpf.BaseTab = function(){
+ /* ********************************************************************
+ PROPERTIES
+ *********************************************************************/
+
+ this.activePage = -1;
+ this.isPaged = true;
+ this.focussable = true;
+ var lastpages = [], pages = [], pageLUT = {};
+
+ /* ********************************************************************
+ PUBLIC METHODS
+ *********************************************************************/
+
+ this.setActiveTab = function(active){
+ return this.setProperty("activepage", active);
+ }
+
+ this.__setActiveTab = function(active, no_event){
+ if (typeof active == "string")
+ active = pageLUT[active] || parseInt(active);
+ if (!active)
+ active = 0;
+
+ if (!no_event && this.dispatchEvent("onbeforeswitch", {
+ pageId : active,
+ page : pages[active]
+ }) === false) {
+ if (this.hideLoader)
+ this.hideLoader();
+ return false;
+ }
+ if (this.switchType == "hide-all" && (jpf.hasDeskRun || jpf.hasWebRun))
+ DeskRun.hideAll();
+ if (!pages[active])
+ return false;
+
+ // if we have a fake-page structure, only update the tabs visiblity when active==0
+ if (this.activePage > -1)
+ pages[this.activePage].deactivate(pages[active].fake);
+ pages[active].activate();
+
+ this.activePage = this.activepage = active; //please fix to to use this.activepage... this is confusing
+
+ if (jpf.layoutServer)
+ jpf.layoutServer.forceResize(pages[active].oInt);
+
+ // #ifdef __DESKRUN
+ if (jpf.hasDeskRun || jpf.hasWebRun) {
+ if (this.switchType == "hide-all")
+ DeskRun.showAll();
+ else
+ DeskRun.fixShow();
+ }
+ // #endif
+
+ if (this.hideLoader) {
+ if (pages[active].isRendered)
+ this.hideLoader();
+ else
+ nextpage.addEventListener("onafterrender", function(){
+ this.parentNode.hideLoader();
+ });
+ }
+
+ if (!no_event) {
+ if (pages[active].isRendered)
+ this.dispatchEvent("onafterswitch", {
+ pageId : active,
+ page : pages[active]
+ });
+ else
+ pages[active].addEventListener("onafterrender", function(){
+ this.parentNode.dispatchEvent("onafterswitch", {
+ pageId : active,
+ page : pages[active]
+ });
+ });
+ }
+
+ return true;
+ }
+
+ this.__supportedProperties = ["activepage"];
+ this.__handlePropSet = function(prop, value, reqValue){
+ if (prop == "activepage")
+ return this.__setActiveTab(value);
+ }
+
+ this.getPages = function(){
+ return pages;
+ };
+
+ this.getPage = function(id){
+ return pages[id || id === 0 ? id : this.activePage];
+ };
+
+ this.getPageName = function(id){
+ return pages[(id || id === 0)
+ ? id
+ : this.activePage].jml.getAttribute("name");
+ };
+
+ this.getPageId = function(name){
+ return pageLUT[name];
+ };
+
+ function forpages(feat){
+ for (var i = 0; i < pages.length; i++)
+ pages[i][feat]();
+ }
+
+ /* ***********************
+ DISABLING
+ ************************/
+
+ this.__enable = function(){
+ forpages("enable");
+ }
+
+ this.__disable = function(){
+ forpages("disable");
+ }
+
+ /* ********************************************************************
+ PRIVATE METHODS
+ *********************************************************************/
+
+ this.addPage = function(xmlNode, userfunc){
+ var id = pages.push(new jpf.TabPage(xmlNode, this)) - 1;
+ if (pages[id].jml.getAttribute("name"))
+ pageLUT[pages[id].jml.getAttribute("name")] = id;
+ pages[id].draw(this.hasButtons, id, lastpages[id]);
+ if (userfunc)
+ userfunc.call(pages[id], xmlNode);
+ return pages[id];
+ }
+
+ /**
+ * @experimental
+ */
+ this.add = function(caption){
+ var xmlNode = XMLDatabase.getXml('<j:Page caption="'
+ + caption + '" xmlns:j="http://www.javeline.net/j" />');
+ var id = pages.push(new TabPage(xmlNode, this)) - 1;
+ if (pages[id].jml.getAttribute("name"))
+ pageLUT[pages[id].jml.getAttribute("name")] = id;
+ pages[id].draw(this.hasButtons, id);
+ return pages[id];
+ }
+
+ /* ***********************
+ Keyboard Support
+ ************************/
+ // #ifdef __WITH_KBSUPPORT
+
+ //Handler for a plane list
+ this.__keyHandler = function(key, ctrlKey, shiftKey, altKey){
+ switch (key) {
+ case 9:
+ break;
+ case 13:
+ break;
+ case 32:
+ break;
+ case 37:
+ //LEFT
+ prevPage = this.activePage-1;
+ while (prevPage >= 0 && !pages[prevPage].isVisible())
+ prevPage--;
+ if (prevPage >= 0)
+ this.setActiveTab(prevPage);
+ break;
+ case 39:
+ //RIGHT
+ nextPage = this.activePage+1;
+ while (nextPage < pages.length && !pages[nextPage].isVisible())
+ nextPage++;
+ if (nextPage < pages.length)
+ this.setActiveTab(nextPage);
+ break;
+ default:
+ return;
+ }
+ //return false;
+ }
+
+ // #endif
+
+ /* ***********************
+ Other Inheritance
+ ************************/
+ this.inherit(jpf.Presentation); /** @inherits jpf.Presentation */
+
+ // #ifdef __WITH_LANG_SUPPORT || __WITH_EDITMODE
+ this.editableParts = {"Button" : [["caption", "@caption"]]};
+ // #endif
+
+ this.__drawTabs = function(userfunc){
+ if (pages.length) {
+ lastpages = pages;
+ pages = [];
+ }
+
+ var nodes = this.jml.childNodes;
+ for (var i = 0; i < nodes.length; i++) {
+ if (nodes[i].nodeType != 1) continue;
+
+ var tagName = nodes[i][jpf.TAGNAME];
+
+ if (tagName == "page")
+ this.addPage(nodes[i], userfunc);
+ //#ifdef __WITH_XFORMS
+ else if (tagName == "case" && nodes[i].getAttribute("id")) //or should this give an error?
+ jpf.NameServer.register("case", nodes[i].getAttribute("id"),
+ this.addPage(nodes[i], userfunc));
+ //#endif
+ else if (tagName == "loader")
+ this.setLoading(nodes[i]);
+ else if (this.addOther)
+ this.addOther(tagName, nodes[i]);
+ }
+
+ lastpages = null;
+
+ if (pages.length) {
+ pages[0].setFirst();
+ if (pages.length > 1)
+ pages[pages.length - 1].setLast();
+ }
+
+ if (pages.length && this.activepage == 0)
+ this.__setActiveTab(0);
+ else if (pages.length) {
+ this.activepage = 0;
+ this.__setActiveTab(0, true);
+ } else
+ jpf.JMLParser.parseChildren(this.jml, this.oExt, this);
+ }
+}
+
+/**
+ * Object representing a Page in a Paged component.
+ *
+ * @constructor
+ * @define page
+ * @allowchild {components}, {anyjml}
+ *
+ * @author Ruben Daniels
+ * @version %I%, %G%
+ * @since 0.8
+ */
+jpf.TabPage = function(JML, pJmlNode){
+ jpf.register(this, "tabPage", GUI_NODE);/** @inherits jpf.Class */
+
+ this.jml = JML;
+ this.name = this.jml.getAttribute("name");
+ this.fake = (this.jml.getAttribute("fake") == 'true');
+
+ if (this.name) jpf.setReference(this.name, this);
+ this.hasButtons = false;
+ this.pHtmlNode = pJmlNode.oPages;
+
+ // #ifdef __WITH_JMLDOM
+ this.parentNode = pJmlNode;
+ // #endif
+
+ //Hack!!! somehow loadJml parts should be done here...
+ if (this.jml.getAttribute("actiontracker")) {
+ this.__ActionTracker = self[this.jml.getAttribute("actiontracker")]
+ ? jpf.JMLParser.getActionTracker(this.jml.getAttribute("actiontracker"))
+ : jpf.setReference(this.jml.getAttribute("actiontracker"),
+ jpf.NameServer.register("actiontracker",
+ this.jml.getAttribute("actiontracker"),
+ new jpf.ActionTracker(this)));
+ }
+
+ // #ifdef __WITH_LANG_SUPPORT || __WITH_EDITMODE
+ this.editableParts = {"Button" : [["caption", "@caption"]]};
+ // #endif
+
+ this.setCaption = function(caption){
+ this.caption = caption;
+ var node = pJmlNode.__getLayoutNode("Button", "caption", this.oButton);
+
+ if(node.nodeType == 1) node.innerHTML = caption;
+ else node.nodeValue = caption;
+ //jpf.XMLDatabase.setNodeValue(, caption);
+ }
+
+ var position = 0;
+ this.setFirst = function(){
+ position = 1;
+ pJmlNode.__setStyleClass(this.oButton, "firstbtn");
+ }
+
+ this.setLast = function(){
+ position = -1;
+ pJmlNode.__setStyleClass(this.oButton, "lastbtn");
+ }
+
+ /*this.getCaption = function(caption){
+ return jpf.XMLDatabase.getNodeValue(pJmlNode.__getLayoutNode("Button", "caption", this.oButton));
+ }*/
+
+ // Actually, these two should be clearly marked as internals as they allow for total
+ // loss of any active tab, or activating more than one.
+ this.deactivate = function(fakeOther){
+ if (this.disabled) return false;
+
+ this.isActive = false
+
+ if (this.hasButtons) {
+ if (position > 0) pJmlNode.__setStyleClass(this.oButton, "", ["firstcurbtn"]);
+ pJmlNode.__setStyleClass(this.oButton, "", ["curbtn"]);
+ }
+ if (!this.fake && !fakeOther)
+ pJmlNode.__setStyleClass(this.oExt, "", ["curpage"]);
+ }
+
+ this.activate = function(){
+ if (this.disabled) return false;
+
+ if (this.hasButtons) {
+ if(position > 0) pJmlNode.__setStyleClass(this.oButton, "firstcurbtn");
+ pJmlNode.__setStyleClass(this.oButton, "curbtn");
+ }
+ if (!this.fake)
+ pJmlNode.__setStyleClass(this.oExt, "curpage");
+
+ this.isActive = true;
+
+ // #ifdef __WITH_DELAYEDRENDER
+ this.render();
+ // #endif
+ }
+
+ this.hide = function(){
+ //if(this.oButton) this.oButton.style.display = "none";
+ //this.oExt.style.display = "none";
+
+ if (this.isActive) {
+ this.deactivate();
+
+ // Try to find a next page, if any.
+ var nextPage = this.parentNode.activePage + 1;
+ while (nextPage < this.parentNode.getPages().length && !this.parentNode.getPage(nextPage).isVisible())
+ nextPage++;
+ if (nextPage == this.parentNode.getPages().length) {
+ // Try to find a previous page, if any.
+ nextPage = this.parentNode.activePage - 1;
+ while (nextPage >= 0 && this.parentNode.getPages().length
+ && !this.parentNode.getPage(nextPage).isVisible())
+ nextPage--;
+ }
+
+ if (nextPage >= 0)
+ this.parentNode.getPage(nextPage).activate();
+ }
+ }
+
+ this.show = function(){
+ //if(this.oButton) this.oButton.style.display = "block";
+ //this.oExt.style.display = "block";
+
+ if (!this.isActive) {
+ this.activate();
+ var pages = this.parentNode.getPages();
+ for (var i = 0; i < pages.length; i++) {
+ if (pages[i] == this) {
+ pJmlNode.setActiveTab(i);
+ break;
+ }
+ }
+ }
+ }
+
+ this.draw = function(drawButtons, id, lastPage){
+ this.hasButtons = drawButtons;
+ this.caption = this.jml.getAttribute("caption");
+
+ if (drawButtons) {
+ pJmlNode.__getNewContext("Button");
+ var elBtn = pJmlNode.__getLayoutNode("Button");
+ elBtn.setAttribute(pJmlNode.__getOption("Main", "select") || "onmousedown",
+ 'jpf.lookup(' + pJmlNode.uniqueId + ').setActiveTab(' + id
+ + ');if(!jpf.isSafariOld) this.onmouseout()');
+ elBtn.setAttribute("onmouseover", 'var o = jpf.lookup('
+ + pJmlNode.uniqueId + ');if(' + id
+ + ' != o.activePage) o.__setStyleClass(this, "over");');
+ elBtn.setAttribute("onmouseout", 'var o = jpf.lookup('
+ + pJmlNode.uniqueId + '); o.__setStyleClass(this, "", ["over"]);');
+ this.oButton = jpf.XMLDatabase.htmlImport(elBtn, pJmlNode.oButtons);
+
+ this.setCaption(this.caption);
+
+ /* #ifdef __WITH_EDITMODE
+ if(pJmlNode.editable)
+ #endif */
+ // #ifdef __WITH_LANG_SUPPORT || __WITH_EDITMODE
+ pJmlNode.__makeEditable("Button", this.oButton, this.jml);
+ // #endif
+ }
+
+ this.oExt = pJmlNode.__getExternal("Page", pJmlNode.oPages, null, this.jml);
+ this.oInt = pJmlNode.__getLayoutNode("Page", "container", this.oExt);
+
+ if (lastPage) {
+ jpf.JMLParser.replaceNode(this.oInt, lastPage.oInt);
+ this.oInt.setAttribute("id", lastPage.oInt.getAttribute("id"));
+ } else
+ jpf.JMLParser.parseChildren(this.jml, this.oInt, this, true);
+ }
+
+ this.__destroy = function(){
+ this.oButton = null;
+ }
+
+ /* ***********************
+ OTHER INHERITANCE
+ ************************/
+
+ // #ifdef __WITH_DELAYEDRENDER
+ this.inherit(jpf.DelayedRender); /** @inherits jpf.DelayedRender */
+ // #endif
+
+ //Hack
+ this.addEventListener("onbeforerender", function(){
+ pJmlNode.dispatchEvent("onbeforerender", {
+ page : this
+ });
+ });
+ this.addEventListener("onafterrender", function(){
+ pJmlNode.dispatchEvent("onafterrender", {page : this});
+ });
+
+ //this.inherit(jpf.Presentation); /** @inherits jpf.Presentation */
+ this.inherit(jpf.JmlNode); /** @inherits jpf.JmlNode */
+
+ // #ifdef __WITH_JMLDOM
+ this.inherit(jpf.JmlDomAPI); /** @inherits jpf.JmlDomAPI */
+ // #endif
+}
+
+// #endif
View
66 components/bar.js
@@ -0,0 +1,66 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
+ */
+
+// #ifdef __JBAR || __INC_ALL
+// #define __WITH_PRESENTATION 1
+
+/**
+ * Component displaying a skinnable rectangle which can contain other JML components.
+ *
+ * @classDescription This class creates a new bar
+ * @return {Bar} Returns a new bar
+ * @type {Bar}
+ * @constructor
+ * @allowchild {components}, {anyjml}
+ * @addnode components:bar
+ *
+ * @author Ruben Daniels
+ * @version %I%, %G%
+ * @since 0.4
+ */
+jpf.bar = function(pHtmlNode){
+ jpf.register(this, "bar", GUI_NODE);/** @inherits jpf.Class */
+ this.pHtmlNode = pHtmlNode || document.body;
+ this.pHtmlDoc = this.pHtmlNode.ownerDocument;
+
+ /* ***********************
+ Inheritance
+ ************************/
+ /**
+ * @inherits jpf.Presentation
+ * @inherits jpf.JmlNode
+ */
+ this.inherit(jpf.Presentation, jpf.JmlNode);
+
+ this.draw = function(){
+ //Build Main Skin
+ this.oExt = this.__getExternal();
+ }
+
+ this.__loadJML = function(x){
+ var oInt = this.__getLayoutNode("Main", "container", this.oExt);
+
+ this.oInt = this.oInt
+ ? jpf.JMLParser.replaceNode(oInt, this.oInt)
+ : jpf.JMLParser.parseChildren(x, oInt, this);
+ }
+}
+// #endif
View
145 components/browser.js
@@ -0,0 +1,145 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
+ */
+
+// #ifdef __JBROWSER || __INC_ALL
+// #define __WITH_PRESENTATION 1
+
+/**
+ * Component displaying the rendered contents of an URL.
+ *
+ * @classDescription This class creates a new browser
+ * @return {Browser} Returns a new browser
+ * @type {Browser}
+ * @constructor
+ * @addnode components:browser
+ *
+ * @author Ruben Daniels
+ * @version %I%, %G%
+ * @since 0.4
+ */
+jpf.browser = function(pHtmlNode){
+ jpf.register(this, "browser", GUI_NODE);/** @inherits jpf.Class */
+ this.pHtmlNode = pHtmlNode || document.body;
+ this.pHtmlDoc = this.pHtmlNode.ownerDocument;
+
+ /**
+ * @inherits jpf.JmlNode
+ * @inherits jpf.Validation
+ * @inherits jpf.XForms
+ * @inherits jpf.DataBinding
+ */
+ this.inherit(jpf.JmlNode);
+ //Options
+ //this.focussable = true; // This object can get the focus
+ //#ifdef __WITH_VALIDATION || __WITH_XFORMS
+ this.inherit(jpf.Validation);
+ //#endif
+ //#ifdef __WITH_XFORMS
+ this.inherit(jpf.XForms);
+ //#endif
+ // #ifdef __WITH_DATABINDING
+ this.inherit(jpf.DataBinding);
+
+ //DATABINDING
+ this.mainBind = "source";
+
+ // #endif
+
+ /* ********************************************************************
+ PUBLIC METHODS
+ *********************************************************************/
+
+ this.loadURL = function(src){
+ try {
+ this.oInt.src = src;
+ } catch(e) {
+ this.oInt.src = "about:blank";
+ }
+ }
+
+ this.getURL = function(){
+ return this.oInt.src;
+ }
+
+ this.back = function(){
+ this.oInt.contentWindow.history.back();
+ }
+
+ this.forward = function(){
+ this.oInt.contentWindow.history.forward();
+ }
+
+ this.reload = function(){
+ this.oInt.src = this.oInt.src;
+ }
+
+ this.print = function(){
+ this.oInt.contentWindow.print();
+ }
+
+ this.runCode = function(str, no_error){
+ if (no_error)
+ try {
+ this.oInt.contentWindow.eval(str);
+ } catch(e) {}
+ else
+ this.oInt.contentWindow.eval(str);
+ }
+
+ this.__supportedProperties = ["value", "src"];
+ this.__handlePropSet = function(prop, value){
+ switch (prop) {
+ case "src" :
+ case "value" :
+ this.loadURL(value);
+ break;
+ }
+ }
+
+ this.draw = function(parentNode){
+ if(!parentNode) parentNode = this.pHtmlNode;
+
+ //Build Main Skin
+ if (jpf.cannotSizeIframe){
+ this.oExt = parentNode.appendChild(document.createElement("DIV"))
+ .appendChild(document.createElement("iframe")).parentNode;//parentNode.appendChild(document.createElement("iframe"));//
+ this.oExt.style.width = "100px";
+ this.oExt.style.height = "100px";
+ this.oInt = this.oExt.firstChild;
+ //this.oInt = this.oExt;
+ this.oInt.style.width = "100%";
+ this.oInt.style.height = "100%";
+ } else {
+ this.oExt = parentNode.appendChild(document.createElement("iframe"));
+ this.oExt.style.width = "100px";
+ this.oExt.style.height = "100px";
+ this.oInt = this.oExt;
+ //this.oExt.style.border = "2px inset white";
+ }
+
+ //this.oInt = this.oExt.contentWindow.document.body;
+ this.oExt.host = this;
+ //this.o