Example usage for com.vaadin.ui VerticalLayout setMargin

List of usage examples for com.vaadin.ui VerticalLayout setMargin

Introduction

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

Prototype

@Override
    public void setMargin(boolean enabled) 

Source Link

Usage

From source file:com.coatl.pruebas.MyUI.java

@Override
protected void init(VaadinRequest vaadinRequest) {
    final VerticalLayout layout = new VerticalLayout();

    final TextField name = new TextField();
    name.setCaption("Escribe algo aqu:");

    Button button = new Button("Dime que escrib");

    button.addClickListener(new Button.ClickListener() {
        @Override// www .ja v a  2  s  . c  om
        public void buttonClick(Button.ClickEvent event) {
            System.out.println("Click!");
            layout.addComponent(new Label("Usted escribi> " + name.getValue()));
        }
    });

    layout.addComponents(name, button);
    layout.setMargin(true);
    layout.setSpacing(true);

    setContent(layout);
}

From source file:com.coatl.vaadin.abc.ixABCDialogos.java

ixDefinicionDeForma getForma(String forma, String tipo) {
    Stack<AbstractComponent> pila = new Stack();
    Map<String, AbstractComponent> componentes = new HashMap();
    AbstractComponent ultimo = null;/*from www .  j  av a  2s.c  o m*/

    String[] cmds = forma.split(" ");

    for (String cmd : cmds) {
        cmd = cmd.trim();
        if (!cmd.equals("")) {
            //System.out.println("CMD> [" + cmd + "]");
            if (cmd.equals("bConfBorrar")) {
                agregar(pila, getbConfBorrar());

            } else if (cmd.equals("bBorrar")) {
                agregar(pila, getbBorrar());

            } else if (cmd.equals("bGuardar")) {
                agregar(pila, getbGuardar());

            } else if (cmd.equals("bCrear")) {
                agregar(pila, getbCrear());
            } else if (cmd.startsWith("H")) {
                HorizontalLayout hl = new HorizontalLayout();
                if (cmd.contains("m")) {
                    hl.setMargin(true);
                }
                agregar(pila, hl);
            } else if (cmd.startsWith("V")) {
                VerticalLayout vl = new VerticalLayout();
                if (cmd.contains("m")) {
                    vl.setMargin(true);
                }
                agregar(pila, vl);
            } else if (cmd.startsWith("F")) {
                FormLayout fl = new FormLayout();
                if (cmd.contains("m")) {
                    fl.setMargin(true);
                }
                agregar(pila, fl);
            } else if (cmd.equals(".")) {
                ultimo = pila.pop();
                //System.out.println("Sacando de pila a " + ultimo);
            } else if (cmd.startsWith("'")) {
                String txt = cmd.substring(1);
                while (txt.contains("~")) {
                    txt = txt.replace("~", " ");
                }
                Label l = new Label(txt);

                agregar(pila, l);
            } else {
                //System.out.println("Buscando columna [" + cmd + "]");
                ixDefinicionDeColumna columna = columnas.get(cmd);
                String claseControl = columna.getClaseControl();
                if (claseControl == null) {
                    claseControl = "com.vaadin.ui.TextField";
                }

                AbstractComponent con = null;

                try {
                    con = (AbstractComponent) this.getClass().getClassLoader().loadClass(claseControl)
                            .newInstance();
                } catch (Exception ex) {
                    System.out.println("ERROR INSTANCIANDO> [" + claseControl + "], " + ex);
                }
                con.setCaption(this.getTituloColumna(cmd));
                if (con != null) {
                    agregar(pila, con);
                    componentes.put(cmd, con);
                }

                if (tipo != null) {
                    if (tipo.toLowerCase().equals("c")) {
                        if (columna.isSoloLecturaCrear() || columna.isSoloLectura()) {
                            con.setReadOnly(true);
                        }
                    }
                    if (tipo.toLowerCase().equals("e") || tipo.toLowerCase().equals("g")) {
                        if (columna.isSoloLecturaGuardar() || columna.isSoloLectura()) {
                            con.setReadOnly(true);
                        }
                    }
                    if (tipo.toLowerCase().equals("b")) {

                        con.setReadOnly(true);
                    }
                }

            }
        }
    }

    while (pila.size() > 0) {
        ultimo = pila.pop();
    }

    ixDefinicionDeForma res = new ixDefinicionDeForma();
    res.setComponente(ultimo);
    res.setComponentes(componentes);

    return res;
}

From source file:com.cxplonka.feature.ui.vaadin.VaadinUI.java

private void initLayout() {
    final VerticalLayout root = new VerticalLayout();
    root.setSizeFull();//w w w .  java2 s .  c om
    root.setMargin(true);
    root.setSpacing(true);
    setContent(root);

    final CssLayout navigationBar = new CssLayout();
    navigationBar.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);

    navigationBar.addComponent(createNavigationButton("Default View", DefaultView.VIEW_NAME));
    navigationBar.addComponent(createNavigationButton("Data View", DataTableView.VIEW_NAME));

    root.addComponent(navigationBar);

    final Panel viewContainer = new Panel();
    viewContainer.setSizeFull();
    root.addComponent(viewContainer);
    root.setExpandRatio(viewContainer, 1.0f);

    Navigator navigator = new Navigator(this, viewContainer);
    navigator.addProvider(viewProvider);
}

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

public HelpWindow() {
    setCaption("Address Book Help");

    VerticalLayout subContent = new VerticalLayout();
    subContent.addComponent(new Label(HELP_HTML_SNIPPET));
    subContent.setMargin(true);

    setContent(subContent);//from  ww  w  .  j a  va 2s.com

    //DESHABILITAR LA X CERRAR
    setClosable(true); //false

    //DESHABILITAR EL AGRANDAR VENTANA
    setResizable(false);
}

From source file:com.ejt.vaadin.loginform.DefaultVerticalLoginForm.java

License:Apache License

@Override
protected Component createContent(TextField userNameField, PasswordField passwordField, Button loginButton) {
    VerticalLayout layout = new VerticalLayout();
    layout.setSpacing(true);/*from w w w.  ja  va  2  s.com*/
    layout.setMargin(true);

    layout.addComponent(userNameField);
    layout.addComponent(passwordField);
    layout.addComponent(loginButton);
    return layout;
}

From source file:com.esofthead.mycollab.mobile.module.crm.view.account.AccountRelatedContactView.java

License:Open Source License

@Override
protected Component createRightComponent() {
    final NavigationBarQuickMenu addContact = new NavigationBarQuickMenu();
    addContact.setStyleName("add-btn");

    VerticalLayout addButtons = new VerticalLayout();
    addButtons.setSpacing(true);/* w w  w  .  j  a v  a 2 s. co m*/
    addButtons.setWidth("100%");
    addButtons.setMargin(true);
    addButtons.addStyleName("edit-btn-layout");

    Button newContact = new Button(AppContext.getMessage(ContactI18nEnum.VIEW_NEW_TITLE));
    newContact.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(Button.ClickEvent arg0) {
            fireNewRelatedItem("");
        }
    });
    addButtons.addComponent(newContact);

    Button selectContact = new Button(AppContext.getMessage(ContactI18nEnum.M_TITLE_SELECT_CONTACTS));
    selectContact.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 243969948418203441L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            AccountContactSelectionView contactSelectionView = new AccountContactSelectionView(
                    AccountRelatedContactView.this);
            final ContactSearchCriteria criteria = new ContactSearchCriteria();
            criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId()));
            contactSelectionView.setSearchCriteria(criteria);
            EventBusFactory.getInstance()
                    .post(new ShellEvent.PushView(AccountRelatedContactView.this, contactSelectionView));

        }
    });
    addButtons.addComponent(selectContact);

    addContact.setContent(addButtons);

    return addContact;
}

From source file:com.esofthead.mycollab.mobile.module.crm.view.account.AccountRelatedLeadView.java

License:Open Source License

@Override
protected Component createRightComponent() {
    final NavigationBarQuickMenu addLead = new NavigationBarQuickMenu();
    addLead.setStyleName("add-btn");

    VerticalLayout addButtons = new VerticalLayout();
    addButtons.setSpacing(true);//  w  w w.j a  v  a 2  s .  com
    addButtons.setWidth("100%");
    addButtons.setMargin(true);
    addButtons.addStyleName("edit-btn-layout");

    Button newLead = new Button(AppContext.getMessage(LeadI18nEnum.VIEW_NEW_TITLE));
    newLead.addClickListener(new Button.ClickListener() {

        private static final long serialVersionUID = 8228954365650824438L;

        @Override
        public void buttonClick(Button.ClickEvent arg0) {
            fireNewRelatedItem("");
        }
    });
    addButtons.addComponent(newLead);

    Button selectLead = new Button(AppContext.getMessage(LeadI18nEnum.M_TITLE_SELECT_LEADS));
    selectLead.addClickListener(new Button.ClickListener() {

        private static final long serialVersionUID = 9076596614526838523L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            AccountLeadSelectionView leadSelectionView = new AccountLeadSelectionView(
                    AccountRelatedLeadView.this);
            final LeadSearchCriteria criteria = new LeadSearchCriteria();
            criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId()));
            leadSelectionView.setSearchCriteria(criteria);
            EventBusFactory.getInstance()
                    .post(new ShellEvent.PushView(AccountRelatedLeadView.this, leadSelectionView));

        }
    });
    addButtons.addComponent(selectLead);

    addLead.setContent(addButtons);

    return addLead;
}

From source file:com.esofthead.mycollab.mobile.module.crm.view.campaign.CampaignRelatedAccountView.java

License:Open Source License

@Override
protected Component createRightComponent() {
    final NavigationBarQuickMenu addAccount = new NavigationBarQuickMenu();
    addAccount.setStyleName("add-btn");

    VerticalLayout addButtons = new VerticalLayout();
    addButtons.setSpacing(true);//from  w  w w .  j a va  2 s .c o  m
    addButtons.setWidth("100%");
    addButtons.setMargin(true);
    addButtons.addStyleName("edit-btn-layout");

    Button newAccount = new Button(AppContext.getMessage(AccountI18nEnum.VIEW_NEW_TITLE));
    newAccount.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(Button.ClickEvent arg0) {
            fireNewRelatedItem("");
        }
    });
    addButtons.addComponent(newAccount);

    Button selectAccount = new Button(AppContext.getMessage(AccountI18nEnum.M_TITLE_SELECT_ACCOUNTS));
    selectAccount.addClickListener(new Button.ClickListener() {

        private static final long serialVersionUID = 270503987054356318L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            CampaignAccountSelectionView accountSelectionView = new CampaignAccountSelectionView(
                    CampaignRelatedAccountView.this);
            AccountSearchCriteria criteria = new AccountSearchCriteria();
            criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId()));
            accountSelectionView.setSearchCriteria(criteria);
            EventBusFactory.getInstance()
                    .post(new ShellEvent.PushView(CampaignRelatedAccountView.this, accountSelectionView));
        }
    });
    addButtons.addComponent(selectAccount);

    addAccount.setContent(addButtons);

    return addAccount;
}

From source file:com.esofthead.mycollab.mobile.module.crm.view.campaign.CampaignRelatedContactView.java

License:Open Source License

@Override
protected Component createRightComponent() {
    final NavigationBarQuickMenu addContact = new NavigationBarQuickMenu();
    addContact.setStyleName("add-btn");

    VerticalLayout addButtons = new VerticalLayout();
    addButtons.setWidth("100%");
    addButtons.setSpacing(true);/*from w  w w.j a  v  a2s.  co m*/
    addButtons.setMargin(true);
    addButtons.setStyleName("edit-btn-layout");

    Button newContact = new Button(AppContext.getMessage(ContactI18nEnum.VIEW_NEW_TITLE));
    newContact.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(Button.ClickEvent arg0) {
            fireNewRelatedItem("");
        }
    });
    addButtons.addComponent(newContact);

    Button selectContact = new Button(AppContext.getMessage(ContactI18nEnum.M_TITLE_SELECT_CONTACTS));
    selectContact.addClickListener(new Button.ClickListener() {

        private static final long serialVersionUID = -429296782998301810L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            CampaignContactSelectionView contactSelectionView = new CampaignContactSelectionView(
                    CampaignRelatedContactView.this);
            ContactSearchCriteria criteria = new ContactSearchCriteria();
            criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId()));
            contactSelectionView.setSearchCriteria(criteria);
            EventBusFactory.getInstance()
                    .post(new ShellEvent.PushView(CampaignRelatedContactView.this, contactSelectionView));
        }
    });
    addButtons.addComponent(selectContact);

    addContact.setContent(addButtons);

    return addContact;
}

From source file:com.esofthead.mycollab.mobile.module.crm.view.campaign.CampaignRelatedLeadView.java

License:Open Source License

@Override
protected Component createRightComponent() {
    final NavigationBarQuickMenu addLead = new NavigationBarQuickMenu();
    addLead.setStyleName("add-btn");

    VerticalLayout addBtns = new VerticalLayout();
    addBtns.setWidth("100%");
    addBtns.setSpacing(true);//from  w  w  w  .j ava2 s  .c  o  m
    addBtns.setMargin(true);
    addBtns.setStyleName("edit-btn-layout");

    Button newLead = new Button(AppContext.getMessage(LeadI18nEnum.VIEW_NEW_TITLE));
    newLead.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(Button.ClickEvent arg0) {
            fireNewRelatedItem("");
        }
    });
    addBtns.addComponent(newLead);

    Button selectLead = new Button(AppContext.getMessage(LeadI18nEnum.M_TITLE_SELECT_LEADS));
    selectLead.addClickListener(new Button.ClickListener() {

        private static final long serialVersionUID = -8749458276290086097L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            CampaignLeadSelectionView leadSelectionView = new CampaignLeadSelectionView(
                    CampaignRelatedLeadView.this);
            LeadSearchCriteria criteria = new LeadSearchCriteria();
            criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId()));
            leadSelectionView.setSearchCriteria(criteria);
            EventBusFactory.getInstance()
                    .post(new ShellEvent.PushView(CampaignRelatedLeadView.this, leadSelectionView));
        }
    });
    addBtns.addComponent(selectLead);

    addLead.setContent(addBtns);

    return addLead;
}