On Nov 20, 2007 7:21 AM, Doublel <[EMAIL PROTECTED]> wrote:
> Yes it works well.Thanks very much
> ...
> public void setWeatherImagePath(Asset weatherImagePath) {
> this.weatherImagePath = weatherImagePath;
> }
> ...
> public Asset getWeatherImagePath(){
> return this.assetSource.findAsset(
> this.resource.getBaseResource(),
> "context:images/weather/"+this.weatherPath, null);
> }
>
> public void onActivate(String id){
> if (lw.hnSunny.equals(bc.getLogWeather())){
> this.weatherPath="hn2_sunny.gif";
> }else if (lw.hnIce.equals(bc.getLogWeather())){
> this.weatherPath="hn2_ice.gif";
> }else if (lw.hnCloudy.equals(bc.getLogWeather())){
> this.weatherPath="hn2_cloudy.gif";
A follow-up question:
Did you get a chance to try a null base resource parameter? i.e:
assetSource.findAsset(null, "context:images/weathePath/" + weatherPath", null)
Just curios whether that would work and lazy to try it out myself :)
And some minor feedback:
* You probably don't need the weatherImagePath setter. Extraneous
setters are a pet peeve of mine! Actually, there are specific
scenarios when pages/components really need setters and i like the
existence of setters to be indicative of this.
* You might consider a simple naming convention for your images that
allows you to get rid of that conditional in onActivate(). Something
like:
weatherPath = "hn2_" + bc.getLogWeather().toString() + ".gif";
> 2007/11/20, Josh Canfield <[EMAIL PROTECTED]>:
> >
> > The advantage to using AssetResource is that you can look up assets at
> > runtime...
> >
> > On Nov 19, 2007 5:34 AM, Chris Lewis <[EMAIL PROTECTED]> wrote:
> >
> > > I've not seen AssetResource - what is the advantage to using it like
> > > this as opposed simply to injecting the asset?
AssetSource (not AssetResource), just for the benefit of those who
stumble on this.
Other than that, what Josh said... :)
Cheers, lasitha.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]