Hi Alex,

I've made improved bug fixes to the qx.ui.embed.Gallery source since the
last go, that will allow the loadComplete to fire more reliably.
Specifically, with the previous bug fix, it still doesn't work when
appending a list of images to the existing list via addFromPartialList() or
addFromUpdatedList(). So the new and improved bug fix involves undoing the
previous bug fix (i.e., undoing modifications to the _processedImages
instance variable in the removeAll() and deleteByPosition() member
functions) and doing the following instead:

1. Change the following:

    addFromPartialList : function(vPartialList)
    {            
      for (var i=0, a=vPartialList, l=a.length; i<l; i++) {
        this._list.push(a[i]);  // added by dalmazio
        this._frame.appendChild(this.createCell(a[i], i));
      }
    },

to:

    addFromPartialList : function(vPartialList)
    {      
      this._listSize = this._list.length + vPartialList.length;
      
      for (var i=0, a=vPartialList, l=a.length; i<l; i++) {
        this._list.push(a[i]);  // added by dalmazio
        this._frame.appendChild(this.createCell(a[i], i));
      }
    },

2. Change the following:

    addFromUpdatedList : function(vNewList)
    {
      for (var a=vNewList, l=a.length, i=this._list.length; i<l; i++) {
        this._frame.appendChild(this.createCell(a[i], i));
      }

      this._list = vNewList;
    },

to

    addFromUpdatedList : function(vNewList)
    {
      this._listSize = vNewList.length;
    
      for (var a=vNewList, l=a.length, i=this._list.length; i<l; i++) {
        this._frame.appendChild(this.createCell(a[i], i));
      }

      this._list = vNewList;
    },

3. Make imageOnComplete() look like this (i.e., how it looked originally
before any mods):

    imageOnComplete : function()
    {
      this._processedImages++;
      
      if (this._processedImages == this._listSize) {       
        this.dispatchEvent(new qx.event.type.Event("loadComplete"), true);
      }
    },

We use the _listSize instance variable in imageOnComplete() afterall since
it refers to the full combined image list size once all images have been
appended to the current list -- provided it is kept up to date by the
modifications in 1 & 2. If we do this we don't need to update the
_processedImages instance variable in any of the remove/delete methods --
these methods can stay as they originally were (i.e., removeAll() and
deleteByPosition() can be left as they were prior to any mods).

I think this should be it.

(Famous last words...)

Best,
Dalmazio





Alexander Back wrote:
> 
> Hi Dalmazio,
> 
> many thanks for the fixes! I've just committed them to the legacy_0_7_x 
> branch (Revision #14912)
> 
> cheers,
>    Alex
> 
> Dalmazio Brisinda wrote:
>> Aside from my previous query, looks like I might have another bug fix.
>> This
>> bug fix allows the event "loadComplete" to fire. In the member function
>> imageOnComplete() the following code:
>> 
>>     if (this._processedImages == this._listSize) {      
>>         this.dispatchEvent(new qx.event.type.Event("loadComplete"),
>> true);
>>     }
>> 
>> should be replaced with:
>> 
>>     if (this._processedImages == this._list.length) {      
>>         this.dispatchEvent(new qx.event.type.Event("loadComplete"),
>> true);
>>     }
>> 
>> Since the this._listSize member variable is not kept up-to-date with the
>> actual size of the list. In any case, it's probably better to just get
>> the
>> actual size of the list when needed from the list itself.
>> 
>> Also, the following lines needs to be added to the end of the following
>> member functions so the number of processed images are kept in sync when
>> images are deleted:
>> 
>> removeAll : function() {
>>     ...
>>     this._processedImages = 0;  // add this
>> }
>> 
>> and
>> 
>> deleteByPosition : function(vPos) {
>>     ...
>>     this._processedImages--;  // add this
>> }
>> 
>> This works for me when adding images (even after deleting images), the
>> "loadComplete" now fires. But please confirm in case I've missed some
>> rationale behind the original logic.
>> 
>> Best,
>> Dalmazio
> 
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the
> world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
> 
> 

-- 
View this message in context: 
http://n2.nabble.com/Loading-images-with-original-dimensions-in-qx.ui.embed.Gallery-%280.7.3%29-tp584208p641165.html
Sent from the qooxdoo mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to