Example usage for com.vaadin.ui Alignment MIDDLE_LEFT

List of usage examples for com.vaadin.ui Alignment MIDDLE_LEFT

Introduction

In this page you can find the example usage for com.vaadin.ui Alignment MIDDLE_LEFT.

Prototype

Alignment MIDDLE_LEFT

To view the source code for com.vaadin.ui Alignment MIDDLE_LEFT.

Click Source Link

Usage

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

License:Open Source License

@HibernateUserRead
private void fillPanelTL(User u) {
    @SuppressWarnings("unchecked")
    List<AwardType> typs = (List<AwardType>) HSess.get().createCriteria(AwardType.class).list();
    gridList = new ArrayList<AwardType>(typs.size());
    gridList.addAll(typs);/*from ww  w  .ja v a 2s .c  om*/
    gridLayout.removeAllComponents();
    gridLayout.setRows(typs.size());
    gridLayout.setColumns(4);
    gridLayout.setSpacing(true);
    gridLayout.setColumnExpandRatio(2, 0.5f);
    gridLayout.setColumnExpandRatio(3, 0.5f);

    Set<Award> uAwards = u.getAwards();
    MediaLocator mediaLoc = Mmowgli2UI.getGlobals().getMediaLocator();
    for (AwardType at : typs) {
        CheckBox cb;
        boolean checked = hasBeenAwarded(uAwards, at);
        gridLayout.addComponent(cb = new CheckBox());
        cb.setValue(checked);
        gridLayout.setComponentAlignment(cb, Alignment.MIDDLE_CENTER);
        Embedded emb = new Embedded(null, mediaLoc.locate(at.getIcon55x55()));
        emb.addStyleName("m-greyborder3");
        gridLayout.addComponent(emb);
        Label lab;
        gridLayout.addComponent(lab = new Label(at.getName()));
        gridLayout.setComponentAlignment(lab, Alignment.MIDDLE_LEFT);
        gridLayout.addComponent(lab = new Label(at.getDescription()));
        gridLayout.setComponentAlignment(lab, Alignment.MIDDLE_LEFT);
    }
}

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

License:Open Source License

@Override
public void initGui() {
    super.initGui();
    VerticalLayout leftLayout = getLeftLayout();
    leftLayout.setSpacing(true);// w w w. j av  a  2  s .  c  o m
    getLeftLabel().setValue(""); //"Click on the links below to display lists of cards in play.");
    int i = leftLayout.getComponentIndex(getLeftLabel()) + 1;
    // start adding from here
    Label sp;

    String possessive = "my";
    String capPossessive = "My";
    if (!userIsMe)
        possessive = capPossessive = userName + "'s";

    leftLayout.addComponent(allRow = makeCheckRow(allButt = makeButt("All " + possessive + " ideas")), i++);
    setCheck(allRow, true);
    leftLayout.setComponentAlignment(allRow, Alignment.MIDDLE_LEFT);
    leftLayout.addComponent(
            buildsRow = makeCheckRow(buildsButt = makeButt("Builds on " + possessive + " ideas")), i++);
    setCheck(buildsRow, false);
    leftLayout.addComponent(favsRow = makeCheckRow(favsButt = makeButt(capPossessive + " favorite ideas")),
            i++);
    setCheck(favsRow, false);
    leftLayout.addComponent(profileRow = makeCheckRow(profileButt = makeButt(capPossessive + " idea profile")),
            i++);
    setCheck(profileRow, false);

    getRightLayout().addComponent(sp = new Label());
    sp.setHeight("20px");

    showAllMyIdeas();
}

From source file:edu.nps.moves.mmowgliMobile.ui.UserRenderer2.java

License:Open Source License

public void setMessage(FullEntryView2 mView, ListEntry message, ListView2 messageList,
        AbstractOrderedLayout layout) {//from w  w w  .j  a  va2s.c o m
    // messageList can be null if coming in from ActionPlan
    Object key = HSess.checkInit();
    UserListEntry wu = (UserListEntry) message;
    User u = wu.getUser();
    layout.removeAllComponents();

    HorizontalLayout hlay = new HorizontalLayout();
    layout.addComponent(hlay);
    hlay.addStyleName("m-userview-top");
    hlay.setWidth("100%");
    hlay.setMargin(true);
    hlay.setSpacing(true);

    Image img = new Image();
    img.addStyleName("m-ridgeborder");
    img.setSource(mediaLocator.locate(u.getAvatar().getMedia()));
    img.setWidth("90px");
    img.setHeight("90px");
    hlay.addComponent(img);
    hlay.setComponentAlignment(img, Alignment.MIDDLE_CENTER);

    Label lab;
    hlay.addComponent(lab = new Label());
    lab.setWidth("5px");

    VerticalLayout vlay = new VerticalLayout();
    vlay.setSpacing(true);
    hlay.addComponent(vlay);
    hlay.setComponentAlignment(vlay, Alignment.MIDDLE_LEFT);
    vlay.setWidth("100%");
    hlay.setExpandRatio(vlay, 1.0f);
    HorizontalLayout horl = new HorizontalLayout();
    horl.setSpacing(false);
    vlay.addComponent(horl);
    vlay.setComponentAlignment(horl, Alignment.BOTTOM_LEFT);
    horl.addComponent(lab = new Label("name"));
    lab.addStyleName("m-user-top-label"); //light-text");
    horl.addComponent(lab = new HtmlLabel("&nbsp;&nbsp;" + u.getUserName()));
    lab.addStyleName("m-user-top-value");
    horl = new HorizontalLayout();
    horl.setSpacing(false);
    vlay.addComponent(horl);
    vlay.setComponentAlignment(horl, Alignment.TOP_LEFT);

    horl.addComponent(lab = new Label("level"));
    lab.addStyleName("m-user-top-label"); //light-text");
    Level lev = u.getLevel();
    if (u.isGameMaster()) {
        Level l = Level.getLevelByOrdinal(Level.GAME_MASTER_ORDINAL, HSess.get());
        if (l != null)
            lev = l;
    }
    horl.addComponent(lab = new HtmlLabel("&nbsp;&nbsp;&nbsp;" + lev.getDescription()));
    lab.addStyleName("m-user-top-value");

    GridLayout gLay = new GridLayout();
    // gLay.setHeight("155px");  // won't size properly
    gLay.setMargin(true);
    gLay.addStyleName("m-userview-mid");
    gLay.setColumns(2);
    gLay.setRows(11);
    gLay.setSpacing(true);
    gLay.setWidth("100%");
    gLay.setColumnExpandRatio(1, 1.0f);
    layout.addComponent(gLay);

    addRow(gLay, "user ID:", "" + getPojoId(message));
    addRow(gLay, "location:", u.getLocation());
    addRow(gLay, "expertise:", u.getExpertise());
    addRow(gLay, "affiliation:", u.getAffiliation());
    addRow(gLay, "date registered:", formatter.format(u.getRegisterDate()));

    gLay.addComponent(new Hr(), 0, 5, 1, 5);

    Container cntr = new CardsByUserContainer<Card>(u); // expects ThreadLocal session to be setup
    numCards = cntr.size();
    addRow(gLay, "cards played:", "" + numCards);
    cntr = new ActionPlansByUserContainer<Card>(u); // expects ThreadLocal session to be setup
    numAps = cntr.size();
    addRow(gLay, "action plans:", "" + numAps);

    gLay.addComponent(new Hr(), 0, 8, 1, 8);

    addRow(gLay, "exploration points:", "" + u.getBasicScore());
    addRow(gLay, "innovation points:", "" + u.getInnovationScore());

    cardListener = new CardLis(u, mView);
    apListener = new AppLis(u, mView);

    layout.addComponent(makeButtons());

    HSess.checkClose(key);
}

From source file:edu.vcu.csbc.vahmpexplorer.main.VaHMPExplorer.java

public Component createToolBar(boolean loggedIn) {
    HorizontalLayout h = new HorizontalLayout();
    h.setMargin(true);/*from www  .  ja  v a2s .c o m*/
    h.setWidth("100%");

    Embedded headerImg = new Embedded(null, new ThemeResource("../vahmpexplorer/img/header.png"));
    headerImg.setWidth(311, Embedded.UNITS_PIXELS);
    headerImg.setHeight(45, Embedded.UNITS_PIXELS);
    headerImg.setType(Embedded.TYPE_IMAGE);
    headerImg.setStyleName(BaseTheme.BUTTON_LINK);
    headerImg.setDescription("Version " + HelpMessages.VERSION);
    h.addComponent(headerImg);

    if (loggedIn) {
        Panel panel = new Panel();
        Label loggedInUser = new Label(
                "Welcome: " + user.getFirstName() + " " + user.getLastName() + " (" + user.getLogin() + ")");
        changePassword = new Button("Change Password");
        changePassword.setStyleName(BaseTheme.BUTTON_LINK);
        changePassword.addListener((Button.ClickListener) this);

        logout = new Button("Logout");
        logout.setStyleName(BaseTheme.BUTTON_LINK);
        logout.addListener((Button.ClickListener) this);

        HorizontalLayout hl = new HorizontalLayout();
        hl.setSpacing(true);
        hl.addComponent(changePassword);
        hl.addComponent(logout);

        panel.addComponent(loggedInUser);
        panel.addComponent(hl);
        h.addComponent(panel);
        h.setComponentAlignment(panel, Alignment.MIDDLE_RIGHT);
    }
    PopupView help = new PopupView(new MainHelpPopup());
    h.addComponent(help);
    h.setComponentAlignment(help, Alignment.MIDDLE_RIGHT);
    h.setComponentAlignment(headerImg, Alignment.MIDDLE_LEFT);
    return h;
}

From source file:es.mdef.clientmanager.ui.GestionClientesUI.java

License:Apache License

private Component getMenuTitleComponent() {

    final HorizontalLayout top = new HorizontalLayout();
    top.setWidth("100%");
    top.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    top.addStyleName("valo-menu-title");

    final Label title = new Label("<h3><strong>Gesti&oacute;n de clientes</strong></h3>", ContentMode.HTML);
    title.setSizeUndefined();/*from www . j  a v a2  s . c o  m*/
    top.addComponent(title);
    top.setExpandRatio(title, 1);
    return top;
}

From source file:eu.eco2clouds.portal.component.apwizard.SuggestionStep.java

License:Apache License

private void render() {

    this.removeAllComponents();

    if (this.mainLayout != null && this.mainLayout.getMenu() != null
            && this.mainLayout.getMenu().getResourcesStep() != null
            && this.mainLayout.getMenu().getResourcesStep().getNewResourceTable() != null
            && this.mainLayout.getMenu().getGeneralStep().getDuration() != null
            && this.mainLayout.getMenu().getGeneralStep().getDuration().getValue() != null
            && !this.mainLayout.getMenu().getGeneralStep().getDuration().getValue().equals("")) {

        VerticalLayout vlCpuLoad = new VerticalLayout();
        vlCpuLoad.setMargin(false);//from www.j a v a2  s.  co m
        vlCpuLoad.setSpacing(true);
        Label lblCpuLoad = new Label("Average Cpu Load");
        vlCpuLoad.addComponent(lblCpuLoad);

        this.sliderCpuLoad.addValueChangeListener(new Property.ValueChangeListener() {

            @Override
            public void valueChange(Property.ValueChangeEvent event) {
                updateChart();
            }
        });

        HorizontalLayout hl = new HorizontalLayout();
        hl.setMargin(false);
        hl.setSpacing(true);
        hl.addComponent(new Label("min 0", ContentMode.HTML));
        hl.addComponent(sliderCpuLoad);
        hl.addComponent(new Label("100 max", ContentMode.HTML));

        vlCpuLoad.addComponent(hl);

        vlCpuLoad.setComponentAlignment(lblCpuLoad, Alignment.MIDDLE_LEFT);
        vlCpuLoad.setComponentAlignment(hl, Alignment.MIDDLE_LEFT);

        this.deploymentTable.setContainerDataSource(this.getCombination());
        this.deploymentTable.addValueChangeListener(new Property.ValueChangeListener() {
            @Override
            public void valueChange(final Property.ValueChangeEvent event) {

                DeploymentTableBean item = (DeploymentTableBean) deploymentTable.getValue();
                System.out.println("item is " + item);
                int selected = item.getId() - 1;

                long duration = Long.parseLong(mainLayout.getMenu().getGeneralStep().getDuration().getValue());

                System.out.println("selected " + selected);
                System.out.println("power fr" + power_fr[selected]);
                System.out.println("power uk" + power_uk[selected]);
                System.out.println("power de" + power_de[selected]);

                TrendWindow trendWindow = new TrendWindow(power_fr[selected], power_uk[selected],
                        power_de[selected], duration);
                UI.getCurrent().addWindow(trendWindow);

            }
        });

        this.deploymentTable.addGeneratedColumn("GEC", new ColumnGenerator() {

            @Override
            public Object generateCell(final Table source, final Object itemId, Object columnId) {

                ArrayList<String> locations = new ArrayList<String>();
                String[] vms = ((DeploymentTableBean) itemId).getCombination().split(" ");
                for (int i = 0; i < vms.length; i++) {

                    String vmName = vms[i].split("@")[0];
                    String vmLocation = vms[i].split("@")[1];
                    if (!locations.contains(vmLocation)) {
                        locations.add(vmLocation);
                    }

                }

                SourcePercentage sp = SchedulerManagerFactory.getInstance().getGEC(locations);

                return new Label(Double.toString(sp.getGEC()));
            }
        });

        this.deploymentTable.addGeneratedColumn("", new ColumnGenerator() {

            @Override
            public Object generateCell(final Table source, final Object itemId, Object columnId) {

                Button button = new Button("");
                button.setStyleName(Reindeer.BUTTON_LINK);
                button.setIcon(new ThemeResource("img/pie.png"));
                button.setDescription("GEC");

                button.addClickListener(new Button.ClickListener() {

                    @Override
                    public void buttonClick(Button.ClickEvent event) {

                        ArrayList<String> locations = new ArrayList<String>();
                        String[] vms = ((DeploymentTableBean) itemId).getCombination().split(" ");
                        for (int i = 0; i < vms.length; i++) {

                            String vmName = vms[i].split("@")[0];
                            String vmLocation = vms[i].split("@")[1];
                            if (!locations.contains(vmLocation)) {
                                locations.add(vmLocation);
                            }

                        }

                        SourcePercentage sp = SchedulerManagerFactory.getInstance().getGEC(locations);
                        GECWindow gecWindow = new GECWindow(((DeploymentTableBean) itemId).getCombination(),
                                sp);
                        UI.getCurrent().addWindow(gecWindow);

                    }
                });

                return button;
            }
        });

        this.deploymentTable.addGeneratedColumn(" ", new ColumnGenerator() {

            @Override
            public Object generateCell(final Table source, final Object itemId, Object columnId) {

                Button button = new Button("");
                button.setStyleName(Reindeer.BUTTON_LINK);
                button.setIcon(new ThemeResource("img/trend.png"));
                button.setDescription("CO2 trend");
                button.addClickListener(new Button.ClickListener() {

                    @Override
                    public void buttonClick(Button.ClickEvent event) {

                        //DeploymentTableBean item = (DeploymentTableBean) deploymentTable.getValue();
                        System.out.println("item is " + itemId);
                        int selected = ((DeploymentTableBean) itemId).getId() - 1;

                        long duration = Long
                                .parseLong(mainLayout.getMenu().getGeneralStep().getDuration().getValue());

                        System.out.println("selected " + selected);
                        System.out.println("power fr" + power_fr[selected]);
                        System.out.println("power uk" + power_uk[selected]);
                        System.out.println("power de" + power_de[selected]);

                        TrendWindow trendWindow = new TrendWindow(power_fr[selected], power_uk[selected],
                                power_de[selected], duration);
                        UI.getCurrent().addWindow(trendWindow);

                    }
                });

                return button;
            }
        });

        vlCpuLoad.addComponent(deploymentTable);

        OptionGroup chartAspect = new OptionGroup("Chart aspect");
        chartAspect.addItem(1);
        chartAspect.setItemCaption(1, "NORMAL");
        chartAspect.addItem(2);
        chartAspect.setItemCaption(2, "PERCENTAGE");

        chartAspect.select(1);
        chartAspect.setNullSelectionAllowed(false);
        chartAspect.setImmediate(true);

        chartAspect.addValueChangeListener(new ValueChangeListener() {
            @Override
            public void valueChange(final ValueChangeEvent event) {
                //final String valueString = String.valueOf(event.getProperty()
                //        .getValue());

                if (co2CountryChart != null) {
                    co2CountryChart.toggleAspect();
                }
            }
        });

        vlCpuLoad.addComponent(chartAspect);

        chartHl.addComponent(vlCpuLoad);

        this.compute();

        this.co2CountryChart = new CO2CountryChart(sdf.format(new Date()),
                this.deploymentTable.getItemIds().size(), co2_fr, co2_uk, co2_de,
                this.sliderCpuLoad.getValue());

        chartHl.addComponent(this.co2CountryChart);

        chartHl.setComponentAlignment(vlCpuLoad, Alignment.TOP_LEFT);
        chartHl.setComponentAlignment(this.co2CountryChart, Alignment.TOP_RIGHT);

        this.addComponent(chartHl);

    } else {
        Label lblEmpty = new Label("No resources defined.");
        this.addComponent(lblEmpty);
    }

}

From source file:eu.eco2clouds.portal.component.ExperimentDetails.java

License:Apache License

private void render() {
    try {//from w  w w . j  ava2 s.  c o  m
        this.setSpacing(false);
        this.setMargin(false);
        this.setHeight("200px");

        VerticalLayout details = new VerticalLayout();
        details.setSpacing(true);
        details.setMargin(false);

        SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-YYYY hh:mm");
        SimpleDateFormat edf = new SimpleDateFormat("dd 'days' hh 'hours' mm ' minutes'");

        details.addComponent(new Label("<b>id</b>: " + experiment.getId(), ContentMode.HTML));
        details.addComponent(new Label("<b>user</b>: " + experiment.getBonfireUserId() + " <b>group</b>: "
                + experiment.getBonfireGroupId(), ContentMode.HTML));
        if (!experiment.getStatus().equalsIgnoreCase("terminated")) {
            details.addComponent(new Label(
                    "<b>started</b>: " + sdf.format(new Date(experiment.getStartTime()))
                            + " <b>planned termination</b>: " + sdf.format(new Date(experiment.getEndTime())),
                    ContentMode.HTML));
            //details.addComponent(new Label(edf.format(new Date(experiment.getEndTime() - experiment.getStartTime())) + " to go"));
        } else {
            details.addComponent(new Label(
                    "<b>started</b>: " + sdf.format(new Date(experiment.getStartTime()))
                            + " <b>terminated</b>: " + sdf.format(new Date(experiment.getEndTime())),
                    ContentMode.HTML));
            details.addComponent(new Label(
                    "lasted for " + edf.format(new Date(experiment.getEndTime() - experiment.getStartTime()))));
        }

        final String ap = Parser
                .getJSONApplicationProfile(Parser.getApplicationProfile(experiment.getApplicationProfile()));

        Button btnApplicationProfile = new Button("Show Application Profile");
        btnApplicationProfile.setStyleName(BaseTheme.BUTTON_LINK);
        btnApplicationProfile.addClickListener(new Button.ClickListener() {

            @Override
            public void buttonClick(Button.ClickEvent event) {

                UI.getCurrent().addWindow(new APWindow(ap));

            }
        });
        details.addComponent(btnApplicationProfile);

        this.addComponent(details);
        this.setComponentAlignment(details, Alignment.MIDDLE_LEFT);

        Label spacing = new Label(" ");
        this.addComponent(spacing);
        this.setComponentAlignment(details, Alignment.MIDDLE_LEFT);

        /* if (!experiment.getStatus().equalsIgnoreCase("terminated")) {
        Button terminateBtn = new Button("Terminate");
        this.addComponent(terminateBtn);
        this.setComponentAlignment(terminateBtn, Alignment.MIDDLE_RIGHT);
         }*/

        this.setExpandRatio(spacing, 20.0f);
    } catch (JsonMappingException ex) {
        Logger.getLogger(ExperimentDetails.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
        Logger.getLogger(ExperimentDetails.class.getName()).log(Level.SEVERE, null, ex);
    }

}

From source file:eu.lod2.LOD2Demo.java

License:Apache License

public void home() {
    workspace.removeAllComponents();//from  w  ww .  j av a 2s . co m
    workspace.setHeight("80%");

    HorizontalLayout introH = new HorizontalLayout();
    Embedded lod2cycle = new Embedded("", new ThemeResource("app_images/lod-lifecycle-small.png"));
    lod2cycle.setMimeType("image/png");
    introH.addComponent(lod2cycle);
    introH.setComponentAlignment(lod2cycle, Alignment.MIDDLE_LEFT);

    VerticalLayout introV = new VerticalLayout();
    introH.addComponent(introV);

    Label introtextl = new Label(introtext, Label.CONTENT_XHTML);
    introV.addComponent(introtextl);
    introtextl.setWidth("400px");

    HorizontalLayout introVH = new HorizontalLayout();
    introV.addComponent(introVH);

    Embedded euflag = new Embedded("", new ThemeResource("app_images/eu-flag.gif"));
    euflag.setMimeType("image/gif");
    introVH.addComponent(euflag);
    euflag.addStyleName("eugif");
    euflag.setHeight("50px");
    Embedded fp7 = new Embedded("", new ThemeResource("app_images/fp7-gen-rgb_small.gif"));
    fp7.setMimeType("image/gif");
    fp7.addStyleName("eugif");
    fp7.setHeight("50px");
    introVH.addComponent(fp7);

    workspace.addComponent(introH);

}

From source file:eu.lod2.stat.StatLOD2Demo.java

License:Apache License

public void home() {
    workspace.removeAllComponents();// w w  w .j a  va  2s  . c  o  m
    workspace.setHeight("80%");

    HorizontalLayout introH = new HorizontalLayout();
    Embedded lod2cycle = new Embedded("", new ThemeResource("app_images/lod-lifecycle-cube.jpg"));
    lod2cycle.setMimeType("image/png");
    introH.addComponent(lod2cycle);
    introH.setComponentAlignment(lod2cycle, Alignment.MIDDLE_LEFT);

    VerticalLayout introV = new VerticalLayout();
    introH.addComponent(introV);

    Label introtextl = new Label(introtext, Label.CONTENT_XHTML);
    introV.addComponent(introtextl);
    introtextl.setWidth("400px");

    HorizontalLayout introVH = new HorizontalLayout();
    introV.addComponent(introVH);

    Embedded euflag = new Embedded("", new ThemeResource("app_images/eu-flag.gif"));
    euflag.setMimeType("image/gif");
    introVH.addComponent(euflag);
    euflag.addStyleName("eugif");
    euflag.setHeight("50px");
    Embedded fp7 = new Embedded("", new ThemeResource("app_images/fp7-gen-rgb_small.gif"));
    fp7.setMimeType("image/gif");
    fp7.addStyleName("eugif");
    fp7.setHeight("50px");
    introVH.addComponent(fp7);

    workspace.addComponent(introH);

}

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  w ww  .  j  a va2s. c  o m
    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("!", ""));
}