Hi there,
I want to use CssResource for our project. I already built some cool
things with that n1 stuff.
Now I came across a question I couldn't find an answer in a
satisfactory manner by myself.
I try to explain what I want to do.
My project organisation looks like the following:
de.myproject.theme
.client
.InjectTheme.java (an
EntryPoint which inits Resources with my bundle, calls
#ensureInjected(), so styling is injected and Resources#get() is not
null later)
.resources
.Resources.java
(Singleton; provides access to Gradients class, etc., with
Resources#get()#gradients())
.ResourceBundle.java
(used in Resources class, see above)
.Gradients.java
.gradients.css (with css-
class .whiteToBlue { background: linear-gradient(...); })
.... (others for
shadows, fontColors, borders)
.Theme.gwt.xml (defines the EntryPoint
InjectTheme.java)
de.myproject.widgets
.client
.InjectStyling.java (also an
EntryPoint, same functionality so Styling#get() works and widget
specific styling is injected)
.ui
.MyButton.java (while its
initialization I call #addStyleName(Styling#get()#MyButton()) so it
has the right styling later)
.styling
.Styling.java (Singleton;
provides access to WidgetStyles class with Styling#get()#MyButton())
.ResourceBundle.java (used
in Styling class, see above)
.WidgetStyles.java
.widgetStyles.css (with
css-class .MyButton { margin: xy; display: inline; })
.Widgets.gwt.xml (inherits
de.myproject.theme.Theme and defines the EntryPoint
InjectStyling.java)
So now i can inherit the module de.myproject.widgets.Widgets to use
MyButton somewhere in my project.
Now the question: Can I benefit from the "whiteToBlue" gradient
defined in gradients.css in widgetStyles.css in a way where I don't
have to call
MyButton#addStyleName(Resources#get()#gradients()#whiteToBlue()) too?
For example like this in widgetStyles.css (pseudo-code):
.MyButton {
margin: 10px;
display: inline;
<addRuleDefinedIn>(Resources#get()#gradients()#whiteToBlue())
}
My current answer to that question is no.
>From all I know I would have to add either the whole background rule
in widgetStyles.css for .MyButton again (okay, I could use the
constants defined in gradients.css, but at least the css rule keyword
"background" is needed). (1)
Or I actually would have to call
MyButton#addStyleName(Resources#get()#gradients()#whiteToBlue()). (2)
(1) would result in c&p code, or in other words I loose my styleguide
friendly code organisation
(2) would mean I have two css classes in the compiled client code
instead of one (compared to "classic" css code I would write for this
case).
thanks for answers/hints/questions/...
best regards
kiiu
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.