From 884fc16298aacd82375616d1a9c9a22f9f4112b1 Mon Sep 17 00:00:00 2001 From: Felix Homa Date: Mon, 28 Mar 2022 03:13:09 +0200 Subject: [PATCH] Renamed a method, fixed documentation warnings --- .../pingger/korrekturHelper/KorrekturHelper.java | 13 ++++++++++--- .../cs/rvs/pingger/korrekturHelper/Utils.java | 6 ++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/main/java/de/tuDortmund/cs/rvs/pingger/korrekturHelper/KorrekturHelper.java b/src/main/java/de/tuDortmund/cs/rvs/pingger/korrekturHelper/KorrekturHelper.java index 1b5b6f2..0b90785 100644 --- a/src/main/java/de/tuDortmund/cs/rvs/pingger/korrekturHelper/KorrekturHelper.java +++ b/src/main/java/de/tuDortmund/cs/rvs/pingger/korrekturHelper/KorrekturHelper.java @@ -298,6 +298,7 @@ public class KorrekturHelper private final JButton btn_toClipboard; private String currentHtml = ""; + /** The JFrame for this {@link KorrekturHelper} */ public final JFrame frm; private final HtmlContext hc; @@ -344,7 +345,7 @@ public class KorrekturHelper var panel = new JPanel(true); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); var jsp = new JScrollPane(panel); - Consumer c = n -> lostOwnership(); + Consumer c = n -> verifyClipboard(); for (var n : nodes) { n.addChangeListener(c); @@ -356,6 +357,9 @@ public class KorrekturHelper frm.pack(); } + /** + * Copies the current State to clipboard + */ public synchronized void copyToClipboard() { var sb = new StringBuilder(); @@ -366,7 +370,7 @@ public class KorrekturHelper @Override public void lostOwnership(Clipboard clipboard, java.awt.datatransfer.Transferable contents) { - KorrekturHelper.this.lostOwnership(); + KorrekturHelper.this.verifyClipboard(); } }; var clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); @@ -374,7 +378,10 @@ public class KorrekturHelper 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(); recursiveToHtml(nodes, sb, hc, 0); diff --git a/src/main/java/de/tuDortmund/cs/rvs/pingger/korrekturHelper/Utils.java b/src/main/java/de/tuDortmund/cs/rvs/pingger/korrekturHelper/Utils.java index 4997fa6..f4e36fe 100644 --- a/src/main/java/de/tuDortmund/cs/rvs/pingger/korrekturHelper/Utils.java +++ b/src/main/java/de/tuDortmund/cs/rvs/pingger/korrekturHelper/Utils.java @@ -8,6 +8,12 @@ import java.math.BigDecimal; 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) { return String.format("%.1f", bd.doubleValue());