summaryrefslogtreecommitdiffstats
path: root/server/src/com/vaadin/event/dd/acceptcriteria
diff options
context:
space:
mode:
authorTeemu Suo-Anttila <teemusa@vaadin.com>2016-03-10 22:40:51 +0200
committerTeemu Suo-Anttila <teemusa@vaadin.com>2016-03-14 07:59:12 +0200
commita6653d3fe49e6a97468ac09f7f2f4d621bea1078 (patch)
tree96c82e20ca6551ee4c14c8877f0258b25c63cddf /server/src/com/vaadin/event/dd/acceptcriteria
parentf7e57d77ce621ee39167369c31d989edc5633266 (diff)
downloadvaadin-framework-a6653d3fe49e6a97468ac09f7f2f4d621bea1078.tar.gz
vaadin-framework-a6653d3fe49e6a97468ac09f7f2f4d621bea1078.zip
Migrate vaadin-server build to maven
Change-Id: I5c740f4e9cb28103bab199f9a552153d82277e7e
Diffstat (limited to 'server/src/com/vaadin/event/dd/acceptcriteria')
-rw-r--r--server/src/com/vaadin/event/dd/acceptcriteria/AcceptAll.java48
-rw-r--r--server/src/com/vaadin/event/dd/acceptcriteria/AcceptCriterion.java87
-rw-r--r--server/src/com/vaadin/event/dd/acceptcriteria/And.java66
-rw-r--r--server/src/com/vaadin/event/dd/acceptcriteria/ClientSideCriterion.java73
-rw-r--r--server/src/com/vaadin/event/dd/acceptcriteria/ContainsDataFlavor.java65
-rw-r--r--server/src/com/vaadin/event/dd/acceptcriteria/Not.java51
-rw-r--r--server/src/com/vaadin/event/dd/acceptcriteria/Or.java64
-rw-r--r--server/src/com/vaadin/event/dd/acceptcriteria/ServerSideCriterion.java69
-rw-r--r--server/src/com/vaadin/event/dd/acceptcriteria/SourceIs.java79
-rw-r--r--server/src/com/vaadin/event/dd/acceptcriteria/SourceIsTarget.java63
-rw-r--r--server/src/com/vaadin/event/dd/acceptcriteria/TargetDetailIs.java84
11 files changed, 0 insertions, 749 deletions
diff --git a/server/src/com/vaadin/event/dd/acceptcriteria/AcceptAll.java b/server/src/com/vaadin/event/dd/acceptcriteria/AcceptAll.java
deleted file mode 100644
index fa6a4c2b9a..0000000000
--- a/server/src/com/vaadin/event/dd/acceptcriteria/AcceptAll.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2000-2014 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-/**
- *
- */
-package com.vaadin.event.dd.acceptcriteria;
-
-import com.vaadin.event.dd.DragAndDropEvent;
-
-/**
- * Criterion that accepts all drops anywhere on the component.
- * <p>
- * Note! Class is singleton, use {@link #get()} method to get the instance.
- *
- *
- * @since 6.3
- *
- */
-public final class AcceptAll extends ClientSideCriterion {
-
- private static final long serialVersionUID = 7406683402153141461L;
- private static AcceptCriterion singleton = new AcceptAll();
-
- private AcceptAll() {
- }
-
- public static AcceptCriterion get() {
- return singleton;
- }
-
- @Override
- public boolean accept(DragAndDropEvent dragEvent) {
- return true;
- }
-}
diff --git a/server/src/com/vaadin/event/dd/acceptcriteria/AcceptCriterion.java b/server/src/com/vaadin/event/dd/acceptcriteria/AcceptCriterion.java
deleted file mode 100644
index a968cd8741..0000000000
--- a/server/src/com/vaadin/event/dd/acceptcriteria/AcceptCriterion.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright 2000-2014 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-/**
- *
- */
-package com.vaadin.event.dd.acceptcriteria;
-
-import java.io.Serializable;
-
-import com.vaadin.event.Transferable;
-import com.vaadin.event.dd.DragAndDropEvent;
-import com.vaadin.event.dd.DropHandler;
-import com.vaadin.server.PaintException;
-import com.vaadin.server.PaintTarget;
-
-/**
- * Criterion that can be used create policy to accept/discard dragged content
- * (presented by {@link Transferable}).
- *
- * The drag and drop mechanism will verify the criteria returned by
- * {@link DropHandler#getAcceptCriterion()} before calling
- * {@link DropHandler#drop(DragAndDropEvent)}.
- *
- * The criteria can be evaluated either on the client (browser - see
- * {@link ClientSideCriterion}) or on the server (see
- * {@link ServerSideCriterion}). If no constraints are needed, an
- * {@link AcceptAll} can be used.
- *
- * In addition to accepting or rejecting a possible drop, criteria can provide
- * additional hints for client side painting.
- *
- * @see DropHandler
- * @see ClientSideCriterion
- * @see ServerSideCriterion
- *
- * @since 6.3
- */
-public interface AcceptCriterion extends Serializable {
-
- /**
- * Returns whether the criteria can be checked on the client or whether a
- * server request is needed to check the criteria.
- *
- * This requirement may depend on the state of the criterion (e.g. logical
- * operations between criteria), so this cannot be based on a marker
- * interface.
- */
- public boolean isClientSideVerifiable();
-
- public void paint(PaintTarget target) throws PaintException;
-
- /**
- * This needs to be implemented iff criterion does some lazy server side
- * initialization. The UIDL painted in this method will be passed to client
- * side drop handler implementation. Implementation can assume that
- * {@link #accept(DragAndDropEvent)} is called before this method.
- *
- * @param target
- * @throws PaintException
- */
- public void paintResponse(PaintTarget target) throws PaintException;
-
- /**
- * Validates the data in event to be appropriate for the
- * {@link DropHandler#drop(DragAndDropEvent)} method.
- * <p>
- * Note that even if your criterion is validated on client side, you should
- * always validate the data on server side too.
- *
- * @param dragEvent
- * @return
- */
- public boolean accept(DragAndDropEvent dragEvent);
-}
diff --git a/server/src/com/vaadin/event/dd/acceptcriteria/And.java b/server/src/com/vaadin/event/dd/acceptcriteria/And.java
deleted file mode 100644
index b2fc1b1b94..0000000000
--- a/server/src/com/vaadin/event/dd/acceptcriteria/And.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright 2000-2014 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-/**
- *
- */
-package com.vaadin.event.dd.acceptcriteria;
-
-import com.vaadin.event.dd.DragAndDropEvent;
-import com.vaadin.server.PaintException;
-import com.vaadin.server.PaintTarget;
-
-/**
- * A compound criterion that accepts the drag if all of its criteria accepts the
- * drag.
- *
- * @see Or
- *
- * @since 6.3
- *
- */
-public class And extends ClientSideCriterion {
-
- private static final long serialVersionUID = -5242574480825471748L;
- protected ClientSideCriterion[] criteria;
-
- /**
- *
- * @param criteria
- * criteria of which the And criterion will be composed
- */
- public And(ClientSideCriterion... criteria) {
- this.criteria = criteria;
- }
-
- @Override
- public void paintContent(PaintTarget target) throws PaintException {
- super.paintContent(target);
- for (ClientSideCriterion crit : criteria) {
- crit.paint(target);
- }
- }
-
- @Override
- public boolean accept(DragAndDropEvent dragEvent) {
- for (ClientSideCriterion crit : criteria) {
- if (!crit.accept(dragEvent)) {
- return false;
- }
- }
- return true;
- }
-
-}
diff --git a/server/src/com/vaadin/event/dd/acceptcriteria/ClientSideCriterion.java b/server/src/com/vaadin/event/dd/acceptcriteria/ClientSideCriterion.java
deleted file mode 100644
index 6bb227a95e..0000000000
--- a/server/src/com/vaadin/event/dd/acceptcriteria/ClientSideCriterion.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright 2000-2014 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.vaadin.event.dd.acceptcriteria;
-
-import java.io.Serializable;
-
-import com.vaadin.server.PaintException;
-import com.vaadin.server.PaintTarget;
-
-/**
- * Parent class for criteria that can be completely validated on client side.
- * All classes that provide criteria that can be completely validated on client
- * side should extend this class.
- *
- * It is recommended that subclasses of ClientSideCriterion re-validate the
- * condition on the server side in
- * {@link AcceptCriterion#accept(com.vaadin.event.dd.DragAndDropEvent)} after
- * the client side validation has accepted a transfer.
- *
- * @since 6.3
- */
-public abstract class ClientSideCriterion implements Serializable,
- AcceptCriterion {
-
- /*
- * All criteria that extend this must be completely validatable on client
- * side.
- *
- * (non-Javadoc)
- *
- * @see
- * com.vaadin.event.dd.acceptCriteria.AcceptCriterion#isClientSideVerifiable
- * ()
- */
- @Override
- public final boolean isClientSideVerifiable() {
- return true;
- }
-
- @Override
- public void paint(PaintTarget target) throws PaintException {
- target.startTag("-ac");
- target.addAttribute("name", getIdentifier());
- paintContent(target);
- target.endTag("-ac");
- }
-
- protected void paintContent(PaintTarget target) throws PaintException {
- }
-
- protected String getIdentifier() {
- return getClass().getCanonicalName();
- }
-
- @Override
- public final void paintResponse(PaintTarget target) throws PaintException {
- // NOP, nothing to do as this is client side verified criterion
- }
-
-}
diff --git a/server/src/com/vaadin/event/dd/acceptcriteria/ContainsDataFlavor.java b/server/src/com/vaadin/event/dd/acceptcriteria/ContainsDataFlavor.java
deleted file mode 100644
index 57f4d8253b..0000000000
--- a/server/src/com/vaadin/event/dd/acceptcriteria/ContainsDataFlavor.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright 2000-2014 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-/**
- *
- */
-package com.vaadin.event.dd.acceptcriteria;
-
-import com.vaadin.event.Transferable;
-import com.vaadin.event.dd.DragAndDropEvent;
-import com.vaadin.server.PaintException;
-import com.vaadin.server.PaintTarget;
-
-/**
- * A Criterion that checks whether {@link Transferable} contains given data
- * flavor. The developer might for example accept the incoming data only if it
- * contains "Url" or "Text".
- *
- * @since 6.3
- */
-public class ContainsDataFlavor extends ClientSideCriterion {
-
- private String dataFlavorId;
-
- /**
- * Constructs a new instance of {@link ContainsDataFlavor}.
- *
- * @param dataFlawor
- * the type of data that will be checked from
- * {@link Transferable}
- */
- public ContainsDataFlavor(String dataFlawor) {
- dataFlavorId = dataFlawor;
- }
-
- @Override
- public void paintContent(PaintTarget target) throws PaintException {
- super.paintContent(target);
- target.addAttribute("p", dataFlavorId);
- }
-
- @Override
- public boolean accept(DragAndDropEvent dragEvent) {
- return dragEvent.getTransferable().getDataFlavors()
- .contains(dataFlavorId);
- }
-
- @Override
- protected String getIdentifier() {
- // extending classes use client side implementation from this class
- return ContainsDataFlavor.class.getCanonicalName();
- }
-}
diff --git a/server/src/com/vaadin/event/dd/acceptcriteria/Not.java b/server/src/com/vaadin/event/dd/acceptcriteria/Not.java
deleted file mode 100644
index 95f96bbf08..0000000000
--- a/server/src/com/vaadin/event/dd/acceptcriteria/Not.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 2000-2014 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-/**
- *
- */
-package com.vaadin.event.dd.acceptcriteria;
-
-import com.vaadin.event.dd.DragAndDropEvent;
-import com.vaadin.server.PaintException;
-import com.vaadin.server.PaintTarget;
-
-/**
- * Criterion that wraps another criterion and inverts its return value.
- *
- * @since 6.3
- *
- */
-public class Not extends ClientSideCriterion {
-
- private static final long serialVersionUID = 1131422338558613244L;
- private AcceptCriterion acceptCriterion;
-
- public Not(ClientSideCriterion acceptCriterion) {
- this.acceptCriterion = acceptCriterion;
- }
-
- @Override
- public void paintContent(PaintTarget target) throws PaintException {
- super.paintContent(target);
- acceptCriterion.paint(target);
- }
-
- @Override
- public boolean accept(DragAndDropEvent dragEvent) {
- return !acceptCriterion.accept(dragEvent);
- }
-
-}
diff --git a/server/src/com/vaadin/event/dd/acceptcriteria/Or.java b/server/src/com/vaadin/event/dd/acceptcriteria/Or.java
deleted file mode 100644
index e300606464..0000000000
--- a/server/src/com/vaadin/event/dd/acceptcriteria/Or.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright 2000-2014 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-/**
- *
- */
-package com.vaadin.event.dd.acceptcriteria;
-
-import com.vaadin.event.dd.DragAndDropEvent;
-import com.vaadin.server.PaintException;
-import com.vaadin.server.PaintTarget;
-
-/**
- * A compound criterion that accepts the drag if any of its criterion accepts
- * it.
- *
- * @see And
- *
- * @since 6.3
- *
- */
-public class Or extends ClientSideCriterion {
- private static final long serialVersionUID = 1L;
- private AcceptCriterion criteria[];
-
- /**
- * @param criteria
- * the criteria of which the Or criteria will be composed
- */
- public Or(ClientSideCriterion... criteria) {
- this.criteria = criteria;
- }
-
- @Override
- public void paintContent(PaintTarget target) throws PaintException {
- super.paintContent(target);
- for (AcceptCriterion crit : criteria) {
- crit.paint(target);
- }
- }
-
- @Override
- public boolean accept(DragAndDropEvent dragEvent) {
- for (AcceptCriterion crit : criteria) {
- if (crit.accept(dragEvent)) {
- return true;
- }
- }
- return false;
- }
-
-}
diff --git a/server/src/com/vaadin/event/dd/acceptcriteria/ServerSideCriterion.java b/server/src/com/vaadin/event/dd/acceptcriteria/ServerSideCriterion.java
deleted file mode 100644
index 8b769ee031..0000000000
--- a/server/src/com/vaadin/event/dd/acceptcriteria/ServerSideCriterion.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright 2000-2014 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.vaadin.event.dd.acceptcriteria;
-
-import java.io.Serializable;
-
-import com.vaadin.event.Transferable;
-import com.vaadin.server.PaintException;
-import com.vaadin.server.PaintTarget;
-
-/**
- * Parent class for criteria which are verified on the server side during a drag
- * operation to accept/discard dragged content (presented by
- * {@link Transferable}).
- * <p>
- * Subclasses should implement the
- * {@link AcceptCriterion#accept(com.vaadin.event.dd.DragAndDropEvent)} method.
- * <p>
- * As all server side state can be used to make a decision, this is more
- * flexible than {@link ClientSideCriterion}. However, this does require
- * additional requests from the browser to the server during a drag operation.
- *
- * @see AcceptCriterion
- * @see ClientSideCriterion
- *
- * @since 6.3
- */
-public abstract class ServerSideCriterion implements Serializable,
- AcceptCriterion {
-
- private static final long serialVersionUID = 2128510128911628902L;
-
- @Override
- public final boolean isClientSideVerifiable() {
- return false;
- }
-
- @Override
- public void paint(PaintTarget target) throws PaintException {
- target.startTag("-ac");
- target.addAttribute("name", getIdentifier());
- paintContent(target);
- target.endTag("-ac");
- }
-
- public void paintContent(PaintTarget target) {
- }
-
- @Override
- public void paintResponse(PaintTarget target) throws PaintException {
- }
-
- protected String getIdentifier() {
- return ServerSideCriterion.class.getCanonicalName();
- }
-}
diff --git a/server/src/com/vaadin/event/dd/acceptcriteria/SourceIs.java b/server/src/com/vaadin/event/dd/acceptcriteria/SourceIs.java
deleted file mode 100644
index 8e9fdecdae..0000000000
--- a/server/src/com/vaadin/event/dd/acceptcriteria/SourceIs.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright 2000-2014 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-/**
- *
- */
-package com.vaadin.event.dd.acceptcriteria;
-
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import com.vaadin.event.TransferableImpl;
-import com.vaadin.event.dd.DragAndDropEvent;
-import com.vaadin.server.PaintException;
-import com.vaadin.server.PaintTarget;
-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")
-public class SourceIs extends ClientSideCriterion {
-
- private Component[] components;
-
- public SourceIs(Component... component) {
- components = component;
- }
-
- @Override
- public void paintContent(PaintTarget target) throws PaintException {
- super.paintContent(target);
- int paintedComponents = 0;
- for (int i = 0; i < components.length; i++) {
- Component c = components[i];
- if (c.isAttached()) {
- target.addAttribute("component" + paintedComponents++, c);
- } else {
- Logger.getLogger(SourceIs.class.getName())
- .log(Level.WARNING,
- "SourceIs component {0} at index {1} is not attached to the component hierachy and will thus be ignored",
- new Object[] { c.getClass().getName(),
- Integer.valueOf(i) });
- }
- }
- target.addAttribute("c", paintedComponents);
- }
-
- @Override
- public boolean accept(DragAndDropEvent dragEvent) {
- if (dragEvent.getTransferable() instanceof TransferableImpl) {
- Component sourceComponent = ((TransferableImpl) dragEvent
- .getTransferable()).getSourceComponent();
- for (Component c : components) {
- if (c == sourceComponent) {
- return true;
- }
- }
- }
-
- return false;
- }
-
-}
diff --git a/server/src/com/vaadin/event/dd/acceptcriteria/SourceIsTarget.java b/server/src/com/vaadin/event/dd/acceptcriteria/SourceIsTarget.java
deleted file mode 100644
index c49f126941..0000000000
--- a/server/src/com/vaadin/event/dd/acceptcriteria/SourceIsTarget.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright 2000-2014 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-/**
- *
- */
-package com.vaadin.event.dd.acceptcriteria;
-
-import com.vaadin.event.Transferable;
-import com.vaadin.event.TransferableImpl;
-import com.vaadin.event.dd.DragAndDropEvent;
-import com.vaadin.event.dd.DropTarget;
-import com.vaadin.ui.Component;
-import com.vaadin.ui.Table;
-import com.vaadin.ui.Tree;
-
-/**
- *
- * A criterion that ensures the drag source is the same as drop target. Eg.
- * {@link Tree} or {@link Table} could support only re-ordering of items, but no
- * {@link Transferable}s coming outside.
- * <p>
- * Note! Class is singleton, use {@link #get()} method to get the instance.
- *
- * @since 6.3
- *
- */
-public class SourceIsTarget extends ClientSideCriterion {
-
- private static final long serialVersionUID = -451399314705532584L;
- private static SourceIsTarget instance = new SourceIsTarget();
-
- private SourceIsTarget() {
- }
-
- @Override
- public boolean accept(DragAndDropEvent dragEvent) {
- if (dragEvent.getTransferable() instanceof TransferableImpl) {
- Component sourceComponent = ((TransferableImpl) dragEvent
- .getTransferable()).getSourceComponent();
- DropTarget target = dragEvent.getTargetDetails().getTarget();
- return sourceComponent == target;
- }
- return false;
- }
-
- public static synchronized SourceIsTarget get() {
- return instance;
- }
-
-}
diff --git a/server/src/com/vaadin/event/dd/acceptcriteria/TargetDetailIs.java b/server/src/com/vaadin/event/dd/acceptcriteria/TargetDetailIs.java
deleted file mode 100644
index 42fb5dfa11..0000000000
--- a/server/src/com/vaadin/event/dd/acceptcriteria/TargetDetailIs.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright 2000-2014 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-/**
- *
- */
-package com.vaadin.event.dd.acceptcriteria;
-
-import com.vaadin.event.dd.DragAndDropEvent;
-import com.vaadin.event.dd.TargetDetails;
-import com.vaadin.server.PaintException;
-import com.vaadin.server.PaintTarget;
-
-/**
- * Criterion for checking if drop target details contains the specific property
- * with the specific value. Currently only String values are supported.
- *
- * @since 6.3
- *
- * TODO add support for other basic data types that we support in UIDL.
- *
- */
-public class TargetDetailIs extends ClientSideCriterion {
-
- private static final long serialVersionUID = 763165450054331246L;
- private String propertyName;
- private Object value;
-
- /**
- * Constructs a criterion which ensures that the value there is a value in
- * {@link TargetDetails} that equals the reference value.
- *
- * @param dataFlavor
- * the type of data to be checked
- * @param value
- * the reference value to which the drop target detail will be
- * compared
- */
- public TargetDetailIs(String dataFlavor, String value) {
- propertyName = dataFlavor;
- this.value = value;
- }
-
- public TargetDetailIs(String dataFlavor, Boolean true1) {
- propertyName = dataFlavor;
- value = true1;
- }
-
- @Override
- public void paintContent(PaintTarget target) throws PaintException {
- super.paintContent(target);
- target.addAttribute("p", propertyName);
- if (value instanceof Boolean) {
- target.addAttribute("v", ((Boolean) value).booleanValue());
- target.addAttribute("t", "b");
- } else if (value instanceof String) {
- target.addAttribute("v", (String) value);
- }
- }
-
- @Override
- public boolean accept(DragAndDropEvent dragEvent) {
- Object data = dragEvent.getTargetDetails().getData(propertyName);
- return value.equals(data);
- }
-
- @Override
- protected String getIdentifier() {
- // sub classes by default use VDropDetailEquals a client implementation
- return TargetDetailIs.class.getCanonicalName();
- }
-}