Example usage for com.vaadin.ui Alignment MIDDLE_CENTER

List of usage examples for com.vaadin.ui Alignment MIDDLE_CENTER

Introduction

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

Prototype

Alignment MIDDLE_CENTER

To view the source code for com.vaadin.ui Alignment MIDDLE_CENTER.

Click Source Link

Usage

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

License:LGPL

public VaadinUI() {
    // Set up the Navigator
    navigator = new Navigator(this, this);

    // Create Welcome Screen
    MainUI mainScreen = new MainUI();
    mainScreen.setMargin(true);// ww  w.  ja va 2 s .  c  o m
    Button start = new Button("Start", e -> {
        navigator.navigateTo(Views.TEST.toString());
    });
    start.setWidth("40%");
    start.setHeight("40%");
    //mainScreen.addComponent(new HtmlLabel(HtmlUtils.center("h1", "Willkommen zur " + productData)));
    mainScreen.addComponent(new HtmlLabel(HtmlUtils.center("h2", "Bitte klicke den <b>" + start.getCaption()
            + "</b> Button um mit dem Rechnungswesentest zu beginnen!")));
    mainScreen.addComponent(start);
    mainScreen.setComponentAlignment(start, Alignment.MIDDLE_CENTER);

    navigator.addView(Views.DEFAULT.toString(), mainScreen);
    // Question view
    // Change this to the questionManager you like
    final QuestionManager manager = new AccountingQuestionManager("Rechnungswesentest");
    navigator.addView(Views.TEST.toString(), manager);
    navigator.addView(Views.Log.toString(), new LogView(new File(Servlet.getLogFileName())));
    navigator.addView(Views.Admin.toString(), new AdminView(manager));
    navigator.addView(Views.Results.toString(), new ResultView(manager));
    navigator.setErrorView(mainScreen);
    LogHelper.logInfo("Startup completed");
}

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.  jav a 2s  .co  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);/*  ww  w.jav a  2 s .  co  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.jku.ce.adaptivetesting.vaadin.ui.VaadinResultView.java

License:LGPL

public VaadinResultView(ResultFiredArgs args, String title) {
    setSpacing(true);//from   w  w w  . j av a 2  s  .com
    addComponent(new HtmlLabel(title));
    //addComponent(HtmlLabel.getCenteredLabel("h2", "Test abgeschlossen"));
    addComponent(HtmlLabel.getCenteredLabel(
            "Der Test wurde beendet, da " + (args.outOfQuestions ? "keine weiteren Fragen verfgbar sind."
                    : "dein Kompetenzniveau bestimmt wurde.")));
    addComponent(HtmlLabel.getCenteredLabel(
            "Im Folgenden siehst du die Fragen und die gegebenen Antworten in zeitlich absteigender Reihenfolge."));
    addComponent(HtmlLabel.getCenteredLabel(
            "Die Zahl in der ersten Spalte bezieht sich auf die Schwierigkeit der jeweiligen Frage. Negative Zahlen stehen fr leichtere Fragen, positive Zahlen kennzeichnen schwierigere Fragen."));

    // Create HTML table of the history
    Table table = new Table();
    final String solution = "Korrekte Antwort", userAnswer = "Ihre Antwort";
    table.addContainerProperty("Schwierigkeitsgrad", Float.class, null);
    table.addContainerProperty("Resultat", String.class, null);
    table.addContainerProperty(userAnswer, Button.class, null);
    table.addContainerProperty(solution, Button.class, null);
    //List<HistoryEntry> entries = Lists.reverse(args.history);
    List<HistoryEntry> entries = new ArrayList<HistoryEntry>(args.history);
    Collections.reverse(entries);

    for (HistoryEntry entry : entries) {
        Button qAnswer = null, qSolution = null;
        if (entry.question instanceof Component && entry.question != null) {
            try {
                Class<? extends AnswerStorage> dataStorageClass = entry.question.getSolution().getClass();
                Constructor<? extends IQuestion> constructor = entry.question.getClass()
                        .getConstructor(dataStorageClass, dataStorageClass, float.class, String.class);
                // The following casts can not fail, because the question is
                // a component as well
                Component iQuestionSolution = (Component) constructor.newInstance(entry.question.getSolution(),
                        entry.question.getSolution(), entry.question.getDifficulty(),
                        entry.question.getQuestionText());
                Component iQuestionUser = (Component) constructor.newInstance(entry.question.getSolution(),
                        entry.question.getUserAnswer(), entry.question.getDifficulty(),
                        entry.question.getQuestionText());
                // Create the 2 needed click listeners
                ClickListener clickListenerSol = event -> {
                    Window window = new Window(solution);
                    event.getButton().setEnabled(false);
                    window.addCloseListener(e -> event.getButton().setEnabled(true));
                    window.setContent(iQuestionSolution);
                    window.center();
                    window.setWidth("90%");
                    window.setHeight("50%");
                    if (iQuestionSolution instanceof Sizeable) {
                        Sizeable sizeable = iQuestionSolution;
                        sizeable.setSizeFull();
                    }
                    getUI().addWindow(window);
                };

                ClickListener clickListenerUA = event -> {
                    Window window = new Window(userAnswer);
                    event.getButton().setEnabled(false);
                    window.addCloseListener(e -> event.getButton().setEnabled(true));
                    window.setContent(iQuestionUser);
                    window.center();
                    window.setWidth("90%");
                    window.setHeight("50%");
                    if (iQuestionUser instanceof Sizeable) {
                        Sizeable sizeable = iQuestionUser;
                        sizeable.setSizeFull();
                    }
                    getUI().addWindow(window);
                };

                // Create the two buttons
                qAnswer = new Button(userAnswer, clickListenerUA);
                qSolution = new Button(solution, clickListenerSol);

            } catch (Exception e) {
                // Ignore this line in the table
                LogHelper.logInfo("1 entry's solution/ user answer are missing on the final screen."
                        + entry.question.getClass().getName()
                        + " does not implement the constructors required by" + IQuestion.class.getName());
            }
        }

        table.addItem(new Object[] { entry.question.getDifficulty(),
                isCorrect(entry.points, entry.question.getMaxPoints()), qAnswer, qSolution }, null);
    }
    int size = table.size();
    if (size > 10) {
        size = 10;
    }
    table.setPageLength(size);
    addComponent(table);
    setComponentAlignment(table, Alignment.MIDDLE_CENTER);

    addComponent(HtmlLabel.getCenteredLabel("h3", "Dein Kompetenzniveau ist: <b>" + args.skillLevel + "</b>"));
    addComponent(HtmlLabel.getCenteredLabel("Delta:  " + args.delta));
    storeResults(args);
}

From source file:at.peppol.webgui.app.LoginWindow.java

License:Mozilla Public License

private void init() {

    HorizontalLayout h1 = new HorizontalLayout();
    h1.setSizeFull();//from   ww  w  . j a v a  2 s.  c  o  m

    FormLayout fl = new FormLayout();
    fl.setSizeUndefined();
    usernameField = new TextField("Username:");
    usernameField.setImmediate(true);
    fl.addComponent(usernameField);
    passwordField = new PasswordField("Password:");
    passwordField.setImmediate(true);
    fl.addComponent(passwordField);

    Button loginButton = new Button("Login");
    loginButton.addStyleName("default");
    loginButton.addListener(this);
    fl.addComponent(loginButton);
    loginButton.setClickShortcut(KeyCode.ENTER);

    h1.addComponent(fl);
    h1.setComponentAlignment(fl, Alignment.MIDDLE_CENTER);
    addComponent(h1);

}

From source file:at.peppol.webgui.app.MainWindow.java

License:Mozilla Public License

@SuppressWarnings("unused")
private void createTopBar() {

    topBarCSSLayout.setStyleName("toolbar");
    topBarCSSLayout.setSizeFull();/*from w  ww  .j  a  v  a2  s .c o m*/
    topBarLayout.setMargin(false, true, false, true);
    topBarLayout.setSizeFull();
    topBarLayoutLeft = new HorizontalLayout();
    topBarLayoutRight = new HorizontalLayout();

    final Label pawgLabel = new Label("PAWG");
    pawgLabel.setStyleName("h1");
    pawgLabel.setSizeUndefined();
    topBarLayoutLeft.addComponent(pawgLabel);

    final HorizontalLayout segBtns = createTopBarButtons();
    topBarLayoutLeft.addComponent(segBtns);

    // IUser user = (IUser) PawgApp.getInstance().getUser();
    final Label loggedInLabel = new Label("Test User");
    loggedInLabel.setSizeUndefined();
    topBarLayoutRight.addComponent(loggedInLabel);
    topBarLayoutRight.setComponentAlignment(loggedInLabel, Alignment.MIDDLE_RIGHT);
    topBarLayoutLeft.setComponentAlignment(segBtns, Alignment.MIDDLE_CENTER);
    topBarLayoutLeft.setSpacing(true);

    topBarLayout.addComponent(topBarLayoutLeft);
    topBarLayout.addComponent(topBarLayoutRight);
    topBarLayout.setComponentAlignment(topBarLayoutRight, Alignment.MIDDLE_RIGHT);

    topBarLayout.setExpandRatio(topBarLayoutLeft, 1);
    topBarLayout.setExpandRatio(topBarLayoutRight, 1);

    topBarCSSLayout.addComponent(topBarLayout);
    addComponent(topBarCSSLayout);

}

From source file:at.peppol.webgui.app.MainWindow.java

License:Mozilla Public License

private void createMenuBar() {

    topBarLayout.setMargin(false, false, false, false);
    topBarLayout.setSizeFull();//  ww w  .j av  a 2s  .c  o m
    // topBarLayout.setStyleName("v-menubar");
    topBarLayoutLeft = new HorizontalLayout();
    topBarLayoutRight = new HorizontalLayout();

    // Label pawgLabel = new Label("PAWG",Label.CONTENT_XHTML);
    // pawgLabel.setStyleName("v-menubar");
    // pawgLabel.addStyleName("v-label-big");
    // pawgLabel.setSizeFull();
    // topBarLayoutLeft.addComponent(pawgLabel);

    final MenuBar lMenuBar = new MenuBar();
    lMenuBar.setHtmlContentAllowed(true);
    lMenuBar.addItem("<b>PAWG<b>", new MenuBar.Command() {

        @Override
        public void menuSelected(final MenuItem selectedItem) {

            removeComponent(mainContentComponent);
            showInitialMainContent(um.getDrafts());
        }
    });
    final MenuBar.MenuItem docItem = lMenuBar.addItem("Document", null);
    lMenuBar.addItem("Preferences", null);
    lMenuBar.addItem("Logout", new MenuBar.Command() {
        @Override
        public void menuSelected(MenuItem selectedItem) {
            PawgApp.getInstance().logout();
            PawgApp.getInstance().showLoginWindow();
        }
    });
    lMenuBar.addItem("About", null);
    lMenuBar.setSizeFull();

    final MenuBar.MenuItem invItem = docItem.addItem("Invoice", null);
    final MenuBar.MenuItem orderItem = docItem.addItem("Order", null);
    invItem.addItem("New ...", new MenuBar.Command() {
        @Override
        public void menuSelected(final MenuItem selectedItem) {
            showInvoiceForm();
            //showInvoiceForm (null);
        }
    });
    invItem.addItem("View ... ", new MenuBar.Command() {
        @Override
        public void menuSelected(final MenuItem selectedItem) {
            showTestForm();
        }
    });
    invItem.addItem("Upload ...", new MenuBar.Command() {
        @Override
        public void menuSelected(final MenuItem selectedItem) {
            showInvUploadWindow();
        }
    });

    orderItem.addItem("New", null);
    orderItem.addItem("View", null);
    orderItem.addItem("Upload ...", new MenuBar.Command() {
        @Override
        public void menuSelected(final MenuItem selectedItem) {
            showOrdUploadWindow();
        }
    });

    topBarLayoutLeft.addComponent(lMenuBar);

    final IUser user = (IUser) PawgApp.getInstance().getUser();

    topBarLayoutLeft.setComponentAlignment(lMenuBar, Alignment.MIDDLE_CENTER);
    topBarLayoutLeft.setSpacing(false);
    topBarLayoutLeft.setSizeFull();
    topBarLayoutRight.setSizeUndefined();

    final MenuBar rMenuBar = new MenuBar();
    rMenuBar.setHtmlContentAllowed(true);
    final MenuBar.MenuItem userLabel = rMenuBar.addItem("<b>" + user.getEmailAddress() + "<b>", null);
    userLabel.addItem("Logout", new MenuBar.Command() {
        @Override
        public void menuSelected(final MenuItem selectedItem) {
            PawgApp.getInstance().logout();
        }
    });
    topBarLayoutRight.addComponent(rMenuBar);
    topBarLayout.addComponent(topBarLayoutLeft);
    topBarLayout.addComponent(topBarLayoutRight);
    topBarLayout.setComponentAlignment(topBarLayoutRight, Alignment.MIDDLE_RIGHT);
    topBarLayout.setExpandRatio(topBarLayoutLeft, 1);
    // topBarLayout.setExpandRatio(topBarLayoutRight, 1);
    addComponent(topBarLayout);

}

From source file:at.reisisoft.jku.ce.adaptivelearning.vaadin.ui.core.VaadinUI.java

License:LGPL

public VaadinUI() {
    // Set up the Navigator
    navigator = new Navigator(this, this);

    // Create Welcome Screen
    MainUI mainScreen = new MainUI();
    mainScreen.setMargin(true);//from   w w  w .  java  2 s . co  m
    Button start = new Button("Start", e -> {
        navigator.navigateTo(Views.TEST.toString());
    });
    start.setWidth("40%");
    start.setHeight("40%");
    mainScreen.addComponent(new HtmlLabel(HtmlUtils.center("h1", "Welcome to " + productData)));
    mainScreen.addComponent(new HtmlLabel(
            HtmlUtils.center("h2", "Click the <b>" + start.getCaption() + "</b> Button to start!")));
    mainScreen.addComponent(start);
    mainScreen.setComponentAlignment(start, Alignment.MIDDLE_CENTER);

    navigator.addView(Views.DEFAULT.toString(), mainScreen);
    // Question view
    // Change this to the questionManager you like
    final QuestionManager manager = new AccountingQuestionManager("Accounting Quiz");
    navigator.addView(Views.TEST.toString(), manager);
    navigator.addView(Views.Log.toString(), new LogView(new File(Servlet.getLogFileName())));
    navigator.setErrorView(mainScreen);
    LogHelper.logInfo("Startup completed");
}

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

License:LGPL

@Override
public void startQuiz() {
    // 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);
    }//  w w w  .  j  a  va  2 s .c o m
    removeAllComponents();
    // Create first page
    VerticalLayout layout = new VerticalLayout();

    addComponent(layout);
    Label label = new Label("Answer all the questions like you were working for \"Unternehmen XY\"",
            ContentMode.HTML);
    Button cont = new Button("Continue", e -> {
        removeAllComponents();
        for (Component c : components) {
            addComponent(c);
        }
        super.startQuiz();
    });
    layout.addComponent(components[0]);// Title of the quiz
    layout.addComponent(label);
    layout.addComponent(cont);
    layout.setComponentAlignment(components[0], Alignment.MIDDLE_CENTER);

}

From source file:at.reisisoft.jku.ce.adaptivelearning.vaadin.ui.VaadinResultView.java

License:LGPL

public VaadinResultView(ResultFiredArgs args, String title) {
    setSpacing(true);//from  w  w  w .j a v  a2  s .co m
    addComponent(new HtmlLabel(title));
    addComponent(HtmlLabel.getCenteredLabel("h2", "Finished test"));
    addComponent(HtmlLabel.getCenteredLabel("The test ended, because we "
            + (args.outOfQuestions ? "did not have any more questions" : "determined your skill level")));
    addComponent(HtmlLabel.getCenteredLabel(
            "This are the difficulties and your answers. On top are your last answers. The first column indicates the difficulty."));
    addComponent(HtmlLabel.getCenteredLabel(
            "Closer to -INF means easy question, to +INF dificult questions. This also applies to your skill level!"));

    // Create HTML table of the history
    Table table = new Table();
    final String solution = "Solution", userAnswewr = "Yourt answer";
    table.addContainerProperty("Question difficulty", Float.class, null);
    table.addContainerProperty("Result", String.class, null);
    table.addContainerProperty(userAnswewr, Button.class, null);
    table.addContainerProperty(solution, Button.class, null);
    List<HistoryEntry> entries = Lists.reverse(args.history);

    for (HistoryEntry entry : entries) {
        Button qAnswer = null, qSolution = null;
        if (entry.question instanceof Component && entry.question != null) {
            try {
                Class<? extends AnswerStorage> dataStorageClass = entry.question.getSolution().getClass();
                Constructor<? extends IQuestion> constructor = entry.question.getClass()
                        .getConstructor(dataStorageClass, dataStorageClass, float.class, String.class);
                // The following casts can not fail, because the question is
                // a component as well
                Component iQuestionSolution = (Component) constructor.newInstance(entry.question.getSolution(),
                        entry.question.getSolution(), entry.question.getDifficulty(),
                        entry.question.getQuestionText());
                Component iQuestionUser = (Component) constructor.newInstance(entry.question.getSolution(),
                        entry.question.getUserAnswer(), entry.question.getDifficulty(),
                        entry.question.getQuestionText());
                // Create the 2 needed click listeners
                ClickListener clickListenerSol = event -> {
                    Window window = new Window(solution);
                    event.getButton().setEnabled(false);
                    window.addCloseListener(e -> event.getButton().setEnabled(true));
                    window.setContent(iQuestionSolution);
                    window.center();
                    window.setWidth("90%");
                    window.setHeight("50%");
                    if (iQuestionSolution instanceof Sizeable) {
                        Sizeable sizeable = iQuestionSolution;
                        sizeable.setSizeFull();
                    }
                    getUI().addWindow(window);
                };

                ClickListener clickListenerUA = event -> {
                    Window window = new Window(userAnswewr);
                    event.getButton().setEnabled(false);
                    window.addCloseListener(e -> event.getButton().setEnabled(true));
                    window.setContent(iQuestionUser);
                    window.center();
                    window.setWidth("90%");
                    window.setHeight("50%");
                    if (iQuestionUser instanceof Sizeable) {
                        Sizeable sizeable = iQuestionUser;
                        sizeable.setSizeFull();
                    }
                    getUI().addWindow(window);
                };

                // Create the two buttons
                qAnswer = new Button(userAnswewr, clickListenerUA);
                qSolution = new Button(solution, clickListenerSol);

            } catch (Exception e) {
                // Ignore this line in the table
                LogHelper.logInfo("1 entry's solution/ user answer are missing on the final screen."
                        + entry.question.getClass().getName()
                        + " does not implement the constructors required by" + IQuestion.class.getName());
            }
        }

        table.addItem(new Object[] { entry.question.getDifficulty(),
                isCorrect(entry.points, entry.question.getMaxPoints()), qAnswer, qSolution }, null);
    }
    int size = table.size();
    if (size > 10) {
        size = 10;
    }
    table.setPageLength(size);
    addComponent(table);
    setComponentAlignment(table, Alignment.MIDDLE_CENTER);

    addComponent(HtmlLabel.getCenteredLabel("h3", "Your skill level is: <b>" + args.skillLevel + "</b>"));
    addComponent(HtmlLabel.getCenteredLabel("Delta (Valus close to 0 are best):  " + args.delta));
}