Example usage for com.vaadin.ui HorizontalLayout setMargin

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

Introduction

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

Prototype

@Override
    public void setMargin(boolean enabled) 

Source Link

Usage

From source file:jp.primecloud.auto.ui.ServiceDescBasic.java

License:Open Source License

public ServiceDescBasic() {

    addStyleName(Reindeer.PANEL_LIGHT);/*from   w w w  . ja  v  a 2 s  .com*/

    setHeight("100%");

    HorizontalLayout hlPanels = new HorizontalLayout();
    hlPanels.setWidth("100%");
    hlPanels.setHeight("100%");
    hlPanels.setMargin(true);
    hlPanels.setSpacing(true);
    hlPanels.addStyleName("service-desc-basic");
    setContent(hlPanels);

    left.setWidth("100%");
    right.setWidth("100%");

    //????
    Label padding = new Label(" ");
    padding.setWidth("7px");
    padding.setHeight("99%");
    padding.addStyleName("desc-padding");

    Label padding2 = new Label("");
    padding2.setWidth("1px");

    VerticalLayout layLeft = new VerticalLayout();
    layLeft.setMargin(false);
    layLeft.setSpacing(false);
    layLeft.setWidth("100%");
    layLeft.setHeight("100%");
    layLeft.addComponent(left);
    layLeft.setExpandRatio(left, 1.0f);

    VerticalLayout layRight = new VerticalLayout();
    layRight.setMargin(false);
    layRight.setSpacing(false);
    layRight.setWidth("100%");
    layRight.setHeight("100%");
    layRight.addComponent(right);
    layRight.addComponent(serverOpe);
    layRight.setExpandRatio(right, 1.0f);

    hlPanels.addComponent(layLeft);
    hlPanels.addComponent(padding);
    hlPanels.addComponent(padding2);
    hlPanels.addComponent(layRight);
    hlPanels.setExpandRatio(layLeft, 40);
    hlPanels.setExpandRatio(layRight, 60);
}

From source file:jp.primecloud.auto.ui.ServiceDescDetail.java

License:Open Source License

public ServiceDescDetail() {
    addStyleName(Reindeer.PANEL_LIGHT);/*w  w  w  .  j  a v  a  2s  .  c  om*/
    setHeight("100%");

    HorizontalLayout hlPanels = new HorizontalLayout();
    hlPanels.setWidth("100%");
    hlPanels.setHeight("100%");
    hlPanels.setMargin(true);
    hlPanels.setSpacing(true);
    hlPanels.addStyleName("service-desc-detail");
    setContent(hlPanels);

    left.setWidth("250px");
    right.setWidth("100%");
    right.setHeight("100%");

    VerticalLayout layLeft = new VerticalLayout();
    layLeft.setMargin(false);
    layLeft.setSpacing(false);
    layLeft.setWidth("250px");
    layLeft.setHeight("100%");
    layLeft.addComponent(left);
    layLeft.setExpandRatio(left, 1.0f);

    hlPanels.addComponent(layLeft);
    hlPanels.addComponent(right);

    hlPanels.setExpandRatio(right, 100);

}

From source file:jp.primecloud.auto.ui.WinPassword.java

License:Open Source License

public WinPassword(InstanceDto instanceDto, final Long instanceNo) {
    setCaption(ViewProperties.getCaption("description.getPassword"));
    setModal(true);/*www  . j  ava2s  . c o  m*/
    setWidth("580px");
    setIcon(Icons.EDITMINI.resource());

    VerticalLayout layout = (VerticalLayout) getContent();
    layout.setMargin(true);
    layout.setSpacing(true);
    layout.setStyleName("win-password");

    //
    PlatformDto platformDto = instanceDto.getPlatform();
    String keyName = "";
    // TODO CLOUD BRANCHING
    if (PCCConstant.PLATFORM_TYPE_AWS.equals(platformDto.getPlatform().getPlatformType())) {
        keyName = instanceDto.getAwsInstance().getKeyName();
    } else if (PCCConstant.PLATFORM_TYPE_CLOUDSTACK.equals(platformDto.getPlatform().getPlatformType())) {
        keyName = instanceDto.getCloudstackInstance().getKeyName();
    }

    Label privateKeyLabel = new Label(ViewMessages.getMessage("IUI-000099", keyName));
    layout.addComponent(privateKeyLabel);

    privateKeyField = new TextField();
    privateKeyField.setSizeFull();
    privateKeyField.setRows(10);

    privateKeyField.setStyleName("privatekey");
    layout.addComponent(privateKeyField);

    passwordField = new TextField("");
    passwordField.setColumns(20);

    passwordField.setCaption(ViewProperties.getCaption("label.password"));
    passwordField.setStyleName("password");
    layout.addComponent(passwordField);

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

    passwordButton = new Button(ViewProperties.getCaption("button.getPassword"));
    passwordButton.addListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            getPassword(instanceNo);
        }
    });

    horizontalLayout.addComponent(passwordButton);

    closeButton = new Button(ViewProperties.getCaption("button.close"));
    closeButton.addListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            close();
        }
    });
    horizontalLayout.addComponent(closeButton);

    layout.addComponent(horizontalLayout);
    layout.setComponentAlignment(horizontalLayout, Alignment.BOTTOM_RIGHT);
    layout.setComponentAlignment(passwordField, Alignment.MIDDLE_CENTER);

    initValidation();
}

From source file:lu.uni.lassy.excalibur.examples.icrash.dev.web.java.views.AdminAuthView.java

License:Open Source License

public AdminAuthView() {

    setSizeFull();//w  w w  . j a  va 2s. com

    VerticalLayout header = new VerticalLayout();
    header.setSizeFull();

    HorizontalLayout content = new HorizontalLayout();
    content.setSizeFull();

    addComponents(header, content);
    setExpandRatio(header, 1);
    setExpandRatio(content, 6);

    welcomeText.setValue("<h1>Welcome to the iCrash Administrator console!</h1>");
    welcomeText.setContentMode(ContentMode.HTML);
    welcomeText.setSizeUndefined();
    header.addComponent(welcomeText);
    header.setComponentAlignment(welcomeText, Alignment.MIDDLE_CENTER);

    Panel controlPanel = new Panel("Administrator control panel");
    controlPanel.setSizeUndefined();

    Panel addCoordPanel = new Panel("Create a new coordinator");
    addCoordPanel.setSizeUndefined();

    Panel messagesPanel = new Panel("Administrator messages");
    messagesPanel.setWidth("580px");

    Table adminMessagesTable = new Table();

    adminMessagesTable.setContainerDataSource(actAdmin.getMessagesDataSource());

    adminMessagesTable.setColumnWidth("inputEvent", 180);
    adminMessagesTable.setSizeFull();

    VerticalLayout controlLayout = new VerticalLayout(controlPanel);
    controlLayout.setSizeFull();
    controlLayout.setMargin(false);
    controlLayout.setComponentAlignment(controlPanel, Alignment.TOP_CENTER);

    VerticalLayout coordOperationsLayout = new VerticalLayout(addCoordPanel);
    coordOperationsLayout.setSizeFull();
    coordOperationsLayout.setMargin(false);
    coordOperationsLayout.setComponentAlignment(addCoordPanel, Alignment.TOP_CENTER);

    /******************************************/
    coordOperationsLayout.setVisible(true); // main layout in the middle
    addCoordPanel.setVisible(false); // ...which contains the panel "Create a new coordinator"
    /******************************************/

    HorizontalLayout messagesExternalLayout = new HorizontalLayout(messagesPanel);
    VerticalLayout messagesInternalLayout = new VerticalLayout(adminMessagesTable);

    messagesExternalLayout.setSizeFull();
    messagesExternalLayout.setMargin(false);
    messagesExternalLayout.setComponentAlignment(messagesPanel, Alignment.TOP_CENTER);

    messagesInternalLayout.setMargin(false);
    messagesInternalLayout.setSizeFull();
    messagesInternalLayout.setComponentAlignment(adminMessagesTable, Alignment.TOP_CENTER);

    messagesPanel.setContent(messagesInternalLayout);

    TextField idCoordAdd = new TextField();
    TextField loginCoord = new TextField();
    PasswordField pwdCoord = new PasswordField();

    Label idCaptionAdd = new Label("ID");
    Label loginCaption = new Label("Login");
    Label pwdCaption = new Label("Password");

    idCaptionAdd.setSizeUndefined();
    idCoordAdd.setSizeUndefined();

    loginCaption.setSizeUndefined();
    loginCoord.setSizeUndefined();

    pwdCaption.setSizeUndefined();
    pwdCoord.setSizeUndefined();

    Button validateNewCoord = new Button("Validate");
    validateNewCoord.setClickShortcut(KeyCode.ENTER);
    validateNewCoord.setStyleName(ValoTheme.BUTTON_PRIMARY);

    GridLayout addCoordinatorLayout = new GridLayout(2, 4);
    addCoordinatorLayout.setSpacing(true);
    addCoordinatorLayout.setMargin(true);
    addCoordinatorLayout.setSizeFull();

    addCoordinatorLayout.addComponents(idCaptionAdd, idCoordAdd, loginCaption, loginCoord, pwdCaption,
            pwdCoord);

    addCoordinatorLayout.addComponent(validateNewCoord, 1, 3);

    addCoordinatorLayout.setComponentAlignment(idCaptionAdd, Alignment.MIDDLE_LEFT);
    addCoordinatorLayout.setComponentAlignment(idCoordAdd, Alignment.MIDDLE_LEFT);
    addCoordinatorLayout.setComponentAlignment(loginCaption, Alignment.MIDDLE_LEFT);
    addCoordinatorLayout.setComponentAlignment(loginCoord, Alignment.MIDDLE_LEFT);
    addCoordinatorLayout.setComponentAlignment(pwdCaption, Alignment.MIDDLE_LEFT);
    addCoordinatorLayout.setComponentAlignment(pwdCoord, Alignment.MIDDLE_LEFT);

    addCoordPanel.setContent(addCoordinatorLayout);

    content.addComponents(controlLayout, coordOperationsLayout, messagesExternalLayout);
    content.setComponentAlignment(messagesExternalLayout, Alignment.TOP_CENTER);
    content.setComponentAlignment(controlLayout, Alignment.TOP_CENTER);
    content.setComponentAlignment(messagesExternalLayout, Alignment.TOP_CENTER);

    content.setExpandRatio(controlLayout, 20);
    content.setExpandRatio(coordOperationsLayout, 10);
    content.setExpandRatio(messagesExternalLayout, 28);

    Button addCoordinator = new Button("Add coordinator");
    Button deleteCoordinator = new Button("Delete coordinator");

    addCoordinator.addStyleName(ValoTheme.BUTTON_HUGE);
    deleteCoordinator.addStyleName(ValoTheme.BUTTON_HUGE);
    logoutBtn.addStyleName(ValoTheme.BUTTON_HUGE);

    VerticalLayout buttons = new VerticalLayout();

    buttons.setMargin(true);
    buttons.setSpacing(true);
    buttons.setSizeFull();

    buttons.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);

    controlPanel.setContent(buttons);

    buttons.addComponents(addCoordinator, deleteCoordinator, logoutBtn);

    /******* DELETE COORDINATOR PANEL BEGIN *********/
    Label idCaptionDel = new Label("ID");
    TextField idCoordDel = new TextField();

    Panel delCoordPanel = new Panel("Delete a coordinator");

    coordOperationsLayout.addComponent(delCoordPanel);
    delCoordPanel.setVisible(false);

    coordOperationsLayout.setComponentAlignment(delCoordPanel, Alignment.TOP_CENTER);
    delCoordPanel.setSizeUndefined();

    GridLayout delCoordinatorLayout = new GridLayout(2, 2);
    delCoordinatorLayout.setSpacing(true);
    delCoordinatorLayout.setMargin(true);
    delCoordinatorLayout.setSizeFull();

    Button deleteCoordBtn = new Button("Delete");
    deleteCoordBtn.setClickShortcut(KeyCode.ENTER);
    deleteCoordBtn.setStyleName(ValoTheme.BUTTON_PRIMARY);

    delCoordinatorLayout.addComponents(idCaptionDel, idCoordDel);

    delCoordinatorLayout.addComponent(deleteCoordBtn, 1, 1);

    delCoordinatorLayout.setComponentAlignment(idCaptionDel, Alignment.MIDDLE_LEFT);
    delCoordinatorLayout.setComponentAlignment(idCoordDel, Alignment.MIDDLE_LEFT);

    delCoordPanel.setContent(delCoordinatorLayout);
    /******* DELETE COORDINATOR PANEL END *********/

    /************************************************* MAIN BUTTONS LOGIC BEGIN *************************************************/

    addCoordinator.addClickListener(event -> {
        if (!addCoordPanel.isVisible()) {
            delCoordPanel.setVisible(false);
            addCoordPanel.setVisible(true);
            idCoordAdd.focus();
        } else
            addCoordPanel.setVisible(false);
    });

    deleteCoordinator.addClickListener(event -> {
        if (!delCoordPanel.isVisible()) {
            addCoordPanel.setVisible(false);
            delCoordPanel.setVisible(true);
            idCoordDel.focus();
        } else
            delCoordPanel.setVisible(false);
    });

    /************************************************* MAIN BUTTONS LOGIC END *************************************************/

    /************************************************* ADD COORDINATOR FORM LOGIC BEGIN *************************************************/
    validateNewCoord.addClickListener(event -> {

        String currentURL = Page.getCurrent().getLocation().toString();
        int strIndexCreator = currentURL.lastIndexOf(AdministratorLauncher.adminPageName);
        String iCrashURL = currentURL.substring(0, strIndexCreator);
        String googleShebang = "#!";
        String coordURL = iCrashURL + CoordinatorServlet.coordinatorsName + googleShebang;

        try {
            sys.oeAddCoordinator(new DtCoordinatorID(new PtString(idCoordAdd.getValue())),
                    new DtLogin(new PtString(loginCoord.getValue())),
                    new DtPassword(new PtString(pwdCoord.getValue())));

            // open new browser tab with the newly created coordinator console...
            // "_blank" instructs the browser to open a new tab instead of a new window...
            // unhappily not all browsers interpret it correctly,
            // some versions of some browsers might still open a new window instead (notably Firefox)!
            Page.getCurrent().open(coordURL + idCoordAdd.getValue(), "_blank");

        } catch (Exception e) {
            e.printStackTrace();
        }

        idCoordAdd.setValue("");
        loginCoord.setValue("");
        pwdCoord.setValue("");

        idCoordAdd.focus();
    });
    /************************************************* ADD COORDINATOR FORM LOGIC END *************************************************/
    /************************************************* DELETE COORDINATOR FORM LOGIC BEGIN *************************************************/
    deleteCoordBtn.addClickListener(event -> {
        IcrashSystem sys = IcrashSystem.getInstance();

        try {
            sys.oeDeleteCoordinator(new DtCoordinatorID(new PtString(idCoordDel.getValue())));
        } catch (Exception e) {
            e.printStackTrace();
        }

        idCoordDel.setValue("");
        idCoordDel.focus();
    });
    /************************************************* DELETE COORDINATOR FORM LOGIC END *************************************************/
}

From source file:module.contents.presentationTier.component.SectionComponent.java

License:Open Source License

private Component createSectionBody(final AbstractComponentContainer container) {
    final VerticalLayout sectionLayout = new VerticalLayout();
    addTag(sectionLayout, "a", null, "name", "section" + section.getNumber());
    addTag(sectionLayout, "h" + (2 + section.levelFromTop()), section.getNumberedTitle());
    if (section.getPage().canEdit()) {
        final HorizontalLayout horizontalLayout = new HorizontalLayout();
        horizontalLayout.setSpacing(true);
        horizontalLayout.setMargin(true);

        addEditSectionButton(horizontalLayout, sectionLayout, container, section);
        addAddSectionButton(horizontalLayout, container, section);
        sectionLayout.addComponent(horizontalLayout);
    }/*from  w  w w.  ja  v  a 2  s  .  c  o  m*/
    addTag(sectionLayout, "div", section.getContents().getContent());
    return sectionLayout;
}

From source file:module.pandabox.presentation.PandaBox.java

License:Open Source License

private Component getHorizontalLayout() {
    HorizontalLayout controls = new HorizontalLayout();
    controls.setSpacing(true);/*from  w w  w .  j  a  v a2 s .  c o m*/
    controls.setStyleName("inline");
    final VerticalLayout main = new VerticalLayout();

    final HorizontalLayout hl = new HorizontalLayout();
    hl.setSpacing(true);
    hl.setMargin(true);
    hl.setCaption("Layout Caption");
    hl.setIcon(new ThemeResource("../runo/icons/16/document.png"));
    hl.addComponent(createImageFixedHeight());
    hl.addComponent(createImageFixedHeight());
    hl.addComponent(createImageFixedHeight());

    controls.addComponent(
            new StyleController(hl, BennuTheme.LAYOUT_BIG, BennuTheme.LAYOUT_INSET, BennuTheme.LAYOUT_SECTION));
    controls.addComponent(new SpacingController(hl));
    controls.addComponent(new MarginController(hl));

    main.addComponent(controls);
    main.addComponent(hl);

    return main;
}

From source file:my.vaadin.profile.Forms.java

public Forms() {
    setSpacing(true);//from w w w.ja v  a 2  s  . co m
    setMargin(true);

    Label title = new Label("Signup Form");
    title.addStyleName("h1");
    addComponent(title);

    final FormLayout form = new FormLayout();
    form.setMargin(false);
    form.setWidth("900px");
    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 zID = new TextField("zID");
    zID.setValue("z123456");
    zID.setRequired(true);
    form.addComponent(zID);

    TextField name = new TextField("Name");
    name.setValue("loreum");
    //name.setWidth("50%");
    form.addComponent(name);

    PasswordField pw = new PasswordField("Set Password");
    pw.setRequired(true);
    form.addComponent(pw);

    DateField birthday = new DateField("Birthday");
    birthday.setDateFormat("dd-MM-yyyy");
    birthday.setValue(new java.util.Date());
    form.addComponent(birthday);

    OptionGroup gender = new OptionGroup("Gender");
    gender.addItem("Male");
    gender.addItem("Female");
    //sex.select("Male");
    gender.addStyleName("horizontal");
    form.addComponent(gender);

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

    TextField classID = new TextField("Class ID");
    classID.setValue("INFS2605");
    classID.setRequired(true);
    //classID.setWidth("50%");
    form.addComponent(classID);

    TextField groupID = new TextField("Group ID");
    groupID.setValue("1");
    //groupID.setWidth("50%");
    groupID.setRequired(true);
    form.addComponent(groupID);

    Button confirm = new Button("Confirm");
    confirm.addStyleName("primary");
    form.addComponent(confirm);

    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(confirm);

}

From source file:net.sf.gazpachoquest.questionnaires.views.QuestionnaireView.java

License:Open Source License

private HorizontalLayout createHeader() {
    final HorizontalLayout layout = new HorizontalLayout();
    layout.setWidth("100%");
    layout.setMargin(true);
    layout.setSpacing(true);//  ww  w .j a  va  2s .c o m
    final Label title = new Label("Activiti + Vaadin - A Match Made in Heaven");
    title.addStyleName(Reindeer.LABEL_H1);
    layout.addComponent(title);
    layout.setExpandRatio(title, 1.0f);

    Label currentUser = new Label();
    currentUser.setSizeUndefined();
    layout.addComponent(currentUser);
    layout.setComponentAlignment(currentUser, Alignment.MIDDLE_RIGHT);

    Button logout = new Button("Logout");
    logout.addStyleName(Reindeer.BUTTON_SMALL);
    // logout.addListener(createLogoutButtonListener());
    layout.addComponent(logout);
    layout.setComponentAlignment(logout, Alignment.MIDDLE_RIGHT);

    return layout;
}

From source file:nl.amc.biolab.nsg.display.component.MainUI.java

License:Open Source License

private HorizontalLayout buildTopPanelLeft() {
    HorizontalLayout topPanelLeft = new HorizontalLayout();
    topPanelLeft.setImmediate(true);/*w  w w . j a v  a 2 s  .  co m*/
    topPanelLeft.setWidth("-1px");
    topPanelLeft.setHeight("-1px");
    topPanelLeft.setMargin(false);
    topPanelLeft.setSpacing(false);

    // updateCatButton = new NativeButton();
    // updateCatButton.setCaption("synchronize data");
    // updateCatButton.setVisible(false);
    // topPanelLeft.addComponent(updateCatButton);
    // topPanelLeft.setComponentAlignment(updateCatButton, new
    // Alignment(33));

    projectsButton = new NativeButton();
    projectsButton.setImmediate(true);
    projectsButton.setWidth("-1px");
    projectsButton.setHeight("-1px");
    projectsButton.setHtmlContentAllowed(true);

    elementsButton = new NativeButton();
    elementsButton.setCaption("data");
    elementsButton.setImmediate(true);
    elementsButton.setWidth("-1px");
    elementsButton.setHeight("-1px");
    elementsButton.setHtmlContentAllowed(true);

    processingsButton = new NativeButton();
    processingsButton.setImmediate(true);
    processingsButton.setWidth("-1px");
    processingsButton.setHeight("-1px");
    processingsButton.setHtmlContentAllowed(true);

    return topPanelLeft;
}

From source file:nl.amc.biolab.nsg.display.component.MainUI.java

License:Open Source License

private HorizontalLayout buildTopPanelMid() {
    // common part: create layout
    HorizontalLayout topPanelMid = new HorizontalLayout();
    topPanelMid.setImmediate(false);//w  w  w .j av a2 s .c om
    topPanelMid.setWidth("-1px");
    topPanelMid.setHeight("-1px");
    topPanelMid.setMargin(false);
    topPanelMid.setSpacing(true);

    // searchLabel
    searchLabel = new Label();
    searchLabel.setImmediate(false);
    searchLabel.setWidth("-1px");
    searchLabel.setHeight("-1px");
    searchLabel.setValue("search ");
    topPanelMid.addComponent(searchLabel);
    topPanelMid.setComponentAlignment(searchLabel, Alignment.MIDDLE_CENTER);

    // searchSelect
    searchSelect = new Select();
    searchSelect.setImmediate(false);
    searchSelect.setWidth("-1px");
    searchSelect.setHeight("-1px");
    topPanelMid.addComponent(searchSelect);
    topPanelMid.setComponentAlignment(searchSelect, Alignment.MIDDLE_CENTER);

    // label_1
    label_1 = new Label();
    label_1.setImmediate(false);
    label_1.setWidth("-1px");
    label_1.setHeight("-1px");
    label_1.setValue(" with ");
    topPanelMid.addComponent(label_1);
    topPanelMid.setComponentAlignment(label_1, Alignment.MIDDLE_CENTER);

    // searchTextField
    searchTextField = new TextField();
    searchTextField.setImmediate(false);
    searchTextField.setWidth("-1px");
    searchTextField.setHeight("-1px");
    topPanelMid.addComponent(searchTextField);
    topPanelMid.setComponentAlignment(searchTextField, Alignment.MIDDLE_CENTER);

    searchButton = new NativeButton();
    searchButton.setCaption("refine search");
    topPanelMid.addComponent(searchButton);
    topPanelMid.setComponentAlignment(searchButton, Alignment.MIDDLE_CENTER);

    allSearchButton = new NativeButton();
    allSearchButton.setCaption("search in all columns");
    topPanelMid.addComponent(allSearchButton);
    topPanelMid.setComponentAlignment(allSearchButton, Alignment.MIDDLE_CENTER);

    newSearchButton = new NativeButton();
    newSearchButton.setCaption("new search");
    topPanelMid.addComponent(newSearchButton);
    topPanelMid.setComponentAlignment(newSearchButton, Alignment.MIDDLE_CENTER);

    return topPanelMid;
}