Example usage for com.vaadin.ui Label Label

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

Introduction

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

Prototype

public Label(String text, ContentMode contentMode) 

Source Link

Document

Creates a new instance with the given text and content mode.

Usage

From source file:annis.gui.AboutWindow.java

License:Apache License

public AboutWindow() {
    setSizeFull();//  ww  w.  jav a 2s  . c o m

    layout = new VerticalLayout();
    setContent(layout);
    layout.setSizeFull();
    layout.setMargin(true);

    HorizontalLayout hLayout = new HorizontalLayout();

    Embedded logoAnnis = new Embedded();
    logoAnnis.setSource(new ThemeResource("images/annis-logo-128.png"));
    logoAnnis.setType(Embedded.TYPE_IMAGE);
    hLayout.addComponent(logoAnnis);

    Embedded logoSfb = new Embedded();
    logoSfb.setSource(new ThemeResource("images/sfb-logo.jpg"));
    logoSfb.setType(Embedded.TYPE_IMAGE);
    hLayout.addComponent(logoSfb);

    Link lnkFork = new Link();
    lnkFork.setResource(new ExternalResource("https://github.com/korpling/ANNIS"));
    lnkFork.setIcon(
            new ExternalResource("https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png"));
    lnkFork.setTargetName("_blank");
    hLayout.addComponent(lnkFork);

    hLayout.setComponentAlignment(logoAnnis, Alignment.MIDDLE_LEFT);
    hLayout.setComponentAlignment(logoSfb, Alignment.MIDDLE_RIGHT);
    hLayout.setComponentAlignment(lnkFork, Alignment.TOP_RIGHT);

    layout.addComponent(hLayout);

    layout.addComponent(new Label(
            "ANNIS is a project of the " + "<a href=\"http://www.sfb632.uni-potsdam.de/\">SFB632</a>.",
            Label.CONTENT_XHTML));
    layout.addComponent(new Label("Homepage: " + "<a href=\"http://corpus-tools.org/annis/\">"
            + "http://corpus-tools.org/annis/</a>.", Label.CONTENT_XHTML));
    layout.addComponent(new Label("Version: " + VersionInfo.getVersion()));
    layout.addComponent(new Label("Vaadin-Version: " + Version.getFullVersion()));

    TextArea txtThirdParty = new TextArea();
    txtThirdParty.setSizeFull();

    StringBuilder sb = new StringBuilder();

    sb.append("The ANNIS team wants to thank these third party software that "
            + "made the ANNIS GUI possible:\n");

    File thirdPartyFolder = new File(VaadinService.getCurrent().getBaseDirectory(), "THIRD-PARTY");
    if (thirdPartyFolder.isDirectory()) {
        for (File c : thirdPartyFolder.listFiles((FileFilter) new WildcardFileFilter("*.txt"))) {
            if (c.isFile()) {
                try {
                    sb.append(FileUtils.readFileToString(c)).append("\n");
                } catch (IOException ex) {
                    log.error("Could not read file", ex);
                }
            }
        }
    }

    txtThirdParty.setValue(sb.toString());
    txtThirdParty.setReadOnly(true);
    txtThirdParty.addStyleName("shared-text");
    txtThirdParty.setWordwrap(false);

    layout.addComponent(txtThirdParty);

    btClose = new Button("Close");
    final AboutWindow finalThis = this;
    btClose.addClickListener(new OkClickListener(finalThis));
    layout.addComponent(btClose);

    layout.setComponentAlignment(hLayout, Alignment.MIDDLE_CENTER);
    layout.setComponentAlignment(btClose, Alignment.MIDDLE_CENTER);
    layout.setExpandRatio(txtThirdParty, 1.0f);

}

From source file:annis.gui.components.ExceptionDialog.java

License:Apache License

public ExceptionDialog(Throwable ex, String caption) {
    this.cause = ex;
    Preconditions.checkNotNull(ex);/*w  ww. j  a  va  2s.c  o m*/

    layout = new VerticalLayout();
    setContent(layout);
    layout.setWidth("100%");
    layout.setHeight("-1");

    if (caption == null) {
        setCaption("Unexpected error");
    } else {
        setCaption(caption);
    }

    Label lblInfo = new Label("An unexpected error occured.<br />The error message was:", ContentMode.HTML);
    lblInfo.setHeight("-1px");
    lblInfo.setWidth("100%");
    layout.addComponent(lblInfo);
    lblInfo.addStyleName("exception-message-caption");

    String message = ex.getMessage();
    if (message == null || message.isEmpty()) {
        message = "<no message>";
    }
    Label lblMessage = new Label(message);
    lblMessage.addStyleName("exception-message-content");
    lblMessage.setHeight("-1px");
    lblMessage.setWidth("100%");
    layout.addComponent(lblMessage);

    actionsLayout = new HorizontalLayout();
    actionsLayout.addStyleName("exception-dlg-details");
    actionsLayout.setWidth("100%");
    actionsLayout.setHeight("-1px");
    layout.addComponent(actionsLayout);

    btDetails = new Button("Show Details", this);
    btDetails.setStyleName(BaseTheme.BUTTON_LINK);
    actionsLayout.addComponent(btDetails);

    btReportBug = new Button("Report Problem", this);
    btReportBug.setStyleName(BaseTheme.BUTTON_LINK);
    btReportBug.setVisible(false);
    btReportBug.setIcon(FontAwesome.ENVELOPE_O);
    UI ui = UI.getCurrent();
    if (ui instanceof AnnisUI) {
        btReportBug.setVisible(((AnnisUI) ui).canReportBugs());
    }
    actionsLayout.addComponent(btReportBug);
    actionsLayout.setComponentAlignment(btDetails, Alignment.TOP_LEFT);
    actionsLayout.setComponentAlignment(btReportBug, Alignment.TOP_RIGHT);

    lblStacktrace = new Label(Helper.convertExceptionToMessage(ex), ContentMode.PREFORMATTED);
    detailsPanel = new Panel(lblStacktrace);
    detailsPanel.setWidth("100%");
    detailsPanel.setHeight("300px");
    detailsPanel.setVisible(false);
    lblStacktrace.setSizeUndefined();
    lblStacktrace.setVisible(true);
    layout.addComponent(detailsPanel);

    btClose = new Button("OK", this);
    layout.addComponent(btClose);

    layout.setComponentAlignment(btClose, Alignment.BOTTOM_CENTER);
    layout.setExpandRatio(detailsPanel, 0.0f);
    layout.setExpandRatio(actionsLayout, 1.0f);
}

From source file:annis.gui.controlpanel.CorpusListPanel.java

License:Apache License

public void initCorpusBrowser(String topLevelCorpusName, final Button l) {

    AnnisCorpus c = ui.getQueryState().getAvailableCorpora().getItem(topLevelCorpusName).getBean();
    MetaDataPanel meta = new MetaDataPanel(c.getName());

    CorpusBrowserPanel browse = new CorpusBrowserPanel(c, ui.getQueryController());
    GridLayout infoLayout = new GridLayout(2, 2);
    infoLayout.setSizeFull();//ww  w.j  a va 2  s.  c o  m

    String corpusURL = Helper.generateCorpusLink(Sets.newHashSet(topLevelCorpusName));
    Label lblLink = new Label("Link to corpus: <a href=\"" + corpusURL + "\">" + corpusURL + "</a>",
            ContentMode.HTML);
    lblLink.setHeight("-1px");
    lblLink.setWidth("-1px");

    infoLayout.addComponent(meta, 0, 0);
    infoLayout.addComponent(browse, 1, 0);
    infoLayout.addComponent(lblLink, 0, 1, 1, 1);

    infoLayout.setRowExpandRatio(0, 1.0f);
    infoLayout.setColumnExpandRatio(0, 0.5f);
    infoLayout.setColumnExpandRatio(1, 0.5f);
    infoLayout.setComponentAlignment(lblLink, Alignment.MIDDLE_CENTER);

    Window window = new Window("Corpus information for " + c.getName() + " (ID: " + c.getId() + ")",
            infoLayout);
    window.setWidth(70, UNITS_EM);
    window.setHeight(45, UNITS_EM);
    window.setResizable(true);
    window.setModal(false);
    window.setResizeLazy(true);

    window.addCloseListener(new Window.CloseListener() {

        @Override
        public void windowClose(Window.CloseEvent e) {
            l.setEnabled(true);
        }
    });

    UI.getCurrent().addWindow(window);
    window.center();
}

From source file:annis.gui.EmbeddedVisUI.java

License:Apache License

private void displayMessage(String header, String content) {
    Label label = new Label("<h1>" + header + "</h1>" + "<div>" + content + "</div>", ContentMode.HTML);
    label.setSizeFull();//from w  w  w . j  a  v  a  2  s  . com
    setContent(label);
}

From source file:annis.gui.ShareQueryReferenceWindow.java

License:Apache License

public ShareQueryReferenceWindow(DisplayedResultQuery query, boolean shorten) {
    super("Query reference link");

    VerticalLayout wLayout = new VerticalLayout();
    setContent(wLayout);//from  w w w  .  j a v a  2 s .  c  o m
    wLayout.setSizeFull();
    wLayout.setMargin(true);

    Label lblInfo = new Label(
            "<p style=\"font-size: 18px\" >" + "<strong>Share your query:</strong>&nbsp;"
                    + "1.&nbsp;Copy the generated link 2.&nbsp;Share this link with your peers. " + "</p>",
            ContentMode.HTML);
    wLayout.addComponent(lblInfo);
    wLayout.setExpandRatio(lblInfo, 0.0f);

    String shortURL = "ERROR";
    if (query != null) {
        URI url = Helper.generateCitation(query.getQuery(), query.getCorpora(), query.getLeftContext(),
                query.getRightContext(), query.getSegmentation(), query.getBaseText(), query.getOffset(),
                query.getLimit(), query.getOrder(), query.getSelectedMatches());

        if (shorten) {
            shortURL = Helper.shortenURL(url);
        } else {
            shortURL = url.toASCIIString();
        }
    }

    TextArea txtCitation = new TextArea();

    txtCitation.setWidth("100%");
    txtCitation.setHeight("100%");
    txtCitation.addStyleName(ValoTheme.TEXTFIELD_LARGE);
    txtCitation.addStyleName("shared-text");
    txtCitation.setValue(shortURL);
    txtCitation.setWordwrap(true);
    txtCitation.setReadOnly(true);

    wLayout.addComponent(txtCitation);

    Button btClose = new Button("Close");
    btClose.addClickListener((Button.ClickListener) this);
    btClose.setSizeUndefined();

    wLayout.addComponent(btClose);

    wLayout.setExpandRatio(txtCitation, 1.0f);
    wLayout.setComponentAlignment(btClose, Alignment.BOTTOM_CENTER);

    setWidth("400px");
    setHeight("300px");

}

From source file:annis.gui.ShareSingleMatchGenerator.java

License:Apache License

public ShareSingleMatchGenerator(List<ResolverEntry> visualizers, Match match, PagedResultQuery query,
        String segmentation, PluginSystem ps) {
    this.match = match;
    this.query = query;
    this.segmentation = segmentation;
    this.ps = ps;

    setResizeLazy(true);//from w w  w. jav a  2s . co m

    directURL = new ObjectProperty<>("");
    iframeCode = new ObjectProperty<>("");

    visContainer = new BeanItemContainer<>(ResolverEntry.class);
    visContainer.addAll(visualizers);

    txtDirectURL = new TextArea(directURL);
    txtDirectURL.setCaption("Link for publications");
    txtDirectURL.setWidth("100%");
    txtDirectURL.setHeight("-1px");
    txtDirectURL.addStyleName(ValoTheme.TEXTFIELD_LARGE);
    txtDirectURL.addStyleName("shared-text");
    txtDirectURL.setWordwrap(true);
    txtDirectURL.setReadOnly(true);

    txtIFrameCode = new TextArea(iframeCode);
    txtIFrameCode.setCaption("Code for embedding visualization into web page");
    txtIFrameCode.setWidth("100%");
    txtIFrameCode.setHeight("-1px");
    txtIFrameCode.addStyleName(ValoTheme.TEXTFIELD_LARGE);
    txtIFrameCode.addStyleName("shared-text");
    txtIFrameCode.setWordwrap(true);
    txtIFrameCode.setReadOnly(true);

    preview = new BrowserFrame();
    preview.setCaption("Preview");
    preview.addStyleName("shared-text");
    preview.setSizeFull();

    generatedLinks = new VerticalLayout(txtDirectURL, txtIFrameCode, preview);
    generatedLinks.setComponentAlignment(txtDirectURL, Alignment.TOP_LEFT);
    generatedLinks.setComponentAlignment(txtIFrameCode, Alignment.TOP_LEFT);
    generatedLinks.setExpandRatio(preview, 1.0f);

    visSelector = new Grid(visContainer);
    visSelector.setCaption("Select visualization");
    visSelector.setHeight("100%");
    visSelector.setColumns("displayName");
    visSelector.setSelectionMode(Grid.SelectionMode.SINGLE);
    visSelector.addSelectionListener(ShareSingleMatchGenerator.this);
    visSelector.select(visContainer.getIdByIndex(0));
    visSelector.setWidth("300px");
    visSelector.getColumn("displayName").setSortable(false);

    generatedLinks.setSizeFull();

    Label infoText = new Label(
            "<p style=\"font-size: 18px\" >" + "<strong>Share your match:</strong>&nbsp;"
                    + "1.&nbsp;Choose the visualization to share. 2.&nbsp;Copy the generated link or code. "
                    + "3.&nbsp;Share this link with your peers or include the code in your website. " + "</p>",
            ContentMode.HTML);

    HorizontalLayout hLayout = new HorizontalLayout(visSelector, generatedLinks);
    hLayout.setSizeFull();
    hLayout.setSpacing(true);
    hLayout.setExpandRatio(generatedLinks, 1.0f);

    Button btClose = new Button("Close");
    btClose.setSizeUndefined();
    btClose.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            getUI().removeWindow(ShareSingleMatchGenerator.this);
        }
    });

    layout = new VerticalLayout(infoText, hLayout, btClose);
    layout.setSizeFull();
    layout.setExpandRatio(hLayout, 1.0f);
    layout.setComponentAlignment(btClose, Alignment.MIDDLE_CENTER);

    setContent(layout);
}

From source file:annis.visualizers.htmlvis.HTMLVis.java

License:Apache License

@Override
public Panel createComponent(VisualizerInput vi, VisualizationToggle vt) {
    Panel scrollPanel = new Panel();
    scrollPanel.setSizeFull();/*from w  w  w  .  j  av a2  s.  c  o  m*/
    Label lblResult = new Label("ERROR", ContentMode.HTML);
    lblResult.setSizeUndefined();

    List<String> corpusPath = CommonHelper.getCorpusPath(vi.getDocument().getGraph(), vi.getDocument());
    String corpusName = corpusPath.get(corpusPath.size() - 1);
    corpusName = urlPathEscape.escape(corpusName);

    String wrapperClassName = "annis-wrapped-htmlvis-" + corpusName.replaceAll("[^0-9A-Za-z-]", "_");

    scrollPanel.addStyleName(wrapperClassName);

    String visConfigName = vi.getMappings().getProperty("config");
    String hitMarkConfig = vi.getMappings().getProperty("hitmark", "true");
    hitMark = Boolean.parseBoolean(hitMarkConfig);
    mc = vi.getMarkedAndCovered();

    VisualizationDefinition[] definitions = parseDefinitions(corpusName, vi.getMappings());

    if (definitions != null) {

        lblResult.setValue(createHTML(vi.getSResult().getDocumentGraph(), definitions));

        String labelClass = vi.getMappings().getProperty("class", "htmlvis");
        lblResult.addStyleName(labelClass);

        InputStream inStreamCSSRaw = null;
        if (visConfigName == null) {
            inStreamCSSRaw = HTMLVis.class.getResourceAsStream("htmlvis.css");
        } else {
            WebResource resBinary = Helper.getAnnisWebResource().path("query/corpora/").path(corpusName)
                    .path(corpusName).path("binary").path(visConfigName + ".css");

            ClientResponse response = resBinary.get(ClientResponse.class);
            if (response.getStatus() == ClientResponse.Status.OK.getStatusCode()) {
                inStreamCSSRaw = response.getEntityInputStream();
            }
        }
        if (inStreamCSSRaw != null) {
            try (InputStream inStreamCSS = inStreamCSSRaw) {
                String cssContent = IOUtils.toString(inStreamCSS);
                UI currentUI = UI.getCurrent();
                if (currentUI instanceof AnnisBaseUI) {
                    // do not add identical CSS files
                    ((AnnisBaseUI) currentUI).injectUniqueCSS(cssContent, wrapperClassName);
                }
            } catch (IOException ex) {
                log.error("Could not parse the HTML visualizer CSS file", ex);
                Notification.show("Could not parse the HTML visualizer CSS file", ex.getMessage(),
                        Notification.Type.ERROR_MESSAGE);
            }
        }

    }

    if (vi.getMappings().containsKey("debug")) {
        TextArea txtDebug = new TextArea();
        txtDebug.setValue(lblResult.getValue());
        txtDebug.setReadOnly(true);
        txtDebug.setWidth("100%");
        Label sep = new Label("<hr/>", ContentMode.HTML);
        VerticalLayout layout = new VerticalLayout(txtDebug, sep, lblResult);
        layout.setSizeUndefined();
        scrollPanel.setContent(layout);
    } else {
        scrollPanel.setContent(lblResult);
    }

    return scrollPanel;
}

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);
    }// www. j a  v a2s  .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);//w w  w  .j ava  2s  .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.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);/* w ww.  j a  v  a2 s . com*/
    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);

}