use of org.freeplane.core.ui.LengthUnits in project freeplane by freeplane.
the class MultipleImage method addLinkIcon.
public void addLinkIcon(Icon icon, NodeModel node) {
final Quantity<LengthUnits> iconHeight = IconController.getController().getIconSize(node);
final IconFactory iconFactory = IconFactory.getInstance();
final Icon scaledIcon = iconFactory.canScaleIcon(icon) ? iconFactory.getScaledIcon(icon, iconHeight) : icon;
mIcons.add(scaledIcon);
mUIIcons.add(null);
}
use of org.freeplane.core.ui.LengthUnits in project freeplane by freeplane.
the class LocationController method getStyleChildGap.
private Quantity<LengthUnits> getStyleChildGap(final MapModel map, final Collection<IStyle> styleKeys) {
final MapStyleModel model = MapStyleModel.getExtension(map);
for (IStyle styleKey : styleKeys) {
final NodeModel styleNode = model.getStyleNode(styleKey);
if (styleNode == null) {
continue;
}
final LocationModel styleModel = styleNode.getExtension(LocationModel.class);
if (styleModel == null) {
continue;
}
Quantity<LengthUnits> vGap = styleModel.getVGap();
if (vGap == LocationModel.DEFAULT_VGAP) {
continue;
}
return vGap;
}
return null;
}
use of org.freeplane.core.ui.LengthUnits in project freeplane by freeplane.
the class NodeStyleBuilder method writeAttributes.
private void writeAttributes(final ITreeWriter writer, final NodeModel node, final NodeBorderModel border, final boolean forceFormatting) {
final Boolean borderWidthMatchesEdgeWidth = forceFormatting ? nsc.getBorderWidthMatchesEdgeWidth(node) : border.getBorderWidthMatchesEdgeWidth();
if (borderWidthMatchesEdgeWidth != null) {
writer.addAttribute("BORDER_WIDTH_LIKE_EDGE", borderWidthMatchesEdgeWidth.toString());
}
final Quantity<LengthUnits> borderWidth = forceFormatting ? nsc.getBorderWidth(node) : border.getBorderWidth();
if (borderWidth != null) {
writer.addAttribute("BORDER_WIDTH", borderWidth.toString());
}
final Boolean borderColorMatchesEdgeColor = forceFormatting ? nsc.getBorderColorMatchesEdgeColor(node) : border.getBorderColorMatchesEdgeColor();
if (borderColorMatchesEdgeColor != null) {
writer.addAttribute("BORDER_COLOR_LIKE_EDGE", borderColorMatchesEdgeColor.toString());
}
final Color borderColor = forceFormatting ? nsc.getBorderColor(node) : border.getBorderColor();
if (borderColor != null) {
ColorUtils.addColorAttributes(writer, "BORDER_COLOR", "BORDER_COLOR_ALPHA", borderColor);
}
final Boolean borderDashMatchesEdgeDash = forceFormatting ? nsc.getBorderDashMatchesEdgeDash(node) : border.getBorderDashMatchesEdgeDash();
if (borderDashMatchesEdgeDash != null) {
writer.addAttribute("BORDER_DASH_LIKE_EDGE", borderDashMatchesEdgeDash.toString());
}
DashVariant borderDash = forceFormatting ? nsc.getBorderDash(node) : border.getBorderDash();
if (borderDash != null) {
writer.addAttribute("BORDER_DASH", borderDash.name());
}
}
use of org.freeplane.core.ui.LengthUnits in project freeplane by freeplane.
the class NodeStyleController method getBorderWidth.
private Quantity<LengthUnits> getBorderWidth(final MapModel map, final Collection<IStyle> styleKeys) {
final MapStyleModel model = MapStyleModel.getExtension(map);
for (IStyle styleKey : styleKeys) {
final NodeModel styleNode = model.getStyleNode(styleKey);
if (styleNode == null) {
continue;
}
final NodeBorderModel borderModel = NodeBorderModel.getModel(styleNode);
if (borderModel == null) {
continue;
}
final Quantity<LengthUnits> borderWidth = borderModel.getBorderWidth();
if (borderWidth == null) {
continue;
}
return borderWidth;
}
return DEFAULT_BORDER_WIDTH;
}
use of org.freeplane.core.ui.LengthUnits in project freeplane by freeplane.
the class NodeStyleController method getMaxNodeWidth.
private Quantity<LengthUnits> getMaxNodeWidth(final MapModel map, final Collection<IStyle> styleKeys) {
final MapStyleModel model = MapStyleModel.getExtension(map);
for (IStyle styleKey : styleKeys) {
final NodeModel styleNode = model.getStyleNode(styleKey);
if (styleNode == null) {
continue;
}
final NodeSizeModel sizeModel = NodeSizeModel.getModel(styleNode);
if (sizeModel == null) {
continue;
}
final Quantity<LengthUnits> maxTextWidth = sizeModel.getMaxNodeWidth();
if (maxTextWidth == null) {
continue;
}
return maxTextWidth;
}
return DEFAULT_MAXIMUM_WIDTH;
}
Aggregations