shoppinglist.lzx

<library>

    <class name="shoppinglist" height="${parent.height}">

        <attribute name="total" type="number" value="0"/>
        <attribute name="panel_to_nudge"/>

        <view name="list" y="14" height="$once{parent.height-85}" width="$once{parent.width}">
            <simplelayout axis="y" spacing="6"/>
            <!-- Repeated view displaying list of items in the shopping cart -->
            <view x="12" width="${parent.width}">
                <datapath xpath="Item" pooling="true"/>
                <simplelayout axis="x" spacing="6"/>
                <view datapath="SmallImage/URL/text()" width="50" height="50" stretches="both" onmouseover="dragsmall.display(this, this.datapath.getNodeText());" onmouseout="dragsmall.hide();" onmousedown="dragsmall.start();" onmouseup="dragsmall.stopdrag(); parent.parent.parent.itemDropped(parent.datapath);">
                    <attribute name="source" value="${this.data}"/>
                </view>

                <view width="$once{parent.width}" fgcolor="#666699">
                    <simplelayout axis="y"/>
                    <text fontsize="12" fontstyle="bold" datapath="ItemAttributes/Title/text()" width="${parent.width}"/>
                    <text datapath="ItemAttributes/Artist[1]/text()" width="${parent.width}"/>
                    <view fontsize="12" fontstyle="bold">
                        <simplelayout axis="x" spacing="4"/>
                        <text>Our Price:</text>
                        <text datapath="Offers/Offer[1]/OfferListing/Price/FormattedPrice/text()" width="${parent.width}"/>
                    </view>
                </view>

            </view>
        </view>

        <view name="divider" y="$once{parent.list.height}" resource="divider_panel"/>

        <view x="4" y="$once{parent.divider.y + 20}" fontstyle="bold" fontsize="14" font="Arial,Helvetica">
            <simplelayout axis="x"/>
            <text fgcolor="#666699">Total:  $</text>
            <text fgcolor="#666699" width="100" text="${Math.round(classroot.total*100)/100}"/>
        </view>

        <trashcan x="144" y="$once{parent.divider.y + 17}" name="trashCan"/>

        <method name="addItem" args="dpath">
            this.panel_to_nudge.nudge();

            this.setAttribute("total", total+parseFloat(dpath.xpathQuery("Offers/Offer[1]/OfferListing/Price/FormattedPrice/text()").substring(1)));
            datapath.addNodeFromPointer(dpath);
        </method>

        <method name="removeItem" args="dpath">
            this.setAttribute("total", total-parseFloat(dpath.xpathQuery("Offers/Offer[1]/OfferListing/Price/FormattedPrice/text()").substring(1)));
            dpath.deleteNode();
        </method>

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

Cross References

Classes