Package com.vaadin.client.ui.dd

Examples of com.vaadin.client.ui.dd.VTransferable


                        || type == Event.ONMOUSEOUT
                        || type == Event.ONTOUCHMOVE) {

                    if (mouseDownEvent != null) {
                        // start actual drag on slight move when mouse is down
                        VTransferable t = new VTransferable();
                        t.setDragSource(ConnectorMap.get(client).getConnector(
                                VTree.this));
                        t.setData("itemId", key);
                        VDragEvent drag = VDragAndDropManager.get().startDrag(
                                t, mouseDownEvent, true);

                        drag.createDragImage(nodeCaptionDiv, true);
                        event.stopPropagation();
View Full Code Here


            int deltaY = Math.abs(mDownEvent.getClientY() - event.getClientY());
            if (deltaX > 5 || deltaY > 5) {
                // Start the drag and drop operation

                // create Transferable, that contains the payload
                VTransferable transferable = new VTransferable();
                transferable.setData("Text", "myPayload");

                // Tell DragAndDropManager to start a drag and drop operation.
                // Also let it handle all events (last parameter true). Could
                // also do all event handling here too.
                VDragAndDropManager.get().startDrag(transferable,
View Full Code Here

                return false;
            }

            protected void startRowDrag(Event event, final int type,
                    Element targetTdOrTr) {
                VTransferable transferable = new VTransferable();
                transferable.setDragSource(ConnectorMap.get(client)
                        .getConnector(VScrollTable.this));
                transferable.setData("itemId", "" + rowKey);
                NodeList<TableCellElement> cells = rowElement.getCells();
                for (int i = 0; i < cells.getLength(); i++) {
                    if (cells.getItem(i).isOrHasChild(targetTdOrTr)) {
                        HeaderCell headerCell = tHead.getHeaderCell(i);
                        transferable.setData("propertyId", headerCell.cid);
                        break;
                    }
                }

                VDragEvent ev = VDragAndDropManager.get().startDrag(
View Full Code Here

     * @return true if the event was handled as a drag start event
     */
    private boolean startDrag(NativeEvent event) {
        if (dragStartMode == WRAPPER || dragStartMode == COMPONENT
                || dragStartMode == COMPONENT_OTHER) {
            VTransferable transferable = new VTransferable();
            transferable.setDragSource(getConnector());

            ComponentConnector paintable = Util.findPaintable(client,
                    Element.as(event.getEventTarget()));
            Widget widget = paintable.getWidget();
            transferable.setData("component", paintable);
            VDragEvent dragEvent = VDragAndDropManager.get().startDrag(
                    transferable, event, true);

            transferable.setData("mouseDown", MouseEventDetailsBuilder
                    .buildMouseEventDetails(event).serialize());

            if (dragStartMode == WRAPPER) {
                dragEvent.createDragImage(getElement(), true);
            } else if (dragStartMode == COMPONENT_OTHER
View Full Code Here

                // returned quickly back to wrapper
                dragleavetimer.cancel();
                dragleavetimer = null;
            }
            if (VDragAndDropManager.get().getCurrentDropHandler() != getDropHandler()) {
                VTransferable transferable = new VTransferable();
                transferable.setDragSource(getConnector());

                vaadinDragEvent = VDragAndDropManager.get().startDrag(
                        transferable, event, false);
                VDragAndDropManager.get().setCurrentDropHandler(
                        getDropHandler());
View Full Code Here

        if (dropHandler == null || !currentlyValid) {
            return true;
        }
        try {

            VTransferable transferable = vaadinDragEvent.getTransferable();

            JsArrayString types = event.getTypes();
            for (int i = 0; i < types.length(); i++) {
                String type = types.get(i);
                if (isAcceptedType(type)) {
                    String data = event.getDataAsText(type);
                    if (data != null) {
                        transferable.setData(type, data);
                    }
                }
            }

            int fileCount = event.getFileCount();
            if (fileCount > 0) {
                transferable.setData("filecount", fileCount);
                for (int i = 0; i < fileCount; i++) {
                    final int fileId = filecounter++;
                    final VHtml5File file = event.getFile(i);
                    VConsole.log("Preparing to upload file " + file.getName()
                            + " with id " + fileId);
                    transferable.setData("fi" + i, "" + fileId);
                    transferable.setData("fn" + i, file.getName());
                    transferable.setData("ft" + i, file.getType());
                    transferable.setData("fs" + i, file.getSize());
                    queueFilePost(fileId, file);
                }

            }
View Full Code Here

TOP

Related Classes of com.vaadin.client.ui.dd.VTransferable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.