Example usage for com.vaadin.ui VerticalLayout addComponent

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

Introduction

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

Prototype

@Override
public void addComponent(Component c) 

Source Link

Document

Add a component into this container.

Usage

From source file:com.jain.addon.web.layout.JainGroupLayout.java

License:Apache License

private JainLayout createOrUpdateCurrentLayout(JNIGroup group, String groupName) {
    if (group != null && group.getParent() != null) {
        JainLayout parentLayout = groupLayoutMap.get(group.getParent().getName());
        if (parentLayout == null) {
            parentLayout = createOrUpdateCurrentLayout(group.getParent(), group.getParent().getName());
        }//from  w w  w. j a  v  a 2 s.  c o m

        if (parentLayout != null) {
            JainLayout layout = new JainLayout(spacing, margin,
                    group.getParent() == null ? group.getColumns() : group.getParent().getColumns());

            if (StringHelper.isNotEmptyWithTrim(alternateStyleName))
                layout.setStyleName(alternateStyleName);

            VerticalLayout groupLayout = new VerticalLayout();

            if (StringHelper.isNotEmptyWithTrim(styleName))
                groupLayout.setStyleName(styleName);

            if (StringHelper.isNotEmptyWithTrim(group.getDisplayName())) {
                groupLayout.setCaption(group.getDisplayName());
            }

            groupLayout.setSpacing(true);
            groupLayout.setMargin(true);
            groupLayout.setWidth("100%");
            groupLayout.addComponent(layout);
            parentLayout.addComponent(groupLayout, group.getColSpan());

            groupLayoutMap.put(groupName, layout);
            return layout;
        }
    }

    String groupDisplayName = group == null ? "" : group.getDisplayName();
    JainLayout layout = new JainLayout(spacing, margin, group == null ? columns : group.getColumns());

    if (StringHelper.isNotEmptyWithTrim(alternateStyleName))
        layout.setStyleName(alternateStyleName);

    VerticalLayout groupLayout = new VerticalLayout();

    if (StringHelper.isNotEmptyWithTrim(styleName))
        groupLayout.setStyleName(styleName);

    if (StringHelper.isNotEmptyWithTrim(groupDisplayName)) {
        groupLayout.setCaption(group.getDisplayName());
    }

    groupLayout.setSpacing(true);
    groupLayout.setMargin(true);
    groupLayout.setWidth("100%");
    groupLayout.addComponent(layout);
    super.addComponent(groupLayout);

    groupLayoutMap.put(groupName, layout);
    return layout;
}

From source file:com.jain.common.approot.ApplicationUI.java

License:Apache License

public void initialize(Locale locale) {
    user.setLocale(locale);/* w  ww  . ja v a  2  s. co m*/

    addApplicationTitle();

    VerticalLayout view = new VerticalLayout();
    setContent(view);

    view.setStyleName(ApplicationTheme.VIEW);
    view.setWidth("100%");
    view.setHeight("100%");
    view.setSpacing(false);
    view.setMargin(false);

    createWelcomebar(view);

    Header header = CDIComponent.getInstance(Header.class);
    view.addComponent(header);
    header.addDefaultTab();
}

From source file:com.jain.common.approot.ApplicationUI.java

License:Apache License

private void createWelcomebar(VerticalLayout view) {
    WelcomeBar welcomebar = CDIComponent.getInstance(WelcomeBar.class);
    view.addComponent(welcomebar);
}

From source file:com.jain.common.authenticate.LoginAction.java

License:Apache License

private void createActions(VerticalLayout layout) {
    ButtonSegment hLayout = new ButtonSegment(ApplicationTheme.FIRST, ApplicationTheme.LAST);
    hLayout.setStyleName(ApplicationTheme.HEADER_SEGMENT_SMALL);
    hLayout.createSegment(this, JAction.LOGIN, JAction.CANCEL);

    VerticalLayout vLayout = new VerticalLayout();
    vLayout.setSizeUndefined();/*ww  w. j  ava  2  s  .c  o m*/
    vLayout.setStyleName(ApplicationTheme.VIEW);
    vLayout.addComponent(hLayout);

    layout.addComponent(vLayout);
    layout.setComponentAlignment(vLayout, Alignment.MIDDLE_CENTER);
    layout.setExpandRatio(vLayout, 1);
}

From source file:com.jain.common.authenticate.LoginAction.java

License:Apache License

private void createFieldGroup(VerticalLayout layout) {
    I18NProvider provider = DefaultI18NResourceProvider.instance();

    userName = new TextField("user.name");
    userName.setCursorPosition(0);//from w  w  w.  j ava 2  s  . c  o  m
    userName.setRequired(true);
    userName.setRequiredError(provider.getMessage(getLocale(), "common.something.required", "user.name.title",
            JAction.LOGIN.getDisplayName()));
    userName.setDescription("user.name");
    userName.setSizeFull();
    userName.setStyleName(JNStyleConstants.J_FIELD);

    password = new PasswordField("password");
    password.setRequired(true);
    password.setRequiredError(provider.getMessage(getLocale(), "common.something.required", "password.title",
            JAction.LOGIN.getDisplayName()));
    password.setDescription("password");
    password.setSizeFull();
    password.setStyleName(JNStyleConstants.J_FIELD);

    VerticalLayout verticalLayout = new VerticalLayout();
    verticalLayout.setStyleName(ApplicationTheme.VIEW);
    verticalLayout.setSpacing(true);
    verticalLayout.setMargin(true);
    verticalLayout.setWidth("100%");

    FormLayout formLayout = new FormLayout();
    formLayout.setStyleName(ApplicationTheme.ALTERNATE_VIEW);
    formLayout.setSpacing(true);
    formLayout.setMargin(true);
    formLayout.setWidth("100%");
    formLayout.addComponent(userName);
    formLayout.addComponent(password);

    verticalLayout.addComponent(formLayout);

    layout.addComponent(verticalLayout);
}

From source file:com.jain.common.header.Header.java

License:Apache License

public void addDefaultTab() {
    findNCreateCurrentComponent();/*from   w  ww  .j  a v  a2 s  .c om*/
    VerticalLayout contentLayout = (VerticalLayout) getUI().getContent();
    contentLayout.setSpacing(false);
    contentLayout.setMargin(false);
    contentLayout.addComponent(currentComponent);
    contentLayout.setExpandRatio(currentComponent, 3);
}

From source file:com.jain.common.header.Header.java

License:Apache License

public void buttonClick(ClickEvent event) {
    Button selected = event.getButton();

    if (selected != current) {
        current.removeStyleName(ApplicationTheme.SELECTED);
        current = event.getButton();/*  ww  w  . j av  a 2  s . co m*/
        current.addStyleName(ApplicationTheme.SELECTED);

        VerticalLayout layout = (VerticalLayout) getUI().getContent();

        if (currentComponent != null)
            layout.removeComponent(currentComponent);

        findNCreateCurrentComponent();

        if (currentComponent != null) {
            layout.setSpacing(false);
            layout.setMargin(false);
            layout.addComponent(currentComponent);
            layout.setExpandRatio(currentComponent, 3);
        }
    }
}

From source file:com.jain.i18N.definition.PersonDefinitionForm.java

License:Apache License

private void createActions(VerticalLayout layout) {
    if (!viewOnly) {
        JainEditClickListener clickListner = new JainEditClickListener(this);
        HorizontalLayout hLayout = VaadinHelper.createButtonSegment(clickListner, JAction.SAVE, JAction.CANCEL);

        VerticalLayout vLayout = new VerticalLayout();
        vLayout.setSizeUndefined();//from  w  ww.j  a v a 2 s . co m
        vLayout.setStyleName(ApplicationTheme.VIEW);
        vLayout.addComponent(hLayout);

        layout.addComponent(vLayout);
        layout.setComponentAlignment(vLayout, Alignment.MIDDLE_CENTER);
        layout.setExpandRatio(vLayout, 1);
    }
}

From source file:com.jain.i18N.definition.PersonDefinitionForm.java

License:Apache License

private void createFieldGroup(VerticalLayout layout) {
    JainBeanItem<Person> item = new JainBeanItem<Person>(getPerson());
    JFieldGroup<Person> jainFieldGroup = new JFieldGroup<Person>(2, PersonPropertyConstraint.values());
    jainFieldGroup.setViewOnly(viewOnly);
    jainFieldGroup.setStyleName(ApplicationTheme.VIEW);
    jainFieldGroup.setAlternateStyleName(ApplicationTheme.ALTERNATE_VIEW);
    layout.addComponent(jainFieldGroup);

    fieldGroup = jainFieldGroup.createFieldGroup(Person.class, item,
            Arrays.asList(PersonPropertyConstraint.values()));
}

From source file:com.jiangyifen.ec2.ui.csr.toolbar.CsrPhone2PhoneSettingWindow.java

public CsrPhone2PhoneSettingWindow() {
    this.setWidth("413px");
    this.setHeight("220px");
    this.setResizable(false);

    VerticalLayout mainLayout = new VerticalLayout();
    mainLayout.setWidth("100%");
    mainLayout.setSpacing(true);//from ww w . j a v  a2s.  c o m
    mainLayout.setMargin(true);
    this.setContent(mainLayout);

    domain = SpringContextHolder.getDomain();
    loginUser = SpringContextHolder.getLoginUser();
    phone2PhoneSettingService = SpringContextHolder.getBean("phone2PhoneSettingService");

    notification = new Notification("");
    notification.setDelayMsec(1000);
    notification.setHtmlContentAllowed(true);

    // ???????
    String notice = "<font color='red'><B>??????</B></font>";
    noticeLabel = new Label(notice, Label.CONTENT_XHTML);
    noticeLabel.setVisible(false);
    mainLayout.addComponent(noticeLabel);

    // ??? 
    this.customP2PSetting = initializeCustomP2PSetting();

    // ?
    createlStartSetting(mainLayout);

    // 
    createlDaysOfWeekType(mainLayout);

    // 
    createlDayOfWeek(mainLayout);

    // 
    createRunRedirectTime(mainLayout);

    // 
    createlRedirectType(mainLayout);

    // ?? 
    createNoanwserTimeout(mainLayout);

    // ?
    createOperatorButtons(mainLayout);
}