Book Image

Vaadin 7 Cookbook

Book Image

Vaadin 7 Cookbook

Overview of this book

Table of Contents (19 chapters)
Vaadin 7 Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Dragging-and-dropping between different layouts


Each layout has a different wrap behavior. If we want to try this behavior for ourselves, we will have to create a simple demo. In this demo, we can drag-and-drop components between the four different layouts. We can also change the size of each layout by moving the separator and watch how components are wrapped. If the line cannot be wrapped, a scroll bar appears.

How to do it...

Carry out the following steps to create a drag and drop panel:

  1. We create project with the root Demo class.

    public class Demo extends UI {…}
  2. All four layouts will be inserted into the DragndropPanel class that extends HorizontalSplitPanel.

    public class DragndropPanel extends HorizontalSplitPanel {…}
  3. Now let's insert the createLayout() method. In this method we add buttons to the layout that is taken over the AbstractLayout parameter. Next we wrap this layout by the DragAndDropWrapper class and set DropHandler. Here we implement two methods. First is getAcceptCriterion()...