Configuring CSS Styles Filter
You can modify the CSS styles for each ro.sync.ecss.extensions.api.node.AuthorNode
rendered in the
Author mode using an implementation of
ro.sync.ecss.extensions.api.StylesFilter
. You can implement the various
callbacks of the interface either by returning the default value given by Oxygen XML Author or by contributing to the value. The received styles ro.sync.ecss.css.Styles
can be
processed and values can be overwritten with your own. For example, you can override
the
KEY_BACKGROUND_COLOR
style to return your own implementation of ro.sync.exml.view.graphics.Color
or
override the KEY_FONT
style to return your own implementation of ro.sync.exml.view.graphics.Font
.
For instance, in our simple document example the filter can change the value of the
KEY_FONT
property for the table
element:
package simple.documentation.framework; import ro.sync.ecss.css.Styles; import ro.sync.ecss.extensions.api.StylesFilter; import ro.sync.ecss.extensions.api.node.AuthorNode; import ro.sync.exml.view.graphics.Font; public class SDFStylesFilter implements StylesFilter { public Styles filter(Styles styles, AuthorNode authorNode) { if (AuthorNode.NODE_TYPE_ELEMENT == authorNode.getType() && "table".equals(authorNode.getName())) { styles.setProperty(Styles.KEY_FONT, new Font(null, Font.BOLD, 12)); } return styles; } }