Example usage for com.vaadin.ui Alignment BOTTOM_LEFT

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

Introduction

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

Prototype

Alignment BOTTOM_LEFT

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

Click Source Link

Usage

From source file:edu.kit.dama.ui.admin.staging.processors.StagingProcessorBasePropertiesLayout.java

License:Apache License

public StagingProcessorBasePropertiesLayout() {
    super();//  ww  w  . j  a v  a  2s  .c  om

    LOGGER.debug("Building " + DEBUG_ID_PREFIX + " ...");

    setId(DEBUG_ID_PREFIX.substring(0, DEBUG_ID_PREFIX.length() - 1));
    setSizeFull();
    setMargin(true);
    setSpacing(true);

    setColumns(3);
    setRows(4);

    /////////check layout and relocate
    addComponent(getNameField(), 0, 0, 2, 0);
    addComponent(getGroupBox(), 0, 1, 1, 1);
    Label minus = new Label("-");
    minus.addStyleName(CSSTokenContainer.BOLD_CAPTION);
    Label plus = new Label("+");
    plus.addStyleName(CSSTokenContainer.BOLD_CAPTION);

    sliderLayout = new HorizontalLayout(minus, getPrioritySlider(), plus);
    sliderLayout.setComponentAlignment(minus, Alignment.BOTTOM_RIGHT);
    sliderLayout.setComponentAlignment(plus, Alignment.BOTTOM_LEFT);
    sliderLayout.setExpandRatio(getPrioritySlider(), .96f);
    sliderLayout.setExpandRatio(minus, .02f);
    sliderLayout.setExpandRatio(plus, .02f);
    sliderLayout.setWidth("100%");
    addComponent(sliderLayout, 0, 2, 1, 2);

    getCheckBoxesLayout().addComponent(getIngestProcessingSupportedBox());
    getCheckBoxesLayout().addComponent(getDownloadProcessingSupportedBox());

    addComponent(getCheckBoxesLayout(), 2, 1, 2, 2);
    addComponent(getDescriptionArea(), 0, 3, 2, 3);

    setColumnExpandRatio(0, .79f);
    setColumnExpandRatio(1, 0.01f);
    setColumnExpandRatio(2, 0.2f);
    setRowExpandRatio(3, 1f);
}

From source file:edu.kit.dama.ui.admin.staging.processors.StagingProcessorConfigurationTab.java

License:Apache License

/**
 *
 * @return//from  w  ww . j  a va 2 s.  com
 */
@Override
public GridLayout buildMainLayout() {
    String id = "mainLayout";
    LOGGER.debug("Building " + DEBUG_ID_PREFIX + id + " ...");

    UIUtils7.GridLayoutBuilder mainLayoutBuilder = new UIUtils7.GridLayoutBuilder(3, 3);

    // Add components to mainLayout
    mainLayoutBuilder.fillColumn(getElementList(), 0, 0, 1);
    mainLayoutBuilder.addComponent(getImplementationClassField(), 1, 0, 1, 1)
            .addComponent(getLoadImplementationClassButton(), Alignment.BOTTOM_RIGHT, 2, 0, 1, 1);
    mainLayoutBuilder.fillRow(getPropertiesPanel(), 1, 1, 1);
    mainLayoutBuilder.addComponent(getNavigateButton(), Alignment.BOTTOM_LEFT, 1, 2, 1, 1)
            .addComponent(getCommitChangesButton(), Alignment.BOTTOM_RIGHT, 2, 2, 1, 1);

    mainLayout = mainLayoutBuilder.getLayout();
    mainLayout.setId(DEBUG_ID_PREFIX + id);
    mainLayout.setSizeFull();
    mainLayout.setImmediate(true);
    mainLayout.setSpacing(true);
    mainLayout.setMargin(true);

    mainLayout.setColumnExpandRatio(1, 1f);
    mainLayout.setRowExpandRatio(1, 1f);

    return mainLayout;
}

From source file:edu.kit.dama.ui.admin.utils.PathSelector.java

License:Apache License

/**
 *
 *//* w w  w . j a va  2s .com*/
private void buildMainLayout() {
    String id = "mainLayout";
    LOGGER.debug("Building " + DEBUG_ID_PREFIX + id + " ...");

    mainLayout = new GridLayout(3, 3);
    mainLayout.setImmediate(true);
    mainLayout.setSizeFull();
    mainLayout.setMargin(true);
    mainLayout.setSpacing(true);

    mainLayout.addComponent(getRootBox(), 0, 0);
    mainLayout.addComponent(getTreeTable(), 0, 1, 2, 1);
    mainLayout.addComponent(getPathField(), 0, 2, 1, 2);
    mainLayout.addComponent(getSelectButton(), 2, 2);

    mainLayout.setComponentAlignment(getPathField(), Alignment.BOTTOM_LEFT);
    mainLayout.setComponentAlignment(getSelectButton(), Alignment.BOTTOM_RIGHT);

    mainLayout.setColumnExpandRatio(0, 0.4f);
    mainLayout.setColumnExpandRatio(1, 0.39f);
    mainLayout.setColumnExpandRatio(2, 0.01f);

    mainLayout.setRowExpandRatio(0, 0.01f);
    mainLayout.setRowExpandRatio(1, 0.9f);
    mainLayout.setRowExpandRatio(2, 0.01f);
}

From source file:edu.kit.dama.ui.admin.wizard.FirstStartWizard.java

License:Apache License

private void buildMainLayout() {
    stepLayout = new VerticalLayout();

    back.setEnabled(false);//from  www .  j  a  va2 s .co m
    stepLayout.addComponent(stepList[currentStep]);
    stepLayout.setComponentAlignment(stepList[currentStep], Alignment.TOP_RIGHT);
    stepLayout.setSpacing(false);
    stepLayout.setMargin(false);
    stepLayout.setWidth("100%");
    stepLayout.setHeight("500px");

    final VerticalLayout stepLabels = new VerticalLayout();
    for (WizardStep step : stepList) {
        Label stepLabel = new Label(step.getStepName());
        stepLabel.setWidth("250px");
        stepLabels.addComponent(stepLabel);
        stepLabels.setComponentAlignment(stepLabel, Alignment.TOP_LEFT);
    }

    //make introduction label bold
    stepLabels.getComponent(0).addStyleName("myboldcaption");

    Label spacer = new Label();
    stepLabels.addComponent(spacer);
    stepLabels.setExpandRatio(spacer, 1.0f);
    stepLabels.setWidth("275px");
    stepLabels.setHeight("550px");
    stepLabels.setSpacing(true);

    UIUtils7.GridLayoutBuilder builder = new UIUtils7.GridLayoutBuilder(2, 2);

    HorizontalLayout buttonLayout = new HorizontalLayout(back, next);
    buttonLayout.setSizeFull();
    buttonLayout.setComponentAlignment(back, Alignment.BOTTOM_RIGHT);
    buttonLayout.setComponentAlignment(next, Alignment.BOTTOM_RIGHT);
    buttonLayout.setExpandRatio(back, 1.0f);

    next.addClickListener((event) -> {
        if ("Go To Login".equals(next.getCaption())) {
            Page.getCurrent().reload();
        } else if ("Finish".equals(next.getCaption())) {
            //do finish
            WizardPersistHelper helper = new WizardPersistHelper();
            if (helper.persist(properties)) {
                UIUtils7.showInformation("Success",
                        "All information have been successfully stored into the database. For details, please refer to the log output above.\n"
                                + "You may now dismiss this message and click 'Go To Login' in order to access the login page.\n"
                                + "From there you can to login using your administrator account or create a personalized user account.",
                        3000);
                back.setVisible(false);
                next.setCaption("Go To Login");
            } else {
                UIUtils7.showError("Failed to store collected information in database.\n"
                        + "Please refer to the log output above.");
            }
            ((WizardSummary) stepList[currentStep]).setSummary(helper.getMessages());
        } else {
            if (currentStep + 1 <= stepList.length - 1) {
                if (stepList[currentStep].validate()) {
                    stepList[currentStep].collectProperties(properties);
                    currentStep++;
                    stepLayout.replaceComponent(stepList[currentStep - 1], stepList[currentStep]);
                    Label currentLabel = (Label) stepLabels.getComponent(currentStep);
                    Label prevLabel = (Label) stepLabels.getComponent(currentStep - 1);
                    currentLabel.addStyleName("myboldcaption");
                    prevLabel.removeStyleName("myboldcaption");

                    if (stepList[currentStep] instanceof WizardSummary) {
                        StringBuilder summary = new StringBuilder();
                        for (WizardStep step : stepList) {
                            summary.append(step.getSummary()).append("\n");
                        }
                        ((WizardSummary) stepList[currentStep]).setSummary(summary.toString());
                    }
                }
            }

            if (currentStep == stepList.length - 1) {
                //finish
                next.setCaption("Finish");
            } else {
                next.setCaption("Next");
            }

            back.setEnabled(true);
        }
    });

    back.addClickListener((event) -> {
        if (currentStep - 1 >= 0) {
            stepList[currentStep].collectProperties(properties);
            currentStep--;
            stepLayout.replaceComponent(stepList[currentStep + 1], stepList[currentStep]);
            Label currentLabel = (Label) stepLabels.getComponent(currentStep);
            Label prevLabel = (Label) stepLabels.getComponent(currentStep + 1);
            currentLabel.addStyleName("myboldcaption");
            prevLabel.removeStyleName("myboldcaption");
        }
        next.setEnabled(true);
        back.setEnabled(currentStep > 0);
        next.setCaption("Next");
    });

    builder.addComponent(stepLabels, Alignment.TOP_LEFT, 0, 0, 1, 2);
    builder.addComponent(stepLayout, Alignment.TOP_LEFT, 1, 0, 1, 1);
    builder.addComponent(buttonLayout, Alignment.BOTTOM_LEFT, 1, 1, 1, 1);

    mainLayout = builder.getLayout();
    mainLayout.setMargin(true);
    mainLayout.setSizeFull();

    // mainLayout.setColumnExpandRatio(0, .3f);
    mainLayout.setColumnExpandRatio(1, 1f);
    mainLayout.setRowExpandRatio(0, .95f);
    mainLayout.setRowExpandRatio(1, .05f);
}

From source file:edu.kit.dama.ui.admin.workflow.ExecutionEnvironmentBasePropertiesLayout.java

License:Apache License

/**
 * Default constructor./*from w w  w  . j  ava2  s .  c  o  m*/
 */
public ExecutionEnvironmentBasePropertiesLayout() {
    super();

    LOGGER.debug("Building " + DEBUG_ID_PREFIX + " ...");

    setId(DEBUG_ID_PREFIX.substring(0, DEBUG_ID_PREFIX.length() - 1));
    setSizeFull();
    setMargin(true);
    setSpacing(true);

    setColumns(4);
    setRows(6);

    addComponent(getNameField(), 0, 0, 2, 0);
    addComponent(getGroupBox(), 3, 0);
    //
    addComponent(getAccessPointBox(), 0, 1, 2, 1);
    addComponent(getCheckBoxesLayout(), 3, 1);
    //

    addComponent(getAccessPointBasePathField(), 0, 2, 2, 2);
    addComponent(getPathSelectorButton(), 3, 2);
    //
    addComponent(getMaxTasksField(), 0, 3, 2, 3);
    //
    addComponent(getDescriptionArea(), 0, 4, 2, 5);

    //add property selection
    Button addPropertyButton = new Button();
    addPropertyButton.setIcon(new ThemeResource(IconContainer.ADD));
    addPropertyButton.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            addPropertyComponent.reset();
            addPropertyComponent.showWindow();
        }
    });

    HorizontalLayout layout = new HorizontalLayout(getEnvironmentPropertiesSelect(), addPropertyButton);
    layout.setComponentAlignment(getEnvironmentPropertiesSelect(), Alignment.TOP_LEFT);
    layout.setComponentAlignment(addPropertyButton, Alignment.BOTTOM_RIGHT);
    layout.setSizeFull();
    layout.setExpandRatio(getEnvironmentPropertiesSelect(), .95f);
    layout.setExpandRatio(addPropertyButton, .05f);
    addComponent(layout, 3, 4, 3, 5);

    //add popup to layout
    addPropertyComponent = new AddEnvironmentPropertyComponent(this);

    setComponentAlignment(getPathSelectorButton(), Alignment.BOTTOM_LEFT);
    setColumnExpandRatio(0, 0.2f);
    setColumnExpandRatio(1, 0.2f);
    setColumnExpandRatio(2, 0.2f);
    setColumnExpandRatio(3, 0.2f);
    setRowExpandRatio(5, 1f);
}

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

License:Open Source License

private Component makeIdField(ActionPlan ap) {
    HorizontalLayout hl = new HorizontalLayout();
    hl.setMargin(false);//from w w  w.  j  a  v  a  2  s . c  om
    hl.setSpacing(false);
    hl.setHeight("22px");

    Label lab;
    hl.addComponent(lab = new Label());
    lab.setWidth("270px");
    hl.addComponent(lab = new Label("ID " + ap.getId()));
    hl.setComponentAlignment(lab, Alignment.BOTTOM_LEFT);

    maybeAddHiddenCheckBoxTL(hl, ap);
    return hl;
}

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

License:Open Source License

private void addChildListsTL() {
    MovePhase phase = MovePhase.getCurrentMovePhaseTL();
    Set<CardType> allowedTypes = phase.getAllowedCards();
    followOnTypes = new ArrayList<CardType>();
    for (CardType ct : allowedTypes)
        if (!ct.isIdeaCard()) // "idea/initiating" is the opposite of followon
            followOnTypes.add(ct);// w  w  w  .j av  a2s.c  o  m

    Collections.sort(followOnTypes, new Comparator<CardType>() {
        @Override
        public int compare(CardType arg0, CardType arg1) {
            return (int) (arg0.getDescendantOrdinal() - arg1.getDescendantOrdinal());
        }
    });

    columnVLs = new ArrayList<VerticalLayout>(followOnTypes.size());

    for (int i = 0; i < followOnTypes.size(); i++) {
        VerticalLayout vl = new VerticalLayout();
        vl.setSpacing(true);
        columnVLs.add(vl);
        listsHL.addComponent(vl);
    }
    Card card = Card.getTL(cardId);
    Card parent = card.getParentCard();
    VerticalLayout spacerVL = new VerticalLayout();

    if (parent != null) {
        topHL.addComponent(spacerVL);
        topHL.setExpandRatio(spacerVL, 1.0f);
        spacerVL.setWidth("100%");

        parentSumm = CardSummary.newCardSummarySmallTL(parent.getId());
        spacerVL.addComponent(parentSumm);
        parentSumm.initGui();
        spacerVL.setComponentAlignment(parentSumm, Alignment.MIDDLE_CENTER);
        parentSumm.setCaption("Parent Card");
        parentSumm.addStyleName("m-parent-card-summary");
    } else {
        topHL.addComponent(spacerVL);
        topHL.setExpandRatio(spacerVL, 1.0f);
        spacerVL.setWidth("100%");

        gotoTopLevelButt.setStyleName("m-gotoTopLevelButton");
        gotoTopLevelButt.setDescription(idea_dash_tt);
        gotoTopLevelButt.setId(PLAY_AN_IDEA_BLUE_BUTTON);
        gotoTopLevelButt.setDescription("Show two top-level card rows");
        spacerVL.addComponent(gotoTopLevelButt);
        spacerVL.setComponentAlignment(gotoTopLevelButt, Alignment.MIDDLE_CENTER);

    }
    if (isGameMaster) {
        spacerVL.addComponent(cardMarkingPanel);
        spacerVL.setComponentAlignment(cardMarkingPanel, Alignment.BOTTOM_LEFT);
    }

    cardLg = CardLarge.newCardLargeTL(card.getId());
    topHL.addComponent(cardLg);
    cardLg.initGuiTL();

    VerticalLayout buttVL = new VerticalLayout();
    buttVL.setHeight("100%");
    topHL.addComponent(buttVL);
    topHL.setComponentAlignment(buttVL, Alignment.MIDDLE_CENTER);
    topHL.setExpandRatio(buttVL, 1.0f);

    Label spacer = new Label();
    buttVL.addComponent(spacer);
    buttVL.setExpandRatio(spacer, 1.0f);

    buttVL.addComponent(gotoIdeaDashButt);
    gotoIdeaDashButt.setStyleName("m-gotoIdeaDashboardButton");
    gotoIdeaDashButt.setDescription(idea_dash_tt);
    gotoIdeaDashButt.setId(GO_TO_IDEA_DASHBOARD_BUTTON);
    buttVL.setComponentAlignment(gotoIdeaDashButt, Alignment.MIDDLE_CENTER);

    buttVL.addComponent(chainButt);
    chainButt.setStyleName("m-viewCardChainButton");
    chainButt.setDescription(view_chain_tt);
    buttVL.setComponentAlignment(chainButt, Alignment.MIDDLE_CENTER);

    spacer = new Label();
    buttVL.addComponent(spacer);
    buttVL.setExpandRatio(spacer, 1.0f);

    int col = -1;
    for (CardType ct : followOnTypes) {
        col++;
        VerticalLayout columnV = columnVLs.get(col);

        CardSummaryListHeader lstHdr = CardSummaryListHeader.newCardSummaryListHeader(ct, card);
        lstHdr.addNewCardListener(this);
        columnV.addComponent(lstHdr);
        lstHdr.initGui();
    }

    listFollowers_oobTL(card.getId()); // gets current vaadin transaction session
}

From source file:edu.nps.moves.mmowgli.modules.maps.LeafletMap.java

License:Open Source License

public void initGuiTL() {
    setSpacing(true);//from  w w w . jav a  2 s.  com
    setSizeUndefined();
    setWidth("950px");
    addStyleName("m-marginleft-20");
    Label lab;

    HorizontalLayout hLay = new HorizontalLayout();
    hLay.setMargin(false);
    hLay.setSpacing(false);
    hLay.setWidth("100%");
    NativeButton butt;
    hLay.addComponent(butt = new NativeButton("go to default game location", new MyDefaultLocationListener()));
    hLay.setExpandRatio(butt, 0.5f);
    hLay.setComponentAlignment(butt, Alignment.BOTTOM_LEFT);

    hLay.addComponent(lab = new HtmlLabel(title));
    lab.setWidth(null);

    makeLayerPopups();
    HorizontalLayout popLay = new HorizontalLayout();
    popLay.setMargin(false);
    popLay.setSpacing(false);
    popLay.setWidth("100%");

    popLay.addComponent(lab = new Label());
    lab.setWidth("1px");
    popLay.setExpandRatio(lab, 1.0f);
    popLay.addComponent(baseLayerPopup);
    popLay.addComponent(overlayPopup);

    hLay.addComponent(popLay);
    hLay.setComponentAlignment(popLay, Alignment.BOTTOM_RIGHT);
    hLay.setExpandRatio(popLay, 0.5f);

    addComponent(hLay);

    User me = Mmowgli2UI.getGlobals().getUserTL();
    this.imAGuest = me.isViewOnly() || me.isAccountDisabled();

    map.setAttributionPrefix("Powered by Leaflet with v-leaflet");
    map.addStyleName("m-greyborder");
    map.removeAllComponents();
    // map.addControl(new LScale());
    layerMap = installAllLayers(map);

    fillLayerPopupsTL(); // build the widgets

    setDefaultMapValuesTL(me); // set default zoom, center, layers

    if (!imAGuest)
        setUserMapValuesTL(me); // set zoom, center and layers from userID pref.

    setOptionGroupWidgetsFromLayerMap();// syncs up the widgets to match the active layers

    Collection<Extension> exts = map.getExtensions();
    LLayers llayers = null;
    for (Extension ex : exts)
        if (ex instanceof LLayers) {
            llayers = (LLayers) ex;
            break;
        }
    if (llayers != null)
        map.removeExtension(llayers);

    addComponent(map);

    setExpandRatio(map, 1);
    map.setHeight("600px");
    map.setWidth("100%");
    map.addMoveEndListener(new MyMoveEndListener());
}

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) {// ww w . j  av a 2  s .  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:fi.semantum.strategia.Updates.java

License:Open Source License

public static void updateTags(final Main main) {

    final Database database = main.getDatabase();

    main.tags.removeAllComponents();//w ww  .j a  v  a  2  s  .  c  o  m
    main.tags.setMargin(true);

    ArrayList<Tag> sorted = new ArrayList<Tag>(Tag.enumerate(database));
    Collections.sort(sorted, new Comparator<Tag>() {

        @Override
        public int compare(Tag arg0, Tag arg1) {
            return arg0.getId(database).compareTo(arg1.getId(database));
        }

    });

    for (final Tag t : sorted) {

        final HorizontalLayout hl = new HorizontalLayout();
        hl.setSpacing(true);
        Label l = new Label(t.getId(database));
        l.setSizeUndefined();
        l.addStyleName(ValoTheme.LABEL_HUGE);

        hl.addComponent(l);
        hl.setComponentAlignment(l, Alignment.BOTTOM_LEFT);

        final Image select = new Image("", new ThemeResource("cursor.png"));
        select.setHeight("24px");
        select.setWidth("24px");
        select.setDescription("Valitse");
        select.addClickListener(new MouseEvents.ClickListener() {

            private static final long serialVersionUID = 3734678948272593793L;

            @Override
            public void click(com.vaadin.event.MouseEvents.ClickEvent event) {
                main.setCurrentItem(t, main.getUIState().currentPosition);
                Utils.loseFocus(select);
            }

        });
        hl.addComponent(select);
        hl.setComponentAlignment(select, Alignment.BOTTOM_LEFT);

        final Image edit = new Image("", new ThemeResource("table_edit.png"));
        edit.setHeight("24px");
        edit.setWidth("24px");
        edit.setDescription("Muokkaa");
        edit.addClickListener(new MouseEvents.ClickListener() {

            private static final long serialVersionUID = -3792353723974454702L;

            @Override
            public void click(com.vaadin.event.MouseEvents.ClickEvent event) {
                Utils.editTextAndId(main, "Muokkaa aihetunnistetta", t);
                updateTags(main);
            }

        });
        hl.addComponent(edit);
        hl.setComponentAlignment(edit, Alignment.BOTTOM_LEFT);

        main.tags.addComponent(hl);
        main.tags.setComponentAlignment(hl, Alignment.MIDDLE_CENTER);

        Label l2 = new Label(t.getText(database));
        l2.addStyleName(ValoTheme.LABEL_LIGHT);
        l2.setSizeUndefined();
        main.tags.addComponent(l2);
        main.tags.setComponentAlignment(l2, Alignment.MIDDLE_CENTER);

    }

}