diff options
| author | unknown <james.jenour@protonmail.com> | 2020-05-31 01:59:47 +1000 |
|---|---|---|
| committer | unknown <james.jenour@protonmail.com> | 2020-05-31 01:59:47 +1000 |
| commit | de97f55968d183cc7d76aad87e3b27d382bfdbc9 (patch) | |
| tree | eab5e7769069f31b79016e3702855ebb9f614a8e /src/main/java/io/github/moulberry/notenoughupdates/util/HTMLParagraphView.java | |
| download | notenoughupdates-de97f55968d183cc7d76aad87e3b27d382bfdbc9.tar.gz notenoughupdates-de97f55968d183cc7d76aad87e3b27d382bfdbc9.tar.bz2 notenoughupdates-de97f55968d183cc7d76aad87e3b27d382bfdbc9.zip | |
1.5
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/util/HTMLParagraphView.java')
| -rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/util/HTMLParagraphView.java | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/HTMLParagraphView.java b/src/main/java/io/github/moulberry/notenoughupdates/util/HTMLParagraphView.java new file mode 100644 index 00000000..ab4be4a7 --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/HTMLParagraphView.java @@ -0,0 +1,30 @@ +package io.github.moulberry.notenoughupdates.util; + +import javax.swing.text.Element; +import javax.swing.text.FlowView; +import javax.swing.text.View; +import javax.swing.text.html.ParagraphView; + +class HTMLParagraphView extends ParagraphView { + + public static int MAX_VIEW_SIZE=100; + + public HTMLParagraphView(Element elem) { + super(elem); + strategy = new HTMLParagraphView.HTMLFlowStrategy(); + } + + public static class HTMLFlowStrategy extends FlowStrategy { + protected View createView(FlowView fv, int startOffset, int spanLeft, int rowIndex) { + View res=super.createView(fv, startOffset, spanLeft, rowIndex); + if (res.getEndOffset()-res.getStartOffset()> MAX_VIEW_SIZE) { + res = res.createFragment(startOffset, startOffset+ MAX_VIEW_SIZE); + } + return res; + } + + } + public int getResizeWeight(int axis) { + return 0; + } +}
\ No newline at end of file |
