⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 elementwrapper.js

📁 这是一个关于java的JSP页面中使用象Swing组件的一个库文件.
💻 JS
📖 第 1 页 / 共 2 页
字号:
uiHtml_ElementWrapper.prototype.getWidth = function(domElement) {  return domElement.offsetWidth;};uiHtml_ElementWrapper.prototype.getHeight = function(domElement) {  return domElement.offsetHeight;};uiHtml_ElementWrapper.prototype._obtainImmediateRelativeDimension = function(    domElement, width, height) {  return new uiUtil_Dimension(      domElement.offsetLeft, domElement.offsetTop, width, height);};uiHtml_ElementWrapper.prototype._obtainRelativeDimension = function(    domElement, width, height) {  var x = 0;  var y = 0;  var currentElement = domElement;  do {    if (uiHtml_Element.getTagName(currentElement) == "body") {      break;    }    x += currentElement.offsetLeft;    y += currentElement.offsetTop;    currentElement = currentElement.offsetParent;      }   while (currentElement != null && this.getCascadedStyleAttribute(      currentElement, "position") != "absolute");  return new uiUtil_Dimension(x, y, width, height);};uiHtml_ElementWrapper.prototype._getDimension = function(    domElement, obtainDimension, getWidth, getHeight) {  if (!this.isAppearing(domElement)) {    var showing = this.isShowing(domElement);      this.hide(domElement);    this.appear(domElement);      var dimension = obtainDimension.call(        this, domElement, getWidth(), getHeight());    this.__setShowing(domElement, showing);    this.disappear(domElement);    return dimension;  }  return obtainDimension.call(      this, domElement, getWidth(), getHeight());};uiHtml_ElementWrapper.prototype.getImmediateRelativeDimension =    function(domElement) {  var wrapper = this;  return this._getDimension(domElement, this._obtainImmediateRelativeDimension,      function() { return wrapper.getWidth(domElement); },      function() { return wrapper.getHeight(domElement); });};uiHtml_ElementWrapper.prototype.getRelativeDimension = function(domElement) {  var wrapper = this;  return this._getDimension(domElement, this._obtainRelativeDimension,      function() { return wrapper.getWidth(domElement); },      function() { return wrapper.getHeight(domElement); });};uiHtml_ElementWrapper.prototype.clearChildDomObjects = function(domElement) {  while (domElement.hasChildNodes()) {    domElement.removeChild(domElement.firstChild);  }};uiHtml_ElementWrapper.prototype.getLogicalValue = function(domElement) {  return domElement.value;};uiHtml_ElementWrapper.prototype.isDisabled = function(domElement) {  return domElement.disabled;};uiHtml_ElementWrapper.prototype.setDisabled = function(domElement, value) {  domElement.disabled = value;};uiHtml_ElementWrapper.getInstance = function() {  if (uiHtml_ElementWrapper.__instance == null) {    uiHtml_ElementWrapper.__instance = new uiHtml_ElementWrapper();  }  return uiHtml_ElementWrapper.__instance;};uiHtml_ElementWrapper.__registerElementToFinalize = function(domElement) {  if (uiHtml_Window.getInstance().isIe()) {    uiHtml_ElementWrapper.__extendedElements.push(domElement);  }};uiHtml_ElementWrapper._finalizeElements = function() {  if (uiHtml_Window.getInstance().isIe()) {    var wrapper = uiHtml_ElementWrapper.getInstance();    for (var i = 0; i < uiHtml_ElementWrapper.__extendedElements.length; ++i) {      var domElement = uiHtml_ElementWrapper.__extendedElements[i];      var initializedHandlers = wrapper.__getExtendedProperty(        domElement, "__initializedEventHandlers");      for (var eventName in initializedHandlers) {        domElement["on" + eventName] = null;      }      domElement.uitagsProps = null;    }  }};function uiHtml_ElementWrapper$DomExtProps() {  this._super();  this.__appearDisplay = "inline";  this.__initializedEventHandlers = new Object();  this.__backwardEventHandlers = new Object();  this.__forwardEventHandlers = new Object();  this.__dragSupporter = null;  this.__classProperty = new Object();  this.__mousePressHandlingSupporters = new Array();}uiHtml_ElementWrapper.DomExtProps = uiUtil_Object.declareClass(    uiHtml_ElementWrapper$DomExtProps, uiUtil_Object);function uiHtml_ElementWrapper$MousePressHandlingSupporter(domElement, eventHandler) {  this.__intervalTimerId = null;  this.__initialTimerId = null;  var supporter = this;  var wrapper = uiHtml_ElementWrapper.getInstance();  wrapper.appendEventHandler(domElement, "mouseout", function(e) {    supporter.__cancelTimer();  });  wrapper.appendEventHandler(domElement, "mouseup", function(e) {    supporter.__cancelTimer();  });  wrapper.appendEventHandler(domElement, "mousedown", function(e) {    eventHandler.call(this);    supporter.__initialTimerId = window.setTimeout(function(e) {      supporter.__intervalTimerId = window.setInterval(function(e) {        eventHandler.call(this);      }, 50);    }, 200);  });}uiHtml_ElementWrapper.MousePressHandlingSupporter = uiUtil_Object.declareClass(    uiHtml_ElementWrapper$MousePressHandlingSupporter, uiUtil_Object);uiHtml_ElementWrapper.MousePressHandlingSupporter.prototype.__cancelTimer = function() {  window.clearInterval(this.__intervalTimerId);  window.clearTimeout(this.__initialTimerId);};function uiHtml_ElementWrapper$DragSupporter(domElement, setCoordinate) {  this.__ieUnselectableDomElements = null;  this.__mouseUpHandlerIndex = 0;  this.__mouseMoveHandlerIndex = 0;  this.__domElement = domElement;  this.__trigger = null;  this.__leftDistance = -1;  this.__topDistance = -1;  this.__setCoordinate = setCoordinate;  this.__restrict = false;  this.__borderLeft = -1;  this.__borderTop = -1;  this.__borderRight = -1;  this.__borderBottom = -1;}uiHtml_ElementWrapper.DragSupporter = uiUtil_Object.declareClass(    uiHtml_ElementWrapper$DragSupporter, uiUtil_Object);uiHtml_ElementWrapper.DragSupporter.prototype.__setDragTrigger = function(trigger) {  this.__trigger = trigger;  var dragger = this;  this.__trigger.appendEventHandler("mousedown", function(e) {    dragger.__startDrag(e);  });  this.__trigger.setStyleAttribute("cursor", "move");};uiHtml_ElementWrapper.DragSupporter.prototype.__initDragBoundary = function(    maxWidth, maxHeight) {  var uiWindow = uiHtml_Window.getInstance();  this.__dragMaxWidth = (maxWidth) ? maxWidth : uiWindow.getWidth();  this.__dragMaxHeight = (maxHeight) ? maxHeight : uiWindow.getHeight();};uiHtml_ElementWrapper.DragSupporter.prototype.__restrictDragging = function(    optLeft, optTop, optMaxWidth, optMaxHeight) {  this.__restrict = true;  this.__borderLeft = (optLeft) ? optLeft : 0;  this.__borderTop = (optTop) ? optTop : 0;  this.__initDragBoundary(optMaxWidth, optMaxHeight);  var element = this;  uiHtml_Window.getInstance().appendEventHandler("resize", function(e) {    element.__initDragBoundary(optMaxWidth, optMaxHeight);  });}uiHtml_ElementWrapper.DragSupporter.prototype.__startDrag = function(e) {  this.__logger.debug("Start drag");  var uiDoc = uiHtml_Document.getInstance();  if (this.__mouseMoveHandlerIndex != 0) {    uiDoc.removeEventHandler("mousemove", this.__mouseMoveHandlerIndex);  }  if (this.__mouseUpHandlerIndex != 0) {    uiDoc.removeEventHandler("mouseup", this.__mouseUpHandlerIndex);  }  var dragger = this;  this.__mouseMoveHandlerIndex = uiDoc.appendEventHandler("mousemove", function(e) {    dragger.__drag(e);  });  this.__mouseUpHandlerIndex = uiDoc.appendEventHandler("mouseup", function(e) {    dragger.__endDrag(e);  });  var event = new uiHtml_Event(e);  var position = event.getViewPortPosition();  var dimension = uiHtml_ElementWrapper.getInstance().      getImmediateRelativeDimension(this.__domElement);  this.__leftDistance = position.getLeft() - dimension.getLeft();  this.__topDistance = position.getTop() - dimension.getTop();  if (this.__restrict) {    this.__borderRight = this.__dragMaxWidth - dimension.getWidth();    this.__borderBottom = this.__dragMaxHeight - dimension.getHeight();  }  if (uiHtml_Window.getInstance().isIe()) {    this.__ieMakeUnselectableRecursively(this.__domElement);  }  else {    event.preventDefault();  }};uiHtml_ElementWrapper.DragSupporter.prototype    .__ieMakeUnselectable = function(domElement) {  if (domElement.unselectable != "on") {    domElement.unselectable = "on";    this.__ieUnselectableDomElements.push(domElement);  }};uiHtml_ElementWrapper.DragSupporter.prototype    .__ieMakeUnselectableRecursively = function(domElement) {  this.__logger.debug("Make unselectable");  if (this.__ieUnselectableDomElements == null) {    this.__ieUnselectableDomElements = new Array();  }  this.__ieMakeUnselectable(domElement);  var childNodes = domElement.childNodes;  for (var i = 0; i < childNodes.length; ++i) {    var node = childNodes.item(i);    if (!uiUtil_Type.isTextNode(node)) {      this.__ieMakeUnselectableRecursively(node);    }  }};uiHtml_ElementWrapper.DragSupporter.prototype.__ieCancelUnselectable = function() {  if (this.__ieUnselectableDomElements != null) {    this.__logger.debug("cancel unselectable");    for (var i = 0; i < this.__ieUnselectableDomElements.length; ++i) {      this.__ieUnselectableDomElements[i].unselectable = "off";    }    this.__ieUnselectableDomElements = null;  }};uiHtml_ElementWrapper.DragSupporter.prototype.__drag = function(e) {  var position = uiHtml_Event.getViewPortPosition(e);  var x = position.getLeft() - this.__leftDistance;  var y = position.getTop() - this.__topDistance;  this.__logger.debug(position.getLeft() + ", " +      position.getTop() + " => " + x + ", " + y);  if (this.__restrict) {    if (x < this.__borderLeft) {      x = this.__borderLeft;    }    else if (x > this.__borderRight) {      x = this.__borderRight;    }    if (y < this.__borderTop) {      y = this.__borderTop;    }    else if (y > this.__borderBottom) {      y = this.__borderBottom;    }  }  this.__setCoordinate(x, y);};uiHtml_ElementWrapper.DragSupporter.prototype.__endDrag = function(e) {  this.__logger.debug("End drag");  uiHtml_Document.getInstance().removeEventHandler(      "mousemove", this.__mouseMoveHandlerIndex);  uiHtml_Document.getInstance().removeEventHandler(      "mouseup", this.__mouseUpHandlerIndex);  this.__mouseMoveHandlerIndex = 0;  this.__mouseUpHandlerIndex = 0;  if (uiHtml_Window.getInstance().isIe()) {    this.__ieCancelUnselectable();    }};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -