Enabling and disabling Drag and Drop "on the fly"

Hello everyone!

I’ve created an Layout for rearranging components similiar to this example:
http://demo.vaadin.com/sampler#DragDropRearrangeComponents

Now I’m wondering if this could be disabled or enabled “on the fly”, so i could lock this layout. Changing the
DragStartMode
of the
com.vaadin.ui.DragAndDropWrapper
did not change anything.

Has someone an idea?

Thanks in advance,
Heinz

Hello again and happy new year!

because maybe noone understood me I wrote a quick example (see the attached source file). Horizontal Drag & Dropping is enabled, but I want to toggle it. Sure, I could edit the AcceptCriterion, but that would mean, that the user is still able to start the process.

So I want to make something like a toolbar. If the user wants to edit the layout, he can do it. Once he’s ready, he should be able to actually lock the layout.

Can anyone help me for this?

Thanks in advance,
Heinz
12149.java (6.27 KB)

So I figuered out, that changing the DragStartMode of each wrapper (which must first added to a list, to access them later), is a way to do this. If anyone has an better idea, please post it here.

Thanks,
Heinz

Looking at the API and examples, yeah, setting layout.setDragStartMode(DragStartMode.NONE); is the way I think it should be done.

Hello Jens,

thank you very much for your reply. Which layout do you mean? Either SortableLayout nor the HorizontalLayout do provide such a method, or am I wrong? It would be really nice to only change the layout instead of each wrapper.

Heinz

This is basically what the
DragDropLayouts addon
does.

Yeah I was referring to the wrapper and not the layout :frowning:

But check out the add-on mentioned (and created) by John. It might clean up your code.

Hello everyone!

Thanks for your reply. Sorry for my late response, but somehow I expected an email to inform me about an answer…

I will check this layout out, thanks a lot!

Heinz

how can i manage DragStartMode on select purticular layout

I’m using Vaadin Framework : I’ve created a list of vertical layout where every vertical layout is composed of : 1- An horizontal layout where there is a button and a label 2- An other list of vertical layout. These elements are hidden. I can do the drag and drop in mode vertical between the vertical layouts parent but when I press the button and I want to make drag and drop betweeen vertical layouts child, all the layout parent is dragged. So my solution is to find a way to disable drag and drop of the vertical layout parent when I press the button and enable drag and drop of the vertical layout child, but I don’t find the way to do it. Is there someone who can help me please ? I created a kind of SortableLayout on which I do the drag and drop …