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:com.concur.ui.WebApp.java

License:Apache License

private Window createWindow() {
    FormLayout fl = new FormLayout();

    //        final SessionGuard sg = new SessionGuard();
    //        sg.setKeepalive(true);
    //        fl.addComponent(sg);

    fl.setSizeFull();//  w  w w .  ja va2s.c  o  m
    fl.setMargin(true);
    fl.addComponent(new Label("<h2>ATS Tuple Store -- Demo App<h2/>", Label.CONTENT_XML));

    actionField = new NativeSelect("Action:");
    actionField.addItem("Authenticate");
    actionField.addItem("GetTuple");
    actionField.addItem("PutTuple");
    actionField.addItem("GetConfigurations");
    actionField.select("Authenticate");
    fl.addComponent(actionField);

    tokenField = new TextField("Authentication Token:");
    tokenField.setColumns(40);
    fl.addComponent(tokenField);

    tupleKeyField = new TextField("TupleKey:");
    tupleKeyField.setColumns(40);
    fl.addComponent(tupleKeyField);

    tupleDataArea = new TextArea("TupleData:");
    tupleDataArea.setColumns(40);
    tupleDataArea.setRows(5);
    fl.addComponent(tupleDataArea);

    Button b = new Button("Send Request");
    b.addListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            submit();
        }
    });

    fl.addComponent(b);

    final Window w = new Window("ATS Tuple Store -- DEMO");
    w.setContent(fl);
    return w;
}

From source file:com.demo.tutorial.agenda.ui.SearchView.java

public SearchView(final MyUI app) {
    this.app = app;

    setCaption("Buscar Contactos");
    setSizeFull();/*from  ww  w .ja  v  a 2 s.c  o m*/
    addStyleName("view");

    /* Usar un FormLayout como layout principal para este Panel*/
    FormLayout formLayout = new FormLayout();

    /* Creando componente UI */
    txtTextField = new TextField("Buscar");
    cmbFieldtoSearch = new NativeSelect("Campo por buscar");
    chkSaveSearch = new CheckBox("Guardar Bsqueda");
    txtSearchName = new TextField("Buscar nombre");
    Button btnBuscar = new Button("Buscar");

    btnBuscar.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            performSearch();
        }
    });

    /* Inicializar combo */
    for (int i = 0; i < PersonContainer.NATURAL_COL_ORDER.length; i++) {

        cmbFieldtoSearch.addItem(PersonContainer.NATURAL_COL_ORDER[i]);
        cmbFieldtoSearch.setItemCaption(PersonContainer.NATURAL_COL_ORDER[i],
                PersonContainer.COL_HEADERS_ENGLISH[i]);
    }

    cmbFieldtoSearch.setValue("apPaterno");
    cmbFieldtoSearch.setNullSelectionAllowed(false);

    /* Inicializando save checkbox */
    chkSaveSearch.setValue(true);
    chkSaveSearch.setImmediate(true);
    chkSaveSearch.addListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(ValueChangeEvent event) {
            boolean value = (Boolean) event.getProperty().getValue();
            txtSearchName.setVisible(value);
        }
    });

    /*
     chkSaveSearch.addValueChangeListener(new Property.ValueChangeListener() {
     @Override
     public void valueChange(ValueChangeEvent event) {
     boolean value = (Boolean) event.getProperty().getValue();
     txtSearchName.setVisible(value);
     }
     });*/

    /* Aadiendo los componentes creados al formulario */
    formLayout.addComponent(txtTextField);
    formLayout.addComponent(cmbFieldtoSearch);
    formLayout.addComponent(chkSaveSearch);
    formLayout.addComponent(txtSearchName);
    formLayout.addComponent(btnBuscar);

    setContent(formLayout);
}

From source file:com.dungnv.streetfood.ui.CommonSearchPagedUI.java

private final void init() {

    setWidth("100%");
    setStyleName("item-search-box");
    HorizontalLayout layout = new HorizontalLayout();
    layout.setSpacing(true);//from   ww  w .  j av a2  s. c o  m
    this.addComponent(layout);

    FormLayout form = new FormLayout();
    //        form.setWidth("100%");
    form.setMargin(false);
    layout.addComponent(form);
    layout.setComponentAlignment(form, Alignment.MIDDLE_CENTER);

    cbRecordPerPage = new ComboBox();
    cbRecordPerPage.setWidth("65px");
    cbRecordPerPage.setStyleName(ValoTheme.COMBOBOX_TINY);
    cbRecordPerPage.setCaption(BundleUtils.getLanguage("lbl.recordsPerPage"));
    cbRecordPerPage.setTextInputAllowed(false);
    cbRecordPerPage.addItem(10);
    cbRecordPerPage.addItem(20);
    cbRecordPerPage.addItem(30);
    cbRecordPerPage.addItem(50);
    cbRecordPerPage.addItem(100);
    cbRecordPerPage.addItem(200);
    cbRecordPerPage.select(10);
    form.addComponent(cbRecordPerPage);
    cbRecordPerPage.setNullSelectionAllowed(false);

    btnFastBackward = new Button();
    btnFastBackward.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    btnFastBackward.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    btnFastBackward.setIcon(FontAwesome.FAST_BACKWARD);
    layout.addComponent(btnFastBackward);
    layout.setComponentAlignment(btnFastBackward, Alignment.MIDDLE_CENTER);

    btnBackward = new Button();
    btnBackward.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    btnBackward.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    btnBackward.setIcon(FontAwesome.BACKWARD);
    layout.addComponent(btnBackward);
    layout.setComponentAlignment(btnBackward, Alignment.MIDDLE_CENTER);

    cbPaged = new ComboBox();
    cbPaged.setTextInputAllowed(false);
    for (int i = 1; i <= pageCount; i++) {
        cbPaged.addItem(i);
    }

    cbPaged.setNullSelectionAllowed(false);
    cbPaged.select(1);
    cbPaged.addStyleName(ValoTheme.COMBOBOX_TINY);
    cbPaged.setWidth("60px");
    layout.addComponent(cbPaged);
    layout.setComponentAlignment(cbPaged, Alignment.MIDDLE_CENTER);

    btnFoward = new Button();
    btnFoward.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    btnFoward.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    btnFoward.setIcon(FontAwesome.FORWARD);
    layout.addComponent(btnFoward);
    layout.setComponentAlignment(btnFoward, Alignment.MIDDLE_CENTER);

    btnFastFoward = new Button();
    btnFastFoward.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    btnFastFoward.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    btnFastFoward.setIcon(FontAwesome.FAST_FORWARD);
    layout.addComponent(btnFastFoward);
    layout.setComponentAlignment(btnFastFoward, Alignment.MIDDLE_CENTER);
    enableComponent();
}

From source file:com.esspl.datagen.ui.TableSelectorView.java

License:Open Source License

protected Component createSelectors() throws SQLException {
    FormLayout l = new FormLayout();
    l.setWidth("100%");
    l.setSpacing(false);/*from   w ww  .  j  a va  2s . co  m*/
    l.setMargin(true, false, true, false);

    String catalogTerm = (metadataRetriever != null) ? metadataRetriever.getCatalogTerm() : "DataBase";
    catalogTerm = catalogTerm.substring(0, 1).toUpperCase() + catalogTerm.substring(1, catalogTerm.length());
    List<String> catalogNames = (metadataRetriever != null) ? metadataRetriever.getCatalogs()
            : new ArrayList<String>();
    final ComboBox catalogs = new ComboBox(catalogTerm + ":", catalogNames);
    catalogs.setWidth("100%");
    catalogs.setNullSelectionAllowed(false);
    catalogs.setImmediate(true);
    catalogs.setVisible(!catalogNames.isEmpty());

    String schemaTerm = (metadataRetriever != null) ? metadataRetriever.getSchemaTerm().toLowerCase()
            : "DataBase";
    schemaTerm = schemaTerm.substring(0, 1).toUpperCase() + schemaTerm.substring(1, schemaTerm.length());

    List<String> schemaNames = (metadataRetriever != null) ? metadataRetriever.getSchemas()
            : new ArrayList<String>();
    final ComboBox schemas = new ComboBox(schemaTerm + ":", schemaNames);
    schemas.setWidth("100%");
    schemas.setNullSelectionAllowed(false);
    schemas.setImmediate(true);
    schemas.setVisible(!schemaNames.isEmpty());

    List<String> tableTypesList = (metadataRetriever != null) ? metadataRetriever.getTableTypes()
            : new ArrayList<String>();
    final ComboBox tableTypes = new ComboBox("Object:", tableTypesList);
    if (tableTypesList.contains("TABLE"))
        tableTypes.select("TABLE");
    tableTypes.setWidth("100%");
    tableTypes.setNullSelectionAllowed(false);
    tableTypes.setImmediate(true);

    ValueChangeListener valueChangeListener = new ValueChangeListener() {

        @Override
        public void valueChange(ValueChangeEvent event) {
            updateTableList(catalogs, schemas, tableTypes);
        }
    };

    catalogs.addListener(valueChangeListener);
    schemas.addListener(valueChangeListener);
    tableTypes.addListener(valueChangeListener);

    l.addComponent(catalogs);
    l.addComponent(schemas);
    l.addComponent(tableTypes);
    return l;
}

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

License:Apache License

public Forms() {
    setSpacing(true);//from w  w w.j  av 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.etest.view.systemadministration.curriculum.CurriculumFormWindow.java

FormLayout buildForms() {
    FormLayout form = new FormLayout();
    form.setMargin(true);//from w  ww  .  j  a  v a  2  s .  c om

    yearLevel.setWidth("75%");
    form.addComponent(yearLevel);

    subjectField.setWidth("75%");
    form.addComponent(subjectField);

    normCourseOffering.setWidth("75%");
    form.addComponent(normCourseOffering);

    descriptiveTitleField.setWidth("100%");
    descriptiveTitleField.setRows(3);
    descriptiveTitleField.setInputPrompt("Descriptive Title..");
    form.addComponent(descriptiveTitleField);

    Button save = new Button("SAVE");
    save.setWidth("100%");
    save.setIcon(FontAwesome.SAVE);
    save.addStyleName(ValoTheme.BUTTON_PRIMARY);
    save.addStyleName(ValoTheme.BUTTON_SMALL);
    save.addClickListener(buttonClickListener);

    Button update = new Button("UPDATE");
    update.setWidth("100%");
    update.setIcon(FontAwesome.ADJUST);
    update.addStyleName(ValoTheme.BUTTON_PRIMARY);
    update.addStyleName(ValoTheme.BUTTON_SMALL);
    update.addClickListener(buttonClickListener);

    Button delete = new Button("DELETE");
    delete.setWidth("100%");
    delete.setIcon(FontAwesome.ERASER);
    delete.addStyleName(ValoTheme.BUTTON_PRIMARY);
    delete.addStyleName(ValoTheme.BUTTON_SMALL);
    delete.addClickListener(buttonClickListener);

    HorizontalLayout hlayout = new HorizontalLayout();
    hlayout.setWidth("100%");
    hlayout.setSpacing(true);

    if (getCurriculumId() != 0) {
        hlayout.addComponent(update);
        hlayout.addComponent(delete);
        Curriculum c = cs.getCurriculumById(getCurriculumId());
        yearLevel.setValue(c.getYearLevel());
        subjectField.setValue(c.getSubject());
        normCourseOffering.setValue(c.getNormCourseOffering());
        descriptiveTitleField.setValue(c.getDescriptiveTitle());

        if (getButtonCaption().equals("edit")) {
            delete.setVisible(false);
        } else {
            update.setVisible(false);
        }
    } else {
        hlayout.addComponent(save);
    }

    form.addComponent(hlayout);

    return form;
}

From source file:com.etest.view.systemadministration.faculty.FacultyFormWindow.java

FormLayout buildForms() {
    FormLayout form = new FormLayout();
    form.setWidth("100%");
    form.setSpacing(true);/*ww  w. ja v  a  2 s  . c  o  m*/
    form.setMargin(true);

    firstname.setWidth("100%");
    firstname.setIcon(FontAwesome.INFO);
    firstname.setRequired(true);
    firstname.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    form.addComponent(firstname);

    middlename.setWidth("100%");
    middlename.setIcon(FontAwesome.INFO);
    middlename.setRequired(true);
    middlename.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    form.addComponent(middlename);

    lastname.setWidth("100%");
    lastname.setIcon(FontAwesome.INFO);
    lastname.setRequired(true);
    lastname.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    form.addComponent(lastname);

    userType.setCaption("User Type: ");
    userType.setIcon(FontAwesome.USER_MD);
    userType.setRequired(true);
    form.addComponent(userType);

    username.setWidth("100%");
    username.setIcon(FontAwesome.USER);
    username.setRequired(true);
    username.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    form.addComponent(username);

    password1.setWidth("100%");
    password1.setIcon(FontAwesome.CODE);
    password1.setRequired(true);
    password1.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    form.addComponent(password1);

    password2.setWidth("100%");
    password2.setIcon(FontAwesome.CODE);
    password2.setRequired(true);
    password2.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    form.addComponent(password2);

    facultyBtn.setCaption(getButtonCaption());
    facultyBtn.setWidth("100%");
    facultyBtn.addStyleName(ValoTheme.BUTTON_PRIMARY);
    facultyBtn.addStyleName(ValoTheme.BUTTON_SMALL);
    facultyBtn.addClickListener(buttonClickListener);
    form.addComponent(facultyBtn);

    if (getFacultyId() != 0) {
        Users u = fs.getFacultyInfoById(getFacultyId());
        firstname.setValue(u.getFirstname());
        middlename.setValue(u.getMiddlename());
        lastname.setValue(u.getLastname());
        username.setValue(u.getUsername_());
        userType.setValue(CommonVariableMap.getFacultyUserType(u.getUserType()));
        password1.setValue(u.getPassword_());
        password2.setValue(u.getPassword_());
    }

    return form;
}

From source file:com.etest.view.systemadministration.SemestralTeam.AddSemestralTeamMembersWindow.java

FormLayout buildForms() {
    FormLayout form = new FormLayout();
    form.setWidth("100%");
    form.setSpacing(true);/*from   w  ww.j a v a  2  s  .  co m*/

    faculty = CommonComboBox.getAllFacultyExceptTeamLeader("Add Team Member.. ", getFacultyId());
    faculty.setWidth("60%");
    faculty.setIcon(FontAwesome.USER);
    form.addComponent(faculty);

    addMemberBtn.setWidth("60%");
    addMemberBtn.setIcon(FontAwesome.SAVE);
    addMemberBtn.addStyleName(ValoTheme.BUTTON_PRIMARY);
    addMemberBtn.addStyleName(ValoTheme.BUTTON_SMALL);
    addMemberBtn.addClickListener(buttonClickListener);
    form.addComponent(addMemberBtn);

    populateDataTable();
    form.addComponent(table);

    return form;
}

From source file:com.etest.view.systemadministration.SemestralTeamUI.java

FormLayout buildForms() {
    FormLayout form = new FormLayout();
    form.setWidth("400px");
    form.setSpacing(true);/*from  w  w  w .j  a  va 2s . c o m*/

    subjects = CommonComboBox.getSubjectFromCurriculum("Subject..");
    subjects.setCaption("Curriculum: ");
    subjects.setIcon(FontAwesome.SEARCH);
    form.addComponent(subjects);

    schoolYear = CommonComboBox.getSchoolYear("School Year..");
    schoolYear.setCaption("School Year: ");
    schoolYear.setIcon(FontAwesome.SEARCH);
    form.addComponent(schoolYear);

    semester = CommonComboBox.getNormCourseOfferingComboBox("Semester..");
    semester.setCaption("Semester: ");
    semester.setIcon(FontAwesome.SEARCH);
    form.addComponent(semester);

    faculty = CommonComboBox.getAllFaculty("Select Faculty..");
    faculty.setCaption("Team Leader: ");
    faculty.setIcon(FontAwesome.USER);
    form.addComponent(faculty);

    Button saveBtn = new Button("Enroll Semestral Team");
    saveBtn.setWidth("100%");
    saveBtn.setIcon(FontAwesome.SAVE);
    saveBtn.addStyleName(ValoTheme.BUTTON_PRIMARY);
    saveBtn.addStyleName(ValoTheme.BUTTON_SMALL);
    saveBtn.addClickListener(saveBtnClickListener);
    saveBtn.setImmediate(true);
    form.addComponent(saveBtn);

    return form;
}

From source file:com.etest.view.systemadministration.syllabus.SyllabusFormWindow.java

Component buildSyllabusForms() {
    FormLayout form = new FormLayout();
    form.setWidth("100%");
    form.setMargin(true);/*  ww w  .  j av a2  s . c  om*/

    subjects.setCaption("Subject: ");
    subjects.setWidth("50%");
    subjects.setIcon(FontAwesome.BOOK);
    subjects.addStyleName(ValoTheme.COMBOBOX_SMALL);
    form.addComponent(subjects);

    topicNo.setCaption("Topic No: ");
    topicNo.setWidth("50%");
    topicNo.setIcon(FontAwesome.TAG);
    topicNo.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    form.addComponent(topicNo);

    topic.setCaption("Topic: ");
    topic.setWidth("100%");
    topic.setIcon(FontAwesome.TAG);
    topic.setInputPrompt("Enter Topic..");
    topic.setRows(3);
    topic.addStyleName(ValoTheme.TEXTAREA_SMALL);
    form.addComponent(topic);

    estimatedTime.setCaption("Estimated Time: ");
    estimatedTime.setWidth("50%");
    estimatedTime.setIcon(FontAwesome.TAG);
    estimatedTime.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    form.addComponent(estimatedTime);

    Button save = new Button("SAVE");
    save.setWidth("50%");
    save.setIcon(FontAwesome.SAVE);
    save.addStyleName(ValoTheme.BUTTON_PRIMARY);
    save.addStyleName(ValoTheme.BUTTON_SMALL);
    save.addClickListener(buttonClickListener);

    Button update = new Button("UPDATE");
    update.setWidth("60%");
    update.setIcon(FontAwesome.PENCIL);
    update.addStyleName(ValoTheme.BUTTON_PRIMARY);
    update.addStyleName(ValoTheme.BUTTON_SMALL);
    update.addClickListener(buttonClickListener);

    Button remove = new Button("REMOVE");
    remove.setWidth("60%");
    remove.setIcon(FontAwesome.TRASH_O);
    remove.addStyleName(ValoTheme.BUTTON_PRIMARY);
    remove.addStyleName(ValoTheme.BUTTON_SMALL);
    remove.addClickListener(buttonClickListener);

    if (getSyllabusId() != 0) {
        s = ss.getSyllabusById(syllabusId);
        subjects.setValue(s.getCurriculumId());
        topicNo.setValue(String.valueOf(s.getTopicNo()));
        estimatedTime.setValue(String.valueOf(s.getEstimatedTime()));
        topic.setValue(s.getTopic());

        if (getButtonCaption().equals("edit")) {
            form.addComponent(update);
        } else {
            form.addComponent(remove);
        }
    } else {
        form.addComponent(save);
    }

    return form;
}