Example usage for com.vaadin.ui Alignment TOP_RIGHT

List of usage examples for com.vaadin.ui Alignment TOP_RIGHT

Introduction

In this page you can find the example usage for com.vaadin.ui Alignment TOP_RIGHT.

Prototype

Alignment TOP_RIGHT

To view the source code for com.vaadin.ui Alignment TOP_RIGHT.

Click Source Link

Usage

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");
    }//from w  w  w  .  j  av  a  2s  . c om
    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.module.user.accountsettings.team.view.UserReadViewImpl.java

License:Open Source License

private void displayUserAvatar() {
    header.removeAllComponents();/*from   ww w  . j a v a  2s.c  o  m*/
    MHorizontalLayout avatarAndPass = new MHorizontalLayout().withFullWidth();
    Image cropField = UserAvatarControlFactory.createUserAvatarEmbeddedComponent(user.getAvatarid(), 100);
    cropField.addStyleName(UIConstants.CIRCLE_BOX);
    CssLayout userAvatar = new CssLayout();
    userAvatar.addComponent(cropField);
    avatarAndPass.addComponent(userAvatar);

    MVerticalLayout basicLayout = new MVerticalLayout().withMargin(new MarginInfo(false, true, false, true));
    CssLayout userWrapper = new CssLayout();
    String nickName = user.getNickname();
    ELabel userName = ELabel.h2(user.getDisplayName()
            + (StringUtils.isEmpty(nickName) ? "" : (String.format(" ( %s )", nickName))));
    userWrapper.addComponent(userName);

    basicLayout.addComponent(userWrapper);
    basicLayout.setComponentAlignment(userWrapper, Alignment.MIDDLE_LEFT);

    GridFormLayoutHelper userFormLayout;
    if (UserUIContext.isAdmin()) {
        userFormLayout = GridFormLayoutHelper.defaultFormLayoutHelper(1, 6).withCaptionWidth("140px");
    } else {
        userFormLayout = GridFormLayoutHelper.defaultFormLayoutHelper(1, 5).withCaptionWidth("140px");
    }
    userFormLayout.getLayout().addStyleName(WebThemes.GRIDFORM_BORDERLESS);
    basicLayout.addComponent(userFormLayout.getLayout());

    Node roleDiv;
    if (Boolean.TRUE.equals(user.getIsAccountOwner())) {
        roleDiv = new Div().appendText(UserUIContext.getMessage(RoleI18nEnum.OPT_ACCOUNT_OWNER));
    } else {
        roleDiv = new A(AccountLinkBuilder.generatePreviewFullRoleLink(user.getRoleid()))
                .appendText(user.getRoleName());
    }

    userFormLayout.addComponent(ELabel.html(roleDiv.write()), UserUIContext.getMessage(UserI18nEnum.FORM_ROLE),
            0, 0);
    userFormLayout.addComponent(new Label(UserUIContext.formatDate(user.getDateofbirth())),
            UserUIContext.getMessage(UserI18nEnum.FORM_BIRTHDAY), 0, 1);

    if (Boolean.TRUE.equals(MyCollabUI.showEmailPublicly())) {
        userFormLayout.addComponent(
                ELabel.html(new A("mailto:" + user.getEmail()).appendText(user.getEmail()).write()),
                UserUIContext.getMessage(GenericI18Enum.FORM_EMAIL), 0, 2);
    } else {
        userFormLayout.addComponent(ELabel.html("******"), UserUIContext.getMessage(GenericI18Enum.FORM_EMAIL),
                0, 2);
    }

    userFormLayout.addComponent(
            new Label(TimezoneVal.getDisplayName(UserUIContext.getUserLocale(), user.getTimezone())),
            UserUIContext.getMessage(UserI18nEnum.FORM_TIMEZONE), 0, 3);
    userFormLayout.addComponent(
            new Label(LocalizationHelper.getLocaleInstance(user.getLanguage())
                    .getDisplayLanguage(UserUIContext.getUserLocale())),
            UserUIContext.getMessage(UserI18nEnum.FORM_LANGUAGE), 0, 4);

    if (UserUIContext.isAdmin()) {
        MButton btnChangePassword = new MButton(UserUIContext.getMessage(GenericI18Enum.ACTION_CHANGE),
                clickEvent -> UI.getCurrent().addWindow(new PasswordChangeWindow(user)))
                        .withStyleName(WebThemes.BUTTON_LINK);
        userFormLayout.addComponent(new MHorizontalLayout(new Label("***********"), btnChangePassword),
                UserUIContext.getMessage(ShellI18nEnum.FORM_PASSWORD), 0, 5);
    }

    avatarAndPass.with(basicLayout).withAlign(basicLayout, Alignment.TOP_LEFT).expand(basicLayout);

    Layout controlButtons = createTopPanel();
    CssLayout avatarAndPassWrapper = new CssLayout();
    avatarAndPass.setWidthUndefined();
    avatarAndPassWrapper.addComponent(avatarAndPass);
    header.with(avatarAndPass, controlButtons).withAlign(avatarAndPass, Alignment.TOP_LEFT)
            .withAlign(controlButtons, Alignment.TOP_RIGHT);
}

From source file:com.mycollab.reporting.CustomizeReportOutputWindow.java

License:Open Source License

public CustomizeReportOutputWindow(final String viewId, final String reportTitle, final Class<B> beanCls,
        final ISearchableService<S> searchableService, final VariableInjector<S> variableInjector) {
    super(UserUIContext.getMessage(GenericI18Enum.ACTION_EXPORT));
    MVerticalLayout contentLayout = new MVerticalLayout();
    this.withModal(true).withResizable(false).withWidth("1000px").withCenter().withContent(contentLayout);
    this.viewId = viewId;
    this.variableInjector = variableInjector;

    final OptionGroup optionGroup = new OptionGroup();
    optionGroup.addStyleName("sortDirection");
    optionGroup.addItems(UserUIContext.getMessage(FileI18nEnum.CSV), UserUIContext.getMessage(FileI18nEnum.PDF),
            UserUIContext.getMessage(FileI18nEnum.EXCEL));
    optionGroup.setValue(UserUIContext.getMessage(FileI18nEnum.CSV));
    contentLayout.with(new MHorizontalLayout(ELabel.h3(UserUIContext.getMessage(GenericI18Enum.ACTION_EXPORT)),
            optionGroup).alignAll(Alignment.MIDDLE_LEFT));

    contentLayout.with(ELabel.h3(UserUIContext.getMessage(GenericI18Enum.ACTION_SELECT_COLUMNS)));
    listBuilder = new ListBuilder();
    listBuilder.setImmediate(true);/* ww w .j a v  a2s . c om*/
    listBuilder.setColumns(0);
    listBuilder.setLeftColumnCaption(UserUIContext.getMessage(GenericI18Enum.OPT_AVAILABLE_COLUMNS));
    listBuilder.setRightColumnCaption(UserUIContext.getMessage(GenericI18Enum.OPT_VIEW_COLUMNS));
    listBuilder.setWidth(100, Sizeable.Unit.PERCENTAGE);
    listBuilder.setItemCaptionMode(AbstractSelect.ItemCaptionMode.EXPLICIT);
    final BeanItemContainer<TableViewField> container = new BeanItemContainer<>(TableViewField.class,
            this.getAvailableColumns());
    listBuilder.setContainerDataSource(container);
    for (TableViewField field : getAvailableColumns()) {
        listBuilder.setItemCaption(field, UserUIContext.getMessage(field.getDescKey()));
    }
    final Collection<TableViewField> viewColumnIds = this.getViewColumns();
    listBuilder.setValue(viewColumnIds);
    contentLayout.with(listBuilder).withAlign(listBuilder, Alignment.TOP_CENTER);

    contentLayout.with(ELabel.h3(UserUIContext.getMessage(GenericI18Enum.ACTION_PREVIEW)));
    sampleTableDisplay = new Table();
    for (TableViewField field : getAvailableColumns()) {
        sampleTableDisplay.addContainerProperty(field.getField(), String.class, "",
                UserUIContext.getMessage(field.getDescKey()), null, Table.Align.LEFT);
        sampleTableDisplay.setColumnWidth(field.getField(), field.getDefaultWidth());
    }
    sampleTableDisplay.setWidth("100%");
    sampleTableDisplay.addItem(buildSampleData(), 1);
    sampleTableDisplay.setPageLength(1);
    contentLayout.with(sampleTableDisplay);
    filterColumns();

    listBuilder.addValueChangeListener(valueChangeEvent -> filterColumns());

    MButton resetBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_RESET), clickEvent -> {
        listBuilder.setValue(getDefaultColumns());
        filterColumns();
    }).withStyleName(WebThemes.BUTTON_LINK);

    MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CANCEL),
            clickEvent -> close()).withStyleName(WebThemes.BUTTON_OPTION);

    final MButton exportBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.ACTION_EXPORT))
            .withStyleName(WebThemes.BUTTON_ACTION).withIcon(FontAwesome.DOWNLOAD);
    OnDemandFileDownloader pdfFileDownloader = new OnDemandFileDownloader(new LazyStreamSource() {
        @Override
        protected StreamResource.StreamSource buildStreamSource() {
            return (StreamResource.StreamSource) () -> {
                Collection<TableViewField> columns = (Collection<TableViewField>) listBuilder.getValue();
                // Save custom table view def
                CustomViewStoreService customViewStoreService = AppContextUtil
                        .getSpringBean(CustomViewStoreService.class);
                CustomViewStore viewDef = new CustomViewStore();
                viewDef.setSaccountid(MyCollabUI.getAccountId());
                viewDef.setCreateduser(UserUIContext.getUsername());
                viewDef.setViewid(viewId);
                viewDef.setViewinfo(FieldDefAnalyzer.toJson(new ArrayList<>(columns)));
                customViewStoreService.saveOrUpdateViewLayoutDef(viewDef);

                SimpleReportTemplateExecutor reportTemplateExecutor = new SimpleReportTemplateExecutor.AllItems<>(
                        reportTitle, new RpFieldsBuilder(columns), exportType, beanCls, searchableService);
                ReportStreamSource streamSource = new ReportStreamSource(reportTemplateExecutor) {
                    @Override
                    protected void initReportParameters(Map<String, Object> parameters) {
                        parameters.put(SimpleReportTemplateExecutor.CRITERIA, variableInjector.eval());
                    }
                };
                return streamSource.getStream();
            };
        }

        @Override
        public String getFilename() {
            String exportTypeVal = (String) optionGroup.getValue();
            if (UserUIContext.getMessage(FileI18nEnum.CSV).equals(exportTypeVal)) {
                exportType = ReportExportType.CSV;
            } else if (UserUIContext.getMessage(FileI18nEnum.EXCEL).equals(exportTypeVal)) {
                exportType = ReportExportType.EXCEL;
            } else {
                exportType = ReportExportType.PDF;
            }
            return exportType.getDefaultFileName();
        }
    });
    pdfFileDownloader.extend(exportBtn);

    MHorizontalLayout buttonControls = new MHorizontalLayout(resetBtn, cancelBtn, exportBtn);
    contentLayout.with(buttonControls).withAlign(buttonControls, Alignment.TOP_RIGHT);
}

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

License:Open Source License

private void initContent() {
    previewForm = initPreviewForm();/*from   w w w  .  j  av  a 2 s .c o  m*/
    actionControls = createButtonControls();
    if (actionControls != null) {
        header.with(actionControls).withAlign(actionControls, Alignment.TOP_RIGHT);
    }

    MCssLayout contentWrapper = new MCssLayout().withFullWidth().withStyleName(WebThemes.CONTENT_WRAPPER);

    if (previewLayout == null)
        previewLayout = new DefaultReadViewLayout("");

    contentWrapper.addComponent(previewLayout);

    if (isDisplaySideBar) {
        RightSidebarLayout bodyContainer = new RightSidebarLayout();
        bodyContainer.setSizeFull();

        bodyContent = new MVerticalLayout(previewForm).withSpacing(false).withMargin(false).withFullWidth();
        bodyContainer.setContent(bodyContent);
        sidebarContent = new MVerticalLayout().withWidth("250px").withStyleName("readview-sidebar");
        bodyContainer.setSidebar(sidebarContent);
        previewLayout.addBody(bodyContainer);
    } else {
        CssLayout bodyContainer = new CssLayout();
        bodyContainer.setSizeFull();
        bodyContainer.addStyleName("readview-body-wrap");
        bodyContent = new MVerticalLayout().withSpacing(false).withFullWidth().withMargin(false)
                .with(previewForm);
        bodyContainer.addComponent(bodyContent);
        previewLayout.addBody(bodyContainer);
    }

    this.addComponent(contentWrapper);
}

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

License:Open Source License

public void addHeaderRight(Component headerRight) {
    header.with(headerRight).withAlign(headerRight, Alignment.TOP_RIGHT);
}

From source file:com.mycollab.vaadin.web.ui.table.CustomizedTableWindow.java

License:Open Source License

public CustomizedTableWindow(final String viewId, final AbstractPagedBeanTable<?, ?> table) {
    super(UserUIContext.getMessage(GenericI18Enum.OPT_CUSTOMIZE_VIEW));
    this.viewId = viewId;
    this.withWidth("400px").withModal(true).withResizable(false).withCenter();

    this.tableItem = table;
    customViewStoreService = AppContextUtil.getSpringBean(CustomViewStoreService.class);

    final MVerticalLayout contentLayout = new MVerticalLayout();
    this.setContent(contentLayout);

    listBuilder = new ListBuilder();
    listBuilder.setImmediate(true);// www.j a va2s .c  o  m
    listBuilder.setColumns(0);
    listBuilder.setLeftColumnCaption(UserUIContext.getMessage(GenericI18Enum.OPT_AVAILABLE_COLUMNS));
    listBuilder.setRightColumnCaption(UserUIContext.getMessage(GenericI18Enum.OPT_VIEW_COLUMNS));
    listBuilder.setWidth(100, Sizeable.Unit.PERCENTAGE);
    listBuilder.setItemCaptionMode(ItemCaptionMode.EXPLICIT);
    final BeanItemContainer<TableViewField> container = new BeanItemContainer<>(TableViewField.class,
            this.getAvailableColumns());
    listBuilder.setContainerDataSource(container);
    Iterator<TableViewField> iterator = getAvailableColumns().iterator();
    while (iterator.hasNext()) {
        TableViewField field = iterator.next();
        listBuilder.setItemCaption(field, UserUIContext.getMessage(field.getDescKey()));
    }
    this.setSelectedViewColumns();
    contentLayout.with(listBuilder).withAlign(listBuilder, Alignment.TOP_CENTER);

    MButton restoreLink = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_RESET), clickEvent -> {
        List<TableViewField> defaultSelectedColumns = tableItem.getDefaultSelectedColumns();
        if (defaultSelectedColumns != null) {
            final List<TableViewField> selectedColumns = new ArrayList<>();
            final Collection<TableViewField> itemIds = container.getItemIds();

            for (TableViewField column : defaultSelectedColumns) {
                for (final TableViewField viewField : itemIds) {
                    if (column.getField().equals(viewField.getField())) {
                        selectedColumns.add(viewField);
                    }
                }
            }

            listBuilder.setValue(selectedColumns);
        }
    }).withStyleName(WebThemes.BUTTON_LINK);
    contentLayout.with(restoreLink).withAlign(restoreLink, Alignment.TOP_RIGHT);

    final MButton saveBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SAVE), clickEvent -> {
        List<TableViewField> selectedColumns = (List<TableViewField>) listBuilder.getValue();
        table.setDisplayColumns(selectedColumns);
        // Save custom table view def
        CustomViewStore viewDef = new CustomViewStore();
        viewDef.setSaccountid(MyCollabUI.getAccountId());
        viewDef.setCreateduser(UserUIContext.getUsername());
        viewDef.setViewid(viewId);
        viewDef.setViewinfo(FieldDefAnalyzer.toJson(new ArrayList<>(selectedColumns)));
        customViewStoreService.saveOrUpdateViewLayoutDef(viewDef);
        close();
    }).withIcon(FontAwesome.SAVE).withStyleName(WebThemes.BUTTON_ACTION);

    final MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CANCEL),
            clickEvent -> close()).withStyleName(WebThemes.BUTTON_OPTION);

    MHorizontalLayout buttonControls = new MHorizontalLayout(cancelBtn, saveBtn);
    contentLayout.with(buttonControls).withAlign(buttonControls, Alignment.TOP_RIGHT);
}

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

License:Open Source License

public void setNavigatorVisibility(boolean visibility) {
    if (!visibility) {
        navigatorWrapper.setWidth("65px");
        navigatorContainer.setWidth("65px");
        this.hideTabsCaption();

        navigatorContainer.setComponentAlignment(toggleBtn, Alignment.MIDDLE_CENTER);
        toggleBtn.setIcon(FontAwesome.ANGLE_DOUBLE_RIGHT);
        toggleBtn.setStyleName(WebThemes.BUTTON_ICON_ONLY + " expand-button");
        toggleBtn.setDescription(UserUIContext.getMessage(ShellI18nEnum.ACTION_EXPAND_MENU));
        toggleBtn.setCaption("");
    } else {/*from   ww w  .ja v a 2  s .  co m*/
        navigatorWrapper.setWidth("200px");
        navigatorContainer.setWidth("200px");
        this.showTabsCaption();

        toggleBtn.setStyleName(WebThemes.BUTTON_ICON_ONLY + " closed-button");
        navigatorContainer.setComponentAlignment(toggleBtn, Alignment.TOP_RIGHT);
        toggleBtn.setIcon(FontAwesome.TIMES);
        toggleBtn.setDescription(UserUIContext.getMessage(ShellI18nEnum.ACTION_COLLAPSE_MENU));
    }
}

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

License:Open Source License

public void addToggleNavigatorControl() {
    if (getButtonById("button") == null) {
        toggleBtn = new ButtonTabImpl("button", 0, "", "");
        toggleBtn.setStyleName(WebThemes.BUTTON_ICON_ONLY + " closed-button");
        toggleBtn.addClickListener(clickEvent -> {
            retainVisibility = !retainVisibility;
            setNavigatorVisibility(retainVisibility);
        });//w  ww . j  a  va 2 s  .  c  om
        navigatorContainer.addComponent(toggleBtn, 0);
        navigatorContainer.setComponentAlignment(toggleBtn, Alignment.TOP_RIGHT);
    }

    setNavigatorVisibility(retainVisibility);
}

From source file:com.naoset.framework.frontend.view.window.DialogWindow.java

public void setFooterButtons(DialogButton... buttons) {
    footer.removeAllComponents();/*  w  ww .j ava 2 s .  c o m*/

    HorizontalLayout innerLayout = new HorizontalLayout();
    innerLayout.setSpacing(true);
    footer.addComponent(innerLayout);
    footer.setComponentAlignment(innerLayout, Alignment.TOP_RIGHT);

    for (DialogButton button : buttons) {
        Button btn = new Button();
        if (button.equals(DialogButton.OK)) {
            btn.setCaption("OK");
            btn.addStyleName(ValoTheme.BUTTON_PRIMARY);
            btn.addClickListener(new Button.ClickListener() {
                @Override
                public void buttonClick(final Button.ClickEvent event) {
                    onButtonOKClicked();
                }
            });
            okButton = btn;
        }
        if (button.equals(DialogButton.CANCEL)) {
            btn.setCaption("CANCEL");
            btn.addStyleName(ValoTheme.BUTTON_PRIMARY);
            btn.addClickListener(new Button.ClickListener() {
                @Override
                public void buttonClick(final Button.ClickEvent event) {
                    onButtonCancelClicked();
                }
            });
            cancelButton = btn;
        }
        if (button.equals(DialogButton.YES)) {
            btn.setCaption("YES");
            btn.addStyleName(ValoTheme.BUTTON_PRIMARY);
            btn.addClickListener(new Button.ClickListener() {
                @Override
                public void buttonClick(final Button.ClickEvent event) {
                    onButtonYesClicked();
                }
            });
            yesButton = btn;
        }
        if (button.equals(DialogButton.NO)) {
            btn.setCaption("NO");
            btn.addStyleName(ValoTheme.BUTTON_PRIMARY);
            btn.addClickListener(new Button.ClickListener() {
                @Override
                public void buttonClick(final Button.ClickEvent event) {
                    onButtonNoClicked();
                }
            });
            noButton = btn;
        }
        if (button.equals(DialogButton.CLOSE)) {
            btn.setCaption("CLOSE");
            btn.addStyleName(ValoTheme.BUTTON_PRIMARY);
            btn.addClickListener(new Button.ClickListener() {
                @Override
                public void buttonClick(final Button.ClickEvent event) {
                    onButtonCloseClicked();
                }
            });
            closeButton = btn;
        }
        innerLayout.addComponent(btn);
    }

}

From source file:com.naoset.framework.frontend.view.window.Window.java

private HorizontalLayout buildFooter() {
    HorizontalLayout layout = new HorizontalLayout();
    layout.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR);
    layout.setWidth(100.0f, Unit.PERCENTAGE);

    //Si el objeto a mostrar hereda de Widget, mostraremos su cabecera con el men en la ventana.
    if (Widget.class.isInstance(body)) {
        //if (details.getClass().isInstance(Widget.class)) {
        Widget aux = (Widget) body;/*  www.ja v a2 s  .c o m*/
        HorizontalLayout header = aux.getHeader();
        header.setWidth(100.0f, Unit.PERCENTAGE);
        layout.addComponent(header);
        //layout.setComponentAlignment(header, Alignment.TOP_LEFT);
        layout.setExpandRatio(header, 1);
    }

    Button ok = new Button("Cerrar");
    ok.addStyleName(ValoTheme.BUTTON_PRIMARY);
    ok.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(final Button.ClickEvent event) {
            Boolean canClose = true;
            if (Widget.class.isInstance(body)) {
                Widget aux = (Widget) body;
                canClose = !aux.isModified();
            }
            if (canClose) {
                close();
            } else {

                buildConfirmCloseDialog();

            }

        }
    });
    ok.focus();
    layout.addComponent(ok);
    layout.setComponentAlignment(ok, Alignment.TOP_RIGHT);
    return layout;
}