public int getFontSize(final NodeModel node) { final Font font = getFont(node); return font.getSize(); }
public String getFontFamilyName(final NodeModel node) { final Font font = getFont(node); return font.getFamily(); }
public boolean isStrikedThrough(NodeModel node) { return FontUtils.isStrikedThrough(getFont(node)); } }
public boolean isBold(final NodeModel node) { return getFont(node).isBold(); }
public boolean isItalic(final NodeModel node) { return getFont(node).isItalic(); }
public Font getDefaultFont(final MapModel map, final IStyle style) { final MapStyleModel model = MapStyleModel.getExtension(map); final NodeModel styleNode = model.getStyleNodeSafe(style); return getFont(styleNode); }
private void setDefaultsFrom(MapModel map) { final MapStyleModel model = MapStyleModel.getExtension(map); final NodeModel styleNode = model.getStyleNodeSafe(MapStyleModel.DEFAULT_STYLE); defaultFont = nodeStyleController.getFont(styleNode); defaultColor = nodeStyleController.getColor(styleNode); }
final MapStyleModel model = MapStyleModel.getExtension(node.getMap()); final NodeModel attributeStyleNode = model.getStyleNodeSafe(MapStyleModel.ATTRIBUTE_STYLE); final Font font = style.getFont(attributeStyleNode); final StringBuilder tooltip = new StringBuilder(); tooltip.append("<html><body><table style='border: 1px solid;");
public void updateFont(final NodeView node) { final Font font = NodeStyleController.getController(node.getMap().getModeController()).getFont(node.getModel()); setFont(UITools.scale(font)); }
private void updateContentStyle() { final NodeStyleController style = Controller.getCurrentModeController().getExtension(NodeStyleController.class); final MapModel map = getModel(); final MapStyleModel model = MapStyleModel.getExtension(map); final NodeModel detailStyleNode = model.getStyleNodeSafe(MapStyleModel.DETAILS_STYLE); detailFont = UITools.scale(style.getFont(detailStyleNode)); detailBackground = style.getBackgroundColor(detailStyleNode); detailForeground = style.getColor(detailStyleNode); detailHorizontalAlignment = style.getHorizontalTextAlignment(detailStyleNode).swingConstant; final NodeModel noteStyleNode = model.getStyleNodeSafe(MapStyleModel.NOTE_STYLE); noteFont = UITools.scale(style.getFont(noteStyleNode)); noteBackground = style.getBackgroundColor(noteStyleNode); noteForeground = style.getColor(noteStyleNode); noteHorizontalAlignment = style.getHorizontalTextAlignment(noteStyleNode).swingConstant; }
final Font font = style.getFont(node); float zoom = view.getNodeView().getMap().getZoom(); final StringBuilder htmlBodyStyle = new StringBuilder("<body><div style=\"")
writeFoldingButtons(localParentID); final String fontStyle = fontStyle(nodeStyleController.getColor(model), nodeStyleController.getFont(model)); boolean shouldOutputFontStyle = !fontStyle.equals(""); if (shouldOutputFontStyle) {
private String getTooltip(final ModeController modeController, NodeModel node, MainView view) { final DetailTextModel detailText = DetailTextModel.getDetailText(node); if (detailText == null || !(detailText.isHidden() || ShortenedTextModel.isShortened(node))) { return null; } final NodeStyleController style = modeController.getExtension(NodeStyleController.class); final MapStyleModel model = MapStyleModel.getExtension(node.getMap()); final NodeModel detailStyleNode = model.getStyleNodeSafe(MapStyleModel.DETAILS_STYLE); Font detailFont = style.getFont(detailStyleNode); Color detailBackground = style.getBackgroundColor(detailStyleNode); Color detailForeground = style.getColor(detailStyleNode); final int alignment = style.getHorizontalTextAlignment(detailStyleNode).swingConstant; float zoom = view.getNodeView().getMap().getZoom(); final StringBuilder htmlBodyStyle = new StringBuilder("<body><div style=\"") .append(new CssRuleBuilder() .withHTMLFont(detailFont) .withColor(detailForeground) .withBackground(detailBackground) .withAlignment(alignment) .withMaxWidthAsPt(zoom, NodeSizeModel.getMaxNodeWidth(detailStyleNode), style.getMaxWidth(node))) .append("\">"); String noteText = detailText.getHtml(); final String tooltipText = noteText.replaceFirst("<body>", htmlBodyStyle.toString()) .replaceFirst("</body>", "</div></body>"); return tooltipText; } });
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(); }
private void updateComponentFontAndColors(final JComponent c) { final NodeView nodeView = attributeView.getNodeView(); final MapView mapView = nodeView.getMap(); final ModeController modeController = mapView.getModeController(); final NodeStyleController style = modeController.getExtension(NodeStyleController.class); final MapStyleModel model = MapStyleModel.getExtension(mapView.getModel()); final NodeModel attributeStyleNode = model.getStyleNodeSafe(MapStyleModel.ATTRIBUTE_STYLE); final Font font = style.getFont(attributeStyleNode); c.setFont(font.deriveFont(UITools.FONT_SCALE_FACTOR * font.getSize2D())); if(! SwingUtilities.isDescendingFrom(this, nodeView)) { return; } final Color backgroundColor = NodeStyleModel.getBackgroundColor(attributeStyleNode); if(backgroundColor!= null) { c.setOpaque(true); c.setBackground(backgroundColor); } else { c.setBackground(nodeView.getBackgroundColor()); c.setOpaque(false); } c.setForeground(style.getColor(attributeStyleNode)); }