Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 2.0-Alpha1
-
Fix Version/s: 2.0-Alpha2, 2.0.0
-
Component/s: ICE-Components
-
Labels:None
-
Environment:D&D
Description
Issue Links
- blocks
-
ICE-4458 create component-showcase sample for compat version of ICEfaces-2
- Closed
Activity
- All
- Comments
- History
- Activity
- Remote Attachments
- Subversion
After refresh, the first drag and drop works OK; the second drag and drop triggers an unspecified error. See video at http://screencast.com/t/MzE0Yjg4YTQ.
The unspecified error is in a function in Prototype. See screenshot-1.
required for A2 release
required for A2 release of ICEfaces2
There are some conditions (including the ignoreDrag and ignoreDrop flags) in the code controlling the submission of the events. After commenting out the conditions and stepping through the code for a while in IE's script debugger, the drag and drop suddenly starts to work OK. See video at http://screencast.com/t/ZjkxZTYwNm.
It looks like the "Unspecified error" we get is triggered in Element.cumulativeOffset function which is defined in PrototypeJS. This specific error was supposed to be fixed by this patch: http://dev.rubyonrails.org/ticket/9416 . We use PrototypeJS version 1.6.03 which includes the fix.
Now, unfortunately, I found that ice-extras.js includes an older version of PrototypeJS library (along with Scriptaculous library) which does not have the fix. We load "ice-extras.js" file after "proptotype.js" file which in effect overrides the newer definitions found in prototype.js file.
Applying http://dev.rubyonrails.org/ticket/9416 fix to ice-extras.js gets rid of the exception and makes DnD work better but if the page is reloaded only the first drag&drop will work. Clicking on the "Drag & Drop" link will render the DnD functional again.
There are two problems that need clarification:
a) Why do we load two different versions of Prototype?
b) Is the http://dev.rubyonrails.org/ticket/9416 patch enough to fix DnD?
Maybe it makes sense to update to the latest Prototype and Scriptaculous libraries and also fix the Prototype library duplication.
Compared cumulativeOffset() in prototype.js and ice-extras.js. They are exactly the same. Does our prototype.js really have the patch included?
We might have changed Prototype and/or Scriptaculous ourselves to fix bugs and/or add functionalities? We need to find out and merge/rework those changes when updating Prototype and Scriptaculous.
a) Why do we load two different versions of Prototype?
Not sure, I checked the the ICEFaces 1.6 we are using since then. May be we override something in there.
b) Is the http://dev.rubyonrails.org/ticket/9416 patch enough to fix DnD?
I applied the patch to existing code but it is requiring to click the demo link twice.
As Mircea mentions that ice-extras.js contians the prototype.js as well as Scriptaculous js.
I did the following tasks to test D&D:
1- I removed the prototype code from the ice-extras.js. Tested the D&D, and it worked but it requires the demo link to be clicked twice. As describe by Mircea above.
2- I applied the http://dev.rubyonrails.org/ticket/9416 patch to the prototype code in our ice-extras.js. Tested the D&D, and it worked but it requires the demo link to be clicked twice. As describe by Mircea above.
I looked the trunk/ icefaces.jar and noticed that the ice-extras.js generated dynamically by the build file. The build file concatenates prototype.js, scriptaculous.js and all component.js files and generates ice-extras.js. The prototype or scriptaculous library was never added separately to the icefaces jars. Which means no duplication.
I noticed that in the trunk first half of the prototype.js file goes inside the icefaces-d2d.js and rest of the half goes inside the ice-extras.js. However the compat is using one of the generated ice-extras.js from trunk which keeps second half of the protoypes.js only and missing first half. May be that is why we are force to add prototype.js separately.
List of actions completed:
1- Created trunk like folder structure to compat and moved the following folders "prototype", "scriptaculous" and "extras" to it. Change the build to generate the "icefaces-compat.js". Ran the the showcase, got the same javascript error on drag and drop. I noticed event trunk prototype.js contains the same cumulativeOffset() as compat.
2- Used above steps but instead of using trunk's prototype I used latest prototype API. Ran the showcase, got other kind of component specifc javascript errors.
3- Used above steps and instead of using trunk's extras I used compat's extras code. Ran the showcase and everything works fine.
This is what we ended up:
- Newer version of prototype
glimmer\compat\core\src\main\javascript\prototype\prototype.js
- Scriptaculous from the trunk
glimmer\compat\core\src\main\javascript\scriptaculous*.js
- Existing extras from compat but containing components code only.
glimmer\compat\core\src\main\javascript\extras\extras.js
- Modified build file, that merges all above files and creates "icefaces-compat.js".
Modified: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\glimmer\compat\core\build.javascript.xml
Modified: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\glimmer\compat\core\src\main\java\com\icesoft\faces\application\ExtrasSetup.java
Modified: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\glimmer\compat\core\src\main\java\com\icesoft\faces\context\effects\JavascriptContext.java
Adding: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\glimmer\compat\core\src\main\javascript\extras
Adding: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\glimmer\compat\core\src\main\javascript\extras\extras.js
Adding: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\glimmer\compat\core\src\main\javascript\prototype
Adding: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\glimmer\compat\core\src\main\javascript\prototype\prototype.js
Adding: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\glimmer\compat\core\src\main\javascript\scriptaculous
Adding: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\glimmer\compat\core\src\main\javascript\scriptaculous\builder.js
Adding: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\glimmer\compat\core\src\main\javascript\scriptaculous\controls.js
Adding: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\glimmer\compat\core\src\main\javascript\scriptaculous\dragdrop.js
Adding: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\glimmer\compat\core\src\main\javascript\scriptaculous\effects.js
Adding: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\glimmer\compat\core\src\main\javascript\scriptaculous\scriptaculous.js
Adding: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\glimmer\compat\core\src\main\javascript\scriptaculous\slider.js
Adding: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\glimmer\compat\core\src\main\javascript\scriptaculous\sound.js
Deleting: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\glimmer\compat\core\src\main\resources\META-INF\resources\ice-extras.js
Deleting: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\glimmer\compat\core\src\main\resources\META-INF\resources\prototype.js
Sending content: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\glimmer\compat\core\src\main\javascript\scriptaculous\controls.js
Sending content: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\glimmer\compat\core\src\main\java\com\icesoft\faces\application\ExtrasSetup.java
Sending content: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\glimmer\compat\core\src\main\javascript\scriptaculous\builder.js
Sending content: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\glimmer\compat\core\build.javascript.xml
Sending content: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\glimmer\compat\core\src\main\javascript\scriptaculous\sound.js
Sending content: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\glimmer\compat\core\src\main\java\com\icesoft\faces\context\effects\JavascriptContext.java
Sending content: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\glimmer\compat\core\src\main\javascript\prototype\prototype.js
Sending content: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\glimmer\compat\core\src\main\javascript\extras\extras.js
Sending content: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\glimmer\compat\core\src\main\javascript\scriptaculous\effects.js
Sending content: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\glimmer\compat\core\src\main\javascript\scriptaculous\scriptaculous.js
Sending content: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\glimmer\compat\core\src\main\javascript\scriptaculous\dragdrop.js
Sending content: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\glimmer\compat\core\src\main\javascript\scriptaculous\slider.js
Completed: At revision: 20270
At initial load, there is no error when dragging and dropping, but nothing happens in the shopping cart either. See video at http://screencast.com/t/Mzg0ZGIwODc.