Renamed a method, fixed documentation warnings

This commit is contained in:
Felix Homa 2022-03-28 03:13:09 +02:00
parent f9e1335a82
commit 884fc16298
Signed by: felix.homa
GPG Key ID: 43610F311720D3DA
2 changed files with 16 additions and 3 deletions

View File

@ -298,6 +298,7 @@ public class KorrekturHelper
private final JButton btn_toClipboard; private final JButton btn_toClipboard;
private String currentHtml = ""; private String currentHtml = "";
/** The JFrame for this {@link KorrekturHelper} */
public final JFrame frm; public final JFrame frm;
private final HtmlContext hc; private final HtmlContext hc;
@ -344,7 +345,7 @@ public class KorrekturHelper
var panel = new JPanel(true); var panel = new JPanel(true);
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
var jsp = new JScrollPane(panel); var jsp = new JScrollPane(panel);
Consumer<Node> c = n -> lostOwnership(); Consumer<Node> c = n -> verifyClipboard();
for (var n : nodes) for (var n : nodes)
{ {
n.addChangeListener(c); n.addChangeListener(c);
@ -356,6 +357,9 @@ public class KorrekturHelper
frm.pack(); frm.pack();
} }
/**
* Copies the current State to clipboard
*/
public synchronized void copyToClipboard() public synchronized void copyToClipboard()
{ {
var sb = new StringBuilder(); var sb = new StringBuilder();
@ -366,7 +370,7 @@ public class KorrekturHelper
@Override @Override
public void lostOwnership(Clipboard clipboard, java.awt.datatransfer.Transferable contents) public void lostOwnership(Clipboard clipboard, java.awt.datatransfer.Transferable contents)
{ {
KorrekturHelper.this.lostOwnership(); KorrekturHelper.this.verifyClipboard();
} }
}; };
var clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); var clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
@ -374,7 +378,10 @@ public class KorrekturHelper
btn_toClipboard.setBackground(Color.GREEN); btn_toClipboard.setBackground(Color.GREEN);
} }
public synchronized void lostOwnership() /**
* Called on change of data or when the System signifies, the Clipboard changed
*/
public synchronized void verifyClipboard()
{ {
var sb = new StringBuilder(); var sb = new StringBuilder();
recursiveToHtml(nodes, sb, hc, 0); recursiveToHtml(nodes, sb, hc, 0);

View File

@ -8,6 +8,12 @@ import java.math.BigDecimal;
public class Utils public class Utils
{ {
/**
* formats Points for Users
*
* @param bd the {@link BigDecimal} to format
* @return the formatted String (1 decimal place)
*/
public static String formatPoints(BigDecimal bd) public static String formatPoints(BigDecimal bd)
{ {
return String.format("%.1f", bd.doubleValue()); return String.format("%.1f", bd.doubleValue());