Addon DnD - receiving AcceptCriterion updates

Hi,

I’m implementing a custom component that needs to accept drop events on internal children. Think an org-chart where you can drop onto some of the nodes.

I am implementing DropTarget on my component server side, and Client side I’ve implemented VHasDropHandler on the droppable child elements and my controller extend VAbstractDropHandler to implement VDropHandler.

How does my VDropHandler recieve the acceptance criterion so I can construct a VAcceptCriterion from the VAcceptCriterionFactory? Is there a guide online for implementing DnD in custom components?

To use VAbstractDropHandler, I need to call VAbstractDropHandler.updateAcceptRules with the criterionUIDL. I’m using Vaadin7 / state / updateState on my connector, so not implementing Paintable. Can I retrieve the criterionUIDL from the state? Or is it better to ignore VAbstractDropHandler and implement VDropHandler directly? In which case where would I get the aceptCriterion from?

Many thanks,
Dave

I’ve found a way around this, but it’s not nice - implementing LegacyComponent and Paintable…

e.g. My component implements LegacyComponent, and my Connector implements Paintable and caches the criterionUIDL like so:

    @Override
    public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
        // Yuck - criterionUIDL is required for DnD criterion. Is there a better way to get this?
        if (AbstractComponentConnector.isRealUpdate(uidl) && !uidl.hasAttribute("hidden")) {
            criterionUIDL = uidl.getChildByTagName("-ac");
            if (criterionUIDL == null) {
                this.acceptCriteria = null;
            } else {
                String criterionClass = criterionUIDL.getStringAttribute("name");
                this.acceptCriteria = VAcceptCriteria.get(criterionClass);
            }
        }
    }

Is this the only way to implement ClientSide DnD Criterion at the moment? As far as I can see, all existing components that support this are legacy components and havn’t been updated to the v7 APIs.

Is there a plan to update the DnD / AcceptCriterion implementation to the “new way” of doing things?

Many thanks,
Dave