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) 

Source Link

Document

Construct a MouseEventDetails object from the given event.

Usage

From source file:com.haulmont.cuba.web.widgets.client.addons.dragdroplayouts.ui.VDragDropUtil.java

License:Apache License

/**
 * Creates a transferable for the tabsheet
 * /* w ww.j  a v  a 2s  . c  om*/
 * @param tabsheet
 *            The tabsheet the event occurred
 * @param tab
 *            The tab on which the event occurred
 * @param event
 *            The event
 * @param root
 *            The root widget
 * @return
 */
private static VTransferable createTabsheetTransferableFromMouseDown(VDDTabSheet tabsheet, TabCaption tab,
        NativeEvent event) {
    VTransferable transferable = new VTransferable();
    transferable.setDragSource(Util.findConnectorFor(tabsheet));
    transferable.setData(Constants.TRANSFERABLE_DETAIL_COMPONENT,
            tabsheet.getTab(tabsheet.getTabPosition(tab)));
    transferable.setData(Constants.TRANSFERABLE_DETAIL_INDEX, tabsheet.getTabPosition(tab));
    transferable.setData(Constants.TRANSFERABLE_DETAIL_MOUSEDOWN,
            MouseEventDetailsBuilder.buildMouseEventDetails(event).serialize());
    return transferable;
}

From source file:com.haulmont.cuba.web.widgets.client.addons.dragdroplayouts.ui.VDragDropUtil.java

License:Apache License

/**
 * Creates a transferable for the Accordion
 * //from w ww  .jav  a 2 s .  c om
 * @param accordion
 *            The Accordion where the event occurred
 * @param tab
 *            The tab on which the event occurred
 * @param event
 *            The event
 * @param root
 *            The root widget
 * @return
 */
private static VTransferable createAccordionTransferableFromMouseDown(VDDAccordion accordion, StackItem tab,
        NativeEvent event) {
    VTransferable transferable = new VTransferable();
    transferable.setDragSource(Util.findConnectorFor(accordion));
    transferable.setData(Constants.TRANSFERABLE_DETAIL_COMPONENT,
            accordion.getTab(accordion.getTabPosition(tab)));
    transferable.setData(Constants.TRANSFERABLE_DETAIL_INDEX, accordion.getTabPosition(tab));
    transferable.setData(Constants.TRANSFERABLE_DETAIL_MOUSEDOWN,
            MouseEventDetailsBuilder.buildMouseEventDetails(event).serialize());
    return transferable;
}

From source file:com.haulmont.cuba.web.widgets.client.addons.dragdroplayouts.ui.VDragDropUtil.java

License:Apache License

private static VTransferable createTransferable(ComponentConnector layout, ComponentConnector widgetConnector,
        NativeEvent event) {/*from w w  w  .j  a va2s  .  com*/
    VTransferable transferable = new VTransferable();
    transferable.setDragSource(layout);
    transferable.setData(Constants.TRANSFERABLE_DETAIL_COMPONENT, widgetConnector);
    transferable.setData(Constants.TRANSFERABLE_DETAIL_MOUSEDOWN,
            MouseEventDetailsBuilder.buildMouseEventDetails(event).serialize());
    return transferable;
}

From source file:org.vaadin.anna.gridactionrenderer.client.GridActionRendererConnector.java

License:Apache License

/**
 * Sends RPC call to the server-side about the clicked GridAction and row.
 * If the clicked action was a download action, triggers a remote click to
 * the given GridFileDownloader as well.
 *
 * @param event/*from   w  w w.  j a  va2  s . c o  m*/
 *            triggering click event
 * @param gridAction
 *            triggered action
 * @param rowIndex
 *            index of the row which the action belongs to
 * @param columnIndex
 *            index of the column which the action belongs to
 */
public void handleClick(ClickEvent event, GridAction gridAction, int columnIndex, int rowIndex) {
    MouseEventDetails mouseDetails = MouseEventDetailsBuilder.buildMouseEventDetails(event.getNativeEvent());
    getRpcProxy(GridActionClickRpc.class).click(rowIndex, gridAction.actionKey, mouseDetails);

    if (gridAction.download) {
        if (getState().fileDownloader != null) {
            ((GridFileDownloaderConnector) getState().fileDownloader).remoteClick(columnIndex, rowIndex);
        } else {
            logger.severe("No file downloader set!");
        }
    }
}