Example usage for com.vaadin.ui FormLayout FormLayout

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

Introduction

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

Prototype

public FormLayout() 

Source Link

Usage

From source file:fi.semantum.strategia.Utils.java

License:Open Source License

public static void insertRootMap(final Main main, final Strategiakartta currentRoot) {

    final Database database = main.getDatabase();

    FormLayout content = new FormLayout();
    content.setSizeFull();/*from  w  w w  . j  a  v a  2 s  .c  o m*/

    final TextField tf = new TextField();
    tf.setCaption("Kartan tunniste:");
    tf.setValue("tunniste");
    tf.setWidth("100%");
    content.addComponent(tf);

    final TextField tf2 = new TextField();
    tf2.setCaption("Kartan nimi:");
    tf2.setValue("Uusi kartta");
    tf2.setWidth("100%");
    content.addComponent(tf2);

    final ComboBox combo = new ComboBox();
    combo.setCaption("Kartan tyyppi:");
    combo.setNullSelectionAllowed(false);
    combo.setWidth("100%");
    content.addComponent(combo);

    Collection<Base> subs = Strategiakartta.availableLevels(database);
    for (Base b : subs) {
        combo.addItem(b.uuid);
        combo.setItemCaption(b.uuid, b.getText(database));
        combo.select(b.uuid);
    }

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    buttons.setMargin(true);

    Button ok = new Button("Lis");
    buttons.addComponent(ok);

    final Window dialog = Dialogs.makeDialog(main, "450px", "340px", "Lis alatason kartta", "Peruuta",
            content, buttons);
    ok.addClickListener(new Button.ClickListener() {

        private static final long serialVersionUID = 1422158448876521843L;

        public void buttonClick(ClickEvent event) {

            String id = tf.getValue();
            String name = tf2.getValue();
            String typeUUID = (String) combo.getValue();
            Base type = database.find(typeUUID);

            Strategiakartta uusi = database.newMap(main, null, id, name, type);
            uusi.addAlikartta(currentRoot);
            Updates.updateJS(main, true);
            main.removeWindow(dialog);

        }
    });

}

From source file:fi.semantum.strategia.Utils.java

License:Open Source License

public static void addView(final Main main, final Strategiakartta map) {

    final Database database = main.getDatabase();

    FormLayout content = new FormLayout();
    content.setSizeFull();/*from w w w.j  a v a  2s  .  c o  m*/

    final TextField tf = new TextField();
    tf.setCaption("Nkymn tunniste:");
    tf.setValue("tunniste");
    tf.setWidth("100%");
    content.addComponent(tf);

    final TextField tf2 = new TextField();
    tf2.setCaption("Nkymn nimi:");
    tf2.setValue("Uusi nkym");
    tf2.setWidth("100%");
    content.addComponent(tf2);

    final ComboBox combo = new ComboBox();
    combo.setCaption("Kartan tyyppi:");
    combo.setNullSelectionAllowed(false);
    combo.setWidth("100%");
    content.addComponent(combo);

    Property levelProperty = Property.find(database, Property.LEVEL);
    ObjectType level = database.find((String) levelProperty.getPropertyValue(map));

    Collection<Base> subs = Strategiakartta.availableLevels(database);
    for (Base b : subs) {
        combo.addItem(b.uuid);
        combo.setItemCaption(b.uuid, b.getText(database));
        combo.select(b.uuid);
    }

    final ComboBox combo2 = new ComboBox();
    combo2.setCaption("Aihetunniste:");
    combo2.setNullSelectionAllowed(false);
    combo2.setWidth("100%");
    content.addComponent(combo2);

    for (Tag t : Tag.enumerate(database)) {
        combo2.addItem(t.uuid);
        combo2.setItemCaption(t.uuid, t.getId(database));
        combo2.select(t.uuid);
    }

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    buttons.setMargin(true);

    Button ok = new Button("Lis");
    buttons.addComponent(ok);

    final Window dialog = Dialogs.makeDialog(main, "450px", "380px", "Lis nkym", "Peruuta", content,
            buttons);
    ok.addClickListener(new Button.ClickListener() {

        private static final long serialVersionUID = 1422158448876521843L;

        public void buttonClick(ClickEvent event) {

            String id = tf.getValue();
            String name = tf2.getValue();
            String typeUUID = (String) combo.getValue();
            Base type = database.find(typeUUID);

            String tagUUID = (String) combo2.getValue();
            Tag tag = (Tag) database.find(tagUUID);

            Strategiakartta newMap = database.newMap(main, main.uiState.current, id, name + " (nkym)", type);
            newMap.generators.add(tag);

            Updates.updateJS(main, true);
            main.removeWindow(dialog);

        }

    });

}

From source file:fr.amapj.view.engine.basicform.BasicFormEditorPart.java

License:Open Source License

protected void createContent(VerticalLayout contentLayout) {

    // Construction de la forme
    form = new FormLayout();
    form.setWidth("100%");
    form.setImmediate(true);//from w  w w. ja va2  s  . c om

    //
    binder = new FieldGroup();
    binder.setBuffered(true);
    binder.setItemDataSource(beanItem);

    FormInfo formInfo = new FormInfo(binder, form, addMode);
    stdFormMainView.createFormField(formInfo);

    contentLayout.addComponent(new Label(" "));
    contentLayout.addComponent(form);
    contentLayout.addComponent(new Label(" "));

}

From source file:fr.amapj.view.engine.popup.formpopup.tab.TabFormPopup.java

License:Open Source License

/**
 * Construction de la form// w  w  w.j  a  v a2  s .c  om
 */
private void updateForm(TabInfo tabInfo) {
    vLayout.removeAllComponents();

    // Construction de la forme
    form = new FormLayout();
    form.setWidth("100%");
    form.setImmediate(true);

    //
    binder = new FieldGroup();
    binder.setBuffered(true);
    binder.setItemDataSource(item);

    //
    validatorManager.reset();

    //
    tabInfo.tabDraw.drawTab();

    //
    vLayout.addComponent(form);
    vLayout.setComponentAlignment(form, Alignment.MIDDLE_LEFT);

}

From source file:fr.amapj.view.engine.popup.formpopup.WizardFormPopup.java

License:Open Source License

private void updateForm() {
    if (form != null) {
        contentLayout.removeComponent(form);
    }//from   w w  w  .j  a  v  a2s.c  o m

    // Construction de la forme
    form = new FormLayout();
    form.setWidth("100%");
    form.setImmediate(true);

    //
    binder = new FieldGroup();
    binder.setBuffered(true);
    binder.setItemDataSource(item);

    //
    validatorManager.reset();

    // Dclaration des proprits et construction des champs
    Enum current = (Enum) enumArray[pageNumber];
    DetailStepInfo stepInfo = details.get(current);
    stepInfo.drawScreen.action(); // Dessin de l'cran 

    contentLayout.addComponent(form);
    contentLayout.setComponentAlignment(form, Alignment.MIDDLE_LEFT);

}

From source file:fr.amapj.view.engine.tools.InLineFormHelper.java

License:Open Source License

public InLineFormHelper(String sectionName, String libModifier, PopupListener refreshListener,
        ClickListener saveListener) {//w  ww  .  jav a  2s. c o  m
    super();
    this.libModifier = libModifier;
    this.saveListener = saveListener;
    this.refreshListener = refreshListener;

    form = new FormLayout();
    form.setMargin(false);

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

}

From source file:fr.amapj.view.views.compte.MonCompteView.java

License:Open Source License

/**
 * //from  ww  w  .j av a2 s . c  o m
 */
@Override
public void enter() {
    Panel p0 = new Panel();
    p0.setWidth("100%");
    p0.addStyleName(PANEL_COMPTEFORM);

    VerticalLayout vl1 = new VerticalLayout();
    vl1.setMargin(true);
    p0.setContent(vl1);
    addComponent(p0);

    // Bloc nom et prenom - Le nom et le prenom ne sont pas modifiables
    form1 = new FormLayout();
    form1.setMargin(false);
    form1.addStyleName("light");
    vl1.addComponent(form1);

    Label section = new Label("Nom et prnom");
    section.addStyleName("h2");
    section.addStyleName("colored");
    form1.addComponent(section);

    nom = addTextField("Votre nom ", form1);
    prenom = addTextField("Votre prnom ", form1);

    // Bloc Adresse mail  
    InLineFormHelper formHelper = new InLineFormHelper("Votre mail", "Modifier votre adresse mail", this,
            e -> handleSaveMail());
    mail = addTextField("Votre mail", formHelper.getForm());
    formHelper.getValidatorManager().add(mail, "Votre mail", "mail", new EmailValidator());
    formHelper.addIn(vl1);

    // Bloc mot de passe
    formHelper = new InLineFormHelper("Votre mot de passe", "Modifier votre mot de passe", this,
            e -> handleSavePassword());
    pwd = addTextField("Votre mot de passe", formHelper.getForm());
    formHelper.addIn(vl1);

    // les coordonnes
    formHelper = new InLineFormHelper("Vos coordonnes", "Modifier vos coordonnes", this,
            e -> handleSaveChangerCoordonnees());
    numTel1 = addTextField("Numro de tel 1", formHelper.getForm());
    numTel2 = addTextField("Numro de tel 2", formHelper.getForm());
    adresse = addTextField("Adresse", formHelper.getForm());
    codePostal = addTextField("Code Postal", formHelper.getForm());
    ville = addTextField("Ville", formHelper.getForm());
    formHelper.addIn(vl1);

    refresh();

}

From source file:fr.amapj.view.views.gestioncontratsignes.PopupSaisieAvoir.java

License:Open Source License

@Override
protected void createContent(VerticalLayout contentLayout) {
    PEReceptionCheque peConf = new ParametresService().getPEReceptionCheque();
    boolean allowNegativeNumber = peConf.saisieAvoirNegatif == ChoixOuiNon.OUI;

    FormLayout f = new FormLayout();

    textField = BaseUiTools.createCurrencyField("Montant de l'avoir", allowNegativeNumber);

    textField.setConvertedValue(new Integer(contratSigneDTO.mntAvoirInitial));

    textField.addStyleName("align-center");
    textField.addStyleName("big");

    String message = "<h3> Saisie d'un avoir  pour " + contratSigneDTO.prenomUtilisateur + " "
            + contratSigneDTO.nomUtilisateur + "</h3>";

    f.addComponent(new Label(message, ContentMode.HTML));
    f.addComponent(textField);/*w  ww  .ja va 2 s. c o m*/
    contentLayout.addComponent(f);

}

From source file:fr.amapj.view.views.gestioncontratsignes.PopupSaisieUtilisateur.java

License:Open Source License

@Override
protected void createContent(VerticalLayout contentLayout) {
    FormLayout f = new FormLayout();

    box = new Searcher(SearcherList.UTILISATEUR_SANS_CONTRAT);
    box.setParams(data.idModeleContrat);

    box.setWidth("80%");
    f.addComponent(box);/*from   ww  w. j a  v a 2 s.  c o m*/
    contentLayout.addComponent(f);

}

From source file:fr.amapj.view.views.maintenance.PopupSuppressionTotaleContrat.java

License:Open Source License

@Override
protected void createContent(VerticalLayout contentLayout) {
    FormLayout f = new FormLayout();

    box = new Searcher(SearcherList.MODELE_CONTRAT);

    box.setWidth("80%");
    f.addComponent(box);//from  www .j a  va  2s . c o m
    contentLayout.addComponent(f);

}