You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by sommeralex <al...@gmail.com> on 2012/10/28 20:55:30 UTC

Dynamic Assets

Hello, 

Which is the best way for using dynamic assets?

In one of my classes, i have too much asset declarations now.. 

	@Inject
	@Path("context:/img/icon/star/starScore20.png")	
	private Asset star20Asset;

What i would prefer is a method which directly is generating the asset
(dynamically) - because it happens that many of the defined assets and dont
need. 

e.g:

if (rating == 0){
Asset asset = new Asset("context:/img/icon/star/starScore20.png")
return asset.toClientURL();
} else if (rating <= 0.5) { ... }

..but fore sure, new Asset(...) does not exist.

any ideas?
thx
alex



--
View this message in context: http://tapestry.1045711.n5.nabble.com/Dynamic-Assets-tp5717354.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Dynamic Assets

Posted by Dragan Sahpaski <dr...@gmail.com>.
Yes as I said, AssetSource is the service. AssetSourceImpl is the
implementation.
You inject the service.

Cheers,
Dragan Sahpaski


On Sun, Oct 28, 2012 at 11:35 PM, sommeralex <al...@gmail.com> wrote:
> works now with
>
>         @Inject
>         private AssetSource assetSource;
>
> assetSource.getExpandedAsset("context:/img/icon/star/starScore00.png").toClientURL();
>
> thx
>
>
>
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/Dynamic-Assets-tp5717354p5717361.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Dynamic Assets

Posted by sommeralex <al...@gmail.com>.
works now with 

	@Inject
	private AssetSource assetSource;

assetSource.getExpandedAsset("context:/img/icon/star/starScore00.png").toClientURL();

thx



--
View this message in context: http://tapestry.1045711.n5.nabble.com/Dynamic-Assets-tp5717354p5717361.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Dynamic Assets

Posted by sommeralex <al...@gmail.com>.
Hi!

Thx for your answer.

I tried to

@Inject

private AssetSourceImpl assetSource;

but it keeps saying that

No service implements the interface
org.apache.tapestry5.internal.services.AssetSourceImpl.

i thought AssetSourceIMPL is the implementation???!

2012/10/28 Dragan Sahpaski [via Tapestry] <
ml-node+s1045711n5717359h71@n5.nabble.com>

> See the AssetSource service [1]. I use AssetSource.getExpandedAsset alot.
> Ex: assetSource.getExpandedAsset("classpath:/com/mycompany/logo.png");
>
>
> [1] AssetSource:
>
> http://tapestry.apache.org/5.3.5/apidocs/org/apache/tapestry5/services/AssetSource.html
>
> Cheers,
> Dragan Sahpaski
>
>
> On Sun, Oct 28, 2012 at 8:55 PM, sommeralex <[hidden email]<http://user/SendEmail.jtp?type=node&node=5717359&i=0>>
> wrote:
>
> > Hello,
> >
> > Which is the best way for using dynamic assets?
> >
> > In one of my classes, i have too much asset declarations now..
> >
> >         @Inject
> >         @Path("context:/img/icon/star/starScore20.png")
> >         private Asset star20Asset;
> >
> > What i would prefer is a method which directly is generating the asset
> > (dynamically) - because it happens that many of the defined assets and
> dont
> > need.
> >
> > e.g:
> >
> > if (rating == 0){
> > Asset asset = new Asset("context:/img/icon/star/starScore20.png")
> > return asset.toClientURL();
> > } else if (rating <= 0.5) { ... }
> >
> > ..but fore sure, new Asset(...) does not exist.
> >
> > any ideas?
> > thx
> > alex
> >
> >
> >
> > --
> > View this message in context:
> http://tapestry.1045711.n5.nabble.com/Dynamic-Assets-tp5717354.html
> > Sent from the Tapestry - User mailing list archive at Nabble.com.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=5717359&i=1>
> > For additional commands, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=5717359&i=2>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=5717359&i=3>
> For additional commands, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=5717359&i=4>
>
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
> http://tapestry.1045711.n5.nabble.com/Dynamic-Assets-tp5717354p5717359.html
>  To unsubscribe from Dynamic Assets, click here<http://tapestry.1045711.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5717354&code=YWxleGFuZGVyLnNvbW1lckBnbWFpbC5jb218NTcxNzM1NHwxMDUzMzQxMzM4>
> .
> NAML<http://tapestry.1045711.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: http://tapestry.1045711.n5.nabble.com/Dynamic-Assets-tp5717354p5717360.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

Re: Dynamic Assets

Posted by Dragan Sahpaski <dr...@gmail.com>.
See the AssetSource service [1]. I use AssetSource.getExpandedAsset alot.
Ex: assetSource.getExpandedAsset("classpath:/com/mycompany/logo.png");


[1] AssetSource:
http://tapestry.apache.org/5.3.5/apidocs/org/apache/tapestry5/services/AssetSource.html

Cheers,
Dragan Sahpaski


On Sun, Oct 28, 2012 at 8:55 PM, sommeralex <al...@gmail.com> wrote:
> Hello,
>
> Which is the best way for using dynamic assets?
>
> In one of my classes, i have too much asset declarations now..
>
>         @Inject
>         @Path("context:/img/icon/star/starScore20.png")
>         private Asset star20Asset;
>
> What i would prefer is a method which directly is generating the asset
> (dynamically) - because it happens that many of the defined assets and dont
> need.
>
> e.g:
>
> if (rating == 0){
> Asset asset = new Asset("context:/img/icon/star/starScore20.png")
> return asset.toClientURL();
> } else if (rating <= 0.5) { ... }
>
> ..but fore sure, new Asset(...) does not exist.
>
> any ideas?
> thx
> alex
>
>
>
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/Dynamic-Assets-tp5717354.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org