Skip to content

Commit bdc419d

Browse files
committed
fix(templates): keep IconTextRow raster overload for binary compatibility
The PNG->SVG migration removed the public IconTextRow.render(DocumentImageData, ...) overload, which japicmp flagged as METHOD_REMOVED against the v1.7.0 baseline — IconTextRow is public API, so external template authors could call it. Restored the overload (the bundled presets use the recolorable SvgGlyph overload; the raster one stays for callers with their own raster icons), keeping the change source- and binary-compatible.
1 parent 6f7560d commit bdc419d

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

  • src/main/java/com/demcha/compose/document/templates/cv/v2/widgets

src/main/java/com/demcha/compose/document/templates/cv/v2/widgets/IconTextRow.java

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.demcha.compose.document.templates.cv.v2.widgets;
22

33
import com.demcha.compose.document.dsl.SectionBuilder;
4+
import com.demcha.compose.document.image.DocumentImageData;
45
import com.demcha.compose.document.node.DocumentLinkOptions;
56
import com.demcha.compose.document.node.InlineImageAlignment;
67
import com.demcha.compose.document.node.TextAlign;
@@ -98,4 +99,49 @@ public static void render(SectionBuilder host, SvgGlyph glyph,
9899
});
99100
});
100101
}
102+
103+
/**
104+
* Renders an icon + text row from a pre-decoded raster glyph.
105+
*
106+
* <p>Public API retained for callers that supply their own raster
107+
* {@link DocumentImageData} icon. The bundled CV presets use the
108+
* recolorable {@link SvgGlyph} overload above; prefer it for new code.</p>
109+
*
110+
* @param host host section the row paragraph is appended to
111+
* @param icon glyph image payload (already decoded / cached by the
112+
* caller); when {@code null} the row renders text only
113+
* @param iconSize icon edge length in points (width == height)
114+
* @param text label text rendered after the icon
115+
* @param style text style for the label
116+
* @param link optional link wrapping the whole row (icon + label);
117+
* {@code null} renders a non-clickable row
118+
* @param margin paragraph margin (vertical rhythm between rows)
119+
*/
120+
public static void render(SectionBuilder host, DocumentImageData icon,
121+
double iconSize, String text,
122+
DocumentTextStyle style, DocumentLinkOptions link,
123+
DocumentInsets margin) {
124+
Objects.requireNonNull(host, "host");
125+
Objects.requireNonNull(style, "style");
126+
String label = text == null ? "" : text;
127+
DocumentInsets rowMargin = margin == null ? DocumentInsets.zero() : margin;
128+
129+
host.addParagraph(paragraph -> {
130+
paragraph.textStyle(style)
131+
.align(TextAlign.LEFT)
132+
.link(link)
133+
.margin(rowMargin)
134+
.rich(rich -> {
135+
if (icon != null) {
136+
rich.image(icon, iconSize, iconSize,
137+
InlineImageAlignment.CENTER, 0.0, link);
138+
}
139+
if (link != null) {
140+
rich.link(GAP + label, link);
141+
} else {
142+
rich.style(GAP + label, style);
143+
}
144+
});
145+
});
146+
}
101147
}

0 commit comments

Comments
 (0)