Add javadocs

pull/2/head
Hammy 3 years ago
parent 2aa4cf9b0d
commit d6a6c59a24

@ -57,14 +57,52 @@ abstract class ClipboardListener {
*/ */
abstract void insert(String stringContent); abstract void insert(String stringContent);
/**
* Insert the given {@link Image} into the system clipboard
*
* @param imageContent The given {@link Image} to insert
* @see WindowsOrUnixClipboardListener#insert(Image)
* @see MacClipboardListener#insert(Image)
*/
abstract void insert(Image imageContent); abstract void insert(Image imageContent);
/**
* Insert the given {@link List} of {@link File} into the system clipboard
*
* @param fileContent The given {@link List} of {@link File} to insert
* @see WindowsOrUnixClipboardListener#insert(List)
* @see MacClipboardListener#insert(List)
*/
abstract void insert(List<File> fileContent); abstract void insert(List<File> fileContent);
/**
* Insert the given {@link String} into the system clipboard
* and notify the user about the new contents within the clipboard
*
* @param stringContent The given {@link String} to insert
* @see WindowsOrUnixClipboardListener#insertAndNotify(String)
* @see MacClipboardListener#insertAndNotify(String)
*/
abstract void insertAndNotify(String stringContent); abstract void insertAndNotify(String stringContent);
/**
* Insert the given {@link Image} into the system clipboard
* and notify the user about the new contents within the clipboard
*
* @param imageContent The given {@link Image} to insert
* @see WindowsOrUnixClipboardListener#insertAndNotify(Image)
* @see MacClipboardListener#insertAndNotify(Image)
*/
abstract void insertAndNotify(Image imageContent); abstract void insertAndNotify(Image imageContent);
/**
* Insert the given {@link List} of {@link File} into the system clipboard
* and notify the user about the new contents within the clipboard
*
* @param fileContent The given {@link List} of {@link File} to insert
* @see WindowsOrUnixClipboardListener#insertAndNotify(List)
* @see MacClipboardListener#insertAndNotify(List)
*/
abstract void insertAndNotify(List<File> fileContent); abstract void insertAndNotify(List<File> fileContent);
void toggleTextMonitored() { void toggleTextMonitored() {

@ -4,6 +4,10 @@ import java.awt.image.BufferedImage;
import java.io.File; import java.io.File;
import java.util.List; import java.util.List;
/**
* Contains potential clipboard contents returned from the clipboard. Supported types are currently {@link String},
* {@link BufferedImage} and {@link List} of {@link File}
*/
public class ClipboardContent { public class ClipboardContent {
private String text; private String text;
private BufferedImage image; private BufferedImage image;

@ -2,6 +2,10 @@ package me.goudham.domain;
import java.util.Objects; import java.util.Objects;
/**
* Contains clipboard contents as generics
* @param <T> Type of data given by the {@link java.awt.datatransfer.Clipboard}
*/
public class GenericClipboardContent<T> { public class GenericClipboardContent<T> {
private T oldContent; private T oldContent;

@ -3,6 +3,9 @@ package me.goudham.domain;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.util.Objects; import java.util.Objects;
/**
* Wrapper class surrounding {@link MyBufferedImage} to ensure image equality is properly evaluated
*/
public class MyBufferedImage { public class MyBufferedImage {
private BufferedImage bufferedImage; private BufferedImage bufferedImage;

@ -6,6 +6,13 @@ import java.awt.datatransfer.UnsupportedFlavorException;
import java.io.File; import java.io.File;
import java.util.List; import java.util.List;
/**
* A {@link Transferable} which implements the capability required to transfer a
* {@link List} of {@link File}
* <p>
* This {@link Transferable} properly supports {@link DataFlavor#javaFileListFlavor}
* @see DataFlavor#javaFileListFlavor
*/
public class TransferableFile implements Transferable { public class TransferableFile implements Transferable {
private final List<File> files; private final List<File> files;

@ -6,6 +6,13 @@ import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException; import java.awt.datatransfer.UnsupportedFlavorException;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
/**
* A {@link Transferable} which implements the capability required to transfer a
* {@link java.awt.image.BufferedImage}
* <p>
* This {@link Transferable} properly supports {@link DataFlavor#imageFlavor}
* @see DataFlavor#imageFlavor
*/
public class TransferableImage implements Transferable { public class TransferableImage implements Transferable {
private final Image image; private final Image image;

@ -1,4 +1,7 @@
package me.goudham.event; package me.goudham.event;
/**
* Common interface for all events to extend (Not used yet)
*/
interface ClipboardEvent { interface ClipboardEvent {
} }

@ -4,6 +4,9 @@ import java.io.File;
import java.util.List; import java.util.List;
import me.goudham.domain.ClipboardContent; import me.goudham.domain.ClipboardContent;
/**
* Interface for notifying clipboard changes that happen to be {@link File}
*/
public interface FileEvent extends ClipboardEvent { public interface FileEvent extends ClipboardEvent {
void onCopyFiles(ClipboardContent oldContent, List<File> newContent); void onCopyFiles(ClipboardContent oldContent, List<File> newContent);
} }

@ -3,6 +3,10 @@ package me.goudham.event;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import me.goudham.domain.ClipboardContent; import me.goudham.domain.ClipboardContent;
/**
* Interface for notifying clipboard changes that happen to be {@link BufferedImage}
*/
public interface ImageEvent extends ClipboardEvent { public interface ImageEvent extends ClipboardEvent {
void onCopyImage(ClipboardContent oldContent, BufferedImage newContent); void onCopyImage(ClipboardContent oldContent, BufferedImage newContent);
} }

@ -2,6 +2,9 @@ package me.goudham.event;
import me.goudham.domain.ClipboardContent; import me.goudham.domain.ClipboardContent;
/**
* Interface for notifying clipboard changes that happen to be {@link String}
*/
public interface TextEvent extends ClipboardEvent { public interface TextEvent extends ClipboardEvent {
void onCopyText(ClipboardContent oldContent, String newContent); void onCopyText(ClipboardContent oldContent, String newContent);
} }

Loading…
Cancel
Save