yahoo.lzx

<!-- Resources and positions for weather demo on 176x208 canvas -->
<canvas width="800" height="400" bgcolor="0x7F7F7F" font="Helvetica">

    <resource name="weather_bg" src="clouds.png"/>

    <resource name="tab_bg" src="tab.png"/>
    <resource name="slider_icon" src="slider_icon.png"/>

    <!-- Hardcoded for providence --> 
    <dataset name="weatherdata" src="http://xml.weather.yahoo.com/forecastrss?p=02912" request="true"/>

    <class name="weathertabelement" extends="basetabelement" minheight="20" onclick="parent.openTab(this,true)">
        <attribute name="defaultplacement" value="details" type="string"/>
        <attribute name="label" value="" type="string"/>    
        <view resource="tab_bg" stretches="width" width="176"/>
        <view name="icon" resource="slider_icon" x="2" y="3"/>
        <text name="titleboxsh" text="${classroot.label}" width="176" fgcolor="#3B4057" x="16" y="5"/>
        <text name="titlebox" text="${classroot.label}" width="176" fgcolor="#CAD0EC" x="15" y="4"/>
        <view name="container" width="${parent.width}" visible="${classroot.contentvisible}" options="releasetolayout" y="25" clip="true">
            <view name="details" width="${parent.width}"/>
        </view>                  
    </class>
        
        
    <!-- Loads images from yahoo weather for a given weather code -->    
    <class name="yweathericon">
        <method name="applyData" args="d">
           if (d == null) { return; }
           var myurl = "http://us.i1.yimg.com/us.yimg.com/i/us/we/52/" + d + ".gif";
           setSource( myurl );
        </method>
    </class>
    
    <class name="weatherSummary" height="64">
        <yweathericon name="icon" width="52" height="52" stretches="both" bgcolor="white" datapath="@code"/>    
        <text name="date" fgcolor="#FFFFFF" fontstyle="bold" x="60" y="5" datapath="@date"/>
        <text name="desc" x="60" y="22" fgcolor="#FFFFFF" datapath="@text"/>
        <view x="60" y="39" fgcolor="#FFFFFF">
            <simplelayout axis="x" spacing="3"/>
            <text text="Low"/>
            <text datapath="@low" width="20"/>
            <text text="High"/>
            <text datapath="@high"/>
        </view>
    </class>



    <!-- Background image --> 
    <view x="0" y="0" resource="weather_bg"/>
    <!-- Screen over background --> 
    <view width="176" height="208" bgcolor="#666d92" opacity="0.63"/>
    
    <!-- We'd do something like this to get the dataset dynamically 
            weatherContent.datapath.getDataset().setQueryString({zip:  z});
            weatherContent.datapath.getDataset().doRequest();
    -->
    
    <basetabslider x="0" datapath="weatherdata:/rss[1]/channel[1]" width="208" height="208">
        <weathertabelement label="Current Conditions" selected="true">
            <view id="currentData">
                <view name="form">
                    <text name="where" x="10" fgcolor="#FFFFFF" fontsize="12" fontstyle="bold" datapath="yweather:location/@city"/>
                    <yweathericon name="icon" x="12" y="18" bgcolor="white" width="64" height="64" datapath="item/yweather:condition/@code" stretches="both"/>
                    <text name="temperature" x="85" y="18" fontsize="40" fgcolor="#FFFFFF" fontstyle="bold" datapath="item/yweather:condition/@temp"/>
                    <text name="description" x="85" y="60" fgcolor="#FFFFFF" fontstyle="bold" datapath="item/yweather:condition/@text"/>
                </view>
                <view name="moredata" x="12">
                    <view name="labels">
                        <text fgcolor="#FFFFFF"><b>Low:</b></text>
                        <text fgcolor="#FFFFFF"><b>High:</b></text>
                        <text fgcolor="#FFFFFF"><b>Last Update:</b></text>                            
                        <simplelayout axis="y" spacing="1"/>
                    </view>
                    <view name="fields" x="73">
                        <text name="humidity" fgcolor="#FFFFFF" datapath="item/yweather:forecast[1]/@low"/>
                        <text name="windspeed" fgcolor="#FFFFFF" text="10 knots" datapath="item/yweather:forecast[1]/@high"/>
                        <text name="lastupdate" fgcolor="#FFFFFF" datapath="item/pubDate/text()"/>                            
                        <simplelayout axis="y" spacing="1"/>
                    </view>
                </view>
                <simplelayout axis="y" spacing="10"/>
            </view>
        </weathertabelement>
        
        <weathertabelement label="Radar Maps">
            <image name="radarscan" y="-10" width="176" height="130" stretches="both" resource="radar_dummy.png"/>
        </weathertabelement> 
        
        <weathertabelement label="Forecast">
            <view x="10">
                <weatherSummary datapath="weatherdata:/rss[1]/channel[1]/item[1]/yweather:forecast"/>
                <simplelayout axis="y"/>
            </view>
        </weathertabelement>

    </basetabslider>
    
</canvas>
<!-- * X_LZ_COPYRIGHT_BEGIN ***************************************************
* Copyright 2006 Laszlo Systems, Inc.  All Rights Reserved.                   *
* Use is subject to license terms.                                            *
* X_LZ_COPYRIGHT_END ****************************************************** -->
<!-- @LZX_VERSION@                                                          -->

Cross References

Resources

Name Source Image
weather_bg clouds.png
tab_bg tab.png
slider_icon slider_icon.png

Classes

Named Instances