use of org.freeplane.core.ui.components.html.CssRuleBuilder in project freeplane by freeplane.
the class NoteController method getNoteCSSStyle.
protected String getNoteCSSStyle(ModeController modeController, NodeModel node, float zoom, boolean asHtmlFragment) {
final StringBuilder rule = new StringBuilder();
// set default font for notes:
final NodeStyleController style = (NodeStyleController) Controller.getCurrentModeController().getExtension(NodeStyleController.class);
MapModel map = modeController.getController().getMap();
if (map != null) {
final MapStyleModel model = MapStyleModel.getExtension(map);
final NodeModel noteStyleNode = model.getStyleNodeSafe(MapStyleModel.NOTE_STYLE);
final Font noteFont = style.getFont(noteStyleNode);
Color noteBackground = style.getBackgroundColor(noteStyleNode);
Color noteForeground = style.getColor(noteStyleNode);
final int alignment = style.getHorizontalTextAlignment(noteStyleNode).swingConstant;
final CssRuleBuilder cssRuleBuilder = new CssRuleBuilder();
if (asHtmlFragment)
cssRuleBuilder.withHTMLFont(noteFont);
else
cssRuleBuilder.withCSSFont(noteFont);
cssRuleBuilder.withColor(noteForeground).withBackground(noteBackground).withAlignment(alignment);
if (asHtmlFragment)
cssRuleBuilder.withMaxWidthAsPt(zoom, NodeSizeModel.getMaxNodeWidth(noteStyleNode), style.getMaxWidth(node));
rule.append(cssRuleBuilder);
}
return rule.toString();
}
Aggregations