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.hrms.main.AboutHRIS.java

public AboutHRIS() {
    setCaption("About HRIS");
    setWidth("300px");

    VerticalLayout vlayout = new VerticalLayout();
    vlayout.setSpacing(true);//from   w ww .j a  va  2 s .  co m
    vlayout.setMargin(true);

    Label version = new Label("Version: <b>1.5</b>");
    version.setContentMode(Label.CONTENT_XHTML);
    vlayout.addComponent(version);

    Label title = new Label("Title: <b>Human Resource Information System</b>");
    title.setContentMode(Label.CONTENT_XHTML);
    vlayout.addComponent(title);

    Label developer = new Label("Developed By: <b>Engr. Godfrey D. Beray</b>");
    developer.setContentMode(Label.CONTENT_XHTML);
    vlayout.addComponent(developer);

    Label framework = new Label("Framework: <b>VAADIN - Sept2012</b>");
    framework.setContentMode(Label.CONTENT_XHTML);
    vlayout.addComponent(framework);

    addComponent(vlayout);
}

From source file:com.jain.addon.action.confirm.ConfirmWindow.java

License:Apache License

@JNIComponentInit
public void init() {
    setModal(true);//from   w w w  .j  av  a 2  s.c  o  m
    setWidth("25%");

    VerticalLayout layout = new VerticalLayout();
    setContent(layout);

    layout.setWidth("100%");
    layout.setMargin(true);
    layout.setSpacing(true);
    layout.setStyleName(JNStyleConstants.J_ALTERNATE_VIEW);

    JNConfirm confirm = action.getConfirm();
    HorizontalLayout hLayout = new HorizontalLayout();
    hLayout.setSpacing(true);
    hLayout.setWidth("100%");
    findNAddIcon(confirm, hLayout);

    Label label = new Label(confirm.message());
    label.setContentMode(confirm.mode());
    hLayout.addComponent(label);
    hLayout.setExpandRatio(label, 2);
    layout.addComponent(hLayout);
    layout.setComponentAlignment(hLayout, Alignment.MIDDLE_CENTER);

    ActionMenuBar<ConfirmWindow> menuBar = new ActionMenuBar<ConfirmWindow>(null, this);
    layout.addComponent(menuBar);
    layout.setExpandRatio(menuBar, 2);
    layout.setComponentAlignment(menuBar, Alignment.MIDDLE_CENTER);
}

From source file:com.jain.addon.component.crud.JCrudWindow.java

License:Apache License

@JNIComponentInit
public void init() {
    setModal(true);//from w ww  .ja v a2 s .  c om
    setSizeUndefined();
    setWidth("70%");

    VerticalLayout layout = new VerticalLayout();
    layout.setWidth("100%");
    layout.setMargin(new MarginInfo(false, false, true, false));
    layout.setStyleName(JNStyleConstants.J_ALTERNATE_VIEW);

    setContent(layout);
    createFieldGroup(layout);

    createActions(layout);
}

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 ww  w .  j  a  v  a2s  .c  om

        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);/*from w  w w . j  a  v a2  s .  c o 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.authenticate.LoginAction.java

License:Apache License

@JNIComponentInit
public void init() {
    setModal(true);/* w w w . j a va2  s  .co m*/
    setWidth("30%");

    VerticalLayout layout = new VerticalLayout();
    setContent(layout);

    layout.setWidth("100%");
    layout.setMargin(true);
    layout.setSpacing(true);
    layout.setStyleName(ApplicationTheme.ALTERNATE_VIEW);

    createFieldGroup(layout);

    createActions(layout);
}

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   ww w.  ja va2s.  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 w w .j av a 2 s. c  o  m*/
    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();//from w  w w  . j av  a  2s . c  o  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

@JNIComponentInit
public void init() {
    setModal(true);/*from w w  w .jav a  2s. c  om*/
    setWidth("70%");

    VerticalLayout layout = new VerticalLayout();
    layout.setWidth("100%");
    layout.setMargin(new MarginInfo(false, false, true, false));
    layout.setStyleName(ApplicationTheme.ALTERNATE_VIEW);

    setContent(layout);
    createFieldGroup(layout);

    createActions(layout);
}