Example usage for com.vaadin.ui VerticalLayout setComponentAlignment

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

Introduction

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

Prototype

@Override
    public void setComponentAlignment(Component childComponent, Alignment alignment) 

Source Link

Usage

From source file:com.etest.view.testbank.cellitem.CellCaseItemWindow.java

Table populateDataTable() {
    table.removeAllItems();/*from   www  .jav a2  s.  com*/
    int i = 0;
    for (CellItem ci : cis.getCellItemByCase(getCellCaseId())) {
        VerticalLayout v = new VerticalLayout();
        v.setSizeFull();

        Button edit = new Button("modify");
        edit.setWidth("100%");
        edit.setData(ci.getCellItemId());
        edit.setIcon(FontAwesome.PENCIL);
        edit.addStyleName(ValoTheme.BUTTON_LINK);
        edit.addStyleName(ValoTheme.BUTTON_TINY);
        edit.addStyleName(ValoTheme.BUTTON_QUIET);
        edit.addClickListener(modifyBtnClickListener);
        v.addComponent(edit);
        v.setComponentAlignment(edit, Alignment.MIDDLE_LEFT);

        Button approve = new Button("status");
        approve.setWidth("100%");
        approve.setData(ci.getCellItemId());
        approve.addStyleName(ValoTheme.BUTTON_LINK);
        approve.addStyleName(ValoTheme.BUTTON_TINY);
        approve.addStyleName(ValoTheme.BUTTON_QUIET);
        v.addComponent(approve);
        v.setComponentAlignment(approve, Alignment.MIDDLE_LEFT);

        Button view = new Button("view");
        view.setWidth("100%");
        view.setData(ci.getCellItemId());
        view.setIcon(FontAwesome.PLAY_CIRCLE);
        view.addStyleName(ValoTheme.BUTTON_LINK);
        view.addStyleName(ValoTheme.BUTTON_TINY);
        view.addStyleName(ValoTheme.BUTTON_QUIET);
        view.addClickListener(modifyBtnClickListener);
        v.addComponent(view);
        v.setComponentAlignment(view, Alignment.MIDDLE_LEFT);

        if (ci.getApproveItemStatus() == 0) {
            approve.setIcon(FontAwesome.THUMBS_DOWN);
        } else {
            approve.setIcon(FontAwesome.THUMBS_UP);
        }

        Label label = new Label(ci.getItem());
        label.setStyleName("label-padding");

        table.addItem(new Object[] { ci.getCellItemId(), label, v }, i);
        i++;
    }
    table.setPageLength(table.size());

    return table;
}

From source file:com.etest.view.tq.charts.ItemAnalysisGraphicalViewAll.java

public ItemAnalysisGraphicalViewAll(int curriculumId) {
    this.curriculumId = curriculumId;

    setModal(true);/*from w w  w . j a v  a  2 s . c  o  m*/
    setHeight("100%");

    VerticalLayout v = new VerticalLayout();
    v.setMargin(true);
    v.setSpacing(true);

    Label title = new Label();
    title.setCaption("Item Analysis of " + cs.getCurriculumById(getCurriculumId()).getSubject());
    title.setWidthUndefined();
    v.addComponent(title);
    v.setComponentAlignment(title, Alignment.TOP_CENTER);

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

    h.addComponent(getDiscriminationIndexChart());
    h.addComponent(getDifficultIndexChart());

    h.setWidthUndefined();
    h.setHeightUndefined();

    v.addComponent(h);
    v.setWidthUndefined();

    setContent(v);
    getContent().setWidthUndefined();
    //        getContent().setHeightUndefined();
    center();
}

From source file:com.etest.view.tq.itemanalysis.TQItemAnalysisUI.java

public Table populateDataTable() {
    removeAllItems();/*from w  ww  .ja v  a 2s.c  o m*/
    int i = 0;
    for (TQCoverage t : tq.getAllTQCoverage()) {
        VerticalLayout v = new VerticalLayout();
        v.setWidth("100%");

        Button analyze = new Button();
        analyze.setWidthUndefined();
        analyze.setData(t.getTqCoverageId());
        analyze.setCaption((t.getAnalyzed() == 0) ? "Unanalyze" : "Analyzed");
        analyze.setIcon(FontAwesome.BULLSEYE);
        analyze.addStyleName(ValoTheme.BUTTON_LINK);
        analyze.addStyleName(ValoTheme.BUTTON_TINY);
        analyze.addStyleName(ValoTheme.BUTTON_QUIET);
        analyze.addStyleName("button-container");
        analyze.setEnabled(t.getAnalyzed() == 0);
        analyze.addClickListener(buttonClickListener);
        v.addComponent(analyze);
        v.setComponentAlignment(analyze, Alignment.MIDDLE_LEFT);

        Button view = new Button("View");
        view.setWidthUndefined();
        view.setData(t.getTqCoverageId());
        view.setIcon(FontAwesome.VIDEO_CAMERA);
        view.addStyleName(ValoTheme.BUTTON_LINK);
        view.addStyleName(ValoTheme.BUTTON_TINY);
        view.addStyleName(ValoTheme.BUTTON_QUIET);
        view.addStyleName("button-container");
        view.setVisible((t.getAnalyzed() != 0));
        view.addClickListener(buttonClickListener);
        v.addComponent(view);
        v.setComponentAlignment(view, Alignment.MIDDLE_LEFT);

        addItem(new Object[] { t.getExamTitle(), cs.getCurriculumById(t.getCurriculumId()).getSubject(),
                t.getDateCreated(), t.getTotalHoursCoverage(), t.getTotalItems(), v }, i);
        i++;
    }
    setPageLength(size());

    return this;
}

From source file:com.etest.view.tq.TQCoverageUI.java

Window getTopicWindow(Item item) {
    Window sub = new Window("TOPIC: ");
    sub.setWidth("500px");
    sub.setModal(true);/*  w w  w  . j  a  va 2 s . c  om*/
    sub.center();
    sub.setResizable(false);

    VerticalLayout v = new VerticalLayout();
    v.setWidth("100%");
    v.setMargin(true);
    v.setSpacing(true);

    topic.setInputPrompt("Select a Topic..");
    topic.addStyleName(ValoTheme.COMBOBOX_SMALL);
    topic.setWidth("100%");
    topic.addValueChangeListener((Property.ValueChangeEvent event) -> {
        if (event.getProperty().getValue() == null) {
        } else {
            syllabusId = (int) event.getProperty().getValue();
            topicStr = topic.getItem(topic.getValue()).toString();
        }
    });
    v.addComponent(topic);

    Button button = new Button("CLOSE");
    button.setWidth("50%");
    button.setIcon(FontAwesome.TASKS);
    button.addStyleName(ValoTheme.BUTTON_PRIMARY);
    button.addStyleName(ValoTheme.BUTTON_SMALL);
    button.addClickListener((Button.ClickEvent event) -> {
        if (topic.getValue() == null) {
            Notification.show("Select a Topic!", Notification.Type.WARNING_MESSAGE);
        } else {
            populateGridRow(item);
            populateGridFooter();
        }
        sub.close();
    });
    v.addComponent(button);
    v.setComponentAlignment(button, Alignment.MIDDLE_RIGHT);

    sub.setContent(v);
    sub.getContent().setHeightUndefined();

    return sub;
}

From source file:com.etest.view.tq.TQCoverageUI.java

Window getPickWindow(Item item, String propertyId) {
    Window sub = new Window("Field Value: ");
    sub.setWidth("150px");
    sub.setModal(true);/*from  w ww  .j a  v a 2  s.  c om*/
    sub.center();
    sub.setResizable(false);

    VerticalLayout v = new VerticalLayout();
    v.setWidth("100%");
    v.setMargin(true);
    v.setSpacing(true);

    TextField field = new CommonTextField("Enter Value..", "Enter a Value: ");
    v.addComponent(field);

    Button button = new Button("CLOSE");
    button.setWidth("100%");
    button.setIcon(FontAwesome.TASKS);
    button.addStyleName(ValoTheme.BUTTON_PRIMARY);
    button.addStyleName(ValoTheme.BUTTON_SMALL);
    button.addClickListener((Button.ClickEvent event) -> {
        boolean isNumeric = CommonUtilities.isNumeric(field.getValue().trim());
        if (!isNumeric) {
            return;
        }

        boolean isGreaterThanInTB = tq.isGreaterThanInTB(item, propertyId, field.getValue().trim());
        if (isGreaterThanInTB) {
            Notification.show("Not allowed to exceed in total Items in Test Bank!",
                    Notification.Type.ERROR_MESSAGE);
            return;
        } else {
            item.getItemProperty(CommonUtilities.replaceStringTBToPick(propertyId))
                    .setValue(CommonUtilities.convertStringToInt(field.getValue()));
            footer.getCell(CommonUtilities.replaceStringTBToPick(propertyId)).setText(String.valueOf(
                    tq.calculateTotalPickItems(grid, CommonUtilities.replaceStringTBToPick(propertyId))));
        }
        sub.close();
    });
    v.addComponent(button);
    v.setComponentAlignment(button, Alignment.BOTTOM_CENTER);

    sub.setContent(v);
    sub.getContent().setHeightUndefined();

    return sub;
}

From source file:com.etest.view.tq.TQCoverageUI.java

Window getMaxItemsWindow(Item item, double previousValue) {
    Window sub = new Window("Field Value: ");
    sub.setWidth("150px");
    sub.setModal(true);/*from  ww  w  .  j  av  a 2  s  .  c  om*/
    sub.center();
    sub.setResizable(false);

    VerticalLayout v = new VerticalLayout();
    v.setWidth("100%");
    v.setMargin(true);
    v.setSpacing(true);

    TextField field = new CommonTextField("Enter Value..", "Enter a Value: ");
    v.addComponent(field);

    Button button = new Button("CLOSE");
    button.setWidth("100%");
    button.setIcon(FontAwesome.TASKS);
    button.addStyleName(ValoTheme.BUTTON_PRIMARY);
    button.addStyleName(ValoTheme.BUTTON_SMALL);
    button.addClickListener((Button.ClickEvent event) -> {
        boolean isNumeric = CommonUtilities.isNumeric(field.getValue().trim());
        if (!isNumeric) {
            return;
        }

        item.getItemProperty("Max Items").setValue(CommonUtilities.convertStringToDouble(field.getValue()));
        if (tq.calculateTotalMaxItems(grid) == CommonUtilities
                .convertStringToDouble(totalItems.getValue().trim())) {
            footer.getCell("Max Items").setText(String.valueOf(tq.calculateTotalMaxItems(grid)));
        } else {
            item.getItemProperty("Max Items").setValue(previousValue);
            footer.getCell("Max Items").setText(String.valueOf(tq.calculateTotalMaxItems(grid)));
            ShowErrorNotification.warning("Total Max Items should be equal to Total Test Items");
            return;
        }

        sub.close();
    });
    v.addComponent(button);
    v.setComponentAlignment(button, Alignment.BOTTOM_CENTER);

    sub.setContent(v);
    sub.getContent().setHeightUndefined();

    return sub;
}

From source file:com.etest.view.tq.TQListUI.java

public Table populateDataTable() {
    removeAllItems();// w w  w . j  a  v a 2  s . c o m
    int i = 0;
    for (TQCoverage t : tq.getAllTQCoverage()) {
        VerticalLayout v = new VerticalLayout();
        v.setWidth("100%");

        Button view = new Button("view");
        view.setSizeFull();
        view.setData(t.getTqCoverageId());
        view.setIcon(FontAwesome.VIDEO_CAMERA);
        view.addStyleName(ValoTheme.BUTTON_LINK);
        view.addStyleName(ValoTheme.BUTTON_TINY);
        view.addStyleName(ValoTheme.BUTTON_QUIET);
        view.addStyleName("button-container");
        view.addClickListener(remarksBtnClickListener);
        v.addComponent(view);
        v.setComponentAlignment(view, Alignment.MIDDLE_LEFT);

        Button approve = new Button("status");
        approve.setSizeFull();
        approve.setData(t.getTqCoverageId());
        approve.addStyleName(ValoTheme.BUTTON_LINK);
        approve.addStyleName(ValoTheme.BUTTON_TINY);
        approve.addStyleName(ValoTheme.BUTTON_QUIET);
        approve.addStyleName("button-container");
        v.addComponent(approve);
        v.setComponentAlignment(approve, Alignment.MIDDLE_LEFT);

        //            Button print = new Button("print");
        //            print.setSizeFull();
        //            print.setData(t.getTqCoverageId());  
        //            print.setIcon(FontAwesome.PRINT);
        //            print.addStyleName(ValoTheme.BUTTON_LINK);
        //            print.addStyleName(ValoTheme.BUTTON_TINY);
        //            print.addStyleName(ValoTheme.BUTTON_QUIET);
        //            print.addStyleName("button-container");
        //            print.addClickListener(remarksBtnClickListener);
        //            v.addComponent(print);
        //            v.setComponentAlignment(print, Alignment.MIDDLE_LEFT);

        if (t.getStatus() == 0) {
            approve.setIcon(FontAwesome.THUMBS_DOWN);
            //                print.setVisible(false);
        } else {
            approve.setIcon(FontAwesome.THUMBS_UP);
            //                print.setVisible(true);
        }

        addItem(new Object[] { t.getExamTitle(), cs.getCurriculumById(t.getCurriculumId()).getSubject(),
                t.getDateCreated(), t.getTotalHoursCoverage(), t.getTotalItems(), v }, i);
        i++;
    }
    setPageLength(size());

    return this;
}

From source file:com.expressui.core.MainApplication.java

License:Open Source License

@Override
public void init() {
    currentInstance.set(this);

    setTheme(getCustomTheme());//from   w w  w  .  ja va 2 s .  co  m
    customizeConfirmDialogStyle();

    Window mainWindow = new Window();
    setMainWindow(mainWindow);
    mainWindow.addStyleName("e-main-window");
    mainWindow.setCaption(getTypeCaption());

    VerticalLayout mainLayout = new VerticalLayout();
    String id = StringUtil.generateDebugId("e", this, mainLayout, "mainLayout");
    mainLayout.setDebugId(id);

    mainWindow.setSizeFull();
    mainLayout.setSizeFull();
    mainWindow.setContent(mainLayout);

    setLogoutURL(getApplicationProperties().getRestartApplicationUrl());

    configureLeftMenuBar(mainMenuBar.getLeftMenuBarRoot());
    configureRightMenuBar(mainMenuBar.getRightMenuBarRoot());
    mainLayout.addComponent(mainMenuBar);

    pageLayoutTabSheet = new TabSheet();
    id = StringUtil.generateDebugId("e", this, pageLayoutTabSheet, "pageLayoutTabSheet");
    pageLayoutTabSheet.setDebugId(id);

    pageLayoutTabSheet.addStyleName("e-main-page-layout");
    pageLayoutTabSheet.setSizeFull();
    mainLayout.addComponent(pageLayoutTabSheet);
    mainLayout.setExpandRatio(pageLayoutTabSheet, 1.0f);

    Link expressUILink = new Link(uiMessageSource.getMessage("mainApplication.footerMessage"),
            new ExternalResource(uiMessageSource.getMessage("mainApplication.footerLink")));
    expressUILink.setTargetName("_blank");
    expressUILink.setIcon(new ThemeResource("../expressui/favicon.png"));
    expressUILink.setSizeUndefined();
    mainLayout.addComponent(expressUILink);
    mainLayout.setComponentAlignment(expressUILink, Alignment.TOP_CENTER);

    configureSessionTimeout(mainWindow);
    postWire();
    onDisplay();
}

From source file:com.foc.helpBook.HelpUI.java

License:Apache License

@Override
public FocCentralPanel newWindow() {
    FocCentralPanel focCentralPanel = new FocCentralPanel();
    focCentralPanel.fill();//from ww w .  j  av  a2s.c o m

    Label labelHelpContent = new Label();
    labelHelpContent.setContentMode(ContentMode.HTML);

    String htmlContent = (String) FocWebApplication.getFocWebSession_Static().getParameter("HELP_CONTENT");
    labelHelpContent.setValue(htmlContent);
    VerticalLayout mainLayout = new VerticalLayout();

    mainLayout.setSizeFull();

    HorizontalLayout navigationLayout = new HorizontalLayout();
    navigationLayout.setWidth("95%");

    navigationLayout.addComponent(getPreviousPageButton());
    navigationLayout.setComponentAlignment(getPreviousPageButton(), Alignment.BOTTOM_LEFT);

    navigationLayout.addComponent(getNextPageButton());
    navigationLayout.setComponentAlignment(getNextPageButton(), Alignment.BOTTOM_RIGHT);

    mainLayout.addComponent(labelHelpContent);

    mainLayout.addComponent(navigationLayout);
    mainLayout.setComponentAlignment(navigationLayout, Alignment.BOTTOM_CENTER);

    focCentralPanel.addComponent(mainLayout);
    return focCentralPanel;
}

From source file:com.foc.vaadin.gui.components.objectSelectorPopupView.FVObjectSelectorWindow.java

License:Apache License

private void init() {
    setModal(true);/* w  w  w .  j a  va2  s. c  o  m*/
    setResizable(false);
    setWidth("400px");
    setHeight("200px");

    VerticalLayout verticalLayout = new VerticalLayout();
    verticalLayout.setSizeFull();
    verticalLayout.addComponent(getMainHorizontalLayout());
    verticalLayout.setComponentAlignment(getMainHorizontalLayout(), Alignment.MIDDLE_CENTER);
    setContent(verticalLayout);
}