+++ /dev/null
-/*
-@ITMillApache2LicenseForJavaFiles@
- */
-/**
- *
- */
-package com.vaadin.event.dd.acceptcriteria;
-
-import com.vaadin.event.TransferableImpl;
-import com.vaadin.event.dd.DragAndDropEvent;
-import com.vaadin.terminal.PaintException;
-import com.vaadin.terminal.PaintTarget;
-import com.vaadin.terminal.gwt.client.ui.dd.VDragSourceIs;
-import com.vaadin.ui.Component;
-
-/**
- * Client side criteria that checks if the drag source is one of the given
- * components.
- *
- * @since 6.3
- */
-@ClientCriterion(VDragSourceIs.class)
-public class DragSourceIs extends ClientSideCriterion {
-
- private Component[] component;
-
- public DragSourceIs(Component... component) {
- this.component = component;
- }
-
- @Override
- public void paintContent(PaintTarget target) throws PaintException {
- super.paintContent(target);
- target.addAttribute("c", component.length);
- for (int i = 0; i < component.length; i++) {
- target.addAttribute("component" + i, component[i]);
- }
- }
-
- public boolean accept(DragAndDropEvent dragEvent) {
- if (dragEvent.getTransferable() instanceof TransferableImpl) {
- Component sourceComponent = ((TransferableImpl) dragEvent
- .getTransferable()).getSourceComponent();
- for (Component c : component) {
- if (c == sourceComponent) {
- return true;
- }
- }
- }
-
- return false;
- }
-
-}
\ No newline at end of file
--- /dev/null
+/*
+@ITMillApache2LicenseForJavaFiles@
+ */
+/**
+ *
+ */
+package com.vaadin.event.dd.acceptcriteria;
+
+import com.vaadin.event.TransferableImpl;
+import com.vaadin.event.dd.DragAndDropEvent;
+import com.vaadin.terminal.PaintException;
+import com.vaadin.terminal.PaintTarget;
+import com.vaadin.terminal.gwt.client.ui.dd.VDragSourceIs;
+import com.vaadin.ui.Component;
+
+/**
+ * Client side criteria that checks if the drag source is one of the given
+ * components.
+ *
+ * @since 6.3
+ */
+@SuppressWarnings("serial")
+@ClientCriterion(VDragSourceIs.class)
+public class SourceIs extends ClientSideCriterion {
+
+ private Component[] component;
+
+ public SourceIs(Component... component) {
+ this.component = component;
+ }
+
+ @Override
+ public void paintContent(PaintTarget target) throws PaintException {
+ super.paintContent(target);
+ target.addAttribute("c", component.length);
+ for (int i = 0; i < component.length; i++) {
+ target.addAttribute("component" + i, component[i]);
+ }
+ }
+
+ public boolean accept(DragAndDropEvent dragEvent) {
+ if (dragEvent.getTransferable() instanceof TransferableImpl) {
+ Component sourceComponent = ((TransferableImpl) dragEvent
+ .getTransferable()).getSourceComponent();
+ for (Component c : component) {
+ if (c == sourceComponent) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+}
\ No newline at end of file
import com.vaadin.event.dd.DropHandler;
import com.vaadin.event.dd.acceptcriteria.AcceptCriterion;
import com.vaadin.event.dd.acceptcriteria.And;
-import com.vaadin.event.dd.acceptcriteria.DragSourceIs;
+import com.vaadin.event.dd.acceptcriteria.SourceIs;
import com.vaadin.event.dd.acceptcriteria.Or;
import com.vaadin.terminal.Resource;
import com.vaadin.terminal.ThemeResource;
table.setDragMode(Table.TableDragMode.ROW);
OverFolderNode onNode = new OverFolderNode();
- DragSourceIs fromTable = new DragSourceIs(table);
+ SourceIs fromTable = new SourceIs(table);
- DragSourceIs fromTree = new DragSourceIs(tree1);
+ SourceIs fromTree = new SourceIs(tree1);
final Or fromTree1OrTable = new Or(fromTable, fromTree);
// Or could in the case be replaced with, keeping here as an example and
// test
- DragSourceIs treeOrTable = new DragSourceIs(table, tree1);
+ SourceIs treeOrTable = new SourceIs(table, tree1);
final And and = new And(fromTree1OrTable, onNode);
import com.vaadin.event.dd.DragAndDropEvent;
import com.vaadin.event.dd.DropHandler;
import com.vaadin.event.dd.acceptcriteria.AcceptCriterion;
-import com.vaadin.event.dd.acceptcriteria.DragSourceIs;
+import com.vaadin.event.dd.acceptcriteria.SourceIs;
import com.vaadin.terminal.ThemeResource;
import com.vaadin.terminal.gwt.client.ui.dd.VerticalDropLocation;
import com.vaadin.tests.components.TestBase;
table.setDropHandler(new DropHandler() {
// accept only drags from this table
- AcceptCriterion crit = new DragSourceIs(table);
+ AcceptCriterion crit = new SourceIs(table);
public AcceptCriterion getAcceptCriterion() {
return crit;