* Check the @ClientWidget
*
*/
- @ClientWidget(VMyDropTarget.class)
+ @ClientWidget(VMyDropTargetPaintable.class)
class MyDropTarget extends AbstractComponent implements DropTarget {
public DropHandler getDropHandler() {
return new DropHandler() {
* operations that are controlled via server side api.
*
*/
- @ClientWidget(VMyDragSource.class)
+ @ClientWidget(VMyDragSourcePaintable.class)
public class MyDragSource extends AbstractComponent implements Component {
}
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Widget;
-import com.vaadin.terminal.gwt.client.ApplicationConnection;
-import com.vaadin.terminal.gwt.client.VPaintableWidget;
-import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.ui.dd.VDragAndDropManager;
import com.vaadin.terminal.gwt.client.ui.dd.VTransferable;
/**
* Example code to implement Component that has something to drag.
*/
-public class VMyDragSource extends Composite implements VPaintableWidget,
- MouseDownHandler, MouseMoveHandler, MouseOutHandler {
+public class VMyDragSource extends Composite implements MouseDownHandler,
+ MouseMoveHandler, MouseOutHandler {
private boolean mouseDown;
private MouseDownEvent mDownEvent;
- @SuppressWarnings("unused")
- private ApplicationConnection client;
+ @SuppressWarnings("unused")
public VMyDragSource() {
FlowPanel fp = new FlowPanel();
initWidget(fp);
}
- public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
- if (client.updateComponent(this, uidl, true)) {
- return;
- }
- this.client = client;
- }
-
/*
* Below a sophisticated drag start implementation. Drag event is started if
* mouse is moved 5 pixels with left mouse key down.
--- /dev/null
+package com.vaadin.tests.dd;\r
+\r
+import com.google.gwt.core.client.GWT;\r
+import com.google.gwt.user.client.ui.Widget;\r
+import com.vaadin.terminal.gwt.client.ApplicationConnection;\r
+import com.vaadin.terminal.gwt.client.UIDL;\r
+import com.vaadin.terminal.gwt.client.ui.VAbstractPaintableWidget;\r
+\r
+public class VMyDragSourcePaintable extends VAbstractPaintableWidget {\r
+\r
+ public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {\r
+ if (client.updateComponent(this, uidl, true)) {\r
+ return;\r
+ }\r
+ }\r
+\r
+ @Override\r
+ protected Widget createWidget() {\r
+ return GWT.create(VMyDragSource.class);\r
+ }\r
+\r
+}\r
package com.vaadin.tests.dd;
import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.Widget;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.VPaintableWidget;
-import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.ui.dd.VDragEvent;
import com.vaadin.terminal.gwt.client.ui.dd.VDropHandler;
import com.vaadin.terminal.gwt.client.ui.dd.VHasDropHandler;
public class VMyDropTarget extends Composite implements VHasDropHandler,
- VDropHandler, VPaintableWidget {
+ VDropHandler {
- private ApplicationConnection client;
+ ApplicationConnection client;
public void dragEnter(VDragEvent drag) {
}
return false;
}
- public VPaintableWidget getPaintable() {
- // Drophandler implemented by Paintable itself
+ public VDropHandler getDropHandler() {
+ // Drophandler implemented by widget itself
return this;
}
- public VDropHandler getDropHandler() {
- // Drophandler implemented by Paintable itself
- return this;
+ public VPaintableWidget getPaintable() {
+ // TODO Auto-generated method stub
+ return null;
}
public ApplicationConnection getApplicationConnection() {
return client;
}
- public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
- this.client = client;
-
- }
-
- public Widget getWidgetForPaintable() {
- return this;
- }
-
}
--- /dev/null
+package com.vaadin.tests.dd;\r
+\r
+import com.google.gwt.core.client.GWT;\r
+import com.google.gwt.user.client.ui.Widget;\r
+import com.vaadin.terminal.gwt.client.ApplicationConnection;\r
+import com.vaadin.terminal.gwt.client.UIDL;\r
+import com.vaadin.terminal.gwt.client.ui.VAbstractPaintableWidget;\r
+\r
+public class VMyDropTargetPaintable extends VAbstractPaintableWidget {\r
+\r
+ public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {\r
+ if (client.updateComponent(this, uidl, true)) {\r
+ return;\r
+ }\r
+ getWidgetForPaintable().client = client;\r
+ }\r
+\r
+ @Override\r
+ public VMyDropTarget getWidgetForPaintable() {\r
+ return (VMyDropTarget) super.getWidgetForPaintable();\r
+ }\r
+\r
+ @Override\r
+ protected Widget createWidget() {\r
+ return GWT.create(VMyDropTarget.class);\r
+ }\r
+\r
+}\r