New acceptCriterion

Hi,

I want to accept only components of a specific type (LayoutWrappedComponent.class). How can i achive it?

I’ve tried ContainsDataFlavour, but i don’t understand it very well. What are the dataFlavours? When i print them it shows me 2 strings (component, mouseDown).

Thanks.

Hi,

I guess there is no client side criterion available for that atm in the core Vaadin. If you are not afraid of GWT programming you could add it by your self.

The easiest way around is probably to use ServerSideCriterion. On server side (in accept() method) it is real easy to check the source type like this:

                if(dragEvent.getTransferable().getSourceComponent() instanceof DragAndDropWrapper) {
                    doStuffWithThings(dragEvent);
                }

If you have a decent server and your users have an average network connection, the server side check for valid drop target shouldn’t be a problem.

If you insist using client side verifiable criterion with the core classes, you could do a compound criterion with Or and multiple SourceIs criterion (which point to all possible sources).

cheers,
matti

Ok, i’ll try client side.

Thanks matti.