Example usage for com.vaadin.ui VerticalLayout VerticalLayout

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

Introduction

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

Prototype

public VerticalLayout() 

Source Link

Document

Constructs an empty VerticalLayout.

Usage

From source file:com.esspl.datagen.ui.TableSelectorView.java

License:Open Source License

public TableSelectorView(DatabaseSessionManager sessionManager, DataGenApplication dataApp) {
    dataGenApplication = dataApp;/*from ww w.j  a  va  2s .  c  o  m*/
    try {
        connection = sessionManager.getConnection();
        if (connection != null) {
            metadataRetriever = new MetadataRetriever(connection);
        }

        setSizeFull();
        Component selectors = createSelectors();

        VerticalLayout vl = new VerticalLayout();
        vl.setSizeFull();

        tableListContainer = createObjecListContainer();
        Table objectList = new Table(null, tableListContainer);
        objectList.setSizeFull();
        objectList.setColumnHeaderMode(Table.COLUMN_HEADER_MODE_HIDDEN);
        objectList.setSelectable(true);
        objectList.addListener(new ItemClickListener() {

            @Override
            public void itemClick(ItemClickEvent event) {
                if (null == detailsListener)
                    return;

                JdbcTable item = (JdbcTable) event.getItemId();
                if (null == item)
                    return;
                detailsListener.showDetails(createDetails(item));
            }
        });

        vl.addComponent(selectors);
        vl.addComponent(objectList);
        vl.setExpandRatio(objectList, 1f);
        addComponent(vl);
    } catch (SQLException ex) {
        log.error("failed to create table selector view", ex);
        JdbcUtils.close(connection);
    }
}

From source file:com.etest.pdfgenerator.TQViewer.java

public TQViewer(int tqCoverageId) {
    this.tqCoverageId = tqCoverageId;

    //        setSizeFull();
    setWidth("900px");
    setHeight("600px");
    center();//from   w  ww  . j av a  2s . c o  m

    StreamResource resource = new StreamResource(new TQCoveragePDF(getTQCoverageId()), "TQ.pdf");
    resource.setMIMEType("application/pdf");

    VerticalLayout v = new VerticalLayout();
    v.setSizeFull();
    Embedded e = new Embedded();
    e.setSource(resource);
    e.setSizeFull();
    e.setType(Embedded.TYPE_BROWSER);
    v.addComponent(e);

    setContent(v);
}

From source file:com.etest.pdfviewer.ItemAnalysisOfSubjectReportViewer.java

public ItemAnalysisOfSubjectReportViewer(int tqCoverageId) {
    this.tqCoverageId = tqCoverageId;

    setWidth("900px");
    setHeight("600px");
    center();//from  w  w  w.  j a v  a  2  s  . c  o  m

    StreamResource resource = new StreamResource(new ItemAnalysisOfSubjectReportPDF(getTQCoverageId()),
            "ItemAnalysis.pdf");
    resource.setMIMEType("application/pdf");

    VerticalLayout v = new VerticalLayout();
    v.setSizeFull();
    Embedded e = new Embedded();
    e.setSource(resource);
    e.setSizeFull();
    e.setType(Embedded.TYPE_BROWSER);
    v.addComponent(e);

    setContent(v);
}

From source file:com.etest.pdfviewer.ItemAnalysisReportViewer.java

public ItemAnalysisReportViewer(int tqCoverageId) {
    this.tqCoverageId = tqCoverageId;

    setWidth("900px");
    setHeight("600px");
    center();// w  ww .  j a va  2  s .  c  o m

    StreamResource resource = new StreamResource(new ItemAnalysisReportPDF(getTqCoverageId()),
            "ItemAnalysis.pdf");
    resource.setMIMEType("application/pdf");

    VerticalLayout v = new VerticalLayout();
    v.setSizeFull();
    Embedded e = new Embedded();
    e.setSource(resource);
    e.setSizeFull();
    e.setType(Embedded.TYPE_BROWSER);
    v.addComponent(e);

    setContent(v);
}

From source file:com.etest.pdfviewer.MultipleChoiceHelpViewer.java

public MultipleChoiceHelpViewer() {
    setWidth("900px");
    setHeight("600px");
    center();//from   w w  w  .j a v a2s .  c o m

    StreamResource.StreamSource source = new StreamResource.StreamSource() {
        @Override
        public InputStream getStream() {
            try {
                return this.getClass().getResourceAsStream("/files/TestConstRules.pdf");
            } catch (Exception e) {
                e.getMessage();
                return null;
            }
        }
    };

    StreamResource resource = new StreamResource(source, "TestConstRules.pdf");
    resource.setMIMEType("application/pdf");

    VerticalLayout v = new VerticalLayout();
    v.setSizeFull();
    Embedded e = new Embedded();
    e.setSource(resource);
    e.setSizeFull();
    e.setType(Embedded.TYPE_BROWSER);
    v.addComponent(e);

    setContent(v);
}

From source file:com.etest.pdfviewer.SummaryReportViewer.java

public SummaryReportViewer(String summaryType) {
    setCaption(summaryType);//w  ww .j  a v  a  2s .  co m
    setWidth("900px");
    setHeight("600px");
    center();

    StreamResource resource; //= new StreamResource(new InventoryCasesReportPDF(), "InventoryOfCases.pdf");   
    if (summaryType.equals("Summary: Case vs Items")) {
        resource = new StreamResource(new InventoryCasesReportPDF(), "InventoryOfCases.pdf");
    } else {
        resource = new StreamResource(new InventoryItemsReportPDF(), "InventoryOfItems.pdf");
    }
    resource.setMIMEType("application/pdf");

    VerticalLayout v = new VerticalLayout();
    v.setSizeFull();
    Embedded e = new Embedded();
    e.setSource(resource);
    e.setSizeFull();
    e.setType(Embedded.TYPE_BROWSER);
    v.addComponent(e);

    setContent(v);
}

From source file:com.etest.pdfviewer.TQCriticalIndexReportViewer.java

public TQCriticalIndexReportViewer(int tqCoverageId) {
    this.tqCoverageId = tqCoverageId;
    setWidth("900px");
    setHeight("600px");
    center();//from  ww w. ja  va2 s. c o  m

    StreamResource resource = new StreamResource(new TQCriticalIndexValuesReportPDF(getTQCoverageId()),
            "TQCriticalIndexValues.pdf");
    resource.setMIMEType("application/pdf");

    VerticalLayout v = new VerticalLayout();
    v.setSizeFull();
    Embedded e = new Embedded();
    e.setSource(resource);
    e.setSizeFull();
    e.setType(Embedded.TYPE_BROWSER);
    v.addComponent(e);

    setContent(v);
}

From source file:com.etest.valo.CommonParts.java

License:Apache License

Panel loadingIndicators() {
    Panel p = new Panel("Loading Indicator");
    final VerticalLayout content = new VerticalLayout();
    p.setContent(content);//from   w  ww. j ava  2s  .  c  o m
    content.setSpacing(true);
    content.setMargin(true);
    content.addComponent(new Label("You can test the loading indicator by pressing the buttons."));

    CssLayout group = new CssLayout();
    group.setCaption("Show the loading indicator for");
    group.addStyleName("v-component-group");
    content.addComponent(group);
    Button loading = new Button("0.8");
    loading.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            try {
                Thread.sleep(800);
            } catch (InterruptedException e) {
            }
        }
    });
    group.addComponent(loading);

    Button delay = new Button("3");
    delay.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            try {
                Thread.sleep(3000);
            } catch (InterruptedException e) {
            }
        }
    });
    group.addComponent(delay);

    Button wait = new Button("15");
    wait.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            try {
                Thread.sleep(15000);
            } catch (InterruptedException e) {
            }
        }
    });
    wait.addStyleName("last");
    group.addComponent(wait);
    Label label = new Label("   seconds", ContentMode.HTML);
    label.setSizeUndefined();
    group.addComponent(label);

    Label spinnerDesc = new Label(
            "The theme also provides a mixin that you can use to include a spinner anywhere in your application. The button below reveals a Label with a custom style name, for which the spinner mixin is added.");
    spinnerDesc.addStyleName("small");
    spinnerDesc.setCaption("Spinner");
    content.addComponent(spinnerDesc);

    if (!MainUI.isTestMode()) {
        final Label spinner = new Label();
        spinner.addStyleName("spinner");

        Button showSpinnerButton = new Button("Show spinner", new ClickListener() {
            @Override
            public void buttonClick(final ClickEvent event) {
                content.replaceComponent(event.getComponent(), spinner);
            }
        });
        content.addComponent(showSpinnerButton);
    }

    return p;
}

From source file:com.etest.view.notification.NotificationMainUI.java

Table populateNoficationTable() {
    notificationTable.removeAllItems();//from  w  w w. j  av  a 2  s  .com
    int i = 0;
    for (EtestNotification en : ns.getAllNotificationByUser(
            CommonUtilities.convertStringToInt(VaadinSession.getCurrent().getAttribute("userId").toString()))) {
        VerticalLayout v = new VerticalLayout();
        v.setWidth("100%");

        Button read = new Button();
        read.setWidthUndefined();
        read.setCaption((en.getStatus() == 0) ? "unread" : "read");
        read.setData(en.getNotificationId());
        read.setIcon(FontAwesome.VIDEO_CAMERA);
        read.addStyleName(ValoTheme.BUTTON_LINK);
        read.addStyleName(ValoTheme.BUTTON_TINY);
        read.addStyleName(ValoTheme.BUTTON_QUIET);
        read.addStyleName("button-container");
        read.addClickListener(buttonClickListener);
        v.addComponent(read);
        v.setComponentAlignment(read, Alignment.MIDDLE_LEFT);

        message.setContentMode(ContentMode.HTML);

        String[] split = en.getNotice().split(" ");
        int cellCaseId;
        if (split[0].equals("CellCaseID")) {
            message.setCaption(en.getRemarks() + en.getNotice());
            cellCaseId = CommonUtilities.convertStringToInt(split[1].replace("#", ""));
        } else {
            cellCaseId = cis.getCellItemById(CommonUtilities.convertStringToInt(split[1].replace("#", "")))
                    .getCellCaseId();
            message.setCaption(en.getRemarks() + en.getNotice() + " from CellCaseID #" + cellCaseId);
        }

        Button approve = new Button("status");
        approve.setSizeFull();
        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);

        if (ccs.getCellCaseById(cellCaseId).getApprovalStatus() == 0) {
            approve.setIcon(FontAwesome.THUMBS_DOWN);
        } else {
            approve.setIcon(FontAwesome.THUMBS_UP);
        }

        notificationTable.addItem(new Object[] { message.getCaption().toString(),
                ss.getUsernameById(en.getSenderId()), en.getNoteDate(), v }, i);
        i++;
    }
    notificationTable.setPageLength(0);
    notificationTable.setHeight("100%");

    return notificationTable;
}

From source file:com.etest.view.notification.ViewCaseNotificationWindow.java

VerticalLayout buildForms() {
    VerticalLayout v = new VerticalLayout();
    v.setWidth("700px");
    v.setMargin(true);/*from w  w w .j  a v  a2  s . co  m*/
    v.setSpacing(true);

    Label cellCase = new Label();
    cellCase.setValue("<b>Case</b>: " + ccs.getCellCaseById(getCellCaseId()).getCaseTopic());
    cellCase.setContentMode(ContentMode.HTML);
    v.addComponent(cellCase);

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

    Button approvalBtn = new Button();
    approvalBtn.setCaption("Approve CASE");
    approvalBtn.setWidthUndefined();
    approvalBtn.addStyleName(ValoTheme.BUTTON_TINY);
    approvalBtn.addStyleName(ValoTheme.BUTTON_PRIMARY);
    approvalBtn.addClickListener(buttonClickListener);
    if (ccs.getCellCaseById(getCellCaseId()).getApprovalStatus() == 0) {
        approvalBtn.setVisible(true);
    } else {
        approvalBtn.setVisible(false);
    }
    v.addComponent(approvalBtn);

    HorizontalLayout h1 = new HorizontalLayout();
    h1.setWidth("100%");

    approvalItemBtn.setVisible(false);
    approvalItemBtn.setWidthUndefined();
    approvalItemBtn.addStyleName(ValoTheme.BUTTON_TINY);
    approvalItemBtn.addStyleName(ValoTheme.BUTTON_PRIMARY);

    if (getCellItemId() != 0) {
        approvalBtn.setCaption("Approve ITEM");
        CellItem ci = cis.getCellItemById(getCellItemId());
        keyList = k.getAllItemKey(getCellItemId());
        keyIndexSize = keyList.size();

        if (keyList.isEmpty()) {
            ShowErrorNotification.error("No Item Key was found for STEM: \n" + ci.getItem());
            return null;
        }

        stem = ci.getItem().replace("{key}", "<u>" + keyList.get(getKeyIndex()) + "</u>");
        cellItem.setValue("<b>STEM</b>: " + getStem());
        OptionGroup options = new OptionGroup();
        options.addItems(cis.getCellItemById(getCellItemId()).getOptionA(),
                cis.getCellItemById(getCellItemId()).getOptionB(),
                cis.getCellItemById(getCellItemId()).getOptionC(),
                cis.getCellItemById(getCellItemId()).getOptionD());
        h1.addComponent(options);
        h1.setComponentAlignment(options, Alignment.MIDDLE_CENTER);

        if (cis.getCellItemById(getCellItemId()).getCellItemStatus() == 0) {
            approvalItemBtn.setVisible(true);
        } else {
            approvalItemBtn.setVisible(false);
        }
        approvalItemBtn.addClickListener(buttonClickListener);
        approvalItemBtn.setVisible(true);
    }
    v.addComponent(approvalBtn);
    v.addComponent(cellItem);
    v.addComponent(h1);
    v.addComponent(approvalItemBtn);

    Label separator = new Label("<HR>");
    separator.setContentMode(ContentMode.HTML);
    v.addComponent(separator);

    return v;
}