0

ZK Calendars unable to firing onEventEdit

asked 2014-11-15 11:18:50 +0800

lramellavotta gravatar image lramellavotta flag of Italy
200 1 8

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')" &gt;<="" 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!

delete flag offensive retag edit

4 Answers

Sort by ยป oldest newest most voted
1

answered 2014-11-16 07:42:03 +0800

Darksu gravatar image Darksu
1991 1 4

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

link publish delete flag offensive edit
0

answered 2014-11-16 09:18:08 +0800

lramellavotta gravatar image lramellavotta flag of Italy
200 1 8

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

link publish delete flag offensive edit
0

answered 2014-11-16 09:42:40 +0800

lramellavotta gravatar image lramellavotta flag of Italy
200 1 8

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");
            }
        });
    }
link publish delete flag offensive edit
0

answered 2014-11-16 11:23:49 +0800

Darksu gravatar image Darksu
1991 1 4

Hello lramellavotta,

Event listeners always do the trick :)

Best Regards,

Darksu

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
2 followers

RSS

Stats

Asked: 2014-11-15 11:18:50 +0800

Seen: 19 times

Last updated: Nov 16 '14

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More