You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by aw...@apache.org on 2007/06/08 02:46:15 UTC

svn commit: r545355 - /myfaces/trinidad/branches/awiner-use-XHR-branch/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js

Author: awiner
Date: Thu Jun  7 17:46:14 2007
New Revision: 545355

URL: http://svn.apache.org/viewvc?view=rev&rev=545355
Log:
Code cleanup - delete unused JS functionality, rename some more things to Tr

Modified:
    myfaces/trinidad/branches/awiner-use-XHR-branch/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js

Modified: myfaces/trinidad/branches/awiner-use-XHR-branch/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/awiner-use-XHR-branch/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js?view=diff&rev=545355&r1=545354&r2=545355
==============================================================================
--- myfaces/trinidad/branches/awiner-use-XHR-branch/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js (original)
+++ myfaces/trinidad/branches/awiner-use-XHR-branch/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js Thu Jun  7 17:46:14 2007
@@ -95,9 +95,9 @@
 // Certain Trinidad facilities can request that focus be set to a particular node,
 // or the node AFTER a particular node following a PPR update. These three
 // variables store the values needed to track down that node.
-var _AdfFocusRequestDoc = null;
-var _AdfFocusRequestID = null;
-var _AdfFocusRequestNext = false;
+var _TrFocusRequestDoc = null;
+var _TrFocusRequestID = null;
+var _TrFocusRequestNext = false;
 
 // _checkUnload is set on our body tag and is called when the window
 // unloads. In our dialog windows, we call _checkUnload via an intermediary
@@ -3696,7 +3696,7 @@
   }
 }
 
-/* If the Trinidad facility needs to set focus to a particualr node after a PPR
+/* If the Trinidad facility needs to set focus to a particular node after a PPR
  * update, calling this function saves off the data needed to find that node
  *
  * Args:
@@ -3712,9 +3712,9 @@
     win = window;
 
   // we only allow one outstanding focus request
-  win._AdfFocusRequestDoc = doc;
-  win._AdfFocusRequestID = nodeid;
-  win._AdfFocusRequestNext = (next == true);
+  win._TrFocusRequestDoc = doc;
+  win._TrFocusRequestID = nodeid;
+  win._TrFocusRequestNext = (next == true);
 }
 
 
@@ -3727,15 +3727,15 @@
   if (win == (void 0))
     win = window;
 
-  if ((win._AdfFocusRequestDoc != null)
-      && (win._AdfFocusRequestID != null))
+  if ((win._TrFocusRequestDoc != null)
+      && (win._TrFocusRequestID != null))
   {
-    var element = _getElementById(win._AdfFocusRequestDoc,
-                                  win._AdfFocusRequestID);
+    var element = _getElementById(win._TrFocusRequestDoc,
+                                  win._TrFocusRequestID);
     if (!element)
       return null;
 
-    if (win._AdfFocusRequestNext)
+    if (win._TrFocusRequestNext)
     {
       // If "next" was set, the caller doesn't want this node, but the next
       // one. Try to find something that'll accept focus.
@@ -4122,25 +4122,11 @@
 
   // If we're inside a frameset, and the top frame wants
   // reloads blocked, install a _noReload handler.
-  // chain _monitor also if that is already set.
   var topWindow = _getTop(self);
   
   if ((self != topWindow) && topWindow["_blockReload"])
   {
-    // If _monitor is already set on document.onkeydown, then
-    // chain _noReload and _monitor by calling another function which
-    // calls both: _monitorNoReload.
-    // _monitor is set on IE only.
-    if ((_agent.isIE)
-        && (document.onkeydown != null)
-        && (((document.onkeydown).toString().indexOf('_monitor')) > 0))
-    {
-      document.onkeydown = _monitorNoReload;
-    }
-    else
-    {
-      document.onkeydown = _noReload;
-    }
+    document.onkeydown = _noReload;
   }
 
   // Set initialFocus if necessary
@@ -4170,18 +4156,6 @@
   }
 }
 
-//
-// Event handle that monitors access keys and
-// blocks keys that lead to a page reloading.
-// used for our dialogs.
-//
-function _monitorNoReload(e)
-{
-  if (_agent.isIE)
-    _monitor(e);
-  return _noReload(e);
-}
-
 
 //
 // Deliver a client event with the specified type, source and parameters
@@ -4287,9 +4261,9 @@
 //
 // Set a single value in the Trinidad cookie
 //
-function _setAdfCookie(index, value)
+function _setTrCookie(index, value)
 {
-  var arry = _getAdfCookie();
+  var arry = _getTrCookie();
   arry[index] = value;
 
   // Rebuild the encoded value
@@ -4306,7 +4280,7 @@
 //
 // Extract the decoded form of the Trinidad cookie
 //
-function _getAdfCookie()
+function _getTrCookie()
 {
   var encodedValue = _getCookie("oracle.uix");
   var arry;
@@ -4324,7 +4298,7 @@
 //
 function _defaultTZ()
 {
-  var tz = _getAdfCookie()[2];
+  var tz = _getTrCookie()[2];
 
   // If the time zone has already been set, then bail:  however,
   // time zones that start with "GMT" are inherently unreliable,
@@ -4336,7 +4310,7 @@
   }
 
   // Set the correct time zone.
-  _setAdfCookie(2, _getTimeZoneID());
+  _setTrCookie(2, _getTimeZoneID());
 }
 
 
@@ -4366,202 +4340,6 @@
 }
 
 
-/**
- * _monitor: monitor the document's onkeydown presses.
- * Activate the uix button that has the access key that matches the
- * key that is pressed along with the ALT key (ALT+accessKey).
- * This is called for IE, not on Mac, only.
- *
- * Background: we want the accesskey to work on our Trinidad
- * buttons (which are links wrapped around an image)
- * like it does for a <button> html element, and that is
- * it activates the button rather than sets focus like it does for a link.
- * (This already works as expected in Mozilla)
- * This javascript code must know that the element is our uix button.
- * In ButtonRenderer, we render a bogus attribute for this purpose,
- * called "uixbtn".
- * We also register document.onkeydown=_monitor on the page.
- */
-function _monitor(e)
-{
-
-  // when the user holds down only the accessKey, this triggers a mouse
-  // down event over and over with a keyCode of 18. So...
-  // we make sure not to call the _findAccessKey function if
-  // the user is holding down just the access key.
-
-  var windowEvent = window.event;
-
-  if ((windowEvent.altKey == true) && (windowEvent.ctrlKey == false) &&
-      (windowEvent.keyCode != null) && (windowEvent.keyCode != 18 )
-      && (!windowEvent.repeat) )
-  {
-    var keyPressed = String.fromCharCode(window.event.keyCode);
-
-    var accessKeyNode = _getNodeWithAccessKey(document, keyPressed);
-
-    // if the element is a Trinidad Button, make it act like an accelerator
-
-    if (accessKeyNode != null && (accessKeyNode.getAttribute("adfbtn") != null))
-    {
-
-      // now I need to find the node to click...
-
-      // if label, get the "for" attribute value.
-      // That is the id of the element to click
-      if (accessKeyNode.htmlFor)
-      {
-          var id=accessKeyNode.htmlFor;
-          accessKeyNode = (id != null)
-                          ? window.document.getElementById(id)
-                          : null;
-      }
-
-      if (accessKeyNode != null)
-      {
-        // IE acts like it sets the focus before it triggers the access key,
-        // so we will do the same.
-
-        accessKeyNode.focus();
-        accessKeyNode.click();
-      }
-
-    } // end if (accessKeyNode != null)
-  }
-  return true;
-}
-
-/**
- * This function is passed a DOM Node object and a keyboard key
- * that was pressed at the same time as the ALT key.
- * return the node with the access key, otherwise null.
- */
-function _getNodeWithAccessKey(node, keyPressed)
-{
-  var keyPressedUpper = keyPressed.toUpperCase();
-  var keyPressedLower = keyPressed.toLowerCase();
-
-  var accessKeyObject =
-  {
-    activeFound:false,
-    firstAccessKeyNode:null,
-    accessKeyNode:null
-  }
-
-  // start looking through the DOM Node tree from the beginning
-  // for the access key the user pressed.
-  // The node returned will be the first one
-  // found starting from the current active element, otherwise we will use the
-  // first one found in the DOM tree regardless of the current active element.
-
-  accessKeyObject = _findAccessKey(document,
-                                   accessKeyObject,
-                                   keyPressedUpper,
-                                   keyPressedLower);
-
-  var accessKeyNode = accessKeyObject.accessKeyNode;
-  var firstAccessKeyNode = accessKeyObject.firstAccessKeyNode;
-
-  // if we didn't find accessKeyNode in the tree from the active node
-  // to the end of the tree,
-  // just use the first element we found with the correct access key.
-
-  if ( (accessKeyNode == null) && (firstAccessKeyNode != null) )
-  {
-    accessKeyNode = firstAccessKeyNode;
-  }
-  return accessKeyNode;
-}
-
-/**
- * This function is passed a DOM Node object, a local accessKeyObject,
- * and the keyPressed in upper and lower cases.
- * This function checks to see if the node
- * represents an HTML tag; i.e., if the node is an Element object. It
- * recursively calls itself on each of the children of the node, testing
- * them in the same way. If you invoke this function by passing it the
- * Document object, it traverses the entire DOM tree.
-
- * Find the element with the access key.
- * first, store the first element with the access key encountered in
- * the accessKeyObject.firstAccessKeyNode.
- * Then, find the first element with the access key
- * that is found after the focus element,
- * since this is how it works on IE for <button></button>
- * return accessKeyObject if the access key node found, otherwise return null.
- */
-function _findAccessKey(node, accessKeyObject, keyPressedUpper, keyPressedLower)
-{
-  // check all nodes of type ELEMENT_NODE
-  if (node.nodeType == 1 /*Node.ELEMENT_NODE*/)
-  {
-    // check if the _keyPressed  is the access key
-    if ( (node.accessKey == keyPressedUpper) ||
-          (node.accessKey == keyPressedLower))
-    {
-      if (accessKeyObject.activeFound == true)
-      {
-        // Great! Found accessKey on an element after the focus, so return
-        // the node. The recursion will unwind and pass out this node to
-        // the original call.
-        accessKeyObject.accessKeyNode = node;
-        return accessKeyObject;
-      }
-      else if (accessKeyObject.firstAccessKeyNode == null)
-      {
-        // the focus hasn't been found yet, but store away this node
-        // in the global variable, since it is the first one found
-        accessKeyObject.firstAccessKeyNode = node;
-      }
-    }
-    // If the focus is on an element with the access key, IE activates the NEXT
-    // element, which is why I set the _activeFound flag after checking the
-    // access key.
-    if (node == document.activeElement)
-    {
-      accessKeyObject.activeFound = true;
-    }
-  } // end check if it is an element node
-
-  // Now get all children of n
-  // Loop through the children
-  // Recurse on each one
-
-  var children = node.childNodes;
-  for(var i=0; i < children.length; i++)
-  {
-    var accessKeyObject =
-    _findAccessKey( children[i],
-                    accessKeyObject,
-                    keyPressedUpper,
-                    keyPressedLower);
-
-     if (accessKeyObject.accessKeyNode != null)
-     {
-      return accessKeyObject; // stop looping.
-     }
-  }
-  return accessKeyObject;
-}
-
-
-//
-// Returns true if the value contains nothing but strings
-//
-function _isEmpty(value)
-{
-  var s = "" + value;
-  var i = 0;
-  while (i < s.length)
-  {
-    if (s.charAt(i) != ' ')
-      return false;
-    i++;
-  }
-
-  return true;
-}
-
 //
 // Returns true if the current document reads left to right.
 //
@@ -4641,39 +4419,6 @@
       return true;
   }
   return false;
-}
-
-
-// Sets the _navDirty flag for the given window.
-//
-// Inputs: win:  The window in which to set the _navDirty flag.
-//               (defaults to the current window)
-//         name: The name of the form element that is forcing this change.
-//               We'll check the exclude list for this name, and only set
-//               _navDirty if this element is NOT on the list. If name
-//               is undefined or 0, we WILL set _navDirty.
-//
-// NOTE: !!!! all of Common.js has been converted to set the _navDirty
-//       flag through this function. However, because this change could
-//       be destabilizing, Uncommon.js still sets _navDirty directly. !!!!
-function _setNavDirty(win, name)
-{
-  var theWin = win;
-  if (theWin == (void 0) || !theWin)
-  {
-    theWin = window;
-  }
-
-  var excludes = theWin._initialFormExclude;
-
-  // Only set the _navDirty if this element is NOT on the exclude list.
-  // However, a null name means set no matter what (sent from BodyRenderer).
-  if ((name == (void 0))
-      || !name
-      || !_isInExclude(excludes, name))
-  {
-    theWin._navDirty = true;
-  }
 }
 
 function _radioSet_uixspu(f,v,e,s,pt,p,o)