+ //
+ // ACTIONS
+ //
+
+ /**
+ * Copies the request URI of the project to the clipboard.
+ */
+ private void actionCopyURI() {
+ uriCopied = true;
+ Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
+ clipboard.setContents(new StringSelection(requestURITextField.getText()), this);
+ }
+
+ /**
+ * Formats the given number so that it always has the the given number of
+ * fractional digits.
+ *
+ * @param number
+ * The number to format
+ * @param digits
+ * The number of fractional digits
+ * @return The formatted number
+ */
+ private String formatNumber(double number, int digits) {
+ int multiplier = (int) Math.pow(10, digits);
+ String formattedNumber = String.valueOf((int) (number * multiplier) / (double) multiplier);
+ if (formattedNumber.indexOf('.') == -1) {
+ formattedNumber += '.';
+ for (int digit = 0; digit < digits; digit++) {
+ formattedNumber += "0";
+ }
+ }
+ return formattedNumber;
+ }
+
+ /**
+ * Returns the formatted transfer rate at this point.
+ *
+ * @return The formatted transfer rate
+ */
+ private String getTransferRate() {
+ return formatNumber(insertedBlocks * 32.0 / ((System.currentTimeMillis() - startTime) / 1000), 1);
+ }
+
+ //
+ // INTERFACE ClipboardOwner
+ //
+
+ /**
+ * {@inheritDoc}
+ */
+ public void lostOwnership(Clipboard clipboard, Transferable contents) {
+ /* ignore. */
+ }
+