Re: Reading an attribute that is set in a CSS file as a class
Well, I came up with a way to do it. I wrote a new class called TextTemplateResourceReference, which you can use along with a StyleSheetReference. Basically, you just pass it in a model for the variables to plugin. I don't know about that lastModifiedTime() implementation, but its overridable if anyone wants to do something different. If anyone wants the code to turn a java.awt.Color object into a hex string appropriate for CSS stylesheets, let me know. I've got that floating around somewhere. import org.apache.wicket.IClusterable; import org.apache.wicket.Resource; import org.apache.wicket.ResourceReference; import org.apache.wicket.model.IDetachable; import org.apache.wicket.model.IModel; import org.apache.wicket.util.resource.IResourceStream; import org.apache.wicket.util.resource.StringResourceStream; import org.apache.wicket.util.template.PackagedTextTemplate; import org.apache.wicket.util.template.TextTemplate; import org.apache.wicket.util.time.Time; import java.util.Map; /** * @author James Carman */ public class TextTemplateResourceReference extends ResourceReference implements IClusterable, IDetachable { //** // Fields //** private static final long serialVersionUID = 1L; private final TextTemplate textTemplate; private final IModelMapString,Object variablesModel; //** // Constructors //** public TextTemplateResourceReference(final Class? scope, final String name, IModelMapString,Object variablesModel) { super(scope, name); this.textTemplate = new PackagedTextTemplate(scope, name); this.variablesModel = variablesModel; } public TextTemplateResourceReference(final Class? scope, final String name, final String contentType, IModelMapString,Object variablesModel) { super(scope, name); this.textTemplate = new PackagedTextTemplate(scope, name, contentType); this.variablesModel = variablesModel; } public TextTemplateResourceReference(final Class? scope, final String name, final String contentType, final String encoding, IModelMapString,Object variablesModel) { super(scope, name); this.textTemplate = new PackagedTextTemplate(scope, name, contentType, encoding); this.variablesModel = variablesModel; } //** // IDetachable Implementation //** public void detach() { variablesModel.detach(); } //** // Other Methods //** protected Resource newResource() { return new Resource() { private static final long serialVersionUID = 1L; public IResourceStream getResourceStream() { return new StringResourceStream(textTemplate.asString(variablesModel.getObject())); } }; } public Time lastModifiedTime() { return textTemplate.lastModifiedTime(); } } jwcarman wrote: Perhaps if it's that beneficial to folks, I'll put a wiki page out there in the how to section. On Mon, Nov 17, 2008 at 6:40 AM, Ernesto Reinaldo Barreiro [EMAIL PROTECTED] wrote: Tanks James! At the moment I do not need that code myself but maybe it could be useful to others... Best, Ernesto On Mon, Nov 17, 2008 at 12:20 PM, James Carman [EMAIL PROTECTED]wrote: We're going to go with the generate the CSS route. I'm going to implement that today. If you want me to send you some code after I'm done, I can do that. On Mon, Nov 17, 2008 at 5:27 AM, Ernesto Reinaldo Barreiro [EMAIL PROTECTED] wrote: Why don't you just generate the CSS or parse it if that's not possible... With the former approach you will have the color before hand, with the latter you will have to locate it somewhere on the CSS. So, what is the best solution will depend on how you manage CSS on your application... Best, Ernesto On Mon, Nov 17, 2008 at 9:21 AM, Eyal Golan [EMAIL PROTECTED] wrote: Stephen, I need this the same reason James needs it. We generate an image (a JFreeChart image) and we want it to have the same background
Re: Reading an attribute that is set in a CSS file as a class
And, in case anyone's interested, here's a new WIKI page for it: http://cwiki.apache.org/confluence/display/WICKET/Dynamically+Generate+a+CSS+Stylesheet On Wed, Nov 19, 2008 at 12:48 PM, jwcarman [EMAIL PROTECTED] wrote: Well, I came up with a way to do it. I wrote a new class called TextTemplateResourceReference, which you can use along with a StyleSheetReference. Basically, you just pass it in a model for the variables to plugin. I don't know about that lastModifiedTime() implementation, but its overridable if anyone wants to do something different. If anyone wants the code to turn a java.awt.Color object into a hex string appropriate for CSS stylesheets, let me know. I've got that floating around somewhere. import org.apache.wicket.IClusterable; import org.apache.wicket.Resource; import org.apache.wicket.ResourceReference; import org.apache.wicket.model.IDetachable; import org.apache.wicket.model.IModel; import org.apache.wicket.util.resource.IResourceStream; import org.apache.wicket.util.resource.StringResourceStream; import org.apache.wicket.util.template.PackagedTextTemplate; import org.apache.wicket.util.template.TextTemplate; import org.apache.wicket.util.time.Time; import java.util.Map; /** * @author James Carman */ public class TextTemplateResourceReference extends ResourceReference implements IClusterable, IDetachable { //** // Fields //** private static final long serialVersionUID = 1L; private final TextTemplate textTemplate; private final IModelMapString,Object variablesModel; //** // Constructors //** public TextTemplateResourceReference(final Class? scope, final String name, IModelMapString,Object variablesModel) { super(scope, name); this.textTemplate = new PackagedTextTemplate(scope, name); this.variablesModel = variablesModel; } public TextTemplateResourceReference(final Class? scope, final String name, final String contentType, IModelMapString,Object variablesModel) { super(scope, name); this.textTemplate = new PackagedTextTemplate(scope, name, contentType); this.variablesModel = variablesModel; } public TextTemplateResourceReference(final Class? scope, final String name, final String contentType, final String encoding, IModelMapString,Object variablesModel) { super(scope, name); this.textTemplate = new PackagedTextTemplate(scope, name, contentType, encoding); this.variablesModel = variablesModel; } //** // IDetachable Implementation //** public void detach() { variablesModel.detach(); } //** // Other Methods //** protected Resource newResource() { return new Resource() { private static final long serialVersionUID = 1L; public IResourceStream getResourceStream() { return new StringResourceStream(textTemplate.asString(variablesModel.getObject())); } }; } public Time lastModifiedTime() { return textTemplate.lastModifiedTime(); } } jwcarman wrote: Perhaps if it's that beneficial to folks, I'll put a wiki page out there in the how to section. On Mon, Nov 17, 2008 at 6:40 AM, Ernesto Reinaldo Barreiro [EMAIL PROTECTED] wrote: Tanks James! At the moment I do not need that code myself but maybe it could be useful to others... Best, Ernesto On Mon, Nov 17, 2008 at 12:20 PM, James Carman [EMAIL PROTECTED]wrote: We're going to go with the generate the CSS route. I'm going to implement that today. If you want me to send you some code after I'm done, I can do that. On Mon, Nov 17, 2008 at 5:27 AM, Ernesto Reinaldo Barreiro [EMAIL PROTECTED] wrote: Why don't you just generate the CSS or parse it if that's not possible... With the former approach you will have the color before hand, with the latter you will have to locate it somewhere on the CSS. So, what is the best solution will depend on how you manage CSS on your
Re: Reading an attribute that is set in a CSS file as a class
Stephen, I need this the same reason James needs it. We generate an image (a JFreeChart image) and we want it to have the same background color as the one specified in the CSS file. Eyal Golan [EMAIL PROTECTED] Visit: http://jvdrums.sourceforge.net/ LinkedIn: http://www.linkedin.com/in/egolan74 P Save a tree. Please don't print this e-mail unless it's really necessary On Sun, Nov 16, 2008 at 4:09 PM, James Carman [EMAIL PROTECTED]wrote: I have the same sort of need in my application. I need to do an overlay on an existing image using the same colors that are defined in a CSS document. I guess I could dynamically generate the CSS, but I have no idea how to go about that. :) On Sun, Nov 16, 2008 at 7:02 AM, Swinsburg, Stephen [EMAIL PROTECTED] wrote: What do you need it for? Why can't you just make another class with just the attribute in it and AttributeAppender that in? -Original Message- From: egolan74 [mailto:[EMAIL PROTECTED] Sent: Sun 11/16/2008 10:42 AM To: users@wicket.apache.org Subject: RE: Reading an attribute that is set in a CSS file as a class Steve Swinsburg-2 wrote: On your component attach an AttributeAppender or AttributeModifier, set the class attribute to be the name of your class. Done :) Thanks Steve but this is not what I meant. Adding a class as an attribute to a component is a pretty basic stuff. What I want is, getting a value of an attribute of a class in a CSS file. - Eyal Golan [EMAIL PROTECTED] Visit: http://jvdrums.sourceforge.net/ JVDrums LinkedIn: http://www.linkedin.com/in/egolan74 LinkedIn -- View this message in context: http://www.nabble.com/Reading-an-attribute-that-is-set-in-a-CSS-file-as-a-class-tp20523855p20524044.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Reading an attribute that is set in a CSS file as a class
I understand you need to match some attributes, but I don't understand why the CSS can't just have an extra class containing the attributes you need. Where does the CSS come from? Is it fixed or does it change a lot, ie via user specified/uploaded skins etc? cheers, Steve On 17 Nov 2008, at 08:21, Eyal Golan wrote: Stephen, I need this the same reason James needs it. We generate an image (a JFreeChart image) and we want it to have the same background color as the one specified in the CSS file. Eyal Golan [EMAIL PROTECTED] Visit: http://jvdrums.sourceforge.net/ LinkedIn: http://www.linkedin.com/in/egolan74 P Save a tree. Please don't print this e-mail unless it's really necessary On Sun, Nov 16, 2008 at 4:09 PM, James Carman [EMAIL PROTECTED] wrote: I have the same sort of need in my application. I need to do an overlay on an existing image using the same colors that are defined in a CSS document. I guess I could dynamically generate the CSS, but I have no idea how to go about that. :) On Sun, Nov 16, 2008 at 7:02 AM, Swinsburg, Stephen [EMAIL PROTECTED] wrote: What do you need it for? Why can't you just make another class with just the attribute in it and AttributeAppender that in? -Original Message- From: egolan74 [mailto:[EMAIL PROTECTED] Sent: Sun 11/16/2008 10:42 AM To: users@wicket.apache.org Subject: RE: Reading an attribute that is set in a CSS file as a class Steve Swinsburg-2 wrote: On your component attach an AttributeAppender or AttributeModifier, set the class attribute to be the name of your class. Done :) Thanks Steve but this is not what I meant. Adding a class as an attribute to a component is a pretty basic stuff. What I want is, getting a value of an attribute of a class in a CSS file. - Eyal Golan [EMAIL PROTECTED] Visit: http://jvdrums.sourceforge.net/ JVDrums LinkedIn: http://www.linkedin.com/in/egolan74 LinkedIn -- View this message in context: http://www.nabble.com/Reading-an-attribute-that-is-set-in-a-CSS-file-as-a-class-tp20523855p20524044.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] smime.p7s Description: S/MIME cryptographic signature
Re: Reading an attribute that is set in a CSS file as a class
Why don't you just generate the CSS or parse it if that's not possible... With the former approach you will have the color before hand, with the latter you will have to locate it somewhere on the CSS. So, what is the best solution will depend on how you manage CSS on your application... Best, Ernesto On Mon, Nov 17, 2008 at 9:21 AM, Eyal Golan [EMAIL PROTECTED] wrote: Stephen, I need this the same reason James needs it. We generate an image (a JFreeChart image) and we want it to have the same background color as the one specified in the CSS file. Eyal Golan [EMAIL PROTECTED] Visit: http://jvdrums.sourceforge.net/ LinkedIn: http://www.linkedin.com/in/egolan74 P Save a tree. Please don't print this e-mail unless it's really necessary On Sun, Nov 16, 2008 at 4:09 PM, James Carman [EMAIL PROTECTED] wrote: I have the same sort of need in my application. I need to do an overlay on an existing image using the same colors that are defined in a CSS document. I guess I could dynamically generate the CSS, but I have no idea how to go about that. :) On Sun, Nov 16, 2008 at 7:02 AM, Swinsburg, Stephen [EMAIL PROTECTED] wrote: What do you need it for? Why can't you just make another class with just the attribute in it and AttributeAppender that in? -Original Message- From: egolan74 [mailto:[EMAIL PROTECTED] Sent: Sun 11/16/2008 10:42 AM To: users@wicket.apache.org Subject: RE: Reading an attribute that is set in a CSS file as a class Steve Swinsburg-2 wrote: On your component attach an AttributeAppender or AttributeModifier, set the class attribute to be the name of your class. Done :) Thanks Steve but this is not what I meant. Adding a class as an attribute to a component is a pretty basic stuff. What I want is, getting a value of an attribute of a class in a CSS file. - Eyal Golan [EMAIL PROTECTED] Visit: http://jvdrums.sourceforge.net/ JVDrums LinkedIn: http://www.linkedin.com/in/egolan74 LinkedIn -- View this message in context: http://www.nabble.com/Reading-an-attribute-that-is-set-in-a-CSS-file-as-a-class-tp20523855p20524044.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Reading an attribute that is set in a CSS file as a class
James, Yes, I would like you to send an example of this route. It looks as this is what I need. thanks Eyal Golan [EMAIL PROTECTED] Visit: http://jvdrums.sourceforge.net/ LinkedIn: http://www.linkedin.com/in/egolan74 P Save a tree. Please don't print this e-mail unless it's really necessary On Mon, Nov 17, 2008 at 1:20 PM, James Carman [EMAIL PROTECTED]wrote: We're going to go with the generate the CSS route. I'm going to implement that today. If you want me to send you some code after I'm done, I can do that. On Mon, Nov 17, 2008 at 5:27 AM, Ernesto Reinaldo Barreiro [EMAIL PROTECTED] wrote: Why don't you just generate the CSS or parse it if that's not possible... With the former approach you will have the color before hand, with the latter you will have to locate it somewhere on the CSS. So, what is the best solution will depend on how you manage CSS on your application... Best, Ernesto On Mon, Nov 17, 2008 at 9:21 AM, Eyal Golan [EMAIL PROTECTED] wrote: Stephen, I need this the same reason James needs it. We generate an image (a JFreeChart image) and we want it to have the same background color as the one specified in the CSS file. Eyal Golan [EMAIL PROTECTED] Visit: http://jvdrums.sourceforge.net/ LinkedIn: http://www.linkedin.com/in/egolan74 P Save a tree. Please don't print this e-mail unless it's really necessary On Sun, Nov 16, 2008 at 4:09 PM, James Carman [EMAIL PROTECTED] wrote: I have the same sort of need in my application. I need to do an overlay on an existing image using the same colors that are defined in a CSS document. I guess I could dynamically generate the CSS, but I have no idea how to go about that. :) On Sun, Nov 16, 2008 at 7:02 AM, Swinsburg, Stephen [EMAIL PROTECTED] wrote: What do you need it for? Why can't you just make another class with just the attribute in it and AttributeAppender that in? -Original Message- From: egolan74 [mailto:[EMAIL PROTECTED] Sent: Sun 11/16/2008 10:42 AM To: users@wicket.apache.org Subject: RE: Reading an attribute that is set in a CSS file as a class Steve Swinsburg-2 wrote: On your component attach an AttributeAppender or AttributeModifier, set the class attribute to be the name of your class. Done :) Thanks Steve but this is not what I meant. Adding a class as an attribute to a component is a pretty basic stuff. What I want is, getting a value of an attribute of a class in a CSS file. - Eyal Golan [EMAIL PROTECTED] Visit: http://jvdrums.sourceforge.net/ JVDrums LinkedIn: http://www.linkedin.com/in/egolan74 LinkedIn -- View this message in context: http://www.nabble.com/Reading-an-attribute-that-is-set-in-a-CSS-file-as-a-class-tp20523855p20524044.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Reading an attribute that is set in a CSS file as a class
Tanks James! At the moment I do not need that code myself but maybe it could be useful to others... Best, Ernesto On Mon, Nov 17, 2008 at 12:20 PM, James Carman [EMAIL PROTECTED]wrote: We're going to go with the generate the CSS route. I'm going to implement that today. If you want me to send you some code after I'm done, I can do that. On Mon, Nov 17, 2008 at 5:27 AM, Ernesto Reinaldo Barreiro [EMAIL PROTECTED] wrote: Why don't you just generate the CSS or parse it if that's not possible... With the former approach you will have the color before hand, with the latter you will have to locate it somewhere on the CSS. So, what is the best solution will depend on how you manage CSS on your application... Best, Ernesto On Mon, Nov 17, 2008 at 9:21 AM, Eyal Golan [EMAIL PROTECTED] wrote: Stephen, I need this the same reason James needs it. We generate an image (a JFreeChart image) and we want it to have the same background color as the one specified in the CSS file. Eyal Golan [EMAIL PROTECTED] Visit: http://jvdrums.sourceforge.net/ LinkedIn: http://www.linkedin.com/in/egolan74 P Save a tree. Please don't print this e-mail unless it's really necessary On Sun, Nov 16, 2008 at 4:09 PM, James Carman [EMAIL PROTECTED] wrote: I have the same sort of need in my application. I need to do an overlay on an existing image using the same colors that are defined in a CSS document. I guess I could dynamically generate the CSS, but I have no idea how to go about that. :) On Sun, Nov 16, 2008 at 7:02 AM, Swinsburg, Stephen [EMAIL PROTECTED] wrote: What do you need it for? Why can't you just make another class with just the attribute in it and AttributeAppender that in? -Original Message- From: egolan74 [mailto:[EMAIL PROTECTED] Sent: Sun 11/16/2008 10:42 AM To: users@wicket.apache.org Subject: RE: Reading an attribute that is set in a CSS file as a class Steve Swinsburg-2 wrote: On your component attach an AttributeAppender or AttributeModifier, set the class attribute to be the name of your class. Done :) Thanks Steve but this is not what I meant. Adding a class as an attribute to a component is a pretty basic stuff. What I want is, getting a value of an attribute of a class in a CSS file. - Eyal Golan [EMAIL PROTECTED] Visit: http://jvdrums.sourceforge.net/ JVDrums LinkedIn: http://www.linkedin.com/in/egolan74 LinkedIn -- View this message in context: http://www.nabble.com/Reading-an-attribute-that-is-set-in-a-CSS-file-as-a-class-tp20523855p20524044.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Reading an attribute that is set in a CSS file as a class
Perhaps if it's that beneficial to folks, I'll put a wiki page out there in the how to section. On Mon, Nov 17, 2008 at 6:40 AM, Ernesto Reinaldo Barreiro [EMAIL PROTECTED] wrote: Tanks James! At the moment I do not need that code myself but maybe it could be useful to others... Best, Ernesto On Mon, Nov 17, 2008 at 12:20 PM, James Carman [EMAIL PROTECTED]wrote: We're going to go with the generate the CSS route. I'm going to implement that today. If you want me to send you some code after I'm done, I can do that. On Mon, Nov 17, 2008 at 5:27 AM, Ernesto Reinaldo Barreiro [EMAIL PROTECTED] wrote: Why don't you just generate the CSS or parse it if that's not possible... With the former approach you will have the color before hand, with the latter you will have to locate it somewhere on the CSS. So, what is the best solution will depend on how you manage CSS on your application... Best, Ernesto On Mon, Nov 17, 2008 at 9:21 AM, Eyal Golan [EMAIL PROTECTED] wrote: Stephen, I need this the same reason James needs it. We generate an image (a JFreeChart image) and we want it to have the same background color as the one specified in the CSS file. Eyal Golan [EMAIL PROTECTED] Visit: http://jvdrums.sourceforge.net/ LinkedIn: http://www.linkedin.com/in/egolan74 P Save a tree. Please don't print this e-mail unless it's really necessary On Sun, Nov 16, 2008 at 4:09 PM, James Carman [EMAIL PROTECTED] wrote: I have the same sort of need in my application. I need to do an overlay on an existing image using the same colors that are defined in a CSS document. I guess I could dynamically generate the CSS, but I have no idea how to go about that. :) On Sun, Nov 16, 2008 at 7:02 AM, Swinsburg, Stephen [EMAIL PROTECTED] wrote: What do you need it for? Why can't you just make another class with just the attribute in it and AttributeAppender that in? -Original Message- From: egolan74 [mailto:[EMAIL PROTECTED] Sent: Sun 11/16/2008 10:42 AM To: users@wicket.apache.org Subject: RE: Reading an attribute that is set in a CSS file as a class Steve Swinsburg-2 wrote: On your component attach an AttributeAppender or AttributeModifier, set the class attribute to be the name of your class. Done :) Thanks Steve but this is not what I meant. Adding a class as an attribute to a component is a pretty basic stuff. What I want is, getting a value of an attribute of a class in a CSS file. - Eyal Golan [EMAIL PROTECTED] Visit: http://jvdrums.sourceforge.net/ JVDrums LinkedIn: http://www.linkedin.com/in/egolan74 LinkedIn -- View this message in context: http://www.nabble.com/Reading-an-attribute-that-is-set-in-a-CSS-file-as-a-class-tp20523855p20524044.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Reading an attribute that is set in a CSS file as a class
On your component attach an AttributeAppender or AttributeModifier, set the class attribute to be the name of your class. Done :) -Original Message- From: egolan74 [mailto:[EMAIL PROTECTED] Sent: Sun 11/16/2008 10:05 AM To: users@wicket.apache.org Subject: Reading an attribute that is set in a CSS file as a class Hello, Suppose I have a CSS file that is used in our application (HeaderContributer etc.) In this file I have many classes. Suppose I want to get an attribute that is in one of these classes. Example: In my CSS file I have: ... .colored-table { border: thin; background-color: #BB ... } I want in Wicket code something like: getClassAttributeFromCss(CSS_File, attributeName). And, putting in CSS file the location of that file (same methods as in the HeaderContributor.forCss). Putting background-color in the second parameter. Result: #BB Is it possible? - Eyal Golan [EMAIL PROTECTED] Visit: http://jvdrums.sourceforge.net/ JVDrums LinkedIn: http://www.linkedin.com/in/egolan74 LinkedIn -- View this message in context: http://www.nabble.com/Reading-an-attribute-that-is-set-in-a-CSS-file-as-a-class-tp20523855p20523855.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Reading an attribute that is set in a CSS file as a class
Hello, Suppose I have a CSS file that is used in our application (HeaderContributer etc.) In this file I have many classes. Suppose I want to get an attribute that is in one of these classes. Example: In my CSS file I have: ... .colored-table { border: thin; background-color: #BB ... } I want in Wicket code something like: getClassAttributeFromCss(CSS_File, attributeName). And, putting in CSS file the location of that file (same methods as in the HeaderContributor.forCss). Putting background-color in the second parameter. Result: #BB Is it possible? - Eyal Golan [EMAIL PROTECTED] Visit: http://jvdrums.sourceforge.net/ JVDrums LinkedIn: http://www.linkedin.com/in/egolan74 LinkedIn -- View this message in context: http://www.nabble.com/Reading-an-attribute-that-is-set-in-a-CSS-file-as-a-class-tp20523855p20523855.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Reading an attribute that is set in a CSS file as a class
Steve Swinsburg-2 wrote: On your component attach an AttributeAppender or AttributeModifier, set the class attribute to be the name of your class. Done :) Thanks Steve but this is not what I meant. Adding a class as an attribute to a component is a pretty basic stuff. What I want is, getting a value of an attribute of a class in a CSS file. - Eyal Golan [EMAIL PROTECTED] Visit: http://jvdrums.sourceforge.net/ JVDrums LinkedIn: http://www.linkedin.com/in/egolan74 LinkedIn -- View this message in context: http://www.nabble.com/Reading-an-attribute-that-is-set-in-a-CSS-file-as-a-class-tp20523855p20524044.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Reading an attribute that is set in a CSS file as a class
What do you need it for? Why can't you just make another class with just the attribute in it and AttributeAppender that in? -Original Message- From: egolan74 [mailto:[EMAIL PROTECTED] Sent: Sun 11/16/2008 10:42 AM To: users@wicket.apache.org Subject: RE: Reading an attribute that is set in a CSS file as a class Steve Swinsburg-2 wrote: On your component attach an AttributeAppender or AttributeModifier, set the class attribute to be the name of your class. Done :) Thanks Steve but this is not what I meant. Adding a class as an attribute to a component is a pretty basic stuff. What I want is, getting a value of an attribute of a class in a CSS file. - Eyal Golan [EMAIL PROTECTED] Visit: http://jvdrums.sourceforge.net/ JVDrums LinkedIn: http://www.linkedin.com/in/egolan74 LinkedIn -- View this message in context: http://www.nabble.com/Reading-an-attribute-that-is-set-in-a-CSS-file-as-a-class-tp20523855p20524044.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Reading an attribute that is set in a CSS file as a class
I have the same sort of need in my application. I need to do an overlay on an existing image using the same colors that are defined in a CSS document. I guess I could dynamically generate the CSS, but I have no idea how to go about that. :) On Sun, Nov 16, 2008 at 7:02 AM, Swinsburg, Stephen [EMAIL PROTECTED] wrote: What do you need it for? Why can't you just make another class with just the attribute in it and AttributeAppender that in? -Original Message- From: egolan74 [mailto:[EMAIL PROTECTED] Sent: Sun 11/16/2008 10:42 AM To: users@wicket.apache.org Subject: RE: Reading an attribute that is set in a CSS file as a class Steve Swinsburg-2 wrote: On your component attach an AttributeAppender or AttributeModifier, set the class attribute to be the name of your class. Done :) Thanks Steve but this is not what I meant. Adding a class as an attribute to a component is a pretty basic stuff. What I want is, getting a value of an attribute of a class in a CSS file. - Eyal Golan [EMAIL PROTECTED] Visit: http://jvdrums.sourceforge.net/ JVDrums LinkedIn: http://www.linkedin.com/in/egolan74 LinkedIn -- View this message in context: http://www.nabble.com/Reading-an-attribute-that-is-set-in-a-CSS-file-as-a-class-tp20523855p20524044.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Reading an attribute that is set in a CSS file as a class
I see two options: 1-Generate the css out for of some other data you can easily use at Java level (a velocity template maybe?) 2-Parse the CSS (e.g. with http://cssparser.sourceforge.net/)http://cssparser.sourceforge.net/ http://www.w3.org/Style/CSS/SAC/ For a project I had to use approach 2 and it worked fine except for some glitches on the parser (don't remember exactly but I think it was something about _ character not accepted by the parser as part of CSS class-names, but maybe this has already been fixed). Best, Ernesto On Sun, Nov 16, 2008 at 3:09 PM, James Carman [EMAIL PROTECTED]wrote: I have the same sort of need in my application. I need to do an overlay on an existing image using the same colors that are defined in a CSS document. I guess I could dynamically generate the CSS, but I have no idea how to go about that. :) On Sun, Nov 16, 2008 at 7:02 AM, Swinsburg, Stephen [EMAIL PROTECTED] wrote: What do you need it for? Why can't you just make another class with just the attribute in it and AttributeAppender that in? -Original Message- From: egolan74 [mailto:[EMAIL PROTECTED] Sent: Sun 11/16/2008 10:42 AM To: users@wicket.apache.org Subject: RE: Reading an attribute that is set in a CSS file as a class Steve Swinsburg-2 wrote: On your component attach an AttributeAppender or AttributeModifier, set the class attribute to be the name of your class. Done :) Thanks Steve but this is not what I meant. Adding a class as an attribute to a component is a pretty basic stuff. What I want is, getting a value of an attribute of a class in a CSS file. - Eyal Golan [EMAIL PROTECTED] Visit: http://jvdrums.sourceforge.net/ JVDrums LinkedIn: http://www.linkedin.com/in/egolan74 LinkedIn -- View this message in context: http://www.nabble.com/Reading-an-attribute-that-is-set-in-a-CSS-file-as-a-class-tp20523855p20524044.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Reading an attribute that is set in a CSS file as a class
I was thinking about learning how to use TextTemplates to generate the CSS. Is there any good reference out there? On Sun, Nov 16, 2008 at 9:44 AM, Ernesto Reinaldo Barreiro [EMAIL PROTECTED] wrote: I see two options: 1-Generate the css out for of some other data you can easily use at Java level (a velocity template maybe?) 2-Parse the CSS (e.g. with http://cssparser.sourceforge.net/)http://cssparser.sourceforge.net/ http://www.w3.org/Style/CSS/SAC/ For a project I had to use approach 2 and it worked fine except for some glitches on the parser (don't remember exactly but I think it was something about _ character not accepted by the parser as part of CSS class-names, but maybe this has already been fixed). Best, Ernesto On Sun, Nov 16, 2008 at 3:09 PM, James Carman [EMAIL PROTECTED]wrote: I have the same sort of need in my application. I need to do an overlay on an existing image using the same colors that are defined in a CSS document. I guess I could dynamically generate the CSS, but I have no idea how to go about that. :) On Sun, Nov 16, 2008 at 7:02 AM, Swinsburg, Stephen [EMAIL PROTECTED] wrote: What do you need it for? Why can't you just make another class with just the attribute in it and AttributeAppender that in? -Original Message- From: egolan74 [mailto:[EMAIL PROTECTED] Sent: Sun 11/16/2008 10:42 AM To: users@wicket.apache.org Subject: RE: Reading an attribute that is set in a CSS file as a class Steve Swinsburg-2 wrote: On your component attach an AttributeAppender or AttributeModifier, set the class attribute to be the name of your class. Done :) Thanks Steve but this is not what I meant. Adding a class as an attribute to a component is a pretty basic stuff. What I want is, getting a value of an attribute of a class in a CSS file. - Eyal Golan [EMAIL PROTECTED] Visit: http://jvdrums.sourceforge.net/ JVDrums LinkedIn: http://www.linkedin.com/in/egolan74 LinkedIn -- View this message in context: http://www.nabble.com/Reading-an-attribute-that-is-set-in-a-CSS-file-as-a-class-tp20523855p20524044.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Reading an attribute that is set in a CSS file as a class
I don't know on the Wicket wiki... but when I have to use such things I always look into the existing wicket code. A quick search on my IDE leads me to this the class org.wicketstuff.yui.markup.html.slider.Slider where a text template is used to populate the init.js file... Hope this helps... Best, Ernesto On Sun, Nov 16, 2008 at 3:50 PM, James Carman [EMAIL PROTECTED]wrote: I was thinking about learning how to use TextTemplates to generate the CSS. Is there any good reference out there? On Sun, Nov 16, 2008 at 9:44 AM, Ernesto Reinaldo Barreiro [EMAIL PROTECTED] wrote: I see two options: 1-Generate the css out for of some other data you can easily use at Java level (a velocity template maybe?) 2-Parse the CSS (e.g. with http://cssparser.sourceforge.net/)http://cssparser.sourceforge.net/ http://www.w3.org/Style/CSS/SAC/ For a project I had to use approach 2 and it worked fine except for some glitches on the parser (don't remember exactly but I think it was something about _ character not accepted by the parser as part of CSS class-names, but maybe this has already been fixed). Best, Ernesto On Sun, Nov 16, 2008 at 3:09 PM, James Carman [EMAIL PROTECTED]wrote: I have the same sort of need in my application. I need to do an overlay on an existing image using the same colors that are defined in a CSS document. I guess I could dynamically generate the CSS, but I have no idea how to go about that. :) On Sun, Nov 16, 2008 at 7:02 AM, Swinsburg, Stephen [EMAIL PROTECTED] wrote: What do you need it for? Why can't you just make another class with just the attribute in it and AttributeAppender that in? -Original Message- From: egolan74 [mailto:[EMAIL PROTECTED] Sent: Sun 11/16/2008 10:42 AM To: users@wicket.apache.org Subject: RE: Reading an attribute that is set in a CSS file as a class Steve Swinsburg-2 wrote: On your component attach an AttributeAppender or AttributeModifier, set the class attribute to be the name of your class. Done :) Thanks Steve but this is not what I meant. Adding a class as an attribute to a component is a pretty basic stuff. What I want is, getting a value of an attribute of a class in a CSS file. - Eyal Golan [EMAIL PROTECTED] Visit: http://jvdrums.sourceforge.net/ JVDrums LinkedIn: http://www.linkedin.com/in/egolan74 LinkedIn -- View this message in context: http://www.nabble.com/Reading-an-attribute-that-is-set-in-a-CSS-file-as-a-class-tp20523855p20524044.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Reading an attribute that is set in a CSS file as a class
Thanks for the tip, Ernesto. I'll check it out. On Sun, Nov 16, 2008 at 10:23 AM, Ernesto Reinaldo Barreiro [EMAIL PROTECTED] wrote: I don't know on the Wicket wiki... but when I have to use such things I always look into the existing wicket code. A quick search on my IDE leads me to this the class org.wicketstuff.yui.markup.html.slider.Slider where a text template is used to populate the init.js file... Hope this helps... Best, Ernesto On Sun, Nov 16, 2008 at 3:50 PM, James Carman [EMAIL PROTECTED]wrote: I was thinking about learning how to use TextTemplates to generate the CSS. Is there any good reference out there? On Sun, Nov 16, 2008 at 9:44 AM, Ernesto Reinaldo Barreiro [EMAIL PROTECTED] wrote: I see two options: 1-Generate the css out for of some other data you can easily use at Java level (a velocity template maybe?) 2-Parse the CSS (e.g. with http://cssparser.sourceforge.net/)http://cssparser.sourceforge.net/ http://www.w3.org/Style/CSS/SAC/ For a project I had to use approach 2 and it worked fine except for some glitches on the parser (don't remember exactly but I think it was something about _ character not accepted by the parser as part of CSS class-names, but maybe this has already been fixed). Best, Ernesto On Sun, Nov 16, 2008 at 3:09 PM, James Carman [EMAIL PROTECTED]wrote: I have the same sort of need in my application. I need to do an overlay on an existing image using the same colors that are defined in a CSS document. I guess I could dynamically generate the CSS, but I have no idea how to go about that. :) On Sun, Nov 16, 2008 at 7:02 AM, Swinsburg, Stephen [EMAIL PROTECTED] wrote: What do you need it for? Why can't you just make another class with just the attribute in it and AttributeAppender that in? -Original Message- From: egolan74 [mailto:[EMAIL PROTECTED] Sent: Sun 11/16/2008 10:42 AM To: users@wicket.apache.org Subject: RE: Reading an attribute that is set in a CSS file as a class Steve Swinsburg-2 wrote: On your component attach an AttributeAppender or AttributeModifier, set the class attribute to be the name of your class. Done :) Thanks Steve but this is not what I meant. Adding a class as an attribute to a component is a pretty basic stuff. What I want is, getting a value of an attribute of a class in a CSS file. - Eyal Golan [EMAIL PROTECTED] Visit: http://jvdrums.sourceforge.net/ JVDrums LinkedIn: http://www.linkedin.com/in/egolan74 LinkedIn -- View this message in context: http://www.nabble.com/Reading-an-attribute-that-is-set-in-a-CSS-file-as-a-class-tp20523855p20524044.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]