Example usage for com.vaadin.client MouseEventDetailsBuilder buildMouseEventDetails

List of usage examples for com.vaadin.client MouseEventDetailsBuilder buildMouseEventDetails

Introduction

In this page you can find the example usage for com.vaadin.client MouseEventDetailsBuilder buildMouseEventDetails.

Prototype

public static MouseEventDetails buildMouseEventDetails(NativeEvent evt, Element relativeToElement) 

Source Link

Document

Construct a MouseEventDetails object from the given event.

Usage

From source file:org.vaadin.addons.tuningdatefield.widgetset.client.InlineTuningDateFieldConnector.java

License:Apache License

@Override
protected void init() {
    super.init();

    final InlineTuningDateFieldRpc rpc = getRpcProxy(InlineTuningDateFieldRpc.class);

    getWidget().addCalendarItemClickHandler(new CalendarItemClickHandler() {

        @Override/*from   w ww. jav a2  s.  co m*/
        public void onCalendarItemClick(CalendarItemClickEvent event) {
            MouseEventDetails mouseDetails = MouseEventDetailsBuilder
                    .buildMouseEventDetails(event.getClickEvent().getNativeEvent(), getWidget().getElement());
            rpc.calendarItemClicked(event.getItemIndex(), event.getRelativeDateIndex(), mouseDetails);
        }
    });

    getWidget().addPreviousControlClickHandler(new PreviousControlClickHandler() {

        @Override
        public void onPreviousControlClick(PreviousControlClickEvent event) {
            rpc.previousControlClicked();
        }
    });

    getWidget().addNextControlClickHandler(new NextControlClickHandler() {

        @Override
        public void onNextControlClick(NextControlClickEvent event) {
            rpc.nextControlClicked();
        }
    });

    getWidget().addResolutionControlClickHandler(new ResolutionControlClickHandler() {

        @Override
        public void onResolutionControlClick(ResolutionControlClickEvent event) {
            rpc.resolutionControlClicked();
        }
    });

}

From source file:org.vaadin.addons.tuningdatefield.widgetset.client.TuningDateFieldConnector.java

License:Apache License

@Override
protected void init() {
    super.init();

    final TuningDateFieldRpc rpc = getRpcProxy(TuningDateFieldRpc.class);

    getWidget().addDateTextChangedHandler(new DateTextChangeHandler() {

        @Override//from ww  w. j a va2  s.  co  m
        public void onDateTextChange(DateTextChangeEvent event) {
            rpc.dateTextChanged(event.getDateText());
        }
    });

    getWidget().addCalendarOpenHandler(new CalendarOpenHandler() {

        @Override
        public void onCalendarOpen(CalendarOpenEvent event) {
            rpc.onCalendarOpen();

        }
    });

    getWidget().addCalendarClosedHandler(new CalendarClosedHandler() {

        @Override
        public void onCalendarClosed(CalendarClosedEvent event) {
            rpc.onCalendarClosed();
        }
    });

    getWidget().getCalendar().addCalendarItemClickHandler(new CalendarItemClickHandler() {

        @Override
        public void onCalendarItemClick(CalendarItemClickEvent event) {
            MouseEventDetails mouseDetails = MouseEventDetailsBuilder
                    .buildMouseEventDetails(event.getClickEvent().getNativeEvent(), getWidget().getElement());
            rpc.calendarItemClicked(event.getItemIndex(), event.getRelativeDateIndex(), mouseDetails);
        }
    });

    getWidget().getCalendar().addPreviousControlClickHandler(new PreviousControlClickHandler() {

        @Override
        public void onPreviousControlClick(PreviousControlClickEvent event) {
            rpc.previousControlClicked();
        }
    });

    getWidget().getCalendar().addNextControlClickHandler(new NextControlClickHandler() {

        @Override
        public void onNextControlClick(NextControlClickEvent event) {
            rpc.nextControlClicked();
        }
    });

    getWidget().getCalendar().addResolutionControlClickHandler(new ResolutionControlClickHandler() {

        @Override
        public void onResolutionControlClick(ResolutionControlClickEvent event) {
            rpc.resolutionControlClicked();
        }
    });

}