Example usage for com.vaadin.ui VerticalLayout setStyleName

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

Introduction

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

Prototype

@Override
    public void setStyleName(String style) 

Source Link

Usage

From source file:com.mycollab.mobile.ui.ConfirmDialog.java

License:Open Source License

private void constructUI(final String message, final String okCaption, final String cancelCaption) {
    VerticalLayout layout = new VerticalLayout();
    layout.setWidth("100%");
    layout.setHeightUndefined();//from   ww  w .  j a  v a 2 s. c  o  m
    layout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);

    VerticalLayout messageWrapper = new VerticalLayout();
    messageWrapper.setStyleName("message-wrapper");
    messageWrapper.setWidth("100%");
    messageWrapper.setMargin(true);

    final Label messageDisplay = new Label(message);
    messageDisplay.setWidth("100%");
    messageWrapper.addComponent(messageDisplay);
    layout.addComponent(messageWrapper);

    HorizontalLayout controlBtn = new HorizontalLayout();
    controlBtn.setWidth("100%");

    final Button okBtn = new Button(okCaption);
    okBtn.setWidth("100%");
    okBtn.setHeight("35px");
    final Button cancelBtn = new Button(cancelCaption);
    cancelBtn.setWidth("100%");
    cancelBtn.setHeight("35px");

    ClickListener listener = (clickEvent) -> {
        ConfirmDialog.this.setConfirmed(clickEvent.getButton() == okBtn);
        if (ConfirmDialog.this.getListener() != null) {
            ConfirmDialog.this.getListener().onClose(ConfirmDialog.this);
        }
        close();
    };

    okBtn.addClickListener(listener);
    cancelBtn.addClickListener(listener);

    controlBtn.addComponent(cancelBtn);
    controlBtn.addComponent(okBtn);

    layout.addComponent(controlBtn);
    this.setContent(layout);
}

From source file:com.mycollab.module.crm.view.activity.MeetingFormLayoutFactory.java

License:Open Source License

@Override
public AbstractComponent getLayout() {
    AddViewLayout2 meetingLayout = new AddViewLayout2(title,
            CrmAssetsManager.getAsset(CrmTypeConstants.MEETING));

    Layout topPanel = createTopPanel();// ww  w.j  av a  2 s  .c  o  m
    if (topPanel != null) {
        meetingLayout.addControlButtons(topPanel);
    }
    wrappedLayoutFactory = new DefaultDynaFormLayout(CrmTypeConstants.MEETING,
            MeetingDefaultFormLayoutFactory.getForm());
    VerticalLayout body = new VerticalLayout();
    body.setStyleName(WebThemes.BOX);
    body.addComponent(wrappedLayoutFactory.getLayout());
    meetingLayout.addBody(body);

    return meetingLayout;
}

From source file:com.mycollab.module.user.accountsettings.team.view.UserListViewImpl.java

License:Open Source License

private Component generateMemberBlock(final SimpleUser member) {
    VerticalLayout blockContent = new VerticalLayout();
    blockContent.setWidth("350px");
    blockContent.setStyleName("member-block");
    if (RegisterStatusConstants.NOT_LOG_IN_YET.equals(member.getRegisterstatus())) {
        blockContent.addStyleName("inactive");
    }/*  w  w w  . j av a  2  s  .  com*/
    MHorizontalLayout blockTop = new MHorizontalLayout().withFullWidth();
    Image memberAvatar = UserAvatarControlFactory.createUserAvatarEmbeddedComponent(member.getAvatarid(), 100);
    memberAvatar.addStyleName(UIConstants.CIRCLE_BOX);
    blockTop.addComponent(memberAvatar);

    MVerticalLayout memberInfo = new MVerticalLayout().withMargin(false);

    MHorizontalLayout buttonControls = new MHorizontalLayout();
    buttonControls.setDefaultComponentAlignment(Alignment.TOP_RIGHT);
    buttonControls.setVisible(UserUIContext.canWrite(RolePermissionCollections.ACCOUNT_USER));

    if (RegisterStatusConstants.NOT_LOG_IN_YET.equals(member.getRegisterstatus())) {
        MButton resendBtn = new MButton(UserUIContext.getMessage(UserI18nEnum.ACTION_RESEND_INVITATION),
                clickEvent -> {
                    SendUserInvitationEvent invitationEvent = new SendUserInvitationEvent(member.getUsername(),
                            null, member.getInviteUser(), MyCollabUI.getSubDomain(), MyCollabUI.getAccountId());
                    AsyncEventBus asyncEventBus = AppContextUtil.getSpringBean(AsyncEventBus.class);
                    asyncEventBus.post(invitationEvent);
                    NotificationUtil.showNotification(UserUIContext.getMessage(GenericI18Enum.OPT_SUCCESS),
                            UserUIContext.getMessage(UserI18nEnum.OPT_SEND_INVITATION_SUCCESSFULLY,
                                    member.getDisplayName()));
                }).withStyleName(WebThemes.BUTTON_LINK);
        buttonControls.with(resendBtn);
    }

    MButton editBtn = new MButton("",
            clickEvent -> EventBusFactory.getInstance()
                    .post(new UserEvent.GotoEdit(UserListViewImpl.this, member))).withIcon(FontAwesome.EDIT)
                            .withStyleName(WebThemes.BUTTON_LINK);
    buttonControls.with(editBtn);

    MButton deleteBtn = new MButton("",
            clickEvent -> ConfirmDialogExt.show(UI.getCurrent(),
                    UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, MyCollabUI.getSiteName()),
                    UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE),
                    UserUIContext.getMessage(GenericI18Enum.BUTTON_YES),
                    UserUIContext.getMessage(GenericI18Enum.BUTTON_NO), confirmDialog -> {
                        if (confirmDialog.isConfirmed()) {
                            UserService userService = AppContextUtil.getSpringBean(UserService.class);
                            userService.pendingUserAccounts(Collections.singletonList(member.getUsername()),
                                    MyCollabUI.getAccountId());
                            EventBusFactory.getInstance()
                                    .post(new UserEvent.GotoList(UserListViewImpl.this, null));
                        }
                    })).withIcon(FontAwesome.TRASH_O).withStyleName(WebThemes.BUTTON_LINK);
    buttonControls.with(deleteBtn);

    memberInfo.addComponent(buttonControls);
    memberInfo.setComponentAlignment(buttonControls, Alignment.MIDDLE_RIGHT);

    A memberLink = new A(
            AccountLinkGenerator.generatePreviewFullUserLink(MyCollabUI.getSiteUrl(), member.getUsername()))
                    .appendText(member.getDisplayName());
    ELabel memberLinkLbl = ELabel.h3(memberLink.write()).withStyleName(UIConstants.TEXT_ELLIPSIS);
    memberInfo.addComponent(memberLinkLbl);
    memberInfo.addComponent(ELabel.hr());

    if (member.getRoleid() != null) {
        String memberRoleLinkPrefix = String.format("<a href=\"%s\"",
                AccountLinkBuilder.generatePreviewFullRoleLink(member.getRoleid()));
        ELabel memberRole = new ELabel(ContentMode.HTML).withStyleName(UIConstants.TEXT_ELLIPSIS);
        if (Boolean.TRUE.equals(member.getIsAccountOwner())) {
            memberRole.setValue(String.format("%sstyle=\"color: #B00000;\">%s</a>", memberRoleLinkPrefix,
                    UserUIContext.getMessage(RoleI18nEnum.OPT_ACCOUNT_OWNER)));
        } else {
            memberRole.setValue(String.format("%sstyle=\"color:gray;font-size:12px;\">%s</a>",
                    memberRoleLinkPrefix, member.getRoleName()));
        }
        memberInfo.addComponent(memberRole);
    } else if (Boolean.TRUE.equals(member.getIsAccountOwner())) {
        Label memberRole = new Label(String.format("<a style=\"color: #B00000;\">%s</a>",
                UserUIContext.getMessage(RoleI18nEnum.OPT_ACCOUNT_OWNER)), ContentMode.HTML);
        memberInfo.addComponent(memberRole);
    } else {
        Label lbl = new Label();
        lbl.setHeight("10px");
        memberInfo.addComponent(lbl);
    }

    if (Boolean.TRUE.equals(MyCollabUI.showEmailPublicly())) {
        Label memberEmailLabel = ELabel
                .html(String.format("<a href='mailto:%s'>%s</a>", member.getUsername(), member.getUsername()))
                .withStyleName(UIConstants.TEXT_ELLIPSIS, UIConstants.META_INFO).withFullWidth();
        memberInfo.addComponent(memberEmailLabel);
    }

    ELabel memberSinceLabel = ELabel
            .html(UserUIContext.getMessage(UserI18nEnum.OPT_MEMBER_SINCE,
                    UserUIContext.formatPrettyTime(member.getRegisteredtime())))
            .withDescription(UserUIContext.formatDateTime(member.getRegisteredtime())).withFullWidth();
    memberInfo.addComponent(memberSinceLabel);

    ELabel lastAccessTimeLbl = ELabel
            .html(UserUIContext.getMessage(UserI18nEnum.OPT_MEMBER_LOGGED_IN,
                    UserUIContext.formatPrettyTime(member.getLastaccessedtime())))
            .withDescription(UserUIContext.formatDateTime(member.getLastaccessedtime()));
    memberInfo.addComponent(lastAccessTimeLbl);
    blockTop.with(memberInfo).expand(memberInfo);
    blockContent.addComponent(blockTop);
    return blockContent;
}

From source file:com.mycollab.vaadin.web.ui.OptionPopupContent.java

License:Open Source License

public OptionPopupContent() {
    VerticalLayout root = new VerticalLayout();
    root.setStyleName(WebThemes.OPTION_POPUP_CONTENT);
    this.setCompositionRoot(root);
}

From source file:com.ocs.dynamo.ui.composite.dialog.BaseModalDialog.java

License:Apache License

private void constructLayout() {
    this.setModal(true);
    this.setResizable(false);

    Panel panel = new Panel();
    panel.setCaptionAsHtml(true);//from  w w w .  j av  a2s  . co m
    panel.setCaption(getTitle());

    this.setContent(panel);

    VerticalLayout main = new DefaultVerticalLayout();
    main.setStyleName("ocsDialog");
    panel.setContent(main);

    doBuild(main);

    DefaultHorizontalLayout buttonBar = new DefaultHorizontalLayout();
    main.addComponent(buttonBar);

    doBuildButtonBar(buttonBar);
}

From source file:com.ocs.dynamo.ui.composite.dialog.ModelBasedSearchDialog.java

License:Apache License

@Override
protected void doBuild(Layout parent) {
    FormOptions formOptions = new FormOptions().setHideAddButton(true).setPopup(true)
            .setSearchImmediately(searchImmediately);

    VerticalLayout wrapper = new DefaultVerticalLayout(false, false);
    wrapper.setStyleName("searchDialogWrapper");
    parent.addComponent(wrapper);/* www .j  ava2 s . c  o  m*/

    searchLayout = new SimpleSearchLayout<ID, T>(service, entityModel, QueryType.ID_BASED, formOptions, null,
            filters, sortOrder, joins);
    if (pageLength != null) {
        searchLayout.setPageLength(pageLength);
    }
    searchLayout.setMultiSelect(multiSelect);

    // add double click listener
    searchLayout.getTableWrapper().getTable().addItemClickListener(new ItemClickListener() {

        private static final long serialVersionUID = -6261614659335513455L;

        @Override
        public void itemClick(ItemClickEvent event) {
            if (event.isDoubleClick()) {
                select(event.getItem().getItemProperty(DynamoConstants.ID).getValue());
                getOkButton().click();
            }
        }
    });

    wrapper.addComponent(searchLayout);
}

From source file:com.peergreen.webconsole.scope.deployment.internal.deployable.DeployablePanel.java

License:Open Source License

@PostConstruct
public void init() {

    setSizeFull();/*from   w  w w .j av a 2  s.c  o  m*/

    VerticalLayout mainContent = new VerticalLayout();
    mainContent.setSpacing(true);
    mainContent.setMargin(true);
    mainContent.setStyleName("deployable-style");
    mainContent.setSizeFull();

    HorizontalLayout header = new HorizontalLayout();
    header.setWidth("100%");
    Button openManager = new Button("Edit repositories");
    openManager.addStyleName("link");
    openManager.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            if (tabSheet.getTab(manager) == null) {
                tabSheet.addTab(manager, "Manager",
                        new ClassResource(getClass(), "/images/22x22/configuration.png"), containers.size())
                        .setClosable(true);
            }
            tabSheet.setSelectedTab(manager);
        }
    });
    header.addComponent(openManager);
    header.setComponentAlignment(openManager, Alignment.MIDDLE_RIGHT);
    mainContent.addComponent(header);

    tabSheet.setSizeFull();
    mainContent.addComponent(tabSheet);
    mainContent.setExpandRatio(tabSheet, 1.5f);

    DragAndDropWrapper mainContentWrapper = new DragAndDropWrapper(mainContent);
    mainContentWrapper.setDropHandler(new DeploymentDropHandler(deploymentViewManager, this, notifierService));
    mainContentWrapper.setSizeFull();

    setContent(mainContentWrapper);
}

From source file:com.peergreen.webconsole.scope.deployment.internal.deployed.DeployedPanel.java

License:Open Source License

@PostConstruct
public void init() {
    setSizeFull();//from w  w w .j  ava 2 s  .c om
    Table table = new Table();

    VerticalLayout mainContent = new VerticalLayout();
    mainContent.setSpacing(true);
    mainContent.setMargin(true);
    mainContent.setStyleName("deployable-style");
    mainContent.setSizeFull();

    setContent(mainContent);

    HorizontalLayout toolBar = new HorizontalLayout();
    toolBar.setMargin(true);
    toolBar.setSpacing(true);
    toolBar.setWidth("100%");

    // Select all deployed artifacts
    CheckBox selectAll = new CheckBox("All");
    selectAll.addValueChangeListener(new SelectAll(table));
    toolBar.addComponent(selectAll);
    toolBar.setExpandRatio(selectAll, 1);

    // Filter
    TextField filter = new TextField();
    filter.setInputPrompt("Filter deployed artifacts");
    filter.setWidth("100%");
    filter.addTextChangeListener(new FilterFiles(TREE_ITEM_ID, container));
    toolBar.addComponent(filter);
    toolBar.setComponentAlignment(filter, Alignment.TOP_LEFT);
    toolBar.setExpandRatio(filter, 3);

    HorizontalLayout actionArea = new HorizontalLayout();
    final NativeSelect actionSelection = new NativeSelect();
    actionSelection.addItem(DeploymentActions.UNDEPLOY);
    actionSelection.addItem(DeploymentActions.DELETE);
    actionSelection.addItem(DeploymentActions.DEPLOYMENT_PLAN);
    actionSelection.setWidth("100px");
    actionSelection.setNullSelectionAllowed(false);

    Button doButton = new Button("Do");
    doButton.addStyleName("default");
    doButton.addClickListener(
            new DoClickListener(artifactBuilder, table, actionSelection, deploymentViewManager));

    actionArea.addComponent(actionSelection);
    actionArea.addComponent(doButton);
    toolBar.addComponent(actionArea);
    toolBar.setComponentAlignment(actionArea, Alignment.TOP_RIGHT);
    mainContent.addComponent(toolBar);

    VerticalLayout deployedContainer = new VerticalLayout();
    DragAndDropWrapper deployedContainerWrapper = new DragAndDropWrapper(deployedContainer);
    deployedContainerWrapper
            .setDropHandler(new DeploymentDropHandler(deploymentViewManager, this, notifierService));
    deployedContainerWrapper.setSizeFull();
    mainContent.addComponent(deployedContainerWrapper);
    mainContent.setExpandRatio(deployedContainerWrapper, 1.5f);

    container.addContainerProperty(TREE_ITEM_ID, String.class, null);
    table.setSizeFull();
    table.setImmediate(true);
    table.setMultiSelect(true);
    table.setSelectable(true);
    table.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN);
    table.setContainerDataSource(container);
    table.setDragMode(Table.TableDragMode.MULTIROW);
    table.setItemCaptionPropertyId(TREE_ITEM_ID);
    table.setCellStyleGenerator(new ItemStyle(DeployableContainerType.DEPLOYED, deploymentManager));
    table.addShortcutListener(new DeleteFileShortcutListener(deploymentViewManager, table, "Delete",
            ShortcutAction.KeyCode.DELETE, null));
    table.setItemDescriptionGenerator(new ItemDescription());
    table.addItemClickListener(new ItemClickEvent.ItemClickListener() {
        @Override
        public void itemClick(ItemClickEvent event) {
            if (event.isDoubleClick()) {
                DeployableEntry deployableEntry = (DeployableEntry) event.getItemId();
                try {
                    ArtifactStatusReport report = deploymentManager
                            .getReport(deployableEntry.getUri().toString());
                    event.getComponent().getUI()
                            .addWindow(new DeployableWindow(deployableEntry, report).getWindow());
                } catch (ArtifactStatusReportException e) {
                    LOGGER.warn("Cannot get artifact status report for ''{0}''", deployableEntry.getUri(), e);
                    event.getComponent().getUI().addWindow(new DeployableWindow(deployableEntry).getWindow());
                }
            }
        }
    });
    deployedContainer.addComponent(table);
    deployedContainer.setExpandRatio(table, 1.5f);

    refresh();
}

From source file:com.peergreen.webconsole.scope.deployment.internal.deploymentplan.DeploymentPlanPanel.java

License:Open Source License

@PostConstruct
public void init() {
    setSizeFull();//w w w .  j a va  2  s. c  o m

    TreeTable table = new TreeTable();

    VerticalLayout mainContent = new VerticalLayout();
    mainContent.setSpacing(true);
    mainContent.setMargin(true);
    mainContent.setStyleName("deployable-style");
    mainContent.setSizeFull();

    setContent(mainContent);

    HorizontalLayout toolBar = new HorizontalLayout();
    toolBar.setMargin(true);
    toolBar.setSpacing(true);
    toolBar.setWidth("100%");

    // Deployment Plan name
    Label deploymentPlanNameLabel = new Label("Plan");
    toolBar.addComponent(deploymentPlanNameLabel);
    toolBar.setExpandRatio(deploymentPlanNameLabel, 1);

    deploymentPlanName = new TextField();
    deploymentPlanName.setInputPrompt(getDefaultName());
    deploymentPlanName.setWidth("100%");
    toolBar.addComponent(deploymentPlanName);
    toolBar.setComponentAlignment(deploymentPlanName, Alignment.TOP_LEFT);
    toolBar.setExpandRatio(deploymentPlanName, 3);

    error = new Label("", ContentMode.HTML);
    error.addStyleName("error");
    error.setSizeUndefined();
    error.addStyleName("light");
    error.addStyleName("v-animate-reveal");
    error.setVisible(false);
    toolBar.addComponent(error);
    toolBar.setComponentAlignment(error, Alignment.TOP_RIGHT);
    toolBar.setExpandRatio(error, 1);
    mainContent.addComponent(toolBar);
    mainContent.setComponentAlignment(toolBar, Alignment.TOP_LEFT);
    mainContent.setExpandRatio(toolBar, 1);

    VerticalLayout deploymentPlanContainer = new VerticalLayout();
    DragAndDropWrapper deploymentPlanContainerWrapper = new DragAndDropWrapper(deploymentPlanContainer);
    DropHandler deploymentPlanDropHandler = new DeploymentDropHandler(deploymentViewManager, this,
            notifierService);
    deploymentPlanContainerWrapper.setDropHandler(deploymentPlanDropHandler);
    deploymentPlanContainerWrapper.setSizeFull();
    mainContent.addComponent(deploymentPlanContainerWrapper);
    mainContent.setExpandRatio(deploymentPlanContainerWrapper, 10);

    container.addContainerProperty(TREE_ITEM_ID, String.class, null);
    table.setSizeFull();
    table.setImmediate(true);
    table.setMultiSelect(true);
    table.setSelectable(true);
    table.setContainerDataSource(container);
    table.setDragMode(Table.TableDragMode.MULTIROW);
    table.setItemCaptionPropertyId(TREE_ITEM_ID);
    table.setCellStyleGenerator(new ItemStyle(DeployableContainerType.DEPLOYED));
    table.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN);
    table.setDropHandler(new OrderedContainerDropHandler(table, deploymentPlanDropHandler));
    table.addShortcutListener(new ShortcutListener("Delete", ShortcutAction.KeyCode.DELETE, null) {
        @Override
        public void handleAction(Object sender, Object target) {
            Table table = (Table) target;
            Collection<DeployableEntry> deployableEntries = (Collection<DeployableEntry>) table.getValue();
            for (DeployableEntry deployableEntry : deployableEntries) {
                removeDeployable(deployableEntry);
            }
        }
    });
    deploymentPlanContainer.addComponent(table);

    HorizontalLayout footer = new HorizontalLayout();
    footer.setSizeFull();
    footer.setSpacing(true);
    footer.setMargin(true);
    footer.addStyleName("footer");
    footer.setWidth("100%");

    deployIt = new CheckBox("Deploy this deployment plan");
    footer.addComponent(deployIt);
    footer.setComponentAlignment(deployIt, Alignment.TOP_LEFT);

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    buttons.setMargin(true);
    Button cancel = new Button("Cancel");
    cancel.addClickListener(new CancelButtonListener());
    Button create = new Button("Create");
    create.addClickListener(new CreateButtonListener());
    create.addStyleName("wide");
    create.addStyleName("default");
    buttons.addComponent(cancel);
    buttons.addComponent(create);
    footer.addComponent(buttons);
    footer.setComponentAlignment(buttons, Alignment.TOP_RIGHT);

    mainContent.addComponent(footer);
    mainContent.setComponentAlignment(footer, Alignment.BOTTOM_RIGHT);
    mainContent.setExpandRatio(footer, 1);
}

From source file:com.peergreen.webconsole.vaadin.DefaultWindow.java

License:Open Source License

/**
 * Create a default window//from   ww w  . j  a va2s.  c  om
 * @param caption window caption
 * @param content window content. Vaadin component
 * @param footerButtons list of buttons in footer
 */
public DefaultWindow(String caption, Component content, Button... footerButtons) {
    setCaption(caption);
    setClosable(false);
    setResizable(false);
    addStyleName("edit-dashboard");

    VerticalLayout main = new VerticalLayout();
    main.setSpacing(true);
    main.setMargin(true);
    main.setStyleName("default-window");

    content.addStyleName("default-window-content");
    main.addComponent(content);

    HorizontalLayout footer = new HorizontalLayout();
    footer.setStyleName("footer");
    footer.setWidth("100%");
    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    buttons.setMargin(true);

    for (Button button : footerButtons) {
        buttons.addComponent(button);
    }
    footer.addComponent(buttons);
    footer.setComponentAlignment(buttons, Alignment.MIDDLE_RIGHT);

    main.addComponent(footer);
    setContent(main);
}