Package com.groiss.util
Class Clipboard
java.lang.Object
com.groiss.util.Clipboard
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
Modifier and TypeClassDescriptionstatic enum
the supported modes for the clipboard -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clears the clipboardstatic Clipboard
get()
Returns the clipboard of the session of the current userReturns the container stored in the clipboard.getMode()
Returns the mode stored in the clipboardReturns the objects stored in the clipboard.boolean
isEmpty()
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 unchangedvoid
setData
(Object container, List<? extends Object> objects, Clipboard.Mode mode) Sets the whole content for the clipboardvoid
setMode
(Clipboard.Mode newMode) Sets only the mode, all other clipboard data remain unchangedvoid
setObjects
(List<? extends Object> newObjects) Sets only the objects, all other clipboard data remain unchanged
-
Method Details
-
get
Returns the clipboard of the session of the current user -
setData
Sets the whole content for the clipboard- Parameters:
container
- the container of the passed objectsobjects
- the objects to be set to the clipboardmode
- the clipboard mode
-
setContainer
Sets only the container, all other clipboard data remain unchanged- Parameters:
newContainer
- the new container
-
setObjects
Sets only the objects, all other clipboard data remain unchanged- Parameters:
newObjects
- the new objects
-
setMode
Sets only the mode, all other clipboard data remain unchanged- Parameters:
newMode
- the new mode
-
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
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
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
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
-