Package org.zkoss.zkforge.clipboard
Class ClipboardEvent
- java.lang.Object
-
- org.zkoss.zk.ui.event.Event
-
- org.zkoss.zkforge.clipboard.ClipboardEvent
-
- All Implemented Interfaces:
Serializable
public class ClipboardEvent extends org.zkoss.zk.ui.event.Event- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringEVENT_NAMEprotected static com.google.gson.GsonGSON
-
Constructor Summary
Constructors Constructor Description ClipboardEvent(ClipboardResult result)Creates a ClipboardEvent that broadcasts to all root components (desktop event queue).ClipboardEvent(ClipboardResult result, org.zkoss.zk.ui.Component target)Creates a ClipboardEvent with an optional target component.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ClipboardImagegetClipboardImage()CallingisTextResult()before calling this method.ClipboardTextgetClipboardText()CallingisTextResult()before calling this method.static ClipboardEventgetEvent(org.zkoss.zk.au.AuRequest request)ClipboardResultgetResult()Gets the clipboard result.booleanisSuccess()Checks if the clipboard operation was successful.booleanisTextResult()Checks if this is a text result.protected static ClipboardResultparseResponse(Map<String,Object> data)Parses the AU request data from JavaScript clipboard operations into a ClipboardResult object.
-
-
-
Field Detail
-
EVENT_NAME
public static final String EVENT_NAME
- See Also:
- Constant Field Values
-
GSON
protected static final com.google.gson.Gson GSON
-
-
Constructor Detail
-
ClipboardEvent
public ClipboardEvent(ClipboardResult result, org.zkoss.zk.ui.Component target)
Creates a ClipboardEvent with an optional target component. If target is null, the event is broadcast to all root components (desktop event queue). If target is specified, the event is delivered only to that component.- Parameters:
result- the clipboard operation resulttarget- the target component to receive this event, or null to broadcast to desktop
-
ClipboardEvent
public ClipboardEvent(ClipboardResult result)
Creates a ClipboardEvent that broadcasts to all root components (desktop event queue). This constructor maintains backward compatibility with existing code.- Parameters:
result- the clipboard operation result
-
-
Method Detail
-
getEvent
public static ClipboardEvent getEvent(org.zkoss.zk.au.AuRequest request)
-
isSuccess
public boolean isSuccess()
Checks if the clipboard operation was successful.- Returns:
- true if the operation succeeded, false otherwise
-
getResult
public ClipboardResult getResult()
Gets the clipboard result.- Returns:
- the clipboard result (ClipboardText or ClipboardImage)
-
isTextResult
public boolean isTextResult()
Checks if this is a text result.- Returns:
- true if the result contains text data
-
getClipboardText
public ClipboardText getClipboardText()
CallingisTextResult()before calling this method. Gets the clipboard text if available.- Returns:
- the ClipboardText result, or null if this is not a text result
-
getClipboardImage
public ClipboardImage getClipboardImage()
CallingisTextResult()before calling this method. Gets the clipboard image if available.- Returns:
- the ClipboardImage result, or null if this is not an image result
-
parseResponse
protected static ClipboardResult parseResponse(Map<String,Object> data)
Parses the AU request data from JavaScript clipboard operations into a ClipboardResult object.- Parameters:
data- The AU request data map- Returns:
- ClipboardResult containing the parsed data
-
-