0
我已经在ZK中定义了一个自定义命令,并且想通过单击菜单项来调用它。来自Java API的ZK火灾事件
我看到我们可以定义一个AuRequest对象,但是找不到像我们在JavaScript中使用zkau.send函数一样发送AuRequest的方法。
是有可能的吗?如果没有,是否可以在JavaScript函数中定义zkau.send并在MeunItem中单击事件?
public class MyCustomCommand extends Command
{
protected MyCustomCommand(final String id, final int flags)
{
super(id, flags);
}
@Override
protected void process(final AuRequest request)
{
System.out.println("Menu Item Click");
}
}
注册命令:
<bean id="myCustomCommand" class="com.test.commands.MyCustomCommand">
<constructor-arg value="onMenuEdit" />
<constructor-arg><util:constant static-field="org.zkoss.zk.au.Command.IGNORE_OLD_EQUIV"/></constructor-arg>
</bean>
和菜单项事件
menuItem.addEventListener(Events.ON_CLICK, new EventListener()
{
@Override
public void onEvent(final Event event) throws Exception
{
final Tree tree = (Tree) parent;
final Treeitem treeitem = tree.getSelectedItem();
final AuRequest auRequest = new AuRequest(treeitem.getDesktop(), treeitem.getUuid(), "onMenuEdit", new String[]{});
//how to send the auRequest??
}
});