Example usage for com.vaadin.ui FormLayout addComponent

List of usage examples for com.vaadin.ui FormLayout addComponent

Introduction

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

Prototype

@Override
public void addComponent(Component c) 

Source Link

Document

Add a component into this container.

Usage

From source file:de.kaiserpfalzEdv.vaadin.LoginScreen.java

License:Apache License

private Component buildLoginForm() {
    FormLayout loginForm = new FormLayout();

    loginForm.addStyleName("login-form");
    loginForm.setSizeUndefined();/*from   w  w w  .ja v  a2s  .com*/
    loginForm.setMargin(false);

    loginForm.addComponent(username = new TextField(translate("login.name.caption")));
    username.setDescription(translate("login.name.description"));
    username.setWidth(15, Unit.EM);
    loginForm.addComponent(password = new PasswordField(translate("login.password.caption")));
    password.setWidth(15, Unit.EM);
    password.setDescription(translate("login.password.description"));
    CssLayout buttons = new CssLayout();
    buttons.setStyleName("buttons");
    loginForm.addComponent(buttons);

    login = new Button(translate("login.login-button.caption"));
    buttons.addComponent(login);
    login.setDescription(translate("login.login-button.description"));
    login.setDisableOnClick(true);
    login.addClickListener(event -> {
        try {
            login();
        } finally {
            login.setEnabled(true);
        }
    });
    login.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    login.addStyleName(ValoTheme.BUTTON_FRIENDLY);

    Button forgotPassword;
    buttons.addComponent(forgotPassword = new Button(translate("login.password-forgotten.caption")));
    forgotPassword.setDescription(translate("login.password-forgotten.description"));
    forgotPassword.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            NotificationPayload notification = new NotificationPayload("login.password-forgotten.text");
            bus.post(new NotificationEvent(this, notification));
        }
    });
    forgotPassword.addStyleName(ValoTheme.BUTTON_LINK);
    return loginForm;
}

From source file:de.uni_tuebingen.qbic.qbicmainportlet.ChangeExperimentMetadataComponent.java

License:Open Source License

private void buildFormLayout() {
    final FieldGroup fieldGroup = new FieldGroup();
    final FormLayout form2 = new FormLayout();

    Map<String, PropertyBean> controlledVocabularies = getControlledVocabularies();
    Map<String, PropertyBean> properties = getProperties();
    List<Property> xmlProps = getXMLProperties();

    for (Property f : xmlProps) {
        PropertyType type = f.getType();

        String label = f.getLabel();
        if (f.hasUnit())
            label += " in " + f.getUnit();
        TextField tf = new TextField(label);
        tf.setData(type);// save property type for later, when it is written back
        fieldGroup.bind(tf, label);//  ww  w  .ja  v a2  s  . c  o  m
        tf.setCaption(label);
        tf.setDescription("Q_PROPERTIES");
        tf.setValue((String) f.getValue());
        form2.addComponent(tf);
    }

    for (String key : properties.keySet()) {
        if (controlledVocabularies.keySet().contains(key)) {
            ComboBox select = new ComboBox(controlledVocabularies.get(key).getLabel());
            fieldGroup.bind(select, key);

            // Add items with given item IDs
            select.addItems(controlledVocabularies.get(key).getVocabularyValues());

            select.setDescription(controlledVocabularies.get(key).getCode());
            select.setValue(properties.get(key).getValue());

            form2.addComponent(select);

        } else {
            TextField tf = new TextField(key);
            fieldGroup.bind(tf, key);
            tf.setCaption(properties.get(key).getLabel());
            tf.setDescription(properties.get(key).getCode());
            tf.setValue((String) properties.get(key).getValue());
            form2.addComponent(tf);
        }
    }
    this.fieldGroup = fieldGroup;
    this.form = form2;
}

From source file:de.uni_tuebingen.qbic.qbicmainportlet.ChangeMetadataComponent.java

License:Open Source License

private void buildFormLayout(SampleBean sample) {
    final FieldGroup fieldGroup = new FieldGroup();
    final FormLayout form2 = new FormLayout();

    Map<String, PropertyBean> controlledVocabularies = getControlledVocabularies(sample);
    Map<String, PropertyBean> properties = getProperties(sample);

    for (String key : properties.keySet()) {
        if (controlledVocabularies.keySet().contains(key)) {
            ComboBox select = new ComboBox(controlledVocabularies.get(key).getLabel());
            fieldGroup.bind(select, key);

            // Add items with given item IDs
            select.addItems(controlledVocabularies.get(key).getVocabularyValues());

            /*//from w ww.j  a  va  2  s  . c  om
             * for(Object itemID: select.getItemIds()) { System.out.println(itemID); }
             */
            select.setDescription(controlledVocabularies.get(key).getCode());
            select.setValue(properties.get(key).getValue());

            form2.addComponent(select);

        } else {
            TextField tf = new TextField(key);
            fieldGroup.bind(tf, key);
            tf.setCaption(properties.get(key).getLabel());
            tf.setDescription(properties.get(key).getCode());
            tf.setValue((String) properties.get(key).getValue());
            form2.addComponent(tf);
        }
    }
    this.fieldGroup = fieldGroup;
    this.form = form2;
}

From source file:de.uni_tuebingen.qbic.qbicmainportlet.ChangeProjectMetadataComponent.java

License:Open Source License

private void buildFormLayout() {
    final FieldGroup fieldGroup = new FieldGroup();
    final FormLayout form2 = new FormLayout();

    TextArea tf = new TextArea("Description");
    tf.setWidth("50%");
    tf.setHeight("50%");
    fieldGroup.bind(tf, "Description");
    tf.setCaption("Description");
    tf.setDescription("Description of this project.");
    tf.setValue(currentDescription);/*from  www.  j a  va 2  s.  c  o  m*/
    form2.addComponent(tf);

    this.fieldGroup = fieldGroup;
    this.form = form2;
}

From source file:de.uni_tuebingen.qbic.qbicmainportlet.ChangeSampleMetadataComponent.java

License:Open Source License

private void buildFormLayout() {
    final FieldGroup fieldGroup = new FieldGroup();
    final FormLayout form2 = new FormLayout();
    this.fieldGroup = new FieldGroup();
    this.form = new FormLayout();

    Map<String, PropertyBean> controlledVocabularies = getControlledVocabularies();
    Map<String, PropertyBean> properties = getProperties();
    List<Property> xmlProps = getXMLProperties();

    for (Property f : xmlProps) {
        properties.PropertyType type = f.getType();

        String label = f.getLabel();
        if (f.hasUnit())
            label += " in " + f.getUnit();
        TextField tf = new TextField(label);
        tf.setData(type);// save property type for later, when it is written back
        fieldGroup.bind(tf, label);/*from w ww  .  j a  v a  2s  .c o  m*/
        tf.setCaption(label);
        tf.setDescription("Q_PROPERTIES");
        tf.setValue((String) f.getValue());
        form2.addComponent(tf);
    }

    for (String key : properties.keySet()) {
        if (controlledVocabularies.keySet().contains(key)) {
            ComboBox select = new ComboBox(controlledVocabularies.get(key).getLabel());
            fieldGroup.bind(select, key);

            // Add items with given item IDs
            select.addItems(controlledVocabularies.get(key).getVocabularyValues());

            select.setDescription(controlledVocabularies.get(key).getCode());
            select.setValue(properties.get(key).getValue());

            form2.addComponent(select);

        } else {
            TextField tf = new TextField(key);
            fieldGroup.bind(tf, key);
            tf.setCaption(properties.get(key).getLabel());
            tf.setDescription(properties.get(key).getCode());
            tf.setValue((String) properties.get(key).getValue());
            form2.addComponent(tf);
        }
    }
    this.fieldGroup = fieldGroup;
    this.form = form2;
}

From source file:dhbw.clippinggorilla.userinterface.windows.ActivateWindow.java

public static Window get() {
    Window window = new Window();
    window.setModal(true);//from   w w w.  j av  a  2  s  .co  m
    window.setResizable(false);
    window.setDraggable(false);
    window.setCaption(Language.get(Word.ACTIVATION_CODE));
    window.addCloseShortcut(ShortcutAction.KeyCode.ENTER, null);

    VerticalLayout windowLayout = new VerticalLayout();
    windowLayout.setMargin(false);
    windowLayout.setSizeUndefined();

    FormLayout forms = new FormLayout();
    forms.setMargin(true);
    forms.setSizeUndefined();

    Button save = new Button(Language.get(Word.ACTIVATE));

    TextField activationCode = new TextField(Language.get(Word.ACTIVATION_CODE));
    activationCode.setMaxLength(6);
    activationCode.focus();
    activationCode.addValueChangeListener(e -> {
        if (activationCode.getValue().length() > 5) {
            save.setEnabled(true);
            activationCode.setComponentError(null);
        } else {
            save.setEnabled(false);
            activationCode.setComponentError(new UserError(Language.get(Word.ACTIVATION_CODE_SIX_CHARS),
                    AbstractErrorMessage.ContentMode.HTML, ErrorMessage.ErrorLevel.INFORMATION));
            VaadinUtils.infoNotification(Language.get(Word.ACTIVATION_CODE_SIX_CHARS));
        }
    });
    forms.addComponent(activationCode);

    Button resendMail = new Button(Language.get(Word.RESEND_ACTIVATION_CODE));
    resendMail.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    resendMail.addClickListener(ce -> {
        try {
            UserUtils.resendActivationMail(UserUtils.getCurrent());
            VaadinUtils.infoNotification(Language.get(Word.RESEND_ACTIVATION_CODE_SUCCESSFUL));
        } catch (EmailException ex) {
            VaadinUtils.errorNotification(Language.get(Word.RESEND_ACTIVATION_CODE_FAILED));
        }
    });
    forms.addComponent(resendMail);

    GridLayout footer = new GridLayout(3, 1);
    footer.setSpacing(true);
    footer.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR);
    footer.setWidth(100.0f, Sizeable.Unit.PERCENTAGE);

    Label placeholder = new Label();

    Button cancel = new Button(Language.get(Word.CANCEL));
    cancel.setIcon(VaadinIcons.CLOSE);
    cancel.addClickListener(ce -> {
        window.close();
    });
    cancel.setClickShortcut(ShortcutAction.KeyCode.ESCAPE, null);

    save.setEnabled(false);
    save.setIcon(VaadinIcons.CHECK);
    save.addStyleName(ValoTheme.BUTTON_PRIMARY);
    save.addClickListener(ce -> {
        try {
            String code = activationCode.getValue();
            User user = UserUtils.getCurrent();
            if (UserUtils.activateUser(user, code)) {
                VaadinUtils.infoNotification(Language.get(Word.ACTIVATION_SUCCESSFUL));
                window.close();
            } else {
                activationCode.setValue("");
                VaadinUtils.errorNotification(Language.get(Word.ACTIVATION_FAILED));
            }
        } catch (NumberFormatException e) {
        }
    });
    save.setClickShortcut(ShortcutAction.KeyCode.ENTER, null);

    footer.setSizeUndefined();
    footer.setWidth("100%");
    footer.addComponents(placeholder, cancel, save);
    footer.setColumnExpandRatio(0, 1);//ExpandRatio(placeholder, 1);
    footer.setComponentAlignment(cancel, Alignment.MIDDLE_CENTER);
    footer.setComponentAlignment(save, Alignment.MIDDLE_CENTER);

    windowLayout.addComponent(forms);
    windowLayout.addComponent(footer);

    window.setContent(windowLayout);
    return window;
}

From source file:dhbw.clippinggorilla.userinterface.windows.RegisterWindow.java

public RegisterWindow() {
    setModal(true);/* ww w .  j ava2s  . c  om*/
    setResizable(false);
    setDraggable(false);
    setCaption(Language.get(Word.REGISTER));
    addCloseShortcut(KeyCode.ENTER, null);

    Button save = new Button(Language.get(Word.REGISTER));

    VerticalLayout windowLayout = new VerticalLayout();
    windowLayout.setMargin(false);
    windowLayout.setSizeUndefined();

    FormLayout forms = new FormLayout();
    forms.setMargin(true);
    forms.setSizeUndefined();

    TextField firstName = new TextField(Language.get(Word.FIRST_NAME));
    firstName.focus();
    firstName.setMaxLength(20);
    firstName.addValueChangeListener(event -> {
        String firstNameError = UserUtils.checkName(event.getValue());
        if (!firstNameError.isEmpty()) {
            firstName.setComponentError(new UserError(firstNameError, AbstractErrorMessage.ContentMode.HTML,
                    ErrorMessage.ErrorLevel.INFORMATION));
            VaadinUtils.infoNotification(firstNameError);
            save.setEnabled(setError(firstName, true));
        } else {
            firstName.setComponentError(null);
            boolean enabled = setError(firstName, false);
            save.setEnabled(enabled);
        }
    });
    forms.addComponent(firstName);

    TextField lastName = new TextField(Language.get(Word.LAST_NAME));
    lastName.setMaxLength(20);
    lastName.addValueChangeListener(event -> {
        String lastNameError = UserUtils.checkName(event.getValue());
        if (!lastNameError.isEmpty()) {
            lastName.setComponentError(new UserError(lastNameError, AbstractErrorMessage.ContentMode.HTML,
                    ErrorMessage.ErrorLevel.INFORMATION));
            VaadinUtils.infoNotification(lastNameError);
            save.setEnabled(setError(lastName, true));
        } else {
            lastName.setComponentError(null);
            save.setEnabled(setError(lastName, false));
        }
    });
    forms.addComponent(lastName);

    TextField userName = new TextField(Language.get(Word.USERNAME));
    userName.setMaxLength(20);
    userName.addValueChangeListener(event -> {
        String userNameError = UserUtils.checkUsername(event.getValue());
        if (!userNameError.isEmpty()) {
            userName.setComponentError(new UserError(userNameError, AbstractErrorMessage.ContentMode.HTML,
                    ErrorMessage.ErrorLevel.INFORMATION));
            VaadinUtils.infoNotification(userNameError);
            save.setEnabled(setError(userName, true));
        } else {
            userName.setComponentError(null);
            save.setEnabled(setError(userName, false));

        }
    });
    forms.addComponent(userName);

    TextField email1 = new TextField(Language.get(Word.EMAIL));
    email1.setMaxLength(256);
    email1.addValueChangeListener(event -> {
        String email1Error = UserUtils.checkEmail(event.getValue().toLowerCase());
        if (!email1Error.isEmpty()) {
            email1.setComponentError(new UserError(email1Error, AbstractErrorMessage.ContentMode.HTML,
                    ErrorMessage.ErrorLevel.INFORMATION));
            VaadinUtils.infoNotification(email1Error);
            save.setEnabled(setError(email1, true));
        } else {
            email1.setComponentError(null);
            save.setEnabled(setError(email1, false));
        }
    });
    forms.addComponent(email1);

    TextField email2 = new TextField(Language.get(Word.EMAIL_AGAIN));
    email2.setMaxLength(256);
    email2.addValueChangeListener(event -> {
        String email2Error = UserUtils.checkEmail(event.getValue().toLowerCase())
                + UserUtils.checkSecondEmail(email1.getValue().toLowerCase(), event.getValue().toLowerCase());
        if (!email2Error.isEmpty()) {
            email2.setComponentError(new UserError(email2Error, AbstractErrorMessage.ContentMode.HTML,
                    ErrorMessage.ErrorLevel.INFORMATION));
            VaadinUtils.infoNotification(email2Error);
            save.setEnabled(setError(email2, true));
        } else {
            email2.setComponentError(null);
            save.setEnabled(setError(email2, false));
        }
    });
    forms.addComponent(email2);

    ProgressBar strength = new ProgressBar();

    PasswordField password1 = new PasswordField(Language.get(Word.PASSWORD));
    password1.setMaxLength(51);
    password1.addValueChangeListener(event -> {
        String password1Error = UserUtils.checkPassword(event.getValue());
        strength.setValue(UserUtils.calculatePasswordStrength(event.getValue()));
        if (!password1Error.isEmpty()) {
            password1.setComponentError(new UserError(password1Error, AbstractErrorMessage.ContentMode.HTML,
                    ErrorMessage.ErrorLevel.INFORMATION));
            VaadinUtils.infoNotification(password1Error);
            save.setEnabled(setError(password1, true));
        } else {
            password1.setComponentError(null);
            save.setEnabled(setError(password1, false));
        }

    });
    forms.addComponent(password1);

    strength.setWidth("184px");
    strength.setHeight("1px");
    forms.addComponent(strength);

    PasswordField password2 = new PasswordField(Language.get(Word.PASSWORD_AGAIN));
    password2.setMaxLength(51);
    password2.addValueChangeListener(event -> {
        String password2Error = UserUtils.checkPassword(event.getValue())
                + UserUtils.checkSecondPassword(password1.getValue(), event.getValue());
        if (!password2Error.isEmpty()) {
            password2.setComponentError(new UserError(password2Error, AbstractErrorMessage.ContentMode.HTML,
                    ErrorMessage.ErrorLevel.INFORMATION));
            VaadinUtils.infoNotification(password2Error);
            save.setEnabled(setError(password2, true));
        } else {
            password2.setComponentError(null);
            save.setEnabled(setError(password2, false));
        }
    });
    forms.addComponent(password2);

    GridLayout footer = new GridLayout(3, 1);
    footer.setSpacing(true);
    footer.setSizeUndefined();
    footer.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR);
    footer.setWidth(100.0f, Unit.PERCENTAGE);

    Label placeholder = new Label();

    Button cancel = new Button(Language.get(Word.CANCEL));
    cancel.setIcon(VaadinIcons.CLOSE);
    cancel.addClickListener(ce -> {
        close();
    });
    cancel.setClickShortcut(KeyCode.ESCAPE, null);

    save.setEnabled(false);
    save.setIcon(VaadinIcons.CHECK);
    save.addStyleName(ValoTheme.BUTTON_PRIMARY);
    save.addClickListener(ce -> {
        try {
            User user = UserUtils.registerUser(userName.getValue(), password1.getValue(), password2.getValue(),
                    email1.getValue().toLowerCase(), email2.getValue().toLowerCase(), firstName.getValue(),
                    lastName.getValue());
            UserUtils.setCurrentUser(user);
            close();
            UI.getCurrent().addWindow(ActivateWindow.get());
        } catch (UserCreationException ex) {
            Log.error("Registration failed", ex);
            VaadinUtils.errorNotification(Language.get(Word.REG_FAILED));
        }
    });
    save.setClickShortcut(KeyCode.ENTER, null);

    footer.addComponents(placeholder, cancel, save);
    footer.setColumnExpandRatio(0, 1);//ExpandRatio(placeholder, 1);
    footer.setComponentAlignment(cancel, Alignment.MIDDLE_CENTER);
    footer.setComponentAlignment(save, Alignment.MIDDLE_CENTER);

    windowLayout.addComponent(forms);
    windowLayout.addComponent(footer);

    setContent(windowLayout);
}

From source file:dhbw.ka.mwi.businesshorizon2.ui.initialscreen.projectlist.ProjectListViewImpl.java

License:Open Source License

/**
 * Zeige das Projekt-Hinzufuegen-Dialogfenster, bei dem ein Eingabefeld fuer
 * den Namen des Projekts und ein Hinzfuege-Button vorhanden ist. Funktion
 * bei geklicktem Button siehe Clicklistener in dieser Klasse. Das
 * horizontale Layout zur Darstellung besitzt ein Formlayout und den Button,
 * die nebeneinander dargestellt werden.
 * /*w  w  w.j  av a  2 s . co m*/
 * @author Christian Scherer, Mirko Gpfrich
 */
@Override
public void showAddProjectDialog() {
    addDialog = new Window("Projekt hinzufgen");
    addDialog.setModal(true);
    addDialog.setWidth(410, UNITS_PIXELS);
    addDialog.setResizable(false);
    addDialog.setDraggable(false);

    VerticalLayout layout = new VerticalLayout();
    layout.setSpacing(false);

    FormLayout formLayout = new FormLayout();
    formLayout.setMargin(true);
    formLayout.setSpacing(true);

    //TextFeld fr Name dem Formular hinzufgen
    tfName = new TextField("Name whlen:");
    tfName.setRequired(true);
    tfName.addValidator(new StringLengthValidator("Der Projektname muss zwischen 2 und 20 Zeichen lang sein.",
            2, 20, false));
    tfName.setRequiredError("Pflichtfeld");
    tfName.setSizeFull();
    formLayout.addComponent(tfName);

    //TextArea fr Beschreibung dem Formular hinzufgen
    taDescription = new TextArea("Beschreibung whlen");
    taDescription.setSizeFull();
    formLayout.addComponent(taDescription);

    //Formular dem Layout hinzufgen
    layout.addComponent(formLayout);

    //Hinzufge-Button erstllen und dem Layout hinzufgen
    dialogAddBtn = new Button("Hinzufgen", this);
    layout.addComponent(dialogAddBtn);

    //Layout dem Dialog-Fenster hinzufgen
    addDialog.addComponent(layout);

    //Dialog dem Hauptfenster hinzufgen
    getWindow().addWindow(addDialog);
    logger.debug("Hinzufuege-Dialog erzeugt");
}

From source file:dhbw.ka.mwi.businesshorizon2.ui.initialscreen.projectlist.ProjectListViewImpl.java

License:Open Source License

/**Methode zur Implementierung des Dialogfensters fr Projekt-nderungen.
 * /* w w  w  . ja v  a2  s  .  c o  m*/
 */
@Override
public void showEditProjectDialog(Project project) {
    editDialog = new Window("Projekt bearbeiten");
    editDialog.setModal(true);
    editDialog.setWidth(410, UNITS_PIXELS);
    editDialog.setResizable(false);
    editDialog.setDraggable(false);

    VerticalLayout layout = new VerticalLayout();
    layout.setSpacing(true);

    FormLayout formLayout = new FormLayout();
    formLayout.setMargin(true);
    formLayout.setSpacing(true);

    //TextFeld fr Name dem Formular hinzufgen
    tfName = new TextField("Name ndern:", project.getName());
    tfName.setRequired(true);
    tfName.addValidator(new StringLengthValidator("Der Projektname muss zwischen 2 und 20 Zeichen lang sein.",
            2, 20, false));
    tfName.setRequiredError("Pflichtfeld");
    tfName.setSizeFull();
    formLayout.addComponent(tfName);

    //TextArea fr Beschreibung dem Formular hinzufgen
    taDescription = new TextArea("Beschreibung ndern:", project.getDescription());
    taDescription.setSizeFull();
    formLayout.addComponent(taDescription);

    //Formular dem Layout hinzufgen
    layout.addComponent(formLayout);

    //Speichern-Button erstllen und dem Layout hinzufgen
    //TODO: ist das korrekt? Gute Frage, I have no idea what u r doing
    dialogEditBtn = new Button("Speichern");
    layout.addComponent(dialogEditBtn);

    dialogEditBtn.addListener(new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {

            if (tfName.isValid()) {
                boolean succed = presenter.editProject(projects.get(indexEditBtn), (String) tfName.getValue(),
                        (String) taDescription.getValue());
                if (succed) {
                    getWindow().removeWindow(editDialog);
                    logger.debug("Projekt-bearbeiten Dialog geschlossen");

                }

            } else {
                getWindow().showNotification("",
                        "Projektname ist ein Pflichtfeld. Bitte geben Sie einen Projektnamen an",
                        Notification.TYPE_ERROR_MESSAGE);
            }
        }
    });

    //Layout dem Dialog-Fenster hinzufgen
    editDialog.addComponent(layout);

    //Dialog dem Hauptfenster hinzufgen
    getWindow().addWindow(editDialog);
    logger.debug("Bearbeiten-Dialog erzeugt");

}

From source file:dhbw.ka.mwi.businesshorizon2.ui.process.scenario.ScenarioViewImpl.java

License:Open Source License

/**
 * Die Methode fuegt der View ein Szenario hinzu. Sie baut hierzu saemtliche
 * notwendigen GUI-Elemente und entsprecheenden Listener hinzu.
 * //from w w w.  j  a  va  2  s.  c o  m
 * @author Julius Hacker
 * @param rateReturnEquity Standardwert fuer die Renditeforderung Eigenkapital
 * @param rateReturnCapitalStock Standardwert fuer die Renditeforderung Fremdkapital
 * @param businessTax Standardwert fuer die Gewerbesteuer
 * @param corporateAndSolitaryTax Standardwert fuer die Koerperschaftssteuer mit Solidaritaetszuschlag.
 */
@Override
public void addScenario(String rateReturnEquity, String rateReturnCapitalStock, String corporateAndSolitaryTax,
        String businessTax, boolean isIncludeInCalculation, final int number) {
    HashMap<String, AbstractComponent> scenarioComponents = new HashMap<String, AbstractComponent>();

    Property.ValueChangeListener changeListener = new Property.ValueChangeListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            presenter.updateScenario(number);
            logger.debug("TextChange ausgeloest");
            logger.debug("ChangeListener " + System.identityHashCode(this));
        }
    };

    HorizontalLayout hlScenario = new HorizontalLayout();
    hlScenario.setSizeFull();

    FormLayout formLeft = new FormLayout();
    FormLayout formRight = new FormLayout();
    hlScenario.addComponent(formLeft);
    //hlScenario.addComponent(formRight);

    final Label scenarioName = new Label("<strong>Szenario " + number + "</strong>");
    scenarioName.setContentMode(Label.CONTENT_XHTML);
    scenarioComponents.put("label", scenarioName);
    formLeft.addComponent(scenarioName);
    scenarioName.setWidth(Sizeable.SIZE_UNDEFINED, 0);

    final CheckBox cbBerechnungEinbezug = new CheckBox("In Berechnung einbeziehen");
    cbBerechnungEinbezug.setValue(isIncludeInCalculation);
    cbBerechnungEinbezug.setImmediate(true);
    cbBerechnungEinbezug.addListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            presenter.updateScenario(number);
            logger.debug("ChangeListener " + System.identityHashCode(this));
        }

    });
    scenarioComponents.put("isIncludeInCalculation", cbBerechnungEinbezug);
    formLeft.addComponent(cbBerechnungEinbezug);

    final TextField tfEigenkapital = new TextField("Renditeforderung Eigenkapital: ");
    if (!"0.0".equals(rateReturnEquity)) {
        tfEigenkapital.setValue(rateReturnEquity);
    }
    tfEigenkapital.setImmediate(true);
    tfEigenkapital.addListener(changeListener);
    scenarioComponents.put("rateReturnEquity", tfEigenkapital);
    formLeft.addComponent(tfEigenkapital);

    final TextField tfFremdkapital = new TextField("Renditeforderung Fremdkapital: ");
    if (!"0.0".equals(rateReturnCapitalStock)) {
        tfFremdkapital.setValue(rateReturnCapitalStock);
    }
    tfFremdkapital.setImmediate(true);
    tfFremdkapital.addListener(changeListener);
    scenarioComponents.put("rateReturnCapitalStock", tfFremdkapital);
    formLeft.addComponent(tfFremdkapital);

    final TextField tfGewerbesteuer = new TextField("Gewerbesteuer: ");
    if (!"0.0".equals(businessTax)) {
        tfGewerbesteuer.setValue(businessTax);
    }
    tfGewerbesteuer.setImmediate(true);
    tfGewerbesteuer.addListener(changeListener);
    scenarioComponents.put("businessTax", tfGewerbesteuer);
    formLeft.addComponent(tfGewerbesteuer);

    final TextField tfKoerperschaftssteuer = new TextField(
            "K\u00F6rperschaftssteuer mit Solidarit\u00E4tszuschlag: ");
    if (!"0.0".equals(corporateAndSolitaryTax)) {
        tfKoerperschaftssteuer.setValue(corporateAndSolitaryTax);
    }
    tfKoerperschaftssteuer.setImmediate(true);
    tfKoerperschaftssteuer.addListener(changeListener);
    scenarioComponents.put("corporateAndSolitaryTax", tfKoerperschaftssteuer);
    formLeft.addComponent(tfKoerperschaftssteuer);

    final Button removeScenario = new Button("Szenario entfernen");
    removeScenario.addListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            presenter.removeScenario(number);
        }

    });
    formLeft.addComponent(removeScenario);

    formLeft.setWidth(Sizeable.SIZE_UNDEFINED, 0);
    formLeft.setWidth(Sizeable.SIZE_UNDEFINED, 0);

    scenarioComponents.put("scenario", hlScenario);

    this.scenarios.add(scenarioComponents);
    this.vlScenarios.addComponent(hlScenario);
}