-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi, I tried to do a simple calendars example.
public class yyy extends SelectorComposer<Component>
{
private static final long serialVersionUID = 1L;
@Wire("#calendar")
private Calendars calendar;
@Listen("onEventCreate = #calendar; onEventEdit = #calendar")
public void createEvent(CalendarsEvent event)
{
System.out.println(event.getName());
}
/*@Override
public void doAfterCompose(Component comp) throws Exception
{
super.doAfterCompose(comp);
}*/
@AfterCompose
public void afterCompose(@ContextParam(ContextType.VIEW) Component view)
{
Selectors.wireComponents(view, this, false);
}
}
.zul file
<window id="info" apply="org.zkoss.bind.BindComposer" viewmodel="@id('vm') @init('rvl.gm.ui.yyy')" ><="" p="">
<calendars id="calendar" height="500px" firstDayOfWeek="Monday" mold="default"
readonly="true" beginTime="8" endTime="21" />
</window>
I can't intercept none events... Why?
Thanks!
Hello lramellavotta,
Please remove the property readonly="true" from the calendars component (This prevents the events from being triggered).
For more information please look at the respective demo at the url:
http://www.zkoss.org/zkdemo/zkcalendar/zkcalendar
Best Regards,
Darksu
Thanks Darksu for your reply. Your suggestion works but I cannot fire System.out in createEvent where I would like to open a dialog box to ask the data.
Unfortunately I use CE edition and I can't use @Subscribe like the example.
Any ideas?
Luca
This seems to work...
@SuppressWarnings({ "unchecked", "rawtypes" })
@AfterCompose
public void afterCompose(@ContextParam(ContextType.VIEW) Component view)
{
Selectors.wireComponents(view, this, false);
calendar.addEventListener("onEventCreate", new EventListener()
{
public void onEvent(Event e) throws InterruptedException
{
System.out.println("onEventCreate:");
}
});
calendar.addEventListener("onEventEdit", new EventListener()
{
public void onEvent(Event e) throws InterruptedException
{
System.out.println("onEventEdit");
}
});
calendar.addEventListener("onEventUpdate", new EventListener()
{
public void onEvent(Event e) throws InterruptedException
{
System.out.println("onEventUpdate");
}
});
}
Asked: 2014-11-15 11:18:50 +0800
Seen: 19 times
Last updated: Nov 16 '14