Example usage for com.vaadin.ui VerticalLayout setWidthUndefined

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

Introduction

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

Prototype

@Override
    public void setWidthUndefined() 

Source Link

Usage

From source file:ch.bfh.ti.soed.hs16.srs.white.view.LogInView.java

License:Open Source License

@Override
public Component load() {
    final VerticalLayout formContainer = new VerticalLayout();
    formContainer.setStyleName("login-form");
    formContainer.setWidthUndefined();

    fieldMail.setCaption("Type your mail here:");
    fieldMail.setStyleName("textfield-form");
    fieldMail.setTabIndex(1);//  w  w w . ja  v  a2s.  c o  m
    fieldMail.focus();

    fieldPassword.setCaption("Type your password here:");
    fieldPassword.setTabIndex(2);
    fieldPassword.setStyleName("textfield-form");

    btnLogin.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    btnLogin.setTabIndex(3);
    btnLogin.addClickListener(e -> {
        switch (logInController.login()) {
        case ADMIN:
            AbstractView adminView = new AdminView();
            ApplicationController appController = ApplicationController.getInstance();
            appController.loadView(adminView);
            break;
        case USER:
            // Load the user view here
        default:
            break;
        }
    });

    btnLogin.setStyleName("button-center");
    btnLogin.setTabIndex(4);
    btnLogin.setWidth("91px");

    btnRegister.addClickListener(e -> {
        RegistrationView rView = new RegistrationView(this);
        ApplicationController applicationController = ApplicationController.getInstance();
        applicationController.loadView(rView);
    });
    btnRegister.setStyleName("button-center");
    btnRegister.setWidth("91px");

    labelMessage.setStyleName("horizontal-center");
    labelMessage.setSizeUndefined();

    final HorizontalLayout layoutButtons = new HorizontalLayout();

    layoutButtons.addComponents(btnLogin, btnRegister);
    layoutButtons.setStyleName("horizontal-center");
    layoutButtons.setMargin(true);
    layoutButtons.setSpacing(true);

    formContainer.addComponents(fieldMail, fieldPassword, layoutButtons, labelMessage);
    formContainer.setMargin(true);
    formContainer.setSpacing(true);

    Responsive.makeResponsive(formContainer);

    return formContainer;
}

From source file:com.antonjohansson.lprs.view.ErrorView.java

License:Apache License

private VerticalLayout layout() {
    VerticalLayout layout = new VerticalLayout();
    layout.setCaption("Errors found when starting the application");
    layout.setSpacing(true);// w  ww.j a  v a 2 s  .co  m
    layout.setWidthUndefined();
    return layout;
}

From source file:com.antonjohansson.lprs.view.ServiceView.java

License:Apache License

private Layout requestTokenLayout() {
    username.setInputPrompt("Username");
    username.setWidth(STANDARD_WIDTH, EM);
    captcha.setSize(NORMAL);//from w  w  w  .  j  av a  2  s.c o  m
    captcha.setTheme(LIGHT);
    captcha.setType(IMAGE);
    requestToken.setCaption("Request token");
    requestToken.setWidth(STANDARD_WIDTH, EM);
    requestToken.setEnabled(false);

    VerticalLayout layout = new VerticalLayout();
    layout.addComponents(username, captcha, requestToken);
    layout.setMargin(true);
    layout.setSpacing(true);
    layout.setVisible(false);
    layout.setWidthUndefined();

    return layout;
}

From source file:com.antonjohansson.lprs.view.ServiceView.java

License:Apache License

private Layout useTokenLayout() {
    token.setInputPrompt("Token");
    token.setWidth(STANDARD_WIDTH, EM);//from w w  w .  j  av  a2  s  .c o  m
    useToken.setCaption("Next");
    backFromUseToken.setCaption("Back");

    HorizontalLayout buttons = new HorizontalLayout(useToken, backFromUseToken);
    buttons.setSpacing(true);

    VerticalLayout layout = new VerticalLayout();
    layout.addComponents(greeting, token, buttons);
    layout.setMargin(true);
    layout.setSpacing(true);
    layout.setVisible(false);
    layout.setWidthUndefined();

    return layout;
}

From source file:com.antonjohansson.lprs.view.ServiceView.java

License:Apache License

private Layout setPasswordLayout() {
    newPassword.setWidth(STANDARD_WIDTH, EM);
    newPassword.setCaption("Password");
    newPasswordRepeat.setWidth(STANDARD_WIDTH, EM);
    newPasswordRepeat.setCaption("Repeat password");
    setPassword.setCaption("Set password");
    backFromSetPassword.setCaption("Back");

    HorizontalLayout buttons = new HorizontalLayout(setPassword, backFromSetPassword);
    buttons.setSpacing(true);/*from  w  w w  .j a  va2  s. c  om*/

    VerticalLayout layout = new VerticalLayout();
    layout.addComponents(newPassword, newPasswordRepeat, buttons);
    layout.setMargin(true);
    layout.setSpacing(true);
    layout.setVisible(false);
    layout.setWidthUndefined();

    return layout;
}

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

public GraphicalInventoryBarChart() {
    setModal(true);//www. ja  va  2 s.c  o m

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

    //        Panel panel = new Panel();
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    for (Curriculum c : cs.getAllCurriculum()) {
        for (int i = 0; i < 2; i++) {
            if (i == 0) {
                dataset.addValue(rs.getTotalCasesBySubject(c.getCurriculumId()), "Cases", c.getSubject());
            } else {
                dataset.addValue(rs.getTotalItemsBySubject(c.getCurriculumId()), "Items", c.getSubject());
            }
        }
    }

    JFreeChart chart = ChartFactory.createBarChart("Inventory of Items and Cases", "Subjects", "", dataset,
            PlotOrientation.VERTICAL, true, true, false);

    CategoryPlot plot = chart.getCategoryPlot();
    BarRenderer renderer = (BarRenderer) plot.getRenderer();

    Color color;

    for (int i = 0; i < dataset.getRowCount(); i++) {
        if (i % 2 == 0) {
            renderer.setSeriesPaint(i, new Color(0, 0, 255));
        } else {
            renderer.setSeriesPaint(i, new Color(255, 0, 0));
        }
    }

    //        JFreeChartWrapper wrapper = new JFreeChartWrapper(chart){
    //            
    //            @Override
    //            public void attach(){
    //                super.attach();
    //                setResource("src", getSource());
    //            }
    //            
    //        };

    v.addComponent(new ReportChartWrapper(chart, null, null));
    v.setWidthUndefined();
    v.setHeightUndefined();

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

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

public GraphicalInventoryPieChart(int curriculumId) {
    this.curriculumId = curriculumId;
    setModal(true);//from w  w  w.ja v a  2s  .c o m

    int percentage = 0;
    VerticalLayout v = new VerticalLayout();
    DefaultPieDataset dataset = new DefaultPieDataset();

    for (BloomsClass b : BloomsClass.values()) {
        percentage = (int) calculatePercentageOfItemsPerBloomsClass(
                rs.getTotalItemsBySubject(getCurriculumId()),
                rs.getTotalItemsByBloomsCass(getCurriculumId(), tq.getBloomsClassId(b.toString())));

        dataset.setValue(b + " " + percentage + "%", percentage);
    }

    JFreeChart chart = ChartFactory.createPieChart(
            "Inventory of Items for " + cs.getCurriculumById(getCurriculumId()).getSubject(), dataset, true,
            true, false);

    //        JFreeChartWrapper wrapper = new JFreeChartWrapper(chart){
    //            
    //            @Override
    //            public void attach(){
    //                super.attach();
    //                setResource("src", getSource());
    //            }
    //            
    //        };

    v.addComponent(new ReportChartWrapper(chart, null, null));
    v.setWidthUndefined();
    v.setHeightUndefined();

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

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

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

    setModal(true);// w w  w  .j av  a  2  s  .c om
    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.charts.SubjectLineChartWindow.java

public SubjectLineChartWindow(int tqCoverageId, String lineChartType) {
    this.tqCoverageId = tqCoverageId;
    setModal(true);//from  w  w  w  . j  av a2s .  c o  m
    //        setHeight("100%");

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

    if (lineChartType.equals("discrimination")) {
        v.addComponent(new ReportChartWrapper(SubjectTestLineChart.discriminationIndex(getTqCoverageId()), null,
                null));
    } else {
        v.addComponent(
                new ReportChartWrapper(SubjectTestLineChart.difficultIndex(getTqCoverageId()), null, null));
    }
    v.setWidthUndefined();

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

From source file:com.haulmont.cuba.web.AppUI.java

License:Apache License

protected void showCriticalExceptionMessage(Exception exception) {
    String initErrorCaption = messages.getMainMessage("app.initErrorCaption");
    String initErrorMessage = messages.getMainMessage("app.initErrorMessage");

    VerticalLayout content = new VerticalLayout();
    content.setStyleName("c-init-error-view");
    content.setSizeFull();//w  ww  . j  ava 2 s .com

    VerticalLayout errorPanel = new VerticalLayout();
    errorPanel.setStyleName("c-init-error-panel");
    errorPanel.setWidthUndefined();
    errorPanel.setSpacing(true);

    Label captionLabel = new Label(initErrorCaption);
    captionLabel.setWidthUndefined();
    captionLabel.setStyleName("c-init-error-caption");
    captionLabel.addStyleName("h2");
    captionLabel.setValue(initErrorCaption);

    errorPanel.addComponent(captionLabel);

    Label messageLabel = new Label(initErrorCaption);
    messageLabel.setWidthUndefined();
    messageLabel.setStyleName("c-init-error-message");
    messageLabel.setValue(initErrorMessage);

    errorPanel.addComponent(messageLabel);

    Button retryButton = new Button(messages.getMainMessage("app.initRetry"));
    retryButton.setStyleName("c-init-error-retry");
    retryButton.addClickListener(event -> {
        // always restart UI
        String url = ControllerUtils.getLocationWithoutParams() + "?restartApp";
        getPage().open(url, "_self");
    });

    errorPanel.addComponent(retryButton);
    errorPanel.setComponentAlignment(retryButton, Alignment.MIDDLE_CENTER);

    content.addComponent(errorPanel);
    content.setComponentAlignment(errorPanel, Alignment.MIDDLE_CENTER);

    setContent(content);
}