18 package org.zkoss.zk.ui.event;
20 import java.util.Collections;
21 import java.util.List;
24 import org.zkoss.json.JSONArray;
25 import org.zkoss.zk.au.AuRequest;
26 import org.zkoss.zk.au.AuRequests;
27 import org.zkoss.zk.ui.Component;
28 import org.zkoss.zk.ui.Desktop;
37 private final Set _selectedItems;
38 private final Component _ref;
39 private final int _keys;
44 public static final int ALT_KEY = MouseEvent.ALT_KEY;
48 public static final int CTRL_KEY = MouseEvent.CTRL_KEY;
52 public static final int SHIFT_KEY = MouseEvent.SHIFT_KEY;
58 final Map data = request.getData();
59 final Desktop desktop = request.getDesktop();
60 Object obj = data.get(
"items");
61 if(obj instanceof String) {
62 String tmp = (String) data.get(
"items");
63 JSONArray ja =
new JSONArray();
64 ja.add(tmp.replaceAll(
"^\\[\"",
"")
65 .replaceAll(
"\"\\]$",
"")
66 .replaceAll(
"^\\[",
"")
67 .replaceAll(
"\\]$",
""));
68 data.put(
"items", ja);
70 return new SelectEvent_506(request.getCommand(), request.getComponent(),
71 AuRequests.convertToItems(desktop, (List)data.get(
"items")),
72 desktop.getComponentByUuidIfAny((String)data.get(
"reference")),
73 AuRequests.parseKeys(data));
80 this(name, target, selectedItems,
null, 0);
88 this(name, target, selectedItems, ref, 0);
97 Component ref,
int keys) {
99 _selectedItems = selectedItems !=
null ?
100 selectedItems: Collections.EMPTY_SET;
107 return _selectedItems;
static final SelectEvent_506 getSelectEvent(AuRequest request)
static final int CTRL_KEY
SelectEvent_506(String name, Component target, Set selectedItems, Component ref)
final Set getSelectedItems()
static final int SHIFT_KEY
SelectEvent_506(String name, Component target, Set selectedItems)
SelectEvent_506(String name, Component target, Set selectedItems, Component ref, int keys)