Example usage for com.vaadin.ui VerticalLayout setSizeUndefined

List of usage examples for com.vaadin.ui VerticalLayout setSizeUndefined

Introduction

In this page you can find the example usage for com.vaadin.ui VerticalLayout setSizeUndefined.

Prototype

@Override
    public void setSizeUndefined() 

Source Link

Usage

From source file:edu.nps.moves.mmowgli.modules.actionplans.AddVideoDialog.java

License:Open Source License

@SuppressWarnings("serial")
public AddVideoDialog() {
    super("Add a Video");
    addStyleName("m-greybackground");

    setClosable(false); // no x in corner
    setWidth("530px");
    setHeight("400px");

    VerticalLayout mainVL = new VerticalLayout();
    mainVL.setSpacing(true);//from  w  w  w  .  j  a  va  2  s . c o m
    mainVL.setMargin(true);
    mainVL.setSizeUndefined(); // auto size
    mainVL.setWidth("100%");
    setContent(mainVL);

    Label helpLab = new HtmlLabel("Add YouTube videos to your Action Plan this way:"
            + "<OL><LI>Find the video you want at <a href=\"https://www.youtube.com\" target=\""
            + PORTALTARGETWINDOWNAME + "\">www.youtube.com</a>.</LI>"
            + "<LI>Click the \"share\" button below the video screen.</LI>"
            + "<LI>Copy the URL under \"Link to this video:\"</LI>"
            + "<LI>Paste the URL into the field below.</LI>" + "</OL>" + "If you have media that "
            + "has not been uploaded to YouTube, see <a href=\"https://www.youtube.com\" target=\""
            + PORTALTARGETWINDOWNAME + "\">www.youtube.com</a> "
            + "for help with establishing a free account.<br/>");
    helpLab.setWidth("100%");
    mainVL.addComponent(helpLab);

    HorizontalLayout mainHL = new HorizontalLayout();
    mainHL.setMargin(false);
    mainHL.setSpacing(true);
    mainVL.addComponent(mainHL);

    holder = new AbsoluteLayout();
    mainHL.addComponent(holder);
    holder.addStyleName("m-darkgreyborder");
    holder.setWidth("150px");
    holder.setHeight("150px");
    holder.addComponent(new Label("Test video display"), "top:0px;left:0px;");
    VerticalLayout rightVL = new VerticalLayout();
    mainHL.addComponent(rightVL);
    rightVL.setMargin(false);
    rightVL.setSpacing(true);
    rightVL.addComponent(new Label("YouTube video address"));

    HorizontalLayout tfHL = new HorizontalLayout();
    tfHL.setSpacing(true);
    rightVL.addComponent(tfHL);
    addrTf = new TextField();
    tfHL.addComponent(addrTf);
    addrTf.setColumns(21);
    tfHL.addComponent(testButt = new Button("Test"));

    rightVL.addComponent(new Label("Using the test button will set the"));
    rightVL.addComponent(new Label("default title and description."));

    Label sp;
    rightVL.addComponent(sp = new Label());
    sp.setHeight("15px");

    HorizontalLayout bottomHL = new HorizontalLayout();
    rightVL.addComponent(bottomHL);
    rightVL.setComponentAlignment(bottomHL, Alignment.TOP_RIGHT);
    bottomHL.setSpacing(true);
    bottomHL.setWidth("100%");
    Label spacer;
    bottomHL.addComponent(spacer = new Label());
    spacer.setWidth("100%");
    bottomHL.setExpandRatio(spacer, 1.0f);

    bottomHL.addComponent(cancelButt = new Button("Cancel"));
    bottomHL.addComponent(submitButt = new Button("Add"));
    testButt.addClickListener(new TestVidHandler());

    submitButt.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            UI.getCurrent().removeWindow(AddVideoDialog.this);
            if (closer != null)
                closer.windowClose(null);
        }
    });

    cancelButt.addClickListener(new ClickListener() {
        public void buttonClick(ClickEvent event) {
            media = null;
            UI.getCurrent().removeWindow(AddVideoDialog.this);
            if (closer != null)
                closer.windowClose(null);
        }
    });
}

From source file:edu.nps.moves.mmowgli.modules.administration.AddCardClassDialog.java

License:Open Source License

public AddCardClassDialog(CardClass cls, String title) {
    super(title);
    this.cls = cls;

    VerticalLayout vl = new VerticalLayout();
    setContent(vl);// w  ww  . j av  a  2  s .  c o m
    vl.setSpacing(true);
    vl.setMargin(true);
    vl.setSizeUndefined();

    vl.addComponent(titleTF = new TextField("Title"));
    titleTF.setValue("title goes here");
    titleTF.setColumns(35);

    vl.addComponent(summTF = new TextField("Summary"));
    summTF.setValue("summary goes here");
    summTF.setColumns(35);

    vl.addComponent(promptTF = new TextField("Prompt"));
    promptTF.setValue("prompt goes here");
    promptTF.setColumns(35);

    vl.addComponent(colorCombo = new NativeSelect("Color"));
    fillCombo();

    HorizontalLayout buttHL = new HorizontalLayout();
    buttHL.setSpacing(true);
    buttHL.addComponent(cancelButt = new Button("Cancel"));
    cancelButt.addClickListener(new CancelListener());
    buttHL.addComponent(saveButt = new Button("Save"));
    saveButt.addClickListener(new SaveListener());
    vl.addComponent(buttHL);
    vl.setComponentAlignment(buttHL, Alignment.MIDDLE_RIGHT);
}

From source file:edu.nps.moves.mmowgli.modules.administration.AddCardTypeDialog.java

License:Open Source License

public AddCardTypeDialog(int descType, String title) {
    super(title);
    this.typ = descType;

    VerticalLayout vl = new VerticalLayout();
    setContent(vl);/*from   www.  j ava2 s .c om*/
    vl.setSizeUndefined();
    vl.setMargin(true);
    vl.setSpacing(true);
    vl.addComponent(titleTF = new TextField("Title"));
    titleTF.setValue("title goes here");
    titleTF.setColumns(35);

    vl.addComponent(summTF = new TextField("Summary"));
    summTF.setValue("summary goes here");
    summTF.setColumns(35);

    vl.addComponent(promptTF = new TextField("Prompt"));
    promptTF.setValue("prompt goes here");
    promptTF.setColumns(35);

    vl.addComponent(colorCombo = new NativeSelect("Color"));
    fillCombo();

    HorizontalLayout buttHL = new HorizontalLayout();
    buttHL.setSpacing(true);
    buttHL.addComponent(cancelButt = new Button("Cancel"));
    cancelButt.addClickListener(new CancelListener());
    buttHL.addComponent(saveButt = new Button("Save"));
    saveButt.addClickListener(new SaveListener());
    vl.addComponent(buttHL);
    vl.setComponentAlignment(buttHL, Alignment.MIDDLE_RIGHT);
}

From source file:edu.nps.moves.mmowgli.modules.cards.EditCardTextWindow.java

License:Open Source License

public EditCardTextWindow(String text, Integer charLim) {
    super("Edit card text");

    if (charLim != null)
        characterLimit = charLim;//from w w  w. j a v a2  s.com

    setModal(true);
    VerticalLayout layout = new VerticalLayout();
    setContent(layout);
    layout.setMargin(true);
    layout.setSpacing(true);
    ta = new TextArea();
    ta.setRows(10);
    ta.setColumns(50);
    if (text != null) {
        ta.setValue(text);
        ta.selectAll();
    } else
        ta.setInputPrompt("Type card text here");
    layout.addComponent(ta);

    HorizontalLayout buttHL = new HorizontalLayout();
    buttHL.setSpacing(true);

    WindowCloser closeListener = new WindowCloser(this);
    cancelButt = new Button("Cancel", closeListener);
    buttHL.addComponent(cancelButt);

    saveButt = new Button("Save", closeListener);
    saveButt.addClickListener(closeListener);
    buttHL.addComponent(saveButt);

    layout.addComponent(buttHL);

    layout.setSizeUndefined(); // does a "pack"
    UI.getCurrent().addWindow(this);
    ta.focus();
}

From source file:edu.nps.moves.mmowgli.modules.cards.IdeaDashboardTabSuperActive.java

License:Open Source License

@Override
public void initGui() {
    Label leftLabel = new Label("Super-active chains are sets of cards that have two or more authors "
            + "and four or more follow-on cards at two levels.");
    this.getLeftLayout().addComponent(leftLabel, "top:0px;left:0px");

    Panel pan = new Panel();
    getRightLayout().addComponent(pan, "top:0px;left:0px");
    pan.setSizeUndefined();//  www  .  j  av a 2s.c  o m
    pan.setStyleName(Reindeer.PANEL_LIGHT);

    VerticalLayout tableLay = new VerticalLayout();
    pan.setContent(tableLay);
    tableLay.setMargin(false); // default comes back from panel w/ margins
    tableLay.setSizeUndefined();

    tree = new CardChainTree(null, true); // no cards at first
    tree.setWidth("680px");
    tree.setHeight("730px");
    tree.addStyleName("m-greyborder");
    tableLay.addComponent(tree);
}

From source file:edu.nps.moves.mmowgli.modules.registrationlogin.PasswordResetPopup.java

License:Open Source License

private void makeResetAnnounceDialogTL_5(String email, ArrayList<User> aLis) {
    UI myUI = getUI();//from  w ww. java  2s  .  com
    myUI.removeWindow(PasswordResetPopup.this);

    final Window resetAnnounceDialog = new Window("Password Reset Announcement");
    resetAnnounceDialog.setModal(true);
    resetAnnounceDialog.setClosable(false);
    VerticalLayout vLay = new VerticalLayout();
    resetAnnounceDialog.setContent(vLay);
    vLay.setMargin(true);
    vLay.setSpacing(true);
    vLay.setSizeUndefined();
    vLay.setWidth("400px");

    Label message = new HtmlLabel("An email has been sent to <b>" + email + "</b>.");
    vLay.addComponent(message);

    message = new Label(
            "Follow the link in the message to confirm your password reset request to enable login to your mmowgli player account.");
    vLay.addComponent(message);

    message = new Label(
            "Please be advised that you will only have three hours to complete this process, after which time "
                    + "you will have to re-initiate a new password reset process from the game login page.");
    vLay.addComponent(message);

    message = new HtmlLabel(
            "Now, press <b>Homepage -- Return to login</b> after receiving a reset request confirmation email.");
    vLay.addComponent(message);

    @SuppressWarnings("serial")
    Button laterButt = new Button("Homepage -- Return to login", new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            HSess.init();
            Mmowgli2UI.getAppUI().quitAndGoTo(GameLinks.getTL().getGameHomeUrl());
            HSess.close();
        }
    });
    vLay.addComponent(laterButt);

    @SuppressWarnings("serial")
    Button troubleButt = new Button("Send trouble report", new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            HSess.init();
            Mmowgli2UI.getAppUI().quitAndGoTo(GameLinks.getTL().getTroubleLink());
            HSess.close();
        }
    });
    vLay.addComponent(troubleButt);

    myUI.addWindow(resetAnnounceDialog);
    resetAnnounceDialog.center();

    // This process generates unique uId for th3 reset process that will
    // need to be confirmed once the user receives a confirmation email and
    // click on the link containing the uId
    Iterator<User> itr = aLis.iterator();
    // sends email to all user accounts (which are at the same email address)
    // if a game name was entered, only that account receives the email
    while (itr.hasNext()) {
        User usr = itr.next();
        PasswordReset pr = new PasswordReset(usr);
        PasswordReset.saveTL(pr);

        String confirmUrl = buildConfirmUrl(pr);
        AppMaster.instance().getMailManager().sendPasswordResetEmailTL(email, usr.getUserName(), confirmUrl);
    }
}

From source file:edu.nps.moves.mmowgli.modules.registrationlogin.RegistrationPageBase.java

License:Open Source License

@SuppressWarnings("serial")
private void wereInTL(User _usr) {
    Game g = Game.getTL();/*from w  w  w.ja  va  2  s .  co m*/
    if (!g.isEmailConfirmation()/* && !g.isSMSConfirmation()*/) {
        _usr.setEmailConfirmed(true); // confirmation didn't happen, but they want to login
        wereInReallyTL(_usr); // will do update
    }
    /*  else if(g.isSMSConfirmation()) {  // if both are selected, only sms is done
                
      } */
    else {
        List<String> sLis = VHibPii.getUserPiiEmails(_usr.getId());
        String email = sLis.get(0);
        final Window emailDialog = new Window("Email Confirmation");
        emailDialog.setModal(true);
        emailDialog.setClosable(false);
        VerticalLayout vLay = new VerticalLayout();
        emailDialog.setContent(vLay);
        vLay.setMargin(true);
        vLay.setSpacing(true);
        vLay.setSizeUndefined();
        vLay.setWidth("400px");

        Label message = new HtmlLabel("A confirmation email has been sent to <b>" + email + "</b>.");
        vLay.addComponent(message);

        message = new Label("Follow the link in the message "
                + "to confirm your registration and unlock your mmowgli user account.");
        vLay.addComponent(message);

        message = new HtmlLabel("Press the <b>Am I confirmed yet?</b> button " + "to play if ready.");
        vLay.addComponent(message);

        message = new HtmlLabel(
                "Alternatively, press <b>Quit -- I'll come back later</b> to login at a future time.");
        vLay.addComponent(message);

        GridLayout grid = new GridLayout();
        vLay.addComponent(grid);

        MSysOut.println(NEWUSER_CREATION_LOGS,
                "email confirmation dialog displayed, user " + _usr.getUserName());

        final Button contButt = new Button("Am I confirmed yet?", new ClickListener() {
            boolean confirmed = false;

            @Override
            @HibernateUpdate
            @HibernateUserUpdate
            public void buttonClick(ClickEvent event) {
                MSysOut.println(DEBUG_LOGS, "\"Am I confirmed?\" button handler entered");

                HSess.init();
                User u = User.getTL(userId);
                MSysOut.println(NEWUSER_CREATION_LOGS, "\"Am I confirmed?\" clicked, user " + u.getUserName());

                if (confirmed) {
                    closePopup(emailDialog);
                    wereInReallyTL(u); //  @HibernateUserUpdate //@HibernateUserRead
                    MSysOut.println(NEWUSER_CREATION_LOGS,
                            "\"Am I confirmed?\", positive confirmation, user " + u.getUserName());
                } else {
                    MSysOut.println(DEBUG_LOGS, "User.getTL() in RegistrationPageBase.wereInTL()");
                    //User locUsr = User.getTL(userId);  why necessary?
                    //if(locUsr.isEmailConfirmed()) {
                    if (u.isEmailConfirmed()) {
                        confirmed = true;
                        event.getButton().setCaption("I'm ready to play mmowgli!");
                    } else {
                        MSysOut.println(NEWUSER_CREATION_LOGS,
                                "\"Am I confirmed?\", negative confirmation, user " + u.getUserName());
                        Notification.show("Your email is not yet confirmed");
                    }
                }
                HSess.close();
            }
        });
        grid.addComponent(contButt);
        contButt.setImmediate(true);

        Button laterButt = new Button("Quit -- I'll come back later", new ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                MSysOut.println(DEBUG_LOGS, "\"Quit -- I'll come back later\" button handler entered");

                HSess.init();
                Mmowgli2UI.getAppUI().quitAndGoTo(GameLinks.getTL().getThanksForInterestLink());
                HSess.close();
            }
        });
        grid.addComponent(laterButt);

        Button troubleButt = new Button("Send trouble report", new ClickListener() {
            @Override
            @MmowgliCodeEntry
            @HibernateOpened
            @HibernateClosed
            public void buttonClick(ClickEvent event) // no need for HSess
            {
                MSysOut.println(DEBUG_LOGS, "\"Send trouble report\" button handler entered");

                HSess.init();
                Mmowgli2UI.getAppUI().quitAndGoTo(GameLinks.getTL().getTroubleLink());
                HSess.close();
            }
        });
        grid.addComponent(troubleButt);

        openPopupWindowInMainWindow(emailDialog, 500);

        EmailConfirmation ec = new EmailConfirmation(_usr);
        EmailConfirmation.saveTL(ec);

        String confirmUrl = buildConfirmUrl(ec);
        AppMaster.instance().getMailManager().sendEmailConfirmationTL(email, _usr.getUserName(), confirmUrl);
    } // else weren't confirmed
}

From source file:edu.nps.moves.mmowgli.modules.userprofile.UserProfileMyMailPanel.java

License:Open Source License

@Override
public void initGui() {
    super.initGui();

    String left = "Players can choose to receive messages in-game or externally (or both or neither).<br/><br/>Player messages are private and"
            + " actual email identities are hidden.<br/><br/>You can find another player's profile by clicking on their name or using the search"
            + " feature. Then you may send a message to that player by clicking on the "
            + "<i>Send player private email</i> link.<br/><br/>If this link is not present or is disabled, then the player has opted "
            + "to receive neither email nor in-game messages.<br/><br/>";
    getLeftLabel().setValue(left);/*w w w.j av  a 2 s. c om*/

    if (!userIsMe) {
        User u = User.getTL(uid);
        if (u.isOkEmail() || u.isOkGameMessages()) {
            final NativeButton sendEmailButt = new NativeButton("Send private mail to this user");
            sendEmailButt.addStyleName(BaseTheme.BUTTON_LINK);
            sendEmailButt.addStyleName("m-userProfile3-sendmail-button");
            Label sp;
            VerticalLayout vl = getRightLayout();

            vl.setSizeUndefined();
            vl.setWidth("100%");
            vl.addComponent(sp = new Label());
            sp.setHeight("50px");
            vl.addComponent(sendEmailButt);
            vl.setComponentAlignment(sendEmailButt, Alignment.MIDDLE_CENTER);
            vl.addComponent(sp = new Label());
            sp.setHeight("1px");
            vl.setExpandRatio(sp, 1.0f);

            sendEmailButt.addClickListener(new ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                @MmowgliCodeEntry
                @HibernateOpened
                @HibernateClosed
                public void buttonClick(ClickEvent event) {
                    HSess.init();

                    User u = User.getTL(uid);
                    if (u.isOkEmail() || u.isOkGameMessages()) // redundant here
                        new SendMessageWindow(u, imAdminOrGameMaster);
                    else
                        Notification.show("Sorry", "Player " + u.getUserName() + " does not receive mail.",
                                Notification.Type.WARNING_MESSAGE);

                    HSess.close();
                }
            });
        }
        return;
    }
    VerticalLayout rightVL = getRightLayout();
    rightVL.setSizeUndefined();
    rightVL.setWidth("100%");

    getLeftAddedVerticalLayout()
            .addComponent(showButt = new ToggleLinkButton("View all", "View unhidden only", null)); //,ttArray));
    showButt.addOnListener(new ViewAllListener());
    showButt.addOffListener(new ViewUnhiddenOnlyListener());
    showButt.setToolTips("Temporarily show all messages, including those marked \"hidden\"",
            "Temporarily hide messages marked \"hidden\"");
    Label sp;
    rightVL.addComponent(sp = new Label());
    sp.setHeight("10px");
    rightVL.addComponent(mailPanel);

    User me = Mmowgli2UI.getGlobals().getUserTL();
    Set<Message> msgs = me.getGameMessages();
    if (msgs.size() > 0) {
        Message[] msgsAr = new Message[msgs.size()];
        msgsAr = msgs.toArray(msgsAr); // avoid concurrent mod
        int num = msgsAr.length;// .size();
        int n = num;
        for (Message m : msgsAr) {
            addOneMessage(m, n--, num, null);
        }
    }
}

From source file:eu.maxschuster.vaadin.buttonlink.demo.DemoUI.java

License:Apache License

@Override
protected void init(VaadinRequest request) {

    final VerticalLayout wrapper = new VerticalLayout();
    wrapper.setSizeFull();/*from www.  j  a v  a 2  s . c om*/
    setContent(wrapper);

    // Show it in the middle of the screen
    final VerticalLayout layout = new VerticalLayout();
    layout.setSpacing(true);
    layout.setSizeUndefined();
    wrapper.addComponent(layout);
    wrapper.setComponentAlignment(layout, Alignment.MIDDLE_CENTER);

    final Label themeName = new Label();
    themeName.setCaption("Current Theme:");
    themeName.addStyleName("h1");
    layout.addComponent(themeName);

    Label waring = new Label("<strong>Attention:</strong><br />\nChanging the theme may take a few seconds!");
    waring.setContentMode(ContentMode.HTML);
    layout.addComponent(waring);

    getPage().addUriFragmentChangedListener(new UriFragmentChangedListener() {

        @Override
        public void uriFragmentChanged(UriFragmentChangedEvent event) {
            String fragment = event.getUriFragment().replace("!", "");
            if (fragment.isEmpty()) {
                fragment = defaultTheme;
            }
            loadTheme(fragment);
        }
    });

    themeSelect.setSizeFull();
    themeSelect.setNullSelectionAllowed(false);
    themeSelect.addValueChangeListener(new ValueChangeListener() {

        @Override
        public void valueChange(ValueChangeEvent event) {
            String fragment = "!" + themeSelect.getValue();
            getPage().setUriFragment(fragment);
        }
    });
    layout.addComponent(themeSelect);
    layout.setComponentAlignment(themeSelect, Alignment.BOTTOM_CENTER);

    final CheckBox useIcon = new CheckBox("Use icons");
    useIcon.setValue(false);
    layout.addComponent(useIcon);

    final HorizontalLayout comparsionLayout = new HorizontalLayout();
    comparsionLayout.setSpacing(true);
    layout.addComponent(comparsionLayout);
    layout.setComponentAlignment(comparsionLayout, Alignment.TOP_CENTER);

    final Button button = new Button("This is a \"normal\" Button", new Button.ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            Notification.show("Hello World!");
        }
    });
    comparsionLayout.addComponent(button);
    comparsionLayout.setComponentAlignment(button, Alignment.MIDDLE_RIGHT);

    // Initialize our new UI component
    final ButtonLink buttonLink = new ButtonLink("This is a ButtonLink",
            new ExternalResource("https://vaadin.com"));
    buttonLink.setTargetName("_blank");
    buttonLink.setDescription("Visit vaadin.com in a new tab or window.");
    buttonLink.addStyleName("test-stylename");
    comparsionLayout.addComponent(buttonLink);
    comparsionLayout.setComponentAlignment(buttonLink, Alignment.MIDDLE_LEFT);

    themeName.setPropertyDataSource(themeSelect);

    useIcon.addValueChangeListener(new ValueChangeListener() {

        @Override
        public void valueChange(ValueChangeEvent event) {
            boolean b = (Boolean) event.getProperty().getValue();
            if (b) {
                button.setIcon(vaadinIcon, "Vaadin Logo");
                buttonLink.setIcon(vaadinIcon, "Vaadin Logo");
            } else {
                button.setIcon(null);
                buttonLink.setIcon(null);
            }
        }
    });

    String fragment = getPage().getUriFragment();

    loadTheme(
            fragment == null || fragment.replace("!", "").isEmpty() ? defaultTheme : fragment.replace("!", ""));
}

From source file:fi.jasoft.draganddrop.demos.DragDemo.java

License:Apache License

@Override
protected Component getDemoContent() {
    HorizontalLayout hl = new HorizontalLayout();
    hl.setSizeFull();//from  w  w w. j av  a 2s  . c  o  m

    // source-start
    // Create image
    Image image = new Image(null, new ThemeResource("graphics/bin.jpg"));

    // Enable dropping items on image
    DragAndDrop.enable(image, DragAndDropOperation.DROP)

            // Set custom drop handler
            .onDrop(new DropHandler<Image>() {

                @Override
                protected void onDrop(Component component) {

                    // Restor trash bin
                    getSource().setSource(new ThemeResource("graphics/bin.jpg"));

                    // Remove item
                    ((ComponentContainer) component.getParent()).removeComponent(component);
                }
            })

            // Set custom over handler
            .onOver(new DragOverHandler<Image>() {

                @Override
                protected void onOver(Component component) {

                    // Add color to trash bin
                    getSource().setSource(new ThemeResource("graphics/bin2.jpg"));
                }
            })

            // Set custom out handler
            .onOut(new DragOutHandler<Image>() {

                @Override
                protected void onOut(Component component) {

                    // Restore trash bin
                    getSource().setSource(new ThemeResource("graphics/bin.jpg"));
                }
            });

    // source-end

    hl.addComponent(image);
    hl.setComponentAlignment(image, Alignment.TOP_CENTER);

    VerticalLayout vl = new VerticalLayout();
    vl.setSizeUndefined();
    vl.setSpacing(true);
    hl.addComponent(vl);
    hl.setComponentAlignment(vl, Alignment.TOP_CENTER);

    // source-start
    /*
     * Create item list to drag from
     */
    for (int i = 0; i < 5; i++) {
        Label item = new Label("Item " + (i + 1));
        item.setStyleName("item");
        item.setSizeUndefined();

        // Enable dragging the items
        DragAndDrop.enable(item, DragAndDropOperation.DRAG);

        vl.addComponent(item);
    }
    // source-end

    return hl;
}