本文整理汇总了Java中com.vaadin.ui.Layout类的典型用法代码示例。如果您正苦于以下问题:Java Layout类的具体用法?Java Layout怎么用?Java Layout使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Layout类属于com.vaadin.ui包,在下文中一共展示了Layout类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: CubaDateFieldWrapper
import com.vaadin.ui.Layout; //导入依赖的package包/类
public CubaDateFieldWrapper(WebDateField dateField, Layout composition) {
this.dateField = dateField;
this.composition = composition;
if (App.isBound()) {
theme = App.getInstance().getThemeConstants();
}
setSizeUndefined();
//noinspection unchecked
setConverter(new ObjectToObjectConverter());
setValidationVisible(false);
setShowBufferedSourceException(false);
setShowErrorForDisabledState(false);
setFocusDelegate(dateField.getDateField());
setPrimaryStyleName("c-datefield-composition");
}
示例2: createEmptyLayout
import com.vaadin.ui.Layout; //导入依赖的package包/类
private Layout createEmptyLayout() {
Label label = new Label("Add new job...");
label.setSizeUndefined();
label.addStyleName(ValoTheme.LABEL_LARGE);
VerticalLayout emptyLayout = new VerticalLayout(label);
emptyLayout.addStyleName("dashed-border");
emptyLayout.setWidth(380, Unit.PIXELS);
emptyLayout.setHeight(220, Unit.PIXELS);
emptyLayout.setComponentAlignment(label, Alignment.MIDDLE_CENTER);
emptyLayout.addLayoutClickListener(new LayoutEvents.LayoutClickListener() {
@Override
public void layoutClick(LayoutEvents.LayoutClickEvent event) {
BatchJobConfiguration jobConfig = presenter.createBatchJob();
BatchJobCard batchJobCard = batchJobCardInstances.get();
batchJobCard.load(jobConfig);
batchJobCard.addBatchJobCardListener(BatchJobsLayout.this);
batchJobLayout.addComponent(batchJobCard, batchJobLayout.getComponentCount()-1);
}
});
return emptyLayout;
}
示例3: buttonsLayout
import com.vaadin.ui.Layout; //导入依赖的package包/类
private Layout buttonsLayout(Button... buttons) {
HorizontalLayout layout = new HorizontalLayout();
layout.setSizeFull();
List<Component> components = new ArrayList<>(Arrays.asList(buttons));
// Set HTML id for each button
for(Component b : components) {
b.setId(b.getCaption().replace(' ', '-')+"-btn");
}
// Split components into sublists of 5 elements
int partitionSize = 5;
List<List<Component>> partitions = new ArrayList<>();
for (int i = 0; i < components.size(); i += partitionSize) {
partitions.add(components.subList(i, Math.min(i + partitionSize, components.size())));
}
// Create vertical layouts for each list of buttons
for(List<Component> sublist : partitions) {
VerticalLayout vLayout = new VerticalLayout();
vLayout.setMargin(false);
sublist.stream().forEach(btn -> {
btn.setSizeFull();
vLayout.addComponent(btn);
});
layout.addComponent(vLayout);
}
return layout;
}
示例4: init
import com.vaadin.ui.Layout; //导入依赖的package包/类
@Override
protected void init(VaadinRequest request) {
// Root layout
final VerticalLayout root = new VerticalLayout();
root.setSizeFull();
root.setSpacing(false);
root.setMargin(false);
setContent(root);
// Main panel
springViewDisplay = new Panel();
springViewDisplay.setSizeFull();
root.addComponent(springViewDisplay);
root.setExpandRatio(springViewDisplay, 1);
// Footer
Layout footer = getFooter();
root.addComponent(footer);
root.setExpandRatio(footer, 0);
// Error handler
UI.getCurrent().setErrorHandler(new UIErrorHandler());
// Disable session expired notification, the page will be reloaded on any action
VaadinService.getCurrent().setSystemMessagesProvider(
systemMessagesInfo -> {
CustomizedSystemMessages msgs = new CustomizedSystemMessages();
msgs.setSessionExpiredNotificationEnabled(false);
return msgs;
});
}
示例5: getFooter
import com.vaadin.ui.Layout; //导入依赖的package包/类
private Layout getFooter() {
Layout footer = new HorizontalLayout();
footer.addComponent(new Label("Persephone v"+persephoneVersion));
footer.addComponent(new Link("Created by Vianney FAIVRE", new ExternalResource("https://vianneyfaiv.re"), "_blank", 0, 0, BorderStyle.DEFAULT));
footer.addComponent(new Link("GitHub", new ExternalResource("https://github.com/vianneyfaivre/Persephone"), "_blank", 0, 0, BorderStyle.DEFAULT));
footer.setHeight(20, Unit.PIXELS);
footer.setStyleName("persephone-footer");
return footer;
}
示例6: setLayout
import com.vaadin.ui.Layout; //导入依赖的package包/类
public void setLayout(Layout newLayout) {
if (newLayout == null) {
newLayout = new CubaFieldGroupLayout();
}
if (newLayout instanceof CubaFieldGroupLayout) {
super.setContent(newLayout);
} else {
throw new IllegalArgumentException("FieldGroup supports only CubaFieldGroupLayout");
}
}
示例7: CubaGroupBox
import com.vaadin.ui.Layout; //导入依赖的package包/类
public CubaGroupBox() {
registerRpc((CubaGroupBoxServerRpc) expanded -> {
if (getState().collapsable) {
setExpanded(expanded);
}
});
Layout content = new CubaVerticalActionsLayout();
setContent(content);
setWidth(100, Unit.PERCENTAGE);
}
示例8: setAlignment
import com.vaadin.ui.Layout; //导入依赖的package包/类
@Override
public void setAlignment(Alignment alignment) {
this.alignment = alignment;
if (getComposition().getParent() != null) {
com.vaadin.ui.Component component = this.getComposition().getParent();
if (component instanceof Layout.AlignmentHandler) {
((Layout.AlignmentHandler) component).setComponentAlignment(this.getComposition(),
WebWrapperUtils.toVaadinAlignment(alignment));
}
}
}
示例9: addLazyTab
import com.vaadin.ui.Layout; //导入依赖的package包/类
@Override
public Accordion.Tab addLazyTab(String name,
Element descriptor,
ComponentLoader loader) {
WebVBoxLayout tabContent = new WebVBoxLayout();
Layout layout = (Layout) tabContent.getComponent();
layout.setSizeFull();
Tab tab = new Tab(name, tabContent);
tabs.put(name, tab);
com.vaadin.ui.Component tabComponent = WebComponentsHelper.getComposition(tabContent);
tabComponent.setSizeFull();
tabMapping.put(tabComponent, new ComponentDescriptor(name, tabContent));
com.vaadin.ui.Accordion.Tab tabControl = this.component.addTab(tabComponent);
getLazyTabs().add(tabComponent);
this.component.addSelectedTabChangeListener(new LazyTabChangeListener(tabContent, descriptor, loader));
context = loader.getContext();
if (!postInitTaskAdded) {
context.addPostInitTask((context1, window) -> initComponentTabChangeListener());
postInitTaskAdded = true;
}
if (getDebugId() != null) {
this.component.setTestId(tabControl,
AppUI.getCurrent().getTestIdManager().getTestId(getDebugId() + "." + name));
}
if (AppUI.getCurrent().isTestMode()) {
this.component.setCubaId(tabControl, name);
}
tabContent.setFrame(context.getFrame());
return tab;
}
示例10: showInfo
import com.vaadin.ui.Layout; //导入依赖的package包/类
protected void showInfo(Object target) {
com.haulmont.cuba.gui.components.Window.Editor editor = findEditor((Layout) target);
Entity entity = editor.getItem();
Metadata metadata = AppBeans.get(Metadata.NAME);
MetaClass metaClass = metadata.getSession().getClass(entity.getClass());
new ShowInfoAction().showInfo(entity, metaClass, editor);
}
示例11: analyzeLayout
import com.vaadin.ui.Layout; //导入依赖的package包/类
protected void analyzeLayout(Object target) {
Window window = findWindow((Layout) target);
if (window != null) {
LayoutAnalyzer analyzer = new LayoutAnalyzer();
List<LayoutTip> tipsList = analyzer.analyze(window);
if (tipsList.isEmpty()) {
window.showNotification("No layout problems found", Frame.NotificationType.HUMANIZED);
} else {
window.openWindow("layoutAnalyzer", WindowManager.OpenType.DIALOG, ParamsMap.of("tipsList", tipsList));
}
}
}
示例12: getWindow
import com.vaadin.ui.Layout; //导入依赖的package包/类
@Nullable
protected com.haulmont.cuba.gui.components.Window getWindow(Object target) {
if (target instanceof Layout) {
Layout layout = (Layout) target;
for (Component component : layout) {
if (component instanceof WindowBreadCrumbs) {
WindowBreadCrumbs breadCrumbs = (WindowBreadCrumbs) component;
return breadCrumbs.getCurrentWindow();
}
}
}
return null;
}
示例13: findEditor
import com.vaadin.ui.Layout; //导入依赖的package包/类
protected com.haulmont.cuba.gui.components.Window.Editor findEditor(Layout layout) {
for (Object component : layout) {
if (component instanceof WindowBreadCrumbs) {
WindowBreadCrumbs breadCrumbs = (WindowBreadCrumbs) component;
if (breadCrumbs.getCurrentWindow() instanceof Window.Editor)
return (Window.Editor) breadCrumbs.getCurrentWindow();
}
}
return null;
}
示例14: findWindow
import com.vaadin.ui.Layout; //导入依赖的package包/类
protected com.haulmont.cuba.gui.components.Window findWindow(Layout layout) {
for (Object component : layout) {
if (component instanceof WindowBreadCrumbs) {
WindowBreadCrumbs breadCrumbs = (WindowBreadCrumbs) component;
if (breadCrumbs.getCurrentWindow() != null) {
return breadCrumbs.getCurrentWindow();
}
}
}
return null;
}
示例15: setRoot
import com.vaadin.ui.Layout; //导入依赖的package包/类
public void setRoot(Layout root) {
this.root = root;
this.root.setSizeFull();
removeAllComponents();
addComponent(this.root);
setExpandRatio(this.root, 1);
}