just a hint in case you want to add a css file globally don't use the Style component. I'd suggest configuring it in your lang-addon.xml in a <stylesheet>-element
cor3000 ( 2020-07-30 10:10:36 +0800 )edit-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi,
I have looked everywhere but I'm not sure this can be done easily in the Java code, I'm using Richlets.
The Toolbar overflowpopup button is too close to the right edge and I want to add a few more pixels and I found the CSS to be:
.z-toolbar-overflowpopup-on .z-toolbar-overflowpopup-button {right: 5px;}
but from the code I can't figure out the selector to change just the button with the toolbar.setStyle().
I assume I can use the Style component and setContent(), but I would like to know how to access sub components.
Thanks
First being said ... everything possible in a ZUL file is also possible from java code. ZUL files are simply parsed and executed using the same java API methods, which are available from a Composer or Richlet.
toolbar.setStyle()
will only set styles on the root element of a component, so your guess is correct you can't use this 'shortcut'.
Instead you're right you can use the style component ... and set the content dynamically.
I wonder what's stopping you from doing so?
Style style = new Style();
style.setContent(".z-toolbar-overflowpopup-on>.z-toolbar-overflowpopup-button {right: 10px;}");
style.setPage(page);
I'd suggest moving your custom styles into a css file, and simply include it instead of adding CSS code from java code.
Or just build a custom theme.
just a hint in case you want to add a css file globally don't use the Style component. I'd suggest configuring it in your lang-addon.xml in a <stylesheet>-element
cor3000 ( 2020-07-30 10:10:36 +0800 )editAsked: 2020-07-29 02:21:30 +0800
Seen: 8 times
Last updated: Jul 29 '20