Class Clipboard

java.lang.Object
com.groiss.util.Clipboard

public class Clipboard extends Object
This class is the clipboard for all copy/cut/link actions. It is stored within the session of a user so it is always available as long as a http request is accessible via the ThreadContext.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    the supported modes for the clipboard
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Clears the clipboard
    static Clipboard
    get()
    Returns the clipboard of the session of the current user
    Returns the container stored in the clipboard.
    Returns the mode stored in the clipboard
    List<? extends Object>
    Returns the objects stored in the clipboard.
    boolean
    Returns true if the clipboard is empty (which is the case if no objects are stored in the clipboard)
    boolean
    objectsOfClass(Class<?>... classes)
    Returns true if clipboard is empty or all the objects in the clipboard are an instance of at least one of the passed classes.
    void
    setContainer(Object newContainer)
    Sets only the container, all other clipboard data remain unchanged
    void
    setData(Object container, List<? extends Object> objects, Clipboard.Mode mode)
    Sets the whole content for the clipboard
    void
    Sets only the mode, all other clipboard data remain unchanged
    void
    setObjects(List<? extends Object> newObjects)
    Sets only the objects, all other clipboard data remain unchanged

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • get

      public static Clipboard get()
      Returns the clipboard of the session of the current user
    • setData

      public void setData(Object container, List<? extends Object> objects, Clipboard.Mode mode)
      Sets the whole content for the clipboard
      Parameters:
      container - the container of the passed objects
      objects - the objects to be set to the clipboard
      mode - the clipboard mode
    • setContainer

      public void setContainer(Object newContainer)
      Sets only the container, all other clipboard data remain unchanged
      Parameters:
      newContainer - the new container
    • setObjects

      public void setObjects(List<? extends Object> newObjects)
      Sets only the objects, all other clipboard data remain unchanged
      Parameters:
      newObjects - the new objects
    • setMode

      public void setMode(Clipboard.Mode newMode)
      Sets only the mode, all other clipboard data remain unchanged
      Parameters:
      newMode - the new mode
    • getContainer

      public Object getContainer()
      Returns the container stored in the clipboard. If the container is a Persistent the latest version of that object will be returned
      Returns:
      the container
    • getObjects

      public List<? extends Object> getObjects()
      Returns the objects stored in the clipboard. If the clipboard holds Persistents the latest version of those objects will be contained in the returned list
      Returns:
      the objects
    • getMode

      public Clipboard.Mode getMode()
      Returns the mode stored in the clipboard
      Returns:
      the mode
    • isEmpty

      public boolean isEmpty()
      Returns true if the clipboard is empty (which is the case if no objects are stored in the clipboard)
      Returns:
      true if clipboard has no objects
    • objectsOfClass

      public boolean objectsOfClass(Class<?>... classes)
      Returns true if clipboard is empty or all the objects in the clipboard are an instance of at least one of the passed classes.
      Parameters:
      classes - the classes to check
      Returns:
    • clear

      public void clear()
      Clears the clipboard