Java源码示例:org.vaadin.viritin.layouts.MHorizontalLayout

示例1
@Override
public ComponentContainer constructBody() {
    MHorizontalLayout basicSearchBody = new MHorizontalLayout().withMargin(true);
    basicSearchBody.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    Label nameLbl = new Label(UserUIContext.getMessage(GenericI18Enum.FORM_NAME) + ":");
    basicSearchBody.with(nameLbl);

    nameField = new MTextField().withPlaceholder(UserUIContext.getMessage(GenericI18Enum.ACTION_QUERY_BY_TEXT))
            .withWidth(WebUIConstants.DEFAULT_CONTROL_WIDTH);
    basicSearchBody.with(nameField);

    myItemCheckbox = new CheckBox(UserUIContext.getMessage(GenericI18Enum.OPT_MY_ITEMS));
    basicSearchBody.with(myItemCheckbox);

    MButton searchBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SEARCH), clickEvent -> callSearchAction())
            .withIcon(VaadinIcons.SEARCH).withStyleName(WebThemes.BUTTON_ACTION)
            .withClickShortcut(ShortcutAction.KeyCode.ENTER);
    basicSearchBody.with(searchBtn);

    MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CLEAR), clickEvent -> nameField.setValue(""))
            .withStyleName(WebThemes.BUTTON_OPTION);
    basicSearchBody.with(cancelBtn);

    return basicSearchBody;
}
 
示例2
@Override
protected Component createContent() {
    return new MVerticalLayout(
            getToolbar(),
            new MHorizontalLayout(
                    new MFormLayout(
                            name,
                            number,
                            email,
                            birthDate,
                            sendChristmasCard
                    ).withMargin(false),
                    groupsGrid
            ),
            addresses
    ).withMargin(new MMarginInfo(false, true));
}
 
示例3
public AboutWindow() {
    MHorizontalLayout content = new MHorizontalLayout().withMargin(true).withFullWidth();
    this.setContent(content);

    Image about = new Image("", new ExternalResource(StorageUtils.generateAssetRelativeLink(WebResourceIds._about)));

    MVerticalLayout rightPanel = new MVerticalLayout();
    ELabel versionLbl = ELabel.h2(String.format("MyCollab Community Edition %s", Version.getVersion())).withFullWidth();
    ELabel javaNameLbl = new ELabel(String.format("%s, %s", System.getProperty("java.vm.name"),
            System.getProperty("java.runtime.version"))).withFullWidth();
    Label homeFolderLbl = new Label("Home folder: " + AppContextUtil.getSpringBean(ServerConfiguration.class).getHomeDir().getAbsolutePath());
    WebBrowser browser = Page.getCurrent().getWebBrowser();
    ELabel osLbl = new ELabel(String.format("%s, %s", System.getProperty("os.name"), browser.getBrowserApplication())).withFullWidth();
    Div licenseDiv = new Div().appendChild(new Text("Powered by: "))
            .appendChild(new A("https://www.mycollab.com")
                    .appendText("MyCollab")).appendChild(new Text(". Open source under GPL license"));
    ELabel licenseLbl = ELabel.html(licenseDiv.write()).withFullWidth();
    Label copyRightLbl = ELabel.html(String.format("© %s - %s MyCollab Ltd. All rights reserved", "2011",
            LocalDate.now().getYear() + "")).withFullWidth();
    rightPanel.with(versionLbl, javaNameLbl, osLbl, homeFolderLbl, licenseLbl, copyRightLbl).withAlign(copyRightLbl, Alignment.BOTTOM_LEFT);
    content.with(about, rightPanel).expand(rightPanel);
}
 
示例4
@Override
public Component generateRow(IBeanList<ProjectTicket> host, ProjectTicket item, int rowIndex) {
    MButton ticketLink = new MButton(item.getName(), clickEvent -> {
        if (item.getTypeId().equals(parentTicket.getTypeId())) {
            NotificationUtil.showErrorNotification(UserUIContext.getMessage(TaskI18nEnum.ERROR_CAN_NOT_ASSIGN_PARENT_TASK_TO_ITSELF));
        } else {
            TicketHierarchy ticketHierarchy = new TicketHierarchy();
            ticketHierarchy.setParentid(parentTicket.getTypeId());
            ticketHierarchy.setParenttype(parentTicket.getType());
            ticketHierarchy.setProjectid(CurrentProjectVariables.getProjectId());
            ticketHierarchy.setTicketid(item.getTypeId());
            ticketHierarchy.setTickettype(item.getType());
            TicketHierarchyMapper ticketHierarchyMapper = AppContextUtil.getSpringBean(TicketHierarchyMapper.class);
            ticketHierarchyMapper.insert(ticketHierarchy);
            EventBusFactory.getInstance().post(new TicketEvent.SubTicketAdded(this, item.getType(), item.getTypeId()));
        }

        close();
    }).withStyleName(WebThemes.BUTTON_LINK, WebThemes.TEXT_ELLIPSIS).withFullWidth();
    return new MHorizontalLayout(ELabel.fontIcon(ProjectAssetsManager.getAsset(item.getType())), ticketLink).expand(ticketLink).withStyleName("list-row").withFullWidth()
            .alignAll(Alignment.MIDDLE_LEFT);
}
 
示例5
@Override
    protected ComponentContainer buildSearchTitle() {
        if (canSwitchToAdvanceLayout) {
            savedFilterComboBox = new TicketSavedFilterComboBox();
            savedFilterComboBox.addQuerySelectListener((SavedFilterComboBox.QuerySelectListener) querySelectEvent -> {
                List<SearchFieldInfo<ProjectTicketSearchCriteria>> fieldInfos = querySelectEvent.getSearchFieldInfos();
                ProjectTicketSearchCriteria criteria = SearchFieldInfo.buildSearchCriteria(ProjectTicketSearchCriteria.class,
                        fieldInfos);
                criteria.setProjectIds(new SetSearchField<>(CurrentProjectVariables.getProjectId()));
                EventBusFactory.getInstance().post(new TicketEvent.SearchRequest(TicketSearchPanel.this, criteria));
//                    EventBusFactory.getInstance().post(new ShellEvent.AddQueryParam(this, fieldInfos));
            });
            ELabel taskIcon = ELabel.h2(ProjectAssetsManager.getAsset(ProjectTypeConstants.TICKET).getHtml()).withUndefinedWidth();
            return new MHorizontalLayout(taskIcon, savedFilterComboBox).withUndefinedWidth();
        } else return null;
    }
 
示例6
@Override
public ComponentContainer constructBody() {
    MHorizontalLayout basicSearchBody = new MHorizontalLayout().withMargin(true)
            .with(new Label(UserUIContext.getMessage(GenericI18Enum.FORM_NAME) + ":"));

    nameField = new MTextField().withPlaceholder(UserUIContext.getMessage(GenericI18Enum.ACTION_QUERY_BY_TEXT))
            .withWidth(WebUIConstants.DEFAULT_CONTROL_WIDTH);
    basicSearchBody.addComponent(nameField);

    MButton searchBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SEARCH), clickEvent -> callSearchAction())
            .withIcon(VaadinIcons.SEARCH).withStyleName(WebThemes.BUTTON_ACTION)
            .withClickShortcut(ShortcutAction.KeyCode.ENTER);
    basicSearchBody.addComponent(searchBtn);

    MButton clearBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CLEAR), clickEvent -> nameField.setValue(""))
            .withStyleName(WebThemes.BUTTON_OPTION);
    basicSearchBody.addComponent(clearBtn);
    basicSearchBody.setComponentAlignment(clearBtn, Alignment.MIDDLE_LEFT);
    return basicSearchBody;
}
 
示例7
@Override
public AbstractComponent getLayout() {
    final MVerticalLayout layout = new MVerticalLayout().withMargin(false);
    informationLayout = GridFormLayoutHelper.defaultFormLayoutHelper(LayoutType.ONE_COLUMN);
    layout.addComponent(informationLayout.getLayout());

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

    MButton saveBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SAVE), clickEvent -> {
        if (EditForm.this.validateForm()) {
            PageService pageService = AppContextUtil.getSpringBean(PageService.class);
            pageService.createFolder(folder, UserUIContext.getUsername());
            folder.setCreatedTime(new GregorianCalendar());
            folder.setCreatedUser(UserUIContext.getUsername());
            GroupPageAddWindow.this.close();
            EventBusFactory.getInstance().post(new PageEvent.GotoList(GroupPageAddWindow.this, folder.getPath()));
        }
    }).withIcon(VaadinIcons.CLIPBOARD).withStyleName(WebThemes.BUTTON_ACTION)
            .withClickShortcut(KeyCode.ENTER);

    MHorizontalLayout controlsBtn = new MHorizontalLayout(cancelBtn, saveBtn).withMargin(new MarginInfo(true, false, true, false));
    layout.with(controlsBtn).withAlign(controlsBtn, Alignment.MIDDLE_RIGHT);
    return layout;
}
 
示例8
AskToAddMoreMembersWindow() {
    super(UserUIContext.getMessage(GenericI18Enum.OPT_QUESTION));
    MVerticalLayout content = new MVerticalLayout();
    this.withWidth("600px").withResizable(false).withModal(true).withContent(content).withCenter();

    content.with(new Label(UserUIContext.getMessage(ProjectI18nEnum.OPT_ASK_TO_ADD_MEMBERS)));

    MButton skipBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.ACTION_SKIP), clickEvent -> {
        ProjectService projectService = AppContextUtil.getSpringBean(ProjectService.class);
        SimpleProject project = CurrentProjectVariables.getProject();
        project.setContextask(false);
        projectService.updateSelectiveWithSession(project, UserUIContext.getUsername());
        close();
    }).withStyleName(WebThemes.BUTTON_OPTION);

    MButton addNewMembersBtn = new MButton(UserUIContext.getMessage(ProjectI18nEnum.ACTION_ADD_MEMBERS), clickEvent -> {
        close();
        EventBusFactory.getInstance().post(new ProjectMemberEvent.GotoInviteMembers(this, null));
    }).withStyleName(WebThemes.BUTTON_ACTION);

    MHorizontalLayout btnControls = new MHorizontalLayout(skipBtn, addNewMembersBtn);
    content.with(btnControls).withAlign(btnControls, Alignment.MIDDLE_RIGHT);
}
 
示例9
@Override
public ComponentContainer constructBody() {
    MHorizontalLayout basicSearchBody = new MHorizontalLayout().withMargin(true);

    nameField = new MTextField().withPlaceholder(UserUIContext.getMessage(GenericI18Enum.ACTION_QUERY_BY_TEXT))
            .withWidth(WebUIConstants.DEFAULT_CONTROL_WIDTH);
    basicSearchBody.with(nameField).withAlign(nameField, Alignment.MIDDLE_CENTER);

    MButton searchBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SEARCH), clickEvent ->
            callSearchAction()).withIcon(VaadinIcons.SEARCH).withStyleName(WebThemes.BUTTON_ACTION)
            .withClickShortcut(ShortcutAction.KeyCode.ENTER);
    basicSearchBody.with(searchBtn).withAlign(searchBtn, Alignment.MIDDLE_LEFT);

    MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CLEAR),
            clickEvent -> nameField.setValue("")).withStyleName(WebThemes.BUTTON_OPTION);
    basicSearchBody.with(cancelBtn).withAlign(cancelBtn, Alignment.MIDDLE_CENTER);

    MButton advancedSearchBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_ADVANCED_SEARCH),
            clickEvent -> moveToAdvancedSearchLayout()).withStyleName(WebThemes.BUTTON_LINK);
    basicSearchBody.with(advancedSearchBtn).withAlign(advancedSearchBtn, Alignment.MIDDLE_CENTER);

    return basicSearchBody;
}
 
示例10
@Override
public AbstractComponent getLayout() {
    FormContainer layout = new FormContainer();
    layout.addComponent(avatarAndPass);

    MButton btnChangeContactInfo = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_EDIT),
            clickEvent -> UI.getCurrent().addWindow(new ContactInfoChangeWindow(formItem.getBean())))
            .withStyleName(WebThemes.BUTTON_LINK);

    MHorizontalLayout contactInformationHeader = new MHorizontalLayout(new ELabel(UserUIContext.getMessage(UserI18nEnum.SECTION_CONTACT_INFORMATION))
            .withStyleName(ValoTheme.LABEL_H3, ValoTheme.LABEL_NO_MARGIN), btnChangeContactInfo).alignAll(Alignment.MIDDLE_LEFT);

    layout.addSection(new CssLayout(contactInformationHeader), contactLayout.getLayout());

    MButton btnChangeAdvanceInfo = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_EDIT),
            clickEvent -> UI.getCurrent().addWindow(new AdvancedInfoChangeWindow(formItem.getBean())))
            .withStyleName(WebThemes.BUTTON_LINK);

    MHorizontalLayout advanceInfoHeader = new MHorizontalLayout(new ELabel(UserUIContext.getMessage(UserI18nEnum.SECTION_ADVANCED_INFORMATION))
            .withStyleName(ValoTheme.LABEL_H3, ValoTheme.LABEL_NO_MARGIN), btnChangeAdvanceInfo).alignAll(Alignment.MIDDLE_LEFT);

    layout.addSection(new CssLayout(advanceInfoHeader), advancedInfoLayout.getLayout());
    return layout;
}
 
示例11
private void displayInfo(SimpleUser user) {
    Div infoDiv = new Div().appendText("You have not setup SMTP account properly. So we can not send the invitation by email automatically. Please copy/paste below paragraph and inform to the user by yourself").setStyle("font-weight:bold;color:red");
    Label infoLbl = new Label(infoDiv.write(), ContentMode.HTML);

    Div userInfoDiv = new Div().appendText("Your username is ").appendChild(new B().appendText(user.getEmail()));
    Label userInfoLbl = ELabel.html(userInfoDiv.write());

    if (Boolean.TRUE.equals(user.isAccountOwner())) {
        user.setRoleName(UserUIContext.getMessage(RoleI18nEnum.OPT_ACCOUNT_OWNER));
    }
    Div roleInfoDiv = new Div().appendText("Your role is ").appendChild(new B().appendText(user.getRoleName()));
    Label roleInfoLbl = new Label(roleInfoDiv.write(), ContentMode.HTML);
    contentLayout.with(infoLbl, userInfoLbl, roleInfoLbl);

    final Button addNewBtn = new Button("Create another user", clickEvent -> {
        EventBusFactory.getInstance().post(new UserEvent.GotoAdd(GetStartedInstructionWindow.this, null));
        close();
    });
    addNewBtn.setStyleName(WebThemes.BUTTON_ACTION);

    Button doneBtn = new Button(UserUIContext.getMessage(GenericI18Enum.ACTION_DONE), clickEvent -> close());
    doneBtn.setStyleName(WebThemes.BUTTON_ACTION);

    final MHorizontalLayout controlsBtn = new MHorizontalLayout(addNewBtn, doneBtn).withMargin(true);
    contentLayout.with(controlsBtn).withAlign(controlsBtn, Alignment.MIDDLE_RIGHT);
}
 
示例12
@Override
protected Component initContent() {
    componentsText = new TextField();
    componentsText.setReadOnly(true);
    componentsText.addStyleName("noBorderRight");
    componentsText.setWidth("100%");
    componentPopupSelection = new PopupButton();
    componentPopupSelection.addStyleName(WebThemes.MULTI_SELECT_BG);
    componentPopupSelection.setDirection(Alignment.BOTTOM_LEFT);
    componentPopupSelection.addClickListener(clickEvent -> initContentPopup());

    popupContent = new OptionPopupContent();
    componentPopupSelection.setContent(popupContent);

    MHorizontalLayout content = new MHorizontalLayout(componentsText).withAlign(componentsText, Alignment.MIDDLE_LEFT);

    MHorizontalLayout multiSelectComp = new MHorizontalLayout(componentsText, componentPopupSelection)
            .withSpacing(false).expand(componentsText);
    content.with(multiSelectComp);
    return content;
}
 
示例13
protected void feedBlocksPut(LocalDate currentDate, LocalDate nextDate, ComponentContainer currentBlock) {
    MHorizontalLayout blockWrapper = new MHorizontalLayout().withSpacing(false).withFullWidth().withStyleName
            ("feed-block-wrap");

    blockWrapper.setDefaultComponentAlignment(Alignment.TOP_LEFT);

    if (currentDate.getYear() != nextDate.getYear()) {
        int currentYear = nextDate.getYear();
        ELabel yearLbl = ELabel.html("<div>" + currentYear + "</div>").withStyleName("year-lbl").withUndefinedWidth();
        this.addComponent(yearLbl);
    } else {
        blockWrapper.setMargin(new MarginInfo(true, false, false, false));
    }
    ELabel dateLbl = new ELabel(UserUIContext.formatShortDate(nextDate)).withStyleName("date-lbl").withUndefinedWidth();
    blockWrapper.with(dateLbl, currentBlock).expand(currentBlock);

    this.addComponent(blockWrapper);
}
 
示例14
StandupAddWindow(StandupReportStatistic standupReportStatistic, LocalDate onDate) {
    this.withModal(true).withClosable(true).withResizable(false).withCenter().withWidth(UIUtils.INSTANCE.getBrowserWidth() + "px")
            .withHeight(UIUtils.INSTANCE.getBrowserHeight() + "px");

    this.onDate = onDate;
    standupReportService = AppContextUtil.getSpringBean(StandupReportService.class);
    SimpleStandupReport report = standupReportService.findStandupReportByDateUser(standupReportStatistic.getProjectId(),
            UserUIContext.getUsername(), onDate, AppUI.getAccountId());
    if (report == null) {
        report = new SimpleStandupReport();
        report.setProjectid(standupReportStatistic.getProjectId());
        report.setSaccountid(AppUI.getAccountId());
        report.setForday(onDate);
        report.setLogby(UserUIContext.getUsername());
    }

    editForm = new AdvancedEditBeanForm<>();
    editForm.setFormLayoutFactory(new FormLayoutFactory());
    editForm.setBeanFormFieldFactory(new EditFormFieldFactory(editForm));
    editForm.setBean(report);
    Component projectLogo = ProjectAssetsUtil.projectLogoComp(standupReportStatistic.getProjectKey(), standupReportStatistic.getProjectId(),
            standupReportStatistic.getProjectAvatarId(), 32);
    ELabel projectLbl = ELabel.h2(standupReportStatistic.getProjectName()).withStyleName(WebThemes.TEXT_ELLIPSIS);
    setContent(new MVerticalLayout(new MHorizontalLayout(projectLogo, projectLbl).expand(projectLbl), editForm));
    editForm.addFormHandler(this);
}
 
示例15
public RoleReadViewImpl() {
    this.setMargin(new MarginInfo(false, true, true, true));

    MHorizontalLayout header = new MHorizontalLayout().withMargin(new MarginInfo(true, false, true, false)).withFullWidth();
    header.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    ELabel headerText = ELabel.h2(VaadinIcons.USERS.getHtml() + " " + UserUIContext.getMessage(RoleI18nEnum.DETAIL));
    header.with(headerText).expand(headerText);
    this.addComponent(header);

    this.previewForm = new AdvancedPreviewBeanForm<>();
    this.addComponent(this.previewForm);

    Layout controlButtons = createTopPanel();
    if (controlButtons != null) {
        header.addComponent(controlButtons);
    }
}
 
示例16
@Override
public ComponentContainer constructBody() {
    MHorizontalLayout basicSearchBody = new MHorizontalLayout().withMargin(true);
    basicSearchBody.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    Label nameLbl = new Label("Name:");
    basicSearchBody.with(nameLbl);

    nameField = new MTextField().withPlaceholder(UserUIContext.getMessage(GenericI18Enum.ACTION_QUERY_BY_TEXT))
            .withWidth(WebUIConstants.DEFAULT_CONTROL_WIDTH);
    basicSearchBody.with(nameField);

    MButton searchBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SEARCH), clickEvent -> callSearchAction())
            .withIcon(VaadinIcons.SEARCH).withStyleName(WebThemes.BUTTON_ACTION)
            .withClickShortcut(ShortcutAction.KeyCode.ENTER);
    basicSearchBody.with(searchBtn);

    MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CLEAR), clickEvent -> nameField.setValue(""))
            .withStyleName(WebThemes.BUTTON_OPTION);
    basicSearchBody.with(cancelBtn);

    return basicSearchBody;
}
 
示例17
MHorizontalLayout getHeader() {
    if (headerLayout == null) {
        headerLayout = new MHorizontalLayout().withFullWidth().withMargin(new MarginInfo(true, false, true, false));
        headerRightComp = new MHorizontalLayout();
        headerTitleComp = buildSearchTitle();
        if (headerTitleComp != null) {
            headerLayout.with(headerTitleComp, headerRightComp).expand(headerRightComp);
        }

        Component extraControls = buildExtraControls();
        if (extraControls != null) {
            addHeaderRight(extraControls);
        }
    }
    return headerLayout;
}
 
示例18
public Depot(String title, ComponentContainer content) {
    this.setSpacing(false);
    this.setMargin(false);
    this.addStyleName("depot");
    header = new MHorizontalLayout().withStyleName("depot-header");
    bodyContent = content;
    bodyContent.setWidth("100%");
    headerContent = new MHorizontalLayout().withFullHeight().withUndefinedWidth().withVisible(false);
    this.addComponent(header);

    headerLbl = ELabel.h3("");
    setTitle(title);
    final MHorizontalLayout headerLeft = new MHorizontalLayout(headerLbl).withStyleName("depot-title")
            .withAlign(headerLbl, Alignment.MIDDLE_LEFT).withFullWidth();
    headerLeft.addLayoutClickListener(layoutClickEvent -> {
        isOpened = !isOpened;
        if (isOpened) {
            bodyContent.setVisible(true);
            header.removeStyleName(WebThemes.BORDER_BOTTOM);
        } else {
            bodyContent.setVisible(false);
            header.addStyleName(WebThemes.BORDER_BOTTOM);
        }
        setTitle(this.title);
    });
    header.with(headerLeft, headerContent).withAlign(headerLeft, Alignment.MIDDLE_LEFT).withAlign(headerContent,
            Alignment.MIDDLE_RIGHT).expand(headerLeft);

    bodyContent.addStyleName("depot-content");
    this.addComponent(bodyContent);
}
 
示例19
@PostConstruct
public void initComponent() {
    table.setColumnCollapsingAllowed(true);
    table.setColumnWidth("invoiceDate", 105);
    table.setColumnWidth("lastEdited", 105);
    table.setColumnWidth("lastEditor", 110);
    if (session.getUser().getAdministrates().isEmpty()) {
        Notification.show("Add invoicer first!");
        ViewMenuUI.getMenu().navigateTo(MyAccount.class);
        return;
    }
    sender.addMValueChangeListener(e -> listEntities());

    form.setResetHandler(this::reset);
    form.setSavedHandler(this::save);

    table.addMValueChangeListener(e -> {
        if (e.getValue() != null) {
            form.setEntity(e.getValue());
            form.openInModalPopup();
        }
    });

    listEntities();

    Button addButton = new Button("Add", e -> {
        final Invoice invoice = facade.createFor(sender.getValue());
        form.setEntity(invoice);
        form.openInModalPopup();
    });

    add(
            new MHorizontalLayout(addButton, sender).space().add(backup)
            .alignAll(Alignment.MIDDLE_LEFT)
    );
    expand(table);
}
 
示例20
private void initUI() {
    final MVerticalLayout mainLayout = new MVerticalLayout().withFullWidth();

    Label lbInstruct1 = new ELabel(UserUIContext.getMessage(UserI18nEnum.MSG_PASSWORD_INSTRUCT_LABEL_1)).withFullWidth();
    mainLayout.addComponent(lbInstruct1);
    mainLayout.setComponentAlignment(lbInstruct1, Alignment.MIDDLE_LEFT);

    final Label lbInstruct2 = new ELabel(UserUIContext.getMessage(UserI18nEnum.MSG_PASSWORD_INSTRUCT_LABEL_2)).withFullWidth();
    mainLayout.addComponent(lbInstruct2);
    mainLayout.setComponentAlignment(lbInstruct2, Alignment.MIDDLE_LEFT);

    GridFormLayoutHelper passInfo = GridFormLayoutHelper.defaultFormLayoutHelper(LayoutType.ONE_COLUMN);

    txtNewPassword = new PasswordField();
    passInfo.addComponent(txtNewPassword, UserUIContext.getMessage(ShellI18nEnum.OPT_NEW_PASSWORD), 0, 0);

    txtConfirmPassword = new PasswordField();
    passInfo.addComponent(txtConfirmPassword, UserUIContext.getMessage(ShellI18nEnum.OPT_CONFIRMED_PASSWORD), 0, 1);

    mainLayout.addComponent(passInfo.getLayout());
    mainLayout.setComponentAlignment(passInfo.getLayout(), Alignment.MIDDLE_CENTER);

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

    MButton saveBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SAVE), clickEvent -> changePassword())
            .withIcon(VaadinIcons.CLIPBOARD).withStyleName(WebThemes.BUTTON_ACTION).withClickShortcut(KeyCode.ENTER);

    MHorizontalLayout hlayoutControls = new MHorizontalLayout(cancelBtn, saveBtn).withMargin(false);
    mainLayout.with(hlayoutControls).withAlign(hlayoutControls, Alignment.MIDDLE_RIGHT);

    this.setContent(mainLayout);
}
 
示例21
/**
 * @return A default toolbar containing save/cancel/delete buttons
 */
public HorizontalLayout getToolbar() {
    return new MHorizontalLayout(
            getSaveButton(),
            getResetButton(),
            getDeleteButton()
    );
}
 
示例22
@Override
protected Component initContent() {
    selectBtn.setDescription("Click to select person.");
    selectBtn.addClickListener(e -> {
        getUI().addWindow(window);
    });
    return new MHorizontalLayout(display, selectBtn).alignAll(Alignment.MIDDLE_LEFT);
}
 
示例23
/**
 * @return A default toolbar containing save/cancel/delete buttons
 */
public HorizontalLayout getToolbar() {
    return new MHorizontalLayout(
            getSaveButton(),
            getResetButton(),
            getDeleteButton()
    );
}
 
示例24
public ProfileReadViewImpl() {
    this.setMargin(new MarginInfo(false, true, true, true));
    this.avatarAndPass = new MHorizontalLayout().withMargin(new MarginInfo(true, true, true, false)).withFullWidth();

    this.formItem = new PreviewForm();
    this.formItem.setWidth("100%");
    this.addComponent(this.formItem);
}
 
示例25
@Override
protected Component createContent() {
    return new MVerticalLayout(
            new MFormLayout(
                    newButton(),
                    new MHorizontalLayout(initials, middleName).
                    withCaption("Name"),
                    lastName
            ).withMargin(false).withFullWidth(),
            getToolbar()
    ).withMargin(new MMarginInfo(false, true)).withFullWidth();
}
 
示例26
public ProjectAddWindow() {
    super(new Project().withSaccountid(AppUI.getAccountId()));

    MVerticalLayout contentLayout = new MVerticalLayout().withSpacing(false).withMargin(new MarginInfo(false, false, true, false));
    setContent(contentLayout);
    projectInfo = new ProjectGeneralInfoStep(project);
    contentLayout.addComponent(projectInfo.getContent());

    MButton saveBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SAVE), clickEvent -> {
        boolean isValid = projectInfo.commit();
        if (isValid) {
            ProjectService projectService = AppContextUtil.getSpringBean(ProjectService.class);
            project.setSaccountid(AppUI.getAccountId());
            projectService.saveWithSession(project, UserUIContext.getUsername());

            EventBusFactory.getInstance().post(new ProjectEvent.GotoMyProject(this,
                    new PageActionChain(new ProjectScreenData.Goto(project.getId()))));
            close();
        }
    }).withIcon(VaadinIcons.CLIPBOARD).withStyleName(WebThemes.BUTTON_ACTION).withClickShortcut(KeyCode.ENTER);

    MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CANCEL), clickEvent -> close())
            .withStyleName(WebThemes.BUTTON_OPTION);
    MHorizontalLayout buttonControls = new MHorizontalLayout(cancelBtn, saveBtn).withMargin(new MarginInfo(true,
            false, false, false));
    contentLayout.with(buttonControls).withAlign(buttonControls, Alignment.MIDDLE_RIGHT);
}
 
示例27
public ProjectSettingViewImpl() {
    this.setWidth("100%");
    this.setSpacing(true);
    this.addStyleName("readview-layout");

    mainBody = new MHorizontalLayout().withMargin(true).withFullWidth();
    this.addComponent(mainBody);
}
 
示例28
public BuildCriterionComponent(SearchLayout<S> searchLayout, Param[] paramFields, String searchCategory) {
    this.hostSearchLayout = searchLayout;
    this.paramFields = paramFields;
    this.searchCategory = searchCategory;

    MHorizontalLayout headerBox = new MHorizontalLayout().withMargin(new MarginInfo(true, false, true, true));
    headerBox.setDefaultComponentAlignment(Alignment.TOP_LEFT);
    addComponent(headerBox);

    Label filterLbl = new Label(UserUIContext.getMessage(GenericI18Enum.OPT_SAVED_FILTER));
    headerBox.with(filterLbl).withAlign(filterLbl, Alignment.TOP_LEFT);

    filterBox = new MHorizontalLayout();
    headerBox.with(filterBox).withAlign(filterBox, Alignment.TOP_LEFT);

    buildFilterBox(null);

    searchContainer = new MVerticalLayout().withMargin(false);
    searchContainer.setDefaultComponentAlignment(Alignment.TOP_LEFT);

    MButton addCriteriaBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_ADD_CRITERIA), clickEvent -> {
        CriteriaSelectionLayout newCriteriaBar = new CriteriaSelectionLayout(searchContainer.getComponentCount() + 1);
        searchContainer.addComponent(newCriteriaBar);
    }).withIcon(VaadinIcons.PLUS).withStyleName(WebThemes.BUTTON_ACTION);

    this.with(searchContainer, new MHorizontalLayout(addCriteriaBtn).withMargin(true));
}
 
示例29
@Override
public AbstractComponent getLayout() {
    MVerticalLayout layout = new MVerticalLayout();
    informationLayout = GridFormLayoutHelper.defaultFormLayoutHelper(LayoutType.ONE_COLUMN);
    layout.addComponent(informationLayout.getLayout());

    MButton saveBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SAVE), clickEvent -> {
        ProjectTicket relatedTicket = ticketRelationSelectField.getSelectedTicket();
        ticketRelation.setType(relatedTicket.getType());
        ticketRelation.setTypeid(relatedTicket.getTypeId());

        if (editForm.validateForm()) {
            TicketRelationService relatedBugService = AppContextUtil.getSpringBean(TicketRelationService.class);

            ProjectTicket relationTicket = ticketRelationSelectField.getSelectedTicket();
            if (relationTicket == null) {
                throw new UserInvalidInputException("The related ticket must be not null");
            }

            if (relationTicket.getTypeId().equals(hostedTicket.getTypeId()) && relationTicket.getType().equals(hostedTicket.getType())) {
                throw new UserInvalidInputException("The relation is invalid since the both entries are the same");
            }

            ticketRelation.setTypeid(relationTicket.getTypeId());
            ticketRelation.setType(relationTicket.getType());
            relatedBugService.saveWithSession(ticketRelation, UserUIContext.getUsername());
            close();

            EventBusFactory.getInstance().post(new TicketEvent.DependencyChange(this, hostedTicket.getType(), hostedTicket.getTypeId()));
        }
    }).withIcon(VaadinIcons.CLIPBOARD).withStyleName(WebThemes.BUTTON_ACTION);

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

    MHorizontalLayout controlsBtn = new MHorizontalLayout(cancelBtn, saveBtn).withMargin(false);
    layout.with(controlsBtn).withAlign(controlsBtn, Alignment.MIDDLE_RIGHT);
    return layout;
}
 
示例30
@Override
public ComponentContainer constructBody() {
    MHorizontalLayout basicSearchBody = new MHorizontalLayout().withMargin(true);

    Label nameLbl = new Label(UserUIContext.getMessage(GenericI18Enum.FORM_NAME) + ":");
    basicSearchBody.with(nameLbl).withAlign(nameLbl, Alignment.MIDDLE_LEFT);

    nameField = new MTextField().withPlaceholder(UserUIContext.getMessage(GenericI18Enum.ACTION_QUERY_BY_TEXT))
            .withWidth(WebUIConstants.DEFAULT_CONTROL_WIDTH);
    basicSearchBody.with(nameField).withAlign(nameField, Alignment.MIDDLE_CENTER);

    myItemCheckbox = new CheckBox(UserUIContext.getMessage(GenericI18Enum.OPT_MY_ITEMS));
    basicSearchBody.with(myItemCheckbox).withAlign(myItemCheckbox, Alignment.MIDDLE_CENTER);

    MButton searchBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SEARCH), clickEvent -> callSearchAction())
            .withIcon(VaadinIcons.SEARCH).withStyleName(WebThemes.BUTTON_ACTION)
            .withClickShortcut(ShortcutAction.KeyCode.ENTER);
    basicSearchBody.with(searchBtn).withAlign(searchBtn, Alignment.MIDDLE_LEFT);

    MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CLEAR), clickEvent -> nameField.setValue(""))
            .withStyleName(WebThemes.BUTTON_OPTION);
    basicSearchBody.with(cancelBtn).withAlign(cancelBtn, Alignment.MIDDLE_CENTER);

    if (canSwitchToAdvanceLayout) {
        MButton advancedSearchBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_ADVANCED_SEARCH),
                clickEvent -> moveToAdvancedSearchLayout()).withStyleName(WebThemes.BUTTON_LINK);
        basicSearchBody.with(advancedSearchBtn).withAlign(advancedSearchBtn, Alignment.MIDDLE_CENTER);
    }
    return basicSearchBody;
}