Example usage for com.vaadin.ui FormLayout addStyleName

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

Introduction

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

Prototype

@Override
    public void addStyleName(String style) 

Source Link

Usage

From source file:com.cavisson.gui.dashboard.components.controls.Forms.java

License:Apache License

public Forms() {
    setSpacing(true);//from   ww  w. j a v a 2s  .c o m
    setMargin(true);

    Label title = new Label("Forms");
    title.addStyleName("h1");
    addComponent(title);

    final FormLayout form = new FormLayout();
    form.setMargin(false);
    form.setWidth("800px");
    form.addStyleName("light");
    addComponent(form);

    Label section = new Label("Personal Info");
    section.addStyleName("h2");
    section.addStyleName("colored");
    form.addComponent(section);
    StringGenerator sg = new StringGenerator();

    TextField name = new TextField("Name");
    name.setValue(sg.nextString(true) + " " + sg.nextString(true));
    name.setWidth("50%");
    form.addComponent(name);

    DateField birthday = new DateField("Birthday");
    birthday.setValue(new Date(80, 0, 31));
    form.addComponent(birthday);

    TextField username = new TextField("Username");
    username.setValue(sg.nextString(false) + sg.nextString(false));
    username.setRequired(true);
    form.addComponent(username);

    OptionGroup sex = new OptionGroup("Sex");
    sex.addItem("Female");
    sex.addItem("Male");
    sex.select("Male");
    sex.addStyleName("horizontal");
    form.addComponent(sex);

    section = new Label("Contact Info");
    section.addStyleName("h3");
    section.addStyleName("colored");
    form.addComponent(section);

    TextField email = new TextField("Email");
    email.setValue(sg.nextString(false) + "@" + sg.nextString(false) + ".com");
    email.setWidth("50%");
    email.setRequired(true);
    form.addComponent(email);

    TextField location = new TextField("Location");
    location.setValue(sg.nextString(true) + ", " + sg.nextString(true));
    location.setWidth("50%");
    location.setComponentError(new UserError("This address doesn't exist"));
    form.addComponent(location);

    TextField phone = new TextField("Phone");
    phone.setWidth("50%");
    form.addComponent(phone);

    HorizontalLayout wrap = new HorizontalLayout();
    wrap.setSpacing(true);
    wrap.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    wrap.setCaption("Newsletter");
    CheckBox newsletter = new CheckBox("Subscribe to newsletter", true);
    wrap.addComponent(newsletter);

    ComboBox period = new ComboBox();
    period.setTextInputAllowed(false);
    period.addItem("Daily");
    period.addItem("Weekly");
    period.addItem("Montly");
    period.setNullSelectionAllowed(false);
    period.select("Weekly");
    period.addStyleName("small");
    period.setWidth("10em");
    wrap.addComponent(period);
    form.addComponent(wrap);

    section = new Label("Additional Info");
    section.addStyleName("h4");
    section.addStyleName("colored");
    form.addComponent(section);

    TextField website = new TextField("Website");
    website.setInputPrompt("http://");
    website.setWidth("100%");
    form.addComponent(website);

    TextArea shortbio = new TextArea("Short Bio");
    shortbio.setValue(
            "Quis aute iure reprehenderit in voluptate velit esse. Cras mattis iudicium purus sit amet fermentum.");
    shortbio.setWidth("100%");
    shortbio.setRows(2);
    form.addComponent(shortbio);

    final RichTextArea bio = new RichTextArea("Bio");
    bio.setWidth("100%");
    bio.setValue(
            "<div><p><span>Integer legentibus erat a ante historiarum dapibus.</span> <span>Vivamus sagittis lacus vel augue laoreet rutrum faucibus.</span> <span>A communi observantia non est recedendum.</span> <span>Morbi fringilla convallis sapien, id pulvinar odio volutpat.</span> <span>Ab illo tempore, ab est sed immemorabili.</span> <span>Quam temere in vitiis, legem sancimus haerentia.</span></p><p><span>Morbi odio eros, volutpat ut pharetra vitae, lobortis sed nibh.</span> <span>Quam diu etiam furor iste tuus nos eludet?</span> <span>Cum sociis natoque penatibus et magnis dis parturient.</span> <span>Quam diu etiam furor iste tuus nos eludet?</span> <span>Tityre, tu patulae recubans sub tegmine fagi  dolor.</span></p><p><span>Curabitur blandit tempus ardua ridiculus sed magna.</span> <span>Phasellus laoreet lorem vel dolor tempus vehicula.</span> <span>Etiam habebis sem dicantur magna mollis euismod.</span> <span>Hi omnes lingua, institutis, legibus inter se differunt.</span></p></div>");
    form.addComponent(bio);

    form.setReadOnly(true);
    bio.setReadOnly(true);

    Button edit = new Button("Edit", new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            boolean readOnly = form.isReadOnly();
            if (readOnly) {
                bio.setReadOnly(false);
                form.setReadOnly(false);
                form.removeStyleName("light");
                event.getButton().setCaption("Save");
                event.getButton().addStyleName("primary");
            } else {
                bio.setReadOnly(true);
                form.setReadOnly(true);
                form.addStyleName("light");
                event.getButton().setCaption("Edit");
                event.getButton().removeStyleName("primary");
            }
        }
    });

    HorizontalLayout footer = new HorizontalLayout();
    footer.setMargin(new MarginInfo(true, false, true, false));
    footer.setSpacing(true);
    footer.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    form.addComponent(footer);
    footer.addComponent(edit);

    Label lastModified = new Label("Last modified by you a minute ago");
    lastModified.addStyleName("light");
    footer.addComponent(lastModified);
}

From source file:com.etest.valo.Forms.java

License:Apache License

public Forms() {
    setSpacing(true);//from   w  w w  .jav  a 2  s.c  o m
    setMargin(true);

    Label title = new Label("Forms");
    title.addStyleName("h1");
    addComponent(title);

    final FormLayout form = new FormLayout();
    form.setMargin(false);
    form.setWidth("800px");
    form.addStyleName("light");
    addComponent(form);

    Label section = new Label("Personal Info");
    section.addStyleName("h2");
    section.addStyleName("colored");
    form.addComponent(section);
    StringGenerator sg = new StringGenerator();

    TextField name = new TextField("Name");
    name.setValue(sg.nextString(true) + " " + sg.nextString(true));
    name.setWidth("50%");
    form.addComponent(name);

    DateField birthday = new DateField("Birthday");
    birthday.setValue(new Date(80, 0, 31));
    form.addComponent(birthday);

    TextField username = new TextField("Username");
    username.setValue(sg.nextString(false) + sg.nextString(false));
    username.setRequired(true);
    form.addComponent(username);

    OptionGroup sex = new OptionGroup("Sex");
    sex.addItem("Female");
    sex.addItem("Male");
    sex.select("Male");
    sex.addStyleName("horizontal");
    form.addComponent(sex);

    section = new Label("Contact Info");
    section.addStyleName("h3");
    section.addStyleName("colored");
    form.addComponent(section);

    TextField email = new TextField("Email");
    email.setValue(sg.nextString(false) + "@" + sg.nextString(false) + ".com");
    email.setWidth("50%");
    email.setRequired(true);
    form.addComponent(email);

    TextField location = new TextField("Location");
    location.setValue(sg.nextString(true) + ", " + sg.nextString(true));
    location.setWidth("50%");
    location.setComponentError(new UserError("This address doesn't exist"));
    form.addComponent(location);

    TextField phone = new TextField("Phone");
    phone.setWidth("50%");
    form.addComponent(phone);

    HorizontalLayout wrap = new HorizontalLayout();
    wrap.setSpacing(true);
    wrap.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    wrap.setCaption("Newsletter");
    CheckBox newsletter = new CheckBox("Subscribe to newsletter", true);
    wrap.addComponent(newsletter);

    ComboBox period = new ComboBox();
    period.setTextInputAllowed(false);
    period.addItem("Daily");
    period.addItem("Weekly");
    period.addItem("Monthly");
    period.setNullSelectionAllowed(false);
    period.select("Weekly");
    period.addStyleName("small");
    period.setWidth("10em");
    wrap.addComponent(period);
    form.addComponent(wrap);

    section = new Label("Additional Info");
    section.addStyleName("h4");
    section.addStyleName("colored");
    form.addComponent(section);

    TextField website = new TextField("Website");
    website.setInputPrompt("http://");
    website.setWidth("100%");
    form.addComponent(website);

    TextArea shortbio = new TextArea("Short Bio");
    shortbio.setValue(
            "Quis aute iure reprehenderit in voluptate velit esse. Cras mattis iudicium purus sit amet fermentum.");
    shortbio.setWidth("100%");
    shortbio.setRows(2);
    form.addComponent(shortbio);

    final RichTextArea bio = new RichTextArea("Bio");
    bio.setWidth("100%");
    bio.setValue(
            "<div><p><span>Integer legentibus erat a ante historiarum dapibus.</span> <span>Vivamus sagittis lacus vel augue laoreet rutrum faucibus.</span> <span>A communi observantia non est recedendum.</span> <span>Morbi fringilla convallis sapien, id pulvinar odio volutpat.</span> <span>Ab illo tempore, ab est sed immemorabili.</span> <span>Quam temere in vitiis, legem sancimus haerentia.</span></p><p><span>Morbi odio eros, volutpat ut pharetra vitae, lobortis sed nibh.</span> <span>Quam diu etiam furor iste tuus nos eludet?</span> <span>Cum sociis natoque penatibus et magnis dis parturient.</span> <span>Quam diu etiam furor iste tuus nos eludet?</span> <span>Tityre, tu patulae recubans sub tegmine fagi  dolor.</span></p><p><span>Curabitur blandit tempus ardua ridiculus sed magna.</span> <span>Phasellus laoreet lorem vel dolor tempus vehicula.</span> <span>Etiam habebis sem dicantur magna mollis euismod.</span> <span>Hi omnes lingua, institutis, legibus inter se differunt.</span></p></div>");
    form.addComponent(bio);

    form.setReadOnly(true);
    bio.setReadOnly(true);

    Button edit = new Button("Edit", new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            boolean readOnly = form.isReadOnly();
            if (readOnly) {
                bio.setReadOnly(false);
                form.setReadOnly(false);
                form.removeStyleName("light");
                event.getButton().setCaption("Save");
                event.getButton().addStyleName("primary");
            } else {
                bio.setReadOnly(true);
                form.setReadOnly(true);
                form.addStyleName("light");
                event.getButton().setCaption("Edit");
                event.getButton().removeStyleName("primary");
            }
        }
    });

    HorizontalLayout footer = new HorizontalLayout();
    footer.setMargin(new MarginInfo(true, false, true, false));
    footer.setSpacing(true);
    footer.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    form.addComponent(footer);
    footer.addComponent(edit);

    Label lastModified = new Label("Last modified by you a minute ago");
    lastModified.addStyleName("light");
    footer.addComponent(lastModified);
}

From source file:com.hivesys.dashboard.view.preferences.PreferencesView.java

License:Apache License

public PreferencesView() {

    user = (User) VaadinSession.getCurrent().getAttribute(User.class.getName());

    setSpacing(true);/*from   w  ww  .jav a  2  s . c o  m*/
    setMargin(true);

    Label title = new Label("Forms");
    title.addStyleName("h1");
    addComponent(title);

    final FormLayout form = new FormLayout();
    form.setMargin(false);
    form.setWidth("800px");
    form.addStyleName("light");
    addComponent(form);

    Label section = new Label("Personal Info");
    section.addStyleName("h2");
    section.addStyleName("colored");
    form.addComponent(section);

    firstNameField = new TextField("First Name");
    firstNameField.setWidth("50%");
    form.addComponent(firstNameField);

    lastNameField = new TextField("Last Name");
    lastNameField.setWidth("50%");
    form.addComponent(lastNameField);

    titleField = new ComboBox("Title");
    titleField.setInputPrompt("Please specify");
    titleField.addItem("Mr.");
    titleField.addItem("Mrs.");
    titleField.addItem("Ms.");
    titleField.setNewItemsAllowed(true);
    form.addComponent(titleField);

    usernameField = new TextField("Username");
    usernameField.setRequired(true);
    form.addComponent(usernameField);

    sexField = new OptionGroup("Sex");
    sexField.addItem(Boolean.FALSE);
    sexField.setItemCaption(Boolean.FALSE, "Female");
    sexField.addItem(Boolean.TRUE);
    sexField.setItemCaption(Boolean.TRUE, "Male");
    sexField.addStyleName("horizontal");
    form.addComponent(sexField);

    section = new Label("Contact Info");
    section.addStyleName("h3");
    section.addStyleName("colored");
    form.addComponent(section);

    emailField = new TextField("Email");
    emailField.setWidth("50%");
    emailField.setRequired(true);
    form.addComponent(emailField);

    locationField = new TextField("Location");
    locationField.setWidth("50%");
    locationField.setNullRepresentation("");
    form.addComponent(locationField);

    phoneField = new TextField("Phone");
    phoneField.setWidth("50%");
    phoneField.setNullRepresentation("");
    form.addComponent(phoneField);

    section = new Label("Additional Info");
    section.addStyleName("h4");
    section.addStyleName("colored");
    form.addComponent(section);

    websiteField = new TextField("Website");
    websiteField.setInputPrompt("http://");
    websiteField.setWidth("100%");
    form.addComponent(websiteField);

    bioField = new RichTextArea("Bio");
    bioField.setWidth("100%");
    bioField.setValue(
            "<div><p><span>Integer legentibus erat a ante historiarum dapibus.</span> <span>Vivamus sagittis lacus vel augue laoreet rutrum faucibus.</span> <span>A communi observantia non est recedendum.</span> <span>Morbi fringilla convallis sapien, id pulvinar odio volutpat.</span> <span>Ab illo tempore, ab est sed immemorabili.</span> <span>Quam temere in vitiis, legem sancimus haerentia.</span></p><p><span>Morbi odio eros, volutpat ut pharetra vitae, lobortis sed nibh.</span> <span>Quam diu etiam furor iste tuus nos eludet?</span> <span>Cum sociis natoque penatibus et magnis dis parturient.</span> <span>Quam diu etiam furor iste tuus nos eludet?</span> <span>Tityre, tu patulae recubans sub tegmine fagi  dolor.</span></p><p><span>Curabitur blandit tempus ardua ridiculus sed magna.</span> <span>Phasellus laoreet lorem vel dolor tempus vehicula.</span> <span>Etiam habebis sem dicantur magna mollis euismod.</span> <span>Hi omnes lingua, institutis, legibus inter se differunt.</span></p></div>");
    form.addComponent(bioField);

    Button edit = new Button("Edit", new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            boolean readOnly = form.isReadOnly();
            if (readOnly) {
                bioField.setReadOnly(false);
                form.setReadOnly(false);
                form.removeStyleName("light");
                event.getButton().setCaption("Save");
                event.getButton().addStyleName("primary");
            } else {
                bioField.setReadOnly(true);
                form.setReadOnly(true);
                form.addStyleName("light");
                event.getButton().setCaption("Edit");
                event.getButton().removeStyleName("primary");
            }
        }
    });

    HorizontalLayout footer = new HorizontalLayout();
    footer.setMargin(new MarginInfo(true, false, true, false));
    footer.setSpacing(true);
    footer.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    form.addComponent(footer);
    footer.addComponent(edit);

    Label lastModified = new Label("Last modified by you a minute ago");
    lastModified.addStyleName("light");
    footer.addComponent(lastModified);

    fieldGroup = new BeanFieldGroup<>(User.class);
    fieldGroup.bindMemberFields(this);
    fieldGroup.setItemDataSource(user);

    form.setReadOnly(true);
    bioField.setReadOnly(true);

}

From source file:com.mcparland.john.vaadin_mvn_arch.samples.authentication.LoginScreen.java

License:Apache License

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

    loginForm.addStyleName("login-form");
    loginForm.setSizeUndefined();//from w  ww .j  a v a2 s .c  o  m
    loginForm.setMargin(false);

    loginForm.addComponent(username = new TextField("Username", "admin"));
    username.setWidth(15, Unit.EM);
    loginForm.addComponent(password = new PasswordField("Password"));
    password.setWidth(15, Unit.EM);
    password.setDescription("Write anything");
    CssLayout buttons = new CssLayout();
    buttons.setStyleName("buttons");
    loginForm.addComponent(buttons);

    buttons.addComponent(login = new Button("Login"));
    login.setDisableOnClick(true);
    login.addClickListener(new Button.ClickListener() {
        /**
         * The serialVersionUID.
         */
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            try {
                login();
            } finally {
                login.setEnabled(true);
            }
        }
    });
    login.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    login.addStyleName(ValoTheme.BUTTON_FRIENDLY);

    buttons.addComponent(forgotPassword = new Button("Forgot password?"));
    forgotPassword.addClickListener(new Button.ClickListener() {
        /**
         * The serialVersionUID.
         */
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            showNotification(new Notification("Hint: Try anything"));
        }
    });
    forgotPassword.addStyleName(ValoTheme.BUTTON_LINK);
    return loginForm;
}

From source file:com.naoset.framework.frontend.component.profile.CustomerPanelView.java

private Component builtData() {
    FormLayout details = new FormLayout();
    details.addStyleName(ValoTheme.FORMLAYOUT_LIGHT);

    code = new TextField("First Name");
    details.addComponent(code);//  w  w w  .j a va 2 s.c  om
    name = new TextField("Last Name");
    details.addComponent(name);

    sexField = new OptionGroup("Sex");
    sexField.addItem(Boolean.FALSE);
    sexField.setItemCaption(Boolean.FALSE, "Female");
    sexField.addItem(Boolean.TRUE);
    sexField.setItemCaption(Boolean.TRUE, "Male");
    sexField.addStyleName("horizontal");
    details.addComponent(sexField);

    //        Label section = new Label("Contact Info");
    //        section.addStyleName(ValoTheme.LABEL_H4);
    //        section.addStyleName(ValoTheme.LABEL_COLORED);
    //        details.addComponent(section);

    emailField = new TextField("Email");
    emailField.setWidth("100%");
    emailField.setRequired(true);
    emailField.setNullRepresentation("");
    details.addComponent(emailField);

    locationField = new TextField("Direccin");
    locationField.setWidth("100%");
    locationField.setNullRepresentation("");
    locationField.setComponentError(new UserError("This address doesn't exist"));
    details.addComponent(locationField);

    phoneField = new TextField("Telefono");
    phoneField.setWidth("100%");
    phoneField.setNullRepresentation("");
    details.addComponent(phoneField);

    details.addComponent(buildSpecies());

    return details;
}

From source file:com.save.employee.maintenance.MRFormWindow.java

void viewForm(FormLayout form) {
    if (isViewable()) {
        actionButton.setVisible(false);//from   w  w  w. j a  v a 2 s  . co m
        mr = mrs.getMaintenanceReimbursementById(getMrId());
        formType.setValue(mr.getFormType());
        formType.setEnabled(false);
        area.setValue(mr.getAreaId());
        area.setEnabled(false);
        plateNo.setValue(mr.getPlateNo());
        plateNo.setEnabled(false);
        dateCovered.setValue(mr.getDateCovered());
        dateCovered.setEnabled(false);
        amount.setValue(String.valueOf(mr.getAmount()));
        amount.setEnabled(false);
        description.setValue(mr.getDescription());
        description.setEnabled(false);

        form.setReadOnly(true);
        form.addStyleName("light");
    }
}

From source file:com.save.employee.request.ViewRLWindow.java

FormLayout buildFormLayout() {
    FormLayout f = new FormLayout();
    f.setWidth("100%");
    f.setMargin(true);// ww w  . j av a  2  s  . co m

    LiquidationForm lf = rls.getRLById(getRequestId());

    controlNo = new TextField("Control No.");
    controlNo.setWidth("100%");
    controlNo.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    controlNo.setValue(String.valueOf(lf.getControlNo()));
    controlNo.setEnabled(false);
    f.addComponent(controlNo);

    dateOfActivity = new DateField("Date of Activity: ");
    dateOfActivity.setWidth("100%");
    dateOfActivity.addStyleName(ValoTheme.DATEFIELD_SMALL);
    dateOfActivity.setValue(lf.getDateOfActivity());
    dateOfActivity.setEnabled(false);
    f.addComponent(dateOfActivity);

    area = CommonComboBox.areas();
    area.setWidth("100%");
    area.setValue(lf.getAreaId());
    area.setEnabled(false);
    f.addComponent(area);

    activity = new TextField("Activity: ");
    activity.setWidth("100%");
    activity.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    activity.setValue(lf.getActivity());
    activity.setEnabled(false);
    f.addComponent(activity);

    venue = new TextField("Venue: ");
    venue.setWidth("100%");
    venue.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    venue.setValue(lf.getVenue());
    venue.setEnabled(false);
    f.addComponent(venue);

    requirements = new TextArea("Requirements: ");
    requirements.setWidth("100%");
    requirements.addStyleName(ValoTheme.TEXTAREA_SMALL);
    requirements.setValue(lf.getRequirements());
    requirements.setEnabled(false);
    f.addComponent(requirements);

    HorizontalLayout h1 = new HorizontalLayout();
    h1.setWidth("100%");
    h1.setCaption("Request Lodging");
    h1.addStyleName("light");
    //        h1.setReadOnly(true);

    requestLodgingPax = new TextField();
    requestLodgingPax.setWidth("100%");
    requestLodgingPax.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    requestLodgingPax.addStyleName("align-right");
    requestLodgingPax.setValue("Pax: " + String.valueOf(lf.getLodgingPax()));
    requestLodgingPax.setEnabled(false);
    h1.addComponent(requestLodgingPax);

    requestLodgingBudget = new TextField();
    requestLodgingBudget.setWidth("100%");
    requestLodgingBudget.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    requestLodgingBudget.addStyleName("align-right");
    requestLodgingBudget.setValue("Budget: " + String.valueOf(lf.getLodgingBudget()));
    requestLodgingBudget.setEnabled(false);
    h1.addComponent(requestLodgingBudget);

    requestLodgingAmount = new TextField();
    requestLodgingAmount.setWidth("100%");
    requestLodgingAmount.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    requestLodgingAmount.addStyleName("align-right");
    requestLodgingAmount.setValue("Amount: " + String.valueOf(lf.getLodgingAmount()));
    requestLodgingAmount.setEnabled(false);
    h1.addComponent(requestLodgingAmount);

    f.addComponent(h1);
    f.setComponentAlignment(h1, Alignment.MIDDLE_LEFT);

    HorizontalLayout h2 = new HorizontalLayout();
    h2.setWidth("100%");
    h2.setCaption("Request Meals");
    //        h2.setReadOnly(true);

    requestMealsPax = new TextField();
    requestMealsPax.setWidth("100%");
    requestMealsPax.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    requestMealsPax.addStyleName("align-right");
    requestMealsPax.setValue("Pax: " + String.valueOf(lf.getMealsPax()));
    requestMealsPax.setEnabled(false);
    h2.addComponent(requestMealsPax);

    requestMealsBudget = new TextField();
    requestMealsBudget.setWidth("100%");
    requestMealsBudget.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    requestMealsBudget.addStyleName("align-right");
    requestMealsBudget.setValue("Budget: " + String.valueOf(lf.getMealsBudget()));
    requestMealsBudget.setEnabled(false);
    h2.addComponent(requestMealsBudget);

    requestMealsAmount = new TextField();
    requestMealsAmount.setWidth("100%");
    requestMealsAmount.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    requestMealsAmount.addStyleName("align-right");
    requestMealsAmount.setValue("Amount: " + String.valueOf(lf.getMealsAmount()));
    requestMealsAmount.setEnabled(false);
    h2.addComponent(requestMealsAmount);

    f.addComponent(h2);
    f.setComponentAlignment(h2, Alignment.MIDDLE_LEFT);

    HorizontalLayout h3 = new HorizontalLayout();
    h3.setWidth("100%");
    h3.setCaption("Liquidated Lodging");
    //        h3.setReadOnly(true);

    liquidateLodgingPax = new TextField();
    liquidateLodgingPax.setWidth("100%");
    liquidateLodgingPax.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    liquidateLodgingPax.addStyleName("align-right");
    liquidateLodgingPax.setValue("Pax: " + String.valueOf(lf.getLiquidationLodgingPax()));
    liquidateLodgingPax.setEnabled(false);
    h3.addComponent(liquidateLodgingPax);

    liquidateLodgingBudget = new TextField();
    liquidateLodgingBudget.setWidth("100%");
    liquidateLodgingBudget.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    liquidateLodgingBudget.addStyleName("align-right");
    liquidateLodgingBudget.setValue("Budget: " + String.valueOf(lf.getLiquidationLodgingBudget()));
    liquidateLodgingBudget.setEnabled(false);
    h3.addComponent(liquidateLodgingBudget);

    liquidateLodgingAmount = new TextField();
    liquidateLodgingAmount.setWidth("100%");
    liquidateLodgingAmount.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    liquidateLodgingAmount.addStyleName("align-right");
    liquidateLodgingAmount.setValue("Amount: " + String.valueOf(lf.getLiquidationLodgingAmount()));
    liquidateLodgingAmount.setEnabled(false);
    h3.addComponent(liquidateLodgingAmount);

    f.addComponent(h3);
    f.setComponentAlignment(h3, Alignment.MIDDLE_LEFT);

    HorizontalLayout h4 = new HorizontalLayout();
    h4.setWidth("100%");
    h4.setCaption("Liquidated Meals");
    h4.setReadOnly(true);

    liquidateMealsPax = new TextField();
    liquidateMealsPax.setWidth("100%");
    liquidateMealsPax.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    liquidateMealsPax.addStyleName("align-right");
    liquidateMealsPax.setValue("Pax: " + String.valueOf(lf.getLiquidationMealsPax()));
    liquidateMealsPax.setEnabled(false);
    h4.addComponent(liquidateMealsPax);

    liquidateMealsBudget = new TextField();
    liquidateMealsBudget.setWidth("100%");
    liquidateMealsBudget.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    liquidateMealsBudget.addStyleName("align-right");
    liquidateMealsBudget.setValue("Budget: " + String.valueOf(lf.getLiquidationMealsBudget()));
    liquidateMealsBudget.setEnabled(false);
    h4.addComponent(liquidateMealsBudget);

    liquidateMealsAmount = new TextField();
    liquidateMealsAmount.setWidth("100%");
    liquidateMealsAmount.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    liquidateMealsAmount.addStyleName("align-right");
    liquidateMealsAmount.setValue("Amount: " + String.valueOf(lf.getLiquidationMealsAmount()));
    liquidateMealsAmount.setEnabled(false);
    h4.addComponent(liquidateMealsAmount);

    f.addComponent(h4);
    f.setComponentAlignment(h4, Alignment.MIDDLE_LEFT);

    reimbursement = new TextField("Reimbursement: ");
    reimbursement.setWidth("50%");
    reimbursement.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    reimbursement.setValue(String.valueOf(lf.getReimbursedAmount()));
    reimbursement.setEnabled(false);
    f.addComponent(reimbursement);

    f.addStyleName("light");
    f.setReadOnly(true);

    return f;
}

From source file:de.fatalix.app.view.login.LoginView.java

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

    loginForm.addStyleName("login-form");
    loginForm.setSizeUndefined();/* ww  w. j  a  v  a  2 s. c om*/
    loginForm.setMargin(false);

    loginForm.addComponent(username = new TextField("Username", "admin"));
    username.setWidth(15, Unit.EM);
    loginForm.addComponent(password = new PasswordField("Password"));
    password.setWidth(15, Unit.EM);
    password.setDescription("Write anything");
    CssLayout buttons = new CssLayout();
    buttons.setStyleName("buttons");
    loginForm.addComponent(buttons);

    buttons.addComponent(login = new Button("Login"));
    login.setDisableOnClick(true);
    login.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            try {
                presenter.doLogin(username.getValue(), password.getValue());
            } catch (AuthenticationException ex) {
                LoginView.this.showNotification(
                        new Notification("Wrong login", Notification.Type.ERROR_MESSAGE),
                        ValoTheme.NOTIFICATION_FAILURE);
            } finally {
                login.setEnabled(true);
            }
        }
    });
    login.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    login.addStyleName(ValoTheme.BUTTON_FRIENDLY);

    buttons.addComponent(forgotPassword = new Button("Forgot password?"));
    forgotPassword.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            showNotification(new Notification("Hint: Try anything", Notification.Type.HUMANIZED_MESSAGE),
                    ValoTheme.NOTIFICATION_SUCCESS);
        }
    });
    forgotPassword.addStyleName(ValoTheme.BUTTON_LINK);
    return loginForm;
}

From source file:de.fatalix.bookery.view.admin.AppUserCard.java

License:Open Source License

private FormLayout createContent() {
    usernameField = new TextField("Username", "some.user");
    passwordField = new PasswordField("Password", "password");
    fullnameField = new TextField("Fullname", "Some User");
    eMailField = new TextField("EMail", "user@some.de");
    roles = new TextField("Roles", "user");

    FormLayout userCardContent = new FormLayout(usernameField, passwordField, fullnameField, eMailField, roles);
    userCardContent.addStyleName(ValoTheme.FORMLAYOUT_LIGHT);
    userCardContent.setMargin(true);/*w  ww .  j  ava2 s. c  om*/

    return userCardContent;
}

From source file:de.fatalix.bookery.view.admin.BatchJobCard.java

private FormLayout createContent() {
    batchJobTypeCombo = new ComboBox("Batch Type");
    for (BatchJobType type : BatchJobType.values()) {
        batchJobTypeCombo.addItem(type);
    }/*from   w  ww .j  av  a2  s. c  om*/
    batchJobTypeCombo.addValueChangeListener(new Property.ValueChangeListener() {

        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            if (!noUpdate) {
                BatchJobType newType = ((BatchJobType) batchJobTypeCombo.getValue());

                batchJobConfiguration.setValue(newType.getDefaultConfig());

                updateBean();
                setFields();
            }
        }
    });

    description = new Label("description");
    nextRuntime = new Label("---");
    batchJobActive = new CheckBox("active", false);
    cronjobExpression = new TextField("Cronjob", "*******");
    status = new TextField("Status", "-");
    batchJobConfiguration = new TextArea("Configuration");

    Button updateButton = new Button("update", new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            updateBean();
            jobConfig = presenter.updateBatchJob(jobConfig);
            setFields();
            logger.debug("Updated Batch Job...");
        }
    });
    updateButton.addStyleName(ValoTheme.BUTTON_FRIENDLY);

    FormLayout batchJobCardContent = new FormLayout(batchJobTypeCombo, description, cronjobExpression,
            batchJobActive, batchJobConfiguration, nextRuntime, status, updateButton);
    batchJobCardContent.addStyleName(ValoTheme.FORMLAYOUT_LIGHT);
    batchJobCardContent.setMargin(true);
    return batchJobCardContent;
}