favorites.lzx

<library>
    <class name="verticalindent">
        <view width="1" height="${parent.height}" bgcolor="0x2b2ba2"/>
        <view width="1" x="1" height="${parent.height}" bgcolor="0xffffff"/>
    </class>

   <class name="favoriteslayout" extends="layout">
        <!--- The axis in which this layout operates. One of 'x' or 'y'. -->
        <attribute name="axis" value="x" setter="this.setAxis( axis )" type="string"/>
    
        <!--- A pixel amount to inset the first view controlled by the layout-->
        <attribute name="inset" value="0" setter="this.inset = inset;                    if(this.subviews && this.subviews.length ) this.update();                    if (this['oninset']) this.oninset.sendEvent(this.inset)"/>
    
        <!--- A pixel amount to use between each view in the layout -->
        <attribute name="spacing" value="0" setter="this.spacing = spacing;                           if( this.subviews && this.subviews.length ) this.update();                           if (this['onspacing']) this.onspacing.sendEvent(this.spacing)"/>
    
        <attribute name="mymask" when="once"/>
        <attribute name="sizeAxis"/>

        <handler name="oninit">
            this.updateDelegate.register( parent,  "onx" );
        </handler>

        <!--- @keywords private -->
        <method name="setAxis" args="a">
            this.axis = a;
            this.sizeAxis = a == "x" ? "width" : "height"
            //this.updateDelegate.register( parent,  "onheight" );
       </method>
    
        <!--- @keywords private -->
        <method name="addSubview" args="newsub">
            //this.updateDelegate.register( newsub,  "on" + this.sizeAxis);
            this.updateDelegate.register( newsub,  "onvisible" );
            //this is an optimization to avoid calling update in the simple case
            //where a single subview was just added
            if ( ! this.locked && this.subviews.length ){
                var s= this.subviews[ this.subviews.length-1 ];
                var p =  s[ this.axis ] + s[ this.sizeAxis ] + this.spacing;
                newsub.setAttribute( this.axis , p  ) ;
            }
            super.addSubview( newsub );
        </method>
    
        <!--- This method is usually called automatically when any of the views
              controlled by the layout change their size in the layout axis, or
              their visibility. However it can be called directly to force the
              layout to update -->
        <method name="update" args="ignore=null">
            
            if ( this.locked ) return;
            this.locked = true;
            var l = this.subviews.length;
            var c = this.inset;
    
            for(var i=0; i < l; i++) {
                var s = this.subviews[i]; 
                if ( !s.visible ) continue;
                
                if ( s[ this.axis ] != c ){
                    s.setAttribute( this.axis , c );
                }

                if ( c < -parent[ axis ] + mymask[ axis ] + mymask[ sizeAxis ] &&
                     s.height != parent.height - 5 ){
                    s.setAttribute('height', parent.height -5);
                }
                c += this.spacing + s[ this.sizeAxis ];
            }
            this.locked = false;
            
        </method>
    </class>
 
 
       
       
       
       
       
       
       
            var now = (new Date()).getTime();
            var diff = now - this._lasttime;
            this._lasttime = now;

            if (this.isMouseDown) {
                var next; 
                if (diff > 600) {
                    next = 500;
                } else {
                    next = 50;
                    this.onmousestilldown.sendEvent();
                }
                lz.Timer.resetTimer( this.stillDownDelegate, next );
            }
       

       
        
            var now = new Date();
            this._lasttime = now.getTime();
            this.isMouseDown = true;
            if (!this.stillDownDelegate) {
               this.stillDownDelegate = new LzDelegate( this, "stillDownEventGenerator");
           }
            lz.Timer.addTimer( this.stillDownDelegate, 500 );
        
        
        
            this.isMouseDown=false;
            lz.Timer.removeTimer( this.stillDownDelegate );
        
    
>    

 
 <class name="favorites">
        <attribute name="titlearea" value="0" type="number"/>
        <attribute name="footerarea" value="5" type="number"/>
        
        <method name="loadSet" args="tag">
            gSearch.setAttribute('text', tag );         
        
            if ( !canvas.isopen ) {
                gSearch.sendsearch_del.unregisterAll();
                var anm = canvas.setOpen(true); 
                gSearch.sendsearch_del.register(anm, 'onstop' );
            } else {
                gSearch.sendsearch();
             }            
        </method>


            
                parent.photos.interior.animate( 'x', Math.min(parent.photos.interior.x + 30,0), 300 )
            
            
                parent.photos.interior.animate( 'x', Math.min(parent.photos.interior.x + 30,0), 100 )
            
            
        
        
        
            
                parent.photos.interior.animate( 'x', parent.photos.interior.x - 30 , 300 )
            
            
                parent.photos.interior.animate( 'x', parent.photos.interior.x - 30 , 100 )
                        
        
>        
              
        <view name="photos" y="${parent.height - height}" height="${parent.height - parent.titlearea -  parent.footerarea }" width="${parent.width}" clip="true">
            <view name="interior" height="${parent.height}">
                <favoriteslayout name="lyt" spacing="15" inset="0" mymask="parent.parent"/>
                <photo datapath="favoritesds:/rsp/photos/photo" visible="true">
                    <handler name="onclick">
                        photoscontainer.lyt.setAttribute('currentpage', 1);
                        var id = datapath.p.getAttr("id");
                        var tag = datapath.p.getAttr("favoritetag");   
                       classroot.loadSet( tag ); 
                    </handler>
                </photo>
            </view>
        </view>

        
>        
    </class>
</library>
<!--
* X_LZ_COPYRIGHT_BEGIN ****************************************************
* Copyright 2007, 2008 Laszlo Systems, Inc.  All Rights Reserved.          *
* Use is subject to license terms.                                        *
* X_LZ_COPYRIGHT_END ******************************************************-->

Cross References

Classes