本文整理汇总了Java中org.vaadin.viritin.layouts.MHorizontalLayout类的典型用法代码示例。如果您正苦于以下问题:Java MHorizontalLayout类的具体用法?Java MHorizontalLayout怎么用?Java MHorizontalLayout使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MHorizontalLayout类属于org.vaadin.viritin.layouts包,在下文中一共展示了MHorizontalLayout类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import org.vaadin.viritin.layouts.MHorizontalLayout; //导入依赖的package包/类
@Override
protected void init(VaadinRequest request) {
final VerticalLayout root = new VerticalLayout();
root.setSizeFull();
root.setMargin(true);
root.setSpacing(true);
setContent(root);
MHorizontalLayout horizontalLayout = new MHorizontalLayout();
for (MenuEntry menuEntry : menuEntries) {
horizontalLayout.addComponent(new MButton(menuEntry.getName(), event -> {
navigator.navigateTo(menuEntry.getNavigationTarget());
}));
}
root.addComponent(horizontalLayout);
springViewDisplay = new Panel();
springViewDisplay.setSizeFull();
root.addComponent(springViewDisplay);
root.setExpandRatio(springViewDisplay, 1.0f);
}
示例2: layout
import org.vaadin.viritin.layouts.MHorizontalLayout; //导入依赖的package包/类
/**
* Do the application layout that is optimized for the screen size.
* <p>
* Like in Java world in general, Vaadin developers can modularize their
* helpers easily and re-use existing code. E.g. In this method we are using
* extended versions of Vaadins basic layout that has "fluent API" and this
* way we get bit more readable code. Check out vaadin.com/directory for a
* huge amount of helper libraries and custom components. They might be
* valuable for your productivity.
* </p>
*/
private void layout() {
removeAllComponents();
if (ScreenSize.getScreenSize() == ScreenSize.LARGE) {
addComponents(
new MHorizontalLayout(header, filter, addButton)
.expand(header)
.alignAll(Alignment.MIDDLE_LEFT),
mainContent
);
filter.setSizeUndefined();
} else {
addComponents(
header,
new MHorizontalLayout(filter, addButton)
.expand(filter)
.alignAll(Alignment.MIDDLE_LEFT),
mainContent
);
}
setMargin(new MarginInfo(false, true, true, true));
expand(mainContent);
}
示例3: createContent
import org.vaadin.viritin.layouts.MHorizontalLayout; //导入依赖的package包/类
@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));
}
示例4: init
import org.vaadin.viritin.layouts.MHorizontalLayout; //导入依赖的package包/类
@PostConstruct
void init() {
// Add some event listners, e.g. to hook filter input to actually
// filter the displayed entries
filter.addValueChangeListener(e -> {
listEntries(e.getValue());
});
entryList.asSingleSelect().addValueChangeListener(this::entrySelected);
form.setSavedHandler(this::entrySaved);
form.setResetHandler(this::entryEditCanceled);
addComponents(
new MVerticalLayout(
new Header("PhoneBook"),
new MHorizontalLayout(addNew, delete, filter),
new MHorizontalLayout(entryList, form)
)
);
// List all entries and select first entry in the list
listEntries();
entryList.select(service.getGroups().get(0));
}
示例5: init
import org.vaadin.viritin.layouts.MHorizontalLayout; //导入依赖的package包/类
@PostConstruct
void init() {
// Add some event listners, e.g. to hook filter input to actually
// filter the displayed entries
filter.addValueChangeListener(e -> {
listEntries(e.getValue());
});
entryList.asSingleSelect().addValueChangeListener(this::entrySelected);
form.setSavedHandler(this::entrySaved);
form.setResetHandler(this::entryEditCanceled);
addComponents(
new MVerticalLayout(
new MHorizontalLayout(addNew, delete, filter),
new MHorizontalLayout(entryList, form)
)
);
// List all entries and select first entry in the list
listEntries();
form.setVisible(false);
}
示例6: initContent
import org.vaadin.viritin.layouts.MHorizontalLayout; //导入依赖的package包/类
@Override
protected Component initContent() {
MHorizontalLayout layout = new MHorizontalLayout().withFullWidth();
final PrefixNameComboBox prefixSelect = new PrefixNameComboBox();
prefixSelect.setValue(attachForm.getBean().getPrefixname());
layout.addComponent(prefixSelect);
prefixSelect.addValueChangeListener(event -> attachForm.getBean().setPrefixname((String) prefixSelect.getValue()));
TextField firstnameTxtField = new TextField();
firstnameTxtField.setWidth("100%");
firstnameTxtField.setNullRepresentation("");
layout.addComponent(firstnameTxtField);
layout.setExpandRatio(firstnameTxtField, 1.0f);
// binding field group
fieldGroup.bind(prefixSelect, "prefixname");
fieldGroup.bind(firstnameTxtField, "firstname");
return layout;
}
示例7: AboutWindow
import org.vaadin.viritin.layouts.MHorizontalLayout; //导入依赖的package包/类
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()));
Label javaNameLbl = new Label(String.format("%s, %s", System.getProperty("java.vm.name"),
System.getProperty("java.runtime.version")));
Label homeFolderLbl = new Label("Home folder: " + FileUtils.getHomeFolder().getAbsolutePath());
WebBrowser browser = Page.getCurrent().getWebBrowser();
Label osLbl = new Label(String.format("%s, %s", System.getProperty("os.name"),
browser.getBrowserApplication()));
osLbl.addStyleName(UIConstants.LABEL_WORD_WRAP);
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"));
Label licenseLbl = ELabel.html(licenseDiv.write());
Label copyRightLbl = ELabel.html(String.format("© %s - %s MyCollab Ltd. All rights reserved", "2011",
new GregorianCalendar().get(Calendar.YEAR) + ""));
rightPanel.with(versionLbl, javaNameLbl, osLbl, homeFolderLbl, licenseLbl, copyRightLbl)
.withAlign(copyRightLbl, Alignment.BOTTOM_LEFT);
content.with(about, rightPanel).expand(rightPanel);
}
示例8: buildCell
import org.vaadin.viritin.layouts.MHorizontalLayout; //导入依赖的package包/类
public GridCellWrapper buildCell(String caption, String contextHelp, int columns, int rows, int colSpan, String width, Alignment alignment) {
if (StringUtils.isNotBlank(caption)) {
ELabel captionLbl = new ELabel(caption).withStyleName(UIConstants.LABEL_WORD_WRAP).withDescription(caption);
MHorizontalLayout captionWrapper = new MHorizontalLayout().withSpacing(false).withMargin(true)
.withWidth(defaultCaptionWidth).withFullHeight().withStyleName("gridform-caption").with(captionLbl).expand(captionLbl)
.withAlign(captionLbl, alignment);
if (StringUtils.isNotBlank(contextHelp)) {
ELabel contextHelpLbl = ELabel.html(" " + FontAwesome.QUESTION_CIRCLE.getHtml())
.withStyleName(WebThemes.INLINE_HELP).withDescription(contextHelp).withWidthUndefined();
captionWrapper.with(contextHelpLbl);
}
layout.addComponent(captionWrapper, 2 * columns, rows);
}
GridCellWrapper fieldWrapper = new GridCellWrapper();
fieldWrapper.setWidth(width);
layout.addComponent(fieldWrapper, 2 * columns + 1, rows, 2 * (columns + colSpan - 1) + 1, rows);
layout.setColumnExpandRatio(2 * columns + 1, 1.0f);
if (StringUtils.isNotBlank(caption)) {
fieldCaptionMappings.put(caption, fieldWrapper);
}
return fieldWrapper;
}
示例9: buildControlsLayout
import org.vaadin.viritin.layouts.MHorizontalLayout; //导入依赖的package包/类
private ComponentContainer buildControlsLayout() {
MHorizontalLayout viewControlsLayout = new MHorizontalLayout().withStyleName(WebThemes.TABLE_ACTION_CONTROLS).withFullWidth();
selectOptionButton = new SelectionOptionButton(tableItem);
selectOptionButton.setSizeUndefined();
tableActionControls = createActionControls();
MHorizontalLayout leftContainer = new MHorizontalLayout(selectOptionButton, tableActionControls, selectedItemsNumberLabel);
leftContainer.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
extraControlsLayout = new ButtonGroup();
buildExtraControls();
viewControlsLayout.with(leftContainer, extraControlsLayout).withAlign(leftContainer, Alignment.MIDDLE_LEFT)
.withAlign(extraControlsLayout, Alignment.MIDDLE_RIGHT);
return viewControlsLayout;
}
示例10: createButtonControls
import org.vaadin.viritin.layouts.MHorizontalLayout; //导入依赖的package包/类
@Override
protected ComponentContainer createButtonControls() {
MButton editBtn = new MButton("", clickEvent -> EventBusFactory.getInstance().post(new ProjectMemberEvent.GotoEdit(this, beanItem)))
.withIcon(FontAwesome.EDIT).withStyleName(UIConstants.CIRCLE_BOX)
.withVisible(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.USERS));
MButton deleteBtn = new MButton("", clickEvent -> ConfirmDialog.show(UI.getCurrent(),
UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE),
UserUIContext.getMessage(GenericI18Enum.ACTION_YES),
UserUIContext.getMessage(GenericI18Enum.ACTION_NO),
dialog -> {
if (dialog.isConfirmed()) {
ProjectMemberService projectMemberService = AppContextUtil.getSpringBean(ProjectMemberService.class);
projectMemberService.removeWithSession(beanItem, UserUIContext.getUsername(), AppUI.getAccountId());
EventBusFactory.getInstance().post(new ProjectMemberEvent.GotoList(this, CurrentProjectVariables.getProjectId()));
}
})).withIcon(FontAwesome.TRASH).withStyleName(UIConstants.CIRCLE_BOX)
.withVisible(CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.USERS));
return new MHorizontalLayout(editBtn, deleteBtn);
}
示例11: buildSearchTitle
import org.vaadin.viritin.layouts.MHorizontalLayout; //导入依赖的package包/类
@Override
protected ComponentContainer buildSearchTitle() {
if (canSwitchToAdvanceLayout) {
savedFilterComboBox = new BugSavedFilterComboBox();
savedFilterComboBox.addQuerySelectListener(new SavedFilterComboBox.QuerySelectListener() {
@Override
public void querySelect(SavedFilterComboBox.QuerySelectEvent querySelectEvent) {
List<SearchFieldInfo<BugSearchCriteria>> fieldInfos = querySelectEvent.getSearchFieldInfos();
BugSearchCriteria criteria = SearchFieldInfo.buildSearchCriteria(BugSearchCriteria.class, fieldInfos);
criteria.setProjectId(new NumberSearchField(CurrentProjectVariables.getProjectId()));
EventBusFactory.getInstance().post(new BugEvent.SearchRequest(BugSearchPanel.this, criteria));
EventBusFactory.getInstance().post(new ShellEvent.AddQueryParam(this, fieldInfos));
}
});
ELabel taskIcon = ELabel.h2(ProjectAssetsManager.getAsset(ProjectTypeConstants.BUG).getHtml()).withWidthUndefined();
return new MHorizontalLayout(taskIcon, savedFilterComboBox).expand(savedFilterComboBox).alignAll(Alignment.MIDDLE_LEFT);
} else {
return null;
}
}
示例12: getLayout
import org.vaadin.viritin.layouts.MHorizontalLayout; //导入依赖的package包/类
@Override
public AbstractComponent getLayout() {
final VerticalLayout layout = new VerticalLayout();
informationLayout = GridFormLayoutHelper.defaultFormLayoutHelper(2, 2);
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(FontAwesome.SAVE).withStyleName(WebThemes.BUTTON_ACTION);
final MHorizontalLayout controlsBtn = new MHorizontalLayout(cancelBtn, saveBtn).withMargin(new MarginInfo(true, true, true, false));
layout.addComponent(controlsBtn);
layout.setComponentAlignment(controlsBtn, Alignment.MIDDLE_RIGHT);
return layout;
}
示例13: displayFileName
import org.vaadin.viritin.layouts.MHorizontalLayout; //导入依赖的package包/类
private void displayFileName(File file, final String fileName) {
final MHorizontalLayout fileAttachmentLayout = new MHorizontalLayout().withFullWidth();
MButton removeBtn = new MButton("", clickEvent -> {
File tmpFile = fileStores.get(fileName);
if (tmpFile != null) {
tmpFile.delete();
}
fileStores.remove(fileName);
rowWrap.removeComponent(fileAttachmentLayout);
}).withIcon(FontAwesome.TRASH_O).withStyleName(MobileUIConstants.BUTTON_LINK);
ELabel fileLbl = ELabel.html(fileName).withDescription(fileName).withStyleName(UIConstants.TEXT_ELLIPSIS);
fileAttachmentLayout.with(ELabel.fontIcon(FileAssetsUtil.getFileIconResource(fileName)).withWidthUndefined(),
fileLbl, new ELabel(" - " + FileUtils.getVolumeDisplay(file.length()))
.withStyleName(UIConstants.META_INFO).withWidthUndefined(), removeBtn).expand(fileLbl);
rowWrap.addComponent(fileAttachmentLayout);
}
示例14: initUI
import org.vaadin.viritin.layouts.MHorizontalLayout; //导入依赖的package包/类
private void initUI() {
MVerticalLayout mainLayout = new MVerticalLayout().withMargin(new MarginInfo(false, false, true, false)).withFullWidth();
GridFormLayoutHelper passInfo = GridFormLayoutHelper.defaultFormLayoutHelper(1, 4);
passInfo.addComponent(txtWebsite, UserUIContext.getMessage(UserI18nEnum.FORM_WEBSITE), 0, 0);
passInfo.addComponent(txtCompany, UserUIContext.getMessage(UserI18nEnum.FORM_COMPANY), 0, 1);
passInfo.addComponent(cboCountry, UserUIContext.getMessage(UserI18nEnum.FORM_COUNTRY), 0, 2);
txtWebsite.setValue(MoreObjects.firstNonNull(user.getWebsite(), ""));
txtCompany.setValue(MoreObjects.firstNonNull(user.getCompany(), ""));
cboCountry.setValue(MoreObjects.firstNonNull(user.getCountry(), ""));
mainLayout.with(passInfo.getLayout()).withAlign(passInfo.getLayout(), Alignment.TOP_LEFT);
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 -> changeInfo())
.withStyleName(WebThemes.BUTTON_ACTION).withIcon(FontAwesome.SAVE).withClickShortcut(ShortcutAction.KeyCode.ENTER);
MHorizontalLayout buttonControls = new MHorizontalLayout(cancelBtn, saveBtn).withMargin(new MarginInfo(false, true, false, true));
mainLayout.with(buttonControls).withAlign(buttonControls, Alignment.MIDDLE_RIGHT);
this.setModal(true);
this.setContent(mainLayout);
}
示例15: constructTableActionControls
import org.vaadin.viritin.layouts.MHorizontalLayout; //导入依赖的package包/类
private ComponentContainer constructTableActionControls() {
final CssLayout layoutWrapper = new CssLayout();
layoutWrapper.setWidth("100%");
MHorizontalLayout layout = new MHorizontalLayout();
layoutWrapper.addStyleName(WebThemes.TABLE_ACTION_CONTROLS);
layoutWrapper.addComponent(layout);
this.selectOptionButton = new SelectionOptionButton(this.tableItem);
layout.addComponent(this.selectOptionButton);
tableActionControls = new DefaultMassItemActionHandlerContainer();
if (CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.VERSIONS)) {
tableActionControls.addDeleteActionItem();
}
tableActionControls.addMailActionItem();
tableActionControls.addDownloadPdfActionItem();
tableActionControls.addDownloadExcelActionItem();
tableActionControls.addDownloadCsvActionItem();
layout.with(tableActionControls, selectedItemsNumberLabel).withAlign(selectedItemsNumberLabel, Alignment.MIDDLE_CENTER);
return layoutWrapper;
}