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:annis.visualizers.component.RawTextVisualizer.java

License:Apache License

@Override
public Panel createComponent(VisualizerInput visInput, VisualizationToggle visToggle) {

    // get config for alignment
    boolean vertical = Boolean.parseBoolean(visInput.getMappings().getProperty("vertical", "true"));

    // get the texts
    RawTextWrapper texts = visInput.getRawText();

    // create the main panel
    Panel p = new Panel();
    p.setSizeFull();/*from w w  w  .  java2  s  .co  m*/

    // some layout configuration
    p.addStyleName(ChameleonTheme.PANEL_BORDERLESS);
    p.addStyleName(PANEL_CLASS);

    // enable webfonts
    p.addStyleName(Helper.CORPUS_FONT_FORCE);

    Layout l;

    // if no text available inform user and exit
    if (texts == null) {
        Label text = new Label(NO_TEXT);
        text.addStyleName(LABEL_CLASS);
        text.setSizeFull();
        p.setContent(text);
        return p;
    }

    if (texts.hasMultipleTexts()) {

        // set the aligmnent
        if (vertical) {
            l = new VerticalLayout();
        } else {
            l = new GridLayout(texts.getTexts().size(), 1);
        }

        // limit the size to the parent panel.
        l.setSizeFull();

        // add the texts to the layout
        for (int i = 0; i < texts.getTexts().size(); i++) {

            String s = texts.getTexts().get(i);
            Label lblText;

            // check if the text is empty
            if (s == null || hasOnlyWhiteSpace(s)) {
                lblText = new Label(NO_TEXT);
            } else {
                lblText = new Label(s, ContentMode.TEXT);
            }

            lblText.setCaption("text " + (i + 1));
            lblText.addStyleName(LABEL_CLASS);
            lblText.setWidth(98, Sizeable.Unit.PERCENTAGE);

            l.addComponent(lblText);
        }

        // apply the panel
        p.setContent(l);
        return p;
    }

    Label lblText;
    if (texts.hasTexts() && !hasOnlyWhiteSpace(texts.getFirstText())) {
        lblText = new Label(texts.getFirstText(), ContentMode.TEXT);
    } else {
        lblText = new Label(NO_TEXT);
    }

    lblText.setSizeFull();
    lblText.addStyleName(LABEL_CLASS);
    p.setContent(lblText);

    return p;
}

From source file:ar.com.zir.cipres.ui.login.LoginForm.java

@AutoGenerated
private VerticalLayout buildMainLayout() {
    // common part: create layout
    mainLayout = new VerticalLayout();
    mainLayout.setImmediate(false);//from   w  w  w  . ja  va  2 s .c  o m
    mainLayout.setWidth("100%");
    mainLayout.setHeight("100%");
    mainLayout.setMargin(false);

    // top-level component properties
    setWidth("100.0%");
    setHeight("100.0%");

    // panel_2
    panel_2 = buildPanel_2();
    mainLayout.addComponent(panel_2);
    mainLayout.setComponentAlignment(panel_2, new Alignment(48));

    return mainLayout;
}

From source file:at.jku.ce.adaptivetesting.vaadin.ui.MockQuestion.java

License:LGPL

public MockQuestion(Question question) {
    this.question = question;

    TextArea textArea = new TextArea("Question text");
    textArea.setSizeFull();/*from   ww  w . ja  va  2 s  . c  om*/

    // Download the result
    Button button = new Button("Display current user's solution");

    button.setSizeFull();
    button.addClickListener(e -> {
        Window window = new Window("Current user solution");
        VerticalLayout layout = new VerticalLayout();
        layout.setMargin(true);
        window.setContent(layout);
        // Update questionText
        textArea.addTextChangeListener(ev -> questionText = ev.getText());
        textArea.setTextChangeEventMode(TextChangeEventMode.EAGER);
        Label label;
        try {
            label = new Label(toXML());
        } catch (Exception e1) {
            label = new Label(
                    "<h1>Error parsing XML</h1><p>" + e1.getMessage() + Arrays.toString(e1.getStackTrace()),
                    ContentMode.HTML);
            LogHelper.logThrowable(e1);
        }
        layout.addComponent(label);
        window.center();
        getUI().addWindow(window);
    });
    // Add components to the UI
    addComponent(textArea);
    addComponent(question);
    addComponent(button);
}

From source file:at.jku.ce.adaptivetesting.vaadin.ui.topic.accounting.AccountingQuestionManager.java

License:LGPL

@Override
public void startQuiz(StudentData student) {
    // Remove everything from the layout, save it for displaying after
    // clicking OK
    final Component[] components = new Component[getComponentCount()];
    for (int i = 0; i < components.length; i++) {
        components[i] = getComponent(i);
    }//from   w  ww  . j  a v a2 s . c  o  m
    removeAllComponents();
    // Create first page
    VerticalLayout layout = new VerticalLayout();
    addComponent(layout);

    ComboBox gender = new ComboBox("Geschlecht");
    String[] genderItems = { "mnnlich", "weiblich" };
    gender.addItems(genderItems);
    //gender.setSizeFull();
    gender.setEnabled(true);

    Label gradeLastYear = new Label("<p/>Welche Note hattest du im letzten Zeugnis in ...", ContentMode.HTML);
    TextField gradeLastYearRW = new TextField("Rechungswesen");
    TextField gradeLastYearBWL = new TextField("BWL/BVW");
    TextField gradeLastYearD = new TextField("Deutsch");
    TextField gradeLastYearE = new TextField("Englisch");
    TextField gradeLastYearM = new TextField("Mathematik");

    Label gradeLastTest = new Label("<p/>Welche Note hattest du auf die letzte Schularbeit aus ...",
            ContentMode.HTML);
    TextField gradeLastTestRW = new TextField("Rechungswesen");
    TextField gradeLastTestBWL = new TextField("BWL/BVW");
    TextField gradeLastTestD = new TextField("Deutsch");
    TextField gradeLastTestE = new TextField("Englisch");
    TextField gradeLastTestM = new TextField("Mathematik");

    Label classNameLabel = new Label("<p/>Welche Klasse besuchst du?", ContentMode.HTML);
    TextField className = new TextField("(z.B. 4A)");

    Label studentCode = new Label(
            "<p/>Damit deine Antworten mit spteren Fragebogenergebnissen verknpft werden knnen, ist es notwendig, einen anonymen Benutzernamen anzulegen. Erstelle deinen persnlichen Code nach folgendem Muster:",
            ContentMode.HTML);
    TextField studentCodeC1 = new TextField(
            "Tag und Monat der Geburt (DDMM), z.B. \"1008\" fr Geburtstag am 10. August");
    TextField studentCodeC2 = new TextField(
            "Zwei Anfangsbuchstaben des Vornamens, z.B. \"St\" fr \"Stefan\"");
    TextField studentCodeC3 = new TextField(
            "Zwei Anfangsbuchstaben des Vornamens der Mutter,, z.B. \"Jo\" fr \"Johanna\"");

    Label thankYou = new Label("<p/>Danke fr die Angaben.<p/>", ContentMode.HTML);
    Button cont = new Button("Weiter", e -> {
        removeAllComponents();
        studentIDCode = new String(
                studentCodeC1.getValue() + studentCodeC2.getValue() + studentCodeC3.getValue());
        studentGender = (gender.getValue() == null) ? new String("undefined") : gender.getValue().toString();
        studentClass = className.getValue();

        studentGradesLastYear = new HashMap();
        studentGradesLastYear.put("RW", gradeLastYearRW.getValue());
        studentGradesLastYear.put("BWL", gradeLastYearBWL.getValue());
        studentGradesLastYear.put("D", gradeLastYearD.getValue());
        studentGradesLastYear.put("E", gradeLastYearE.getValue());
        studentGradesLastYear.put("M", gradeLastYearM.getValue());

        studentGradesLastTest = new HashMap();
        studentGradesLastTest.put("RW", gradeLastTestRW.getValue());
        studentGradesLastTest.put("BWL", gradeLastTestBWL.getValue());
        studentGradesLastTest.put("D", gradeLastTestD.getValue());
        studentGradesLastTest.put("E", gradeLastTestE.getValue());
        studentGradesLastTest.put("M", gradeLastTestM.getValue());

        this.student = new StudentData(studentIDCode, studentGender, studentClass, studentGradesLastYear,
                studentGradesLastTest);
        LogHelper.logInfo("StudentData: " + this.student.toString());

        displayCompanyInfo(components);
    });

    layout.addComponent(HtmlLabel.getCenteredLabel("h1", "Fragen zu deiner Person"));// Title of the quiz

    layout.addComponent(gender);

    layout.addComponent(gradeLastYear);
    layout.addComponent(gradeLastYearRW);
    layout.addComponent(gradeLastYearBWL);
    layout.addComponent(gradeLastYearD);
    layout.addComponent(gradeLastYearE);
    layout.addComponent(gradeLastYearM);

    layout.addComponent(gradeLastTest);
    layout.addComponent(gradeLastTestRW);
    layout.addComponent(gradeLastTestBWL);
    layout.addComponent(gradeLastTestD);
    layout.addComponent(gradeLastTestE);
    layout.addComponent(gradeLastTestM);

    layout.addComponent(classNameLabel);
    layout.addComponent(className);

    layout.addComponent(studentCode);
    layout.addComponent(studentCodeC1);
    layout.addComponent(studentCodeC2);
    layout.addComponent(studentCodeC3);

    layout.addComponent(thankYou);
    layout.addComponent(cont);
    layout.setComponentAlignment(components[0], Alignment.MIDDLE_CENTER);
}

From source file:at.jku.ce.adaptivetesting.vaadin.ui.topic.accounting.AccountingQuestionManager.java

License:LGPL

public void displayCompanyInfo(Component[] components) {
    // Create second page
    VerticalLayout layout = new VerticalLayout();

    addComponent(layout);//from   w ww .j  ava 2  s .c o m
    Label label = new Label(
            "Stelle dir vor, du hast dich mit dem Handel von Tablet-PCs aller Art selbstndig gemacht und dazu das Einzelunternehmen World of Tabs e. U. vor zwei Jahren gegrndet. Da du dich in Rechnungswesen schon gut auskennst, beschliet du selbst die Buchhaltung zu fhren.<p/>",
            ContentMode.HTML);
    Label companyData = new Label(
            "<table><tr><td>Firmenname:</td><td>World of Tabs</td></tr><tr><td>Adresse:</td><td>Unterfeld 15</td></tr><tr><td></td><td>4541 Adlwang</td></tr><tr><td>E-mail:</td><td>office@worldtabs.at</td></tr><tr><td>Internet:</td><td>www.worldtabs.at</td></tr><tr><td>UID-Nummer:</td><td>ATU32589716</td></tr></table><p/>",
            ContentMode.HTML);
    Label descr = new Label(
            "<i>World of Tabs dient im Folgenden als Modellunternehmen, <b>aus dessen Sicht</b> du die Aufgabenstellungen bearbeiten sollst. Wir bitten dich die Aufgaben <b>alleine, ohne Hilfe</b> von Mitschler/inne/n oder Lehrer/inne/n zu lsen. Du kannst den Kontenplan und einen Taschenrechner verwenden.</i><p/>",
            ContentMode.HTML);
    Label disclaimer = new Label(
            "<b>Wichtig ist, dass du im Folgenden bei der Angabe der Kontennummer und des Kontennamens die genaue Nummer bzw. Bezeichnung verwendest. Bspw. wird eine Aufgabe falsch gewertet, wenn du die Nummer 30 anstatt 33 fr das Lieferverbindlichkeiten whlst oder du den Kontennamen \"Lieferverbindlichkeiten\" anstatt \"AATech\" (bei personifiziertem Lieferantenkonto) fr den Lieferanten whlst.<b>",
            ContentMode.HTML);
    Button cont = new Button("Weiter", e -> {
        removeAllComponents();
        for (Component c : components) {
            addComponent(c);
        }
        super.startQuiz(student);
    });
    //      layout.addComponent(components[0]);// Title of the quiz
    layout.addComponent(HtmlLabel.getCenteredLabel("h1", "Unternehmensbeschreibung"));// Title of the quiz
    layout.addComponent(companyData);
    layout.addComponent(label);
    layout.addComponent(descr);
    layout.addComponent(disclaimer);
    layout.addComponent(cont);
    layout.setComponentAlignment(components[0], Alignment.MIDDLE_CENTER);

}

From source file:at.meikel.nentis.Nentis.java

License:Apache License

private void initInfo(TabSheet tabSheet) {
    VerticalLayout infoTab = new VerticalLayout();
    tabSheet.addTab(infoTab);//  www  .j av  a  2 s. co m
    tabSheet.getTab(infoTab).setCaption("Info");
    infoTab.addComponent(new Label("temp.dir:" + System.getProperty("temp.dir")));
}

From source file:at.meikel.nentis.Nentis.java

License:Apache License

private void initMain(TabSheet tabSheet) {
    final VerticalLayout mainTab = new VerticalLayout();
    tabSheet.addTab(mainTab);//from   ww w. j a  v a2 s.  co m
    tabSheet.getTab(mainTab).setCaption("Main");

    final HorizontalLayout buttons = new HorizontalLayout();
    mainTab.addComponent(buttons);

    final VerticalLayout state = new VerticalLayout();
    mainTab.addComponent(state);

    final VerticalLayout info = new VerticalLayout();
    mainTab.addComponent(info);

    Button createTicket = new Button("Create a new ticket");
    createTicket.addListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent clickEvent) {
            state.removeAllComponents();
            Ticket ticket = nentisApi.createTicket("Ticket (" + new Date() + ")");
            state.addComponent(
                    new Label("Ticket #" + ticket.getId() + " [" + ticket.getDescription() + "] created."));
        }
    });
    buttons.addComponent(createTicket);

    Button listAllTickets = new Button("List all existing tickets");
    listAllTickets.addListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent clickEvent) {
            state.removeAllComponents();
            List<Ticket> allTickets = nentisApi.getAllTickets();
            info.removeAllComponents();
            if (allTickets != null) {
                for (Ticket ticket : allTickets) {
                    info.addComponent(new Label(
                            "Ticket #" + ticket.getId() + " [" + ticket.getDescription() + "] created."));
                }
            }
        }
    });
    buttons.addComponent(listAllTickets);

    final Button openSubWindow = new Button("Open a sub window");
    openSubWindow.addListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent clickEvent) {
            buttons.removeComponent(openSubWindow);
            Window subWindow = new Window("Sub window");
            mainWindow.addWindow(subWindow);
        }
    });
    buttons.addComponent(openSubWindow);
}

From source file:at.peppol.webgui.app.components.InvoiceForm.java

License:Mozilla Public License

private void initElements() {

    final GridLayout grid = new GridLayout(4, 4);
    final VerticalLayout outerLayout = new VerticalLayout();

    final Panel outerPanel = new Panel("Invoice Header");

    outerPanel.addComponent(grid);//from w  w w .j  av  a 2  s  .  co  m
    outerPanel.setScrollable(true);
    outerLayout.addComponent(outerPanel);
    setLayout(outerLayout);

    final Panel invoiceDetailsPanel = new Panel("Invoice Details");
    invoiceDetailsPanel.setStyleName("light");
    invoiceDetailsPanel.setSizeFull();
    invoiceDetailsPanel.addComponent(createInvoiceTopForm());
    grid.addComponent(invoiceDetailsPanel, 0, 0, 3, 0);
    grid.setSizeUndefined();

    outerPanel.requestRepaintAll();
}

From source file:at.peppol.webgui.app.components.InvoiceLineAllowanceChargeForm.java

License:Mozilla Public License

private void initElements() {

    final GridLayout grid = new GridLayout(4, 4);
    final VerticalLayout outerLayout = new VerticalLayout();
    hiddenContent = new VerticalLayout();
    hiddenContent.setSpacing(true);/* ww w.  jav  a 2  s.  c o  m*/
    hiddenContent.setMargin(true);

    table = new InvoiceLineAllowanceChargeTable(lineAllowanceChargeList);
    table.setSelectable(true);
    table.setImmediate(true);
    table.setNullSelectionAllowed(false);
    table.setHeight(150, UNITS_PIXELS);
    table.setFooterVisible(false);
    table.addStyleName("striped strong");

    VerticalLayout tableContainer = new VerticalLayout();
    tableContainer.addComponent(table);
    tableContainer.setMargin(false, true, false, false);

    Button addButton = new Button("Add new");
    Button editButton = new Button("Edit selected");
    Button deleteButton = new Button("Delete selected");

    VerticalLayout buttonsContainer = new VerticalLayout();
    buttonsContainer.setSpacing(true);
    buttonsContainer.addComponent(addButton);
    buttonsContainer.addComponent(editButton);
    buttonsContainer.addComponent(deleteButton);

    InvoiceLineAllowanceChargeTableEditor editor = new InvoiceLineAllowanceChargeTableEditor(editMode, inv);
    Label label = new Label("<h3>Adding allowance/charge line</h3>", Label.CONTENT_XHTML);
    addButton.addListener(editor.addButtonListener(editButton, deleteButton, hiddenContent, table,
            lineAllowanceChargeList, label));
    label = new Label("<h3>Edit allowance/charge line</h3>", Label.CONTENT_XHTML);
    editButton.addListener(editor.editButtonListener(addButton, deleteButton, hiddenContent, table,
            lineAllowanceChargeList, label));
    deleteButton.addListener(editor.deleteButtonListener(table));

    Panel outerPanel = new Panel(prefix + " Allowances/Charges");
    //outerPanel.setStyleName("light");     

    // ---- HIDDEN FORM BEGINS -----
    VerticalLayout formLayout = new VerticalLayout();
    formLayout.addComponent(hiddenContent);
    hiddenContent.setVisible(false);
    // ---- HIDDEN FORM ENDS -----

    grid.setSizeUndefined();
    grid.addComponent(tableContainer, 0, 0);
    grid.addComponent(buttonsContainer, 1, 0);

    outerPanel.addComponent(grid);
    outerPanel.addComponent(formLayout);
    outerLayout.addComponent(outerPanel);
    outerPanel.requestRepaintAll();

    VerticalLayout mainLayout = new VerticalLayout();
    final VerticalLayout showHideContentLayout = new VerticalLayout();
    showHideContentLayout.addComponent(outerPanel);
    HorizontalLayout showHideButtonLayout = new HorizontalLayout();
    Button btn = new Button("Show/Hide Allowances/Charges", new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            // TODO Auto-generated method stub
            showHideContentLayout.setVisible(!showHideContentLayout.isVisible());
        }
    });
    showHideButtonLayout.setWidth("100%");
    showHideButtonLayout.addComponent(btn);
    showHideButtonLayout.setComponentAlignment(btn, Alignment.MIDDLE_RIGHT);

    //mainLayout.addComponent(showHideButtonLayout);
    mainLayout.addComponent(showHideContentLayout);
    //showHideContentLayout.setVisible(false);    

    addComponent(mainLayout);

}

From source file:at.peppol.webgui.app.components.InvoiceLineCommodityClassificationForm.java

License:Mozilla Public License

private void initElements() {

    final GridLayout grid = new GridLayout(4, 4);
    final VerticalLayout outerLayout = new VerticalLayout();
    hiddenContent = new VerticalLayout();
    hiddenContent.setSpacing(true);//from w w w.ja va  2 s  .  c  o m
    hiddenContent.setMargin(true);

    table = new InvoiceLineCommodityClassificationTable(lineCommodityList);
    table.setSelectable(true);
    table.setImmediate(true);
    table.setNullSelectionAllowed(false);
    table.setHeight(150, UNITS_PIXELS);
    table.setFooterVisible(false);
    table.addStyleName("striped strong");

    VerticalLayout tableContainer = new VerticalLayout();
    tableContainer.addComponent(table);
    tableContainer.setMargin(false, true, false, false);

    Button addButton = new Button("Add new");
    Button editButton = new Button("Edit selected");
    Button deleteButton = new Button("Delete selected");

    VerticalLayout buttonsContainer = new VerticalLayout();
    buttonsContainer.setSpacing(true);
    buttonsContainer.addComponent(addButton);
    buttonsContainer.addComponent(editButton);
    buttonsContainer.addComponent(deleteButton);

    InvoiceLineCommodityClassificationTableEditor editor = new InvoiceLineCommodityClassificationTableEditor(
            editMode);
    Label label = new Label("<h3>Adding commodity classification line</h3>", Label.CONTENT_XHTML);
    addButton.addListener(
            editor.addButtonListener(editButton, deleteButton, hiddenContent, table, lineCommodityList, label));
    label = new Label("<h3>Edit commodity classification line</h3>", Label.CONTENT_XHTML);
    editButton.addListener(
            editor.editButtonListener(addButton, deleteButton, hiddenContent, table, lineCommodityList, label));
    deleteButton.addListener(editor.deleteButtonListener(table));

    Panel outerPanel = new Panel(prefix + " Commodity Classifications");
    //outerPanel.setStyleName("light");     

    // ---- HIDDEN FORM BEGINS -----
    VerticalLayout formLayout = new VerticalLayout();
    formLayout.addComponent(hiddenContent);
    hiddenContent.setVisible(false);
    // ---- HIDDEN FORM ENDS -----

    grid.setSizeUndefined();
    grid.addComponent(tableContainer, 0, 0);
    grid.addComponent(buttonsContainer, 1, 0);

    outerPanel.addComponent(grid);
    outerPanel.addComponent(formLayout);
    outerLayout.addComponent(outerPanel);
    outerPanel.requestRepaintAll();

    VerticalLayout mainLayout = new VerticalLayout();
    final VerticalLayout showHideContentLayout = new VerticalLayout();
    showHideContentLayout.addComponent(outerPanel);
    HorizontalLayout showHideButtonLayout = new HorizontalLayout();
    Button btn = new Button("Show/Hide Allowances/Charges", new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            // TODO Auto-generated method stub
            showHideContentLayout.setVisible(!showHideContentLayout.isVisible());
        }
    });
    showHideButtonLayout.setWidth("100%");
    showHideButtonLayout.addComponent(btn);
    showHideButtonLayout.setComponentAlignment(btn, Alignment.MIDDLE_RIGHT);

    //mainLayout.addComponent(showHideButtonLayout);
    mainLayout.addComponent(showHideContentLayout);
    //showHideContentLayout.setVisible(false);    

    addComponent(mainLayout);

}