List of usage examples for com.vaadin.ui HorizontalLayout setMargin
@Override public void setMargin(boolean enabled)
From source file:com.dungnv.streetfood.view.SlideShowSearchDetail.java
private void init() { layout = new VerticalLayout(); layout.setSpacing(true);/*from ww w . j av a 2 s . co m*/ layout.setMargin(true); form = new FormLayout(); form.addStyleName("light"); // form.addStyleName("outlined"); form.setSizeFull(); form.setMargin(true); form.setSpacing(true); layout.addComponent(form); tfName = new TextField(BundleUtils.getLanguage("lbl.category.name")); tfName.setWidth(80.0f, Unit.PERCENTAGE); form.addComponent(tfName); tfDescription = new TextField(BundleUtils.getLanguage("lbl.slideShow.description")); tfDescription.setWidth(80.0f, Unit.PERCENTAGE); form.addComponent(tfDescription); HorizontalLayout hlButton = new HorizontalLayout(); hlButton.setSpacing(true); hlButton.setMargin(true); form.addComponent(hlButton); btnSearch = new Button(BundleUtils.getLanguage("lbl.search"), FontAwesome.SEARCH); hlButton.addComponent(btnSearch); btnCancel = new Button(BundleUtils.getLanguage("lbl.cancel"), FontAwesome.BAN); hlButton.addComponent(btnCancel); }
From source file:com.ejt.vaadin.loginform.DefaultHorizontalLoginForm.java
License:Apache License
@Override protected Component createContent(TextField userNameField, PasswordField passwordField, Button loginButton) { HorizontalLayout layout = new HorizontalLayout(); layout.setSpacing(true);/*from w w w. j a va2s .c o m*/ layout.setMargin(true); layout.addComponent(userNameField); layout.addComponent(passwordField); layout.addComponent(loginButton); layout.setComponentAlignment(loginButton, Alignment.BOTTOM_LEFT); return layout; }
From source file:com.emuanalytics.vaadin.enhancedjavascript.BasicTestUI.java
License:Apache License
@Override public Component getTestComponent() { // The sample component under test sampleComponent = new SampleEnhancedComponent(); sampleComponent.setId("sample-component"); Component componentWrapper = createComponentContainer(sampleComponent); Component testPanel = createTestPanel(); HorizontalLayout layout = new HorizontalLayout(componentWrapper, testPanel); layout.setWidth("100%"); layout.setHeight("100%"); layout.setMargin(true); layout.setExpandRatio(componentWrapper, 1); sampleComponent.addClickListener(value -> { lastEventField.setValue("Click (value=" + value + ")"); });// w w w .j a v a 2 s.co m sampleComponent.addVariableChangeListener(value -> { lastVariableChangeField.setValue("inputValue Changed (value=" + value.toString() + ")"); }); return layout; }
From source file:com.esofthead.mycollab.community.ui.chart.PieChartWrapper.java
License:Open Source License
@Override protected final ComponentContainer createLegendBox() { final CustomLayout boxWrapper = CustomLayoutExt.createLayout("legendBox"); final CssLayout mainLayout = new CssLayout(); mainLayout.setSizeUndefined();//from www. ja v a 2s . c om final List keys = pieDataSet.getKeys(); for (int i = 0; i < keys.size(); i++) { final HorizontalLayout layout = new HorizontalLayout(); layout.setMargin(new MarginInfo(false, false, false, true)); layout.addStyleName("inline-block"); final Comparable key = (Comparable) keys.get(i); final String color = "<div style = \" width:8px;height:8px;border-radius:5px;background: #" + GenericChartWrapper.CHART_COLOR_STR[i % GenericChartWrapper.CHART_COLOR_STR.length] + "\" />"; final Label lblCircle = new Label(color); lblCircle.setContentMode(ContentMode.HTML); String btnCaption; if (enumKeyCls == null) { btnCaption = String.format("%s(%d)", key, pieDataSet.getValue(key).intValue()); } else { btnCaption = String.format("%s(%d)", AppContext.getMessage(enumKeyCls, key.toString()), pieDataSet.getValue(key).intValue()); } final Button btnLink = new Button(btnCaption, new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { PieChartWrapper.this.onClickedDescription(key.toString()); } }); btnLink.addStyleName("link"); layout.addComponent(lblCircle); layout.setComponentAlignment(lblCircle, Alignment.MIDDLE_CENTER); layout.addComponent(btnLink); layout.setComponentAlignment(btnLink, Alignment.MIDDLE_CENTER); layout.setSizeUndefined(); mainLayout.addComponent(layout); } boxWrapper.setWidth("100%"); boxWrapper.addComponent(mainLayout, "legendBoxContent"); return boxWrapper; }
From source file:com.esofthead.mycollab.mobile.ui.GridFormLayoutHelper.java
License:Open Source License
public Component addComponent(final Component field, final String caption, final int columns, final int rows, final int colspan, final String width, final Alignment alignment) { if (caption != null) { final Label l = new Label(caption); final HorizontalLayout captionWrapper = new HorizontalLayout(); captionWrapper.addComponent(l);//from w ww . ja va2 s. co m captionWrapper.setComponentAlignment(l, alignment); captionWrapper.setStyleName("gridform-caption"); captionWrapper.setMargin(true); captionWrapper.setWidth(this.defaultCaptionWidth); if (columns == 0) { captionWrapper.addStyleName("first-col"); } if (rows == 0) { captionWrapper.addStyleName("first-row"); } if ((rows + 1) % 2 == 0) captionWrapper.addStyleName("even-row"); this.layout.addComponent(captionWrapper, 2 * columns, rows); captionWrapper.setHeight("100%"); } final HorizontalLayout fieldWrapper = new HorizontalLayout(); fieldWrapper.setStyleName("gridform-field"); fieldWrapper.setMargin(true); fieldWrapper.addComponent(field); if (!(field instanceof Button)) field.setCaption(null); field.setWidth(width); fieldWrapper.setWidth("100%"); if (rows == 0) { fieldWrapper.addStyleName("first-row"); } if ((rows + 1) % 2 == 0) { fieldWrapper.addStyleName("even-row"); } this.layout.addComponent(fieldWrapper, 2 * columns + 1, rows, 2 * (columns + colspan - 1) + 1, rows); this.layout.setColumnExpandRatio(2 * columns + 1, 1.0f); return field; }
From source file:com.esofthead.mycollab.mobile.ui.GridFormLayoutHelper.java
License:Open Source License
public Component addComponent(final Component field, final String caption, final int columns, final int rows, final String width, final Alignment alignment) { if (caption != null) { final Label l = new Label(caption); // l.setHeight("100%"); final HorizontalLayout captionWrapper = new HorizontalLayout(); captionWrapper.addComponent(l);/*w w w . j a v a 2s. c o m*/ captionWrapper.setComponentAlignment(l, alignment); captionWrapper.setWidth(this.defaultCaptionWidth); captionWrapper.setHeight("100%"); captionWrapper.setStyleName("gridform-caption"); captionWrapper.setMargin(true); if (columns == 0) { captionWrapper.addStyleName("first-col"); } if (rows == 0) { captionWrapper.addStyleName("first-row"); } this.layout.addComponent(captionWrapper, 2 * columns, rows); } final HorizontalLayout fieldWrapper = new HorizontalLayout(); fieldWrapper.setStyleName("gridform-field"); if (!(field instanceof Button)) field.setCaption(null); fieldWrapper.addComponent(field); field.setWidth(width); fieldWrapper.setWidth("100%"); fieldWrapper.setMargin(true); if (rows == 0) { fieldWrapper.addStyleName("first-row"); } this.layout.addComponent(fieldWrapper, 2 * columns + 1, rows); this.layout.setColumnExpandRatio(2 * columns + 1, 1.0f); return field; }
From source file:com.esofthead.mycollab.mobile.ui.GridFormLayoutHelper.java
License:Open Source License
public Component addComponent(Component fieldValue, Component fieldCaption, String defaultCaptionWidth, String fieldValueWidth, int columns, int rows, Alignment alignment) { final HorizontalLayout captionWrapper = new HorizontalLayout(); captionWrapper.addComponent(fieldCaption); captionWrapper.setComponentAlignment(fieldCaption, alignment); captionWrapper.setWidth(defaultCaptionWidth); captionWrapper.setHeight("100%"); captionWrapper.setMargin(true); captionWrapper.setStyleName("gridform-caption"); if (columns == 0) { captionWrapper.addStyleName("first-col"); }/*from w ww . j av a2s . c om*/ if (rows == 0) { captionWrapper.addStyleName("first-row"); } this.layout.addComponent(captionWrapper, 2 * columns, rows); final HorizontalLayout fieldWrapper = new HorizontalLayout(); fieldWrapper.setStyleName("gridform-field"); if (!(fieldValue instanceof Button)) fieldValue.setCaption(null); fieldWrapper.addComponent(fieldValue); fieldValue.setWidth(fieldValueWidth); fieldWrapper.setWidth("100%"); fieldWrapper.setMargin(true); if (rows == 0) { fieldWrapper.addStyleName("first-row"); } this.layout.addComponent(fieldWrapper, 2 * columns + 1, rows); this.layout.setColumnExpandRatio(2 * columns + 1, 1.0f); return fieldValue; }
From source file:com.esofthead.mycollab.module.crm.view.lead.LeadConvertInfoWindow.java
License:Open Source License
public Layout initContent() { CssLayout contentLayout = new CssLayout(); contentLayout.setWidth("100%"); contentLayout.setStyleName("lead-convert-window"); contentLayout.addComponent(createBody()); ComponentContainer buttonControls = createButtonControls(); if (buttonControls != null) { final HorizontalLayout controlPanel = new HorizontalLayout(); buttonControls.setSizeUndefined(); controlPanel.addComponent(buttonControls); controlPanel.setWidth("100%"); controlPanel.setMargin(true); controlPanel.setComponentAlignment(buttonControls, Alignment.MIDDLE_CENTER); contentLayout.addComponent(controlPanel); }/*www.j a v a 2 s.c o m*/ return contentLayout; }
From source file:com.esofthead.mycollab.module.crm.view.opportunity.ContactRoleEditViewImpl.java
License:Open Source License
@Override public void display(SimpleOpportunity opportunity) { this.opportunity = opportunity; this.removeAllComponents(); this.setMargin(new MarginInfo(false, true, true, true)); this.addStyleName("oppcontact-role-edit"); AddViewLayout2 previewLayout = new AddViewLayout2("Add or Edit Contact Roles", CrmAssetsManager.getAsset(CrmTypeConstants.CONTACT)); this.addComponent(previewLayout); ComponentContainer actionControls = createButtonControls(); if (actionControls != null) { previewLayout.addControlButtons(actionControls); }/*from ww w . j a v a 2 s . c o m*/ contactRoleList = new ContactOpportunityList(); previewLayout.addBody(contactRoleList); Button addMoreContactRolesBtn = new Button("Add more contact roles", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { SimpleContactOpportunityRel contactRole = new SimpleContactOpportunityRel(); ContactRoleRowComp row = new ContactRoleRowComp(contactRole); contactRoleList.addRow(row); } }); addMoreContactRolesBtn.setStyleName(UIConstants.THEME_GREEN_LINK); HorizontalLayout buttonControls = new HorizontalLayout(); buttonControls.addComponent(addMoreContactRolesBtn); buttonControls.setMargin(new MarginInfo(true, true, true, true)); previewLayout.addBody(buttonControls); }
From source file:com.esofthead.mycollab.module.crm.view.opportunity.ContactRoleEditViewImpl.java
License:Open Source License
private ComponentContainer createButtonControls() { HorizontalLayout layout = new HorizontalLayout(); layout.setSpacing(true);/* ww w .j a v a 2s.c o m*/ layout.setMargin(true); HorizontalLayout buttonWrapper = new HorizontalLayout(); buttonWrapper.setWidthUndefined(); buttonWrapper.setSpacing(true); Button updateBtn = new Button("Update", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { updateContactRoles(); } }); updateBtn.setIcon(FontAwesome.SAVE); updateBtn.setStyleName(UIConstants.THEME_GREEN_LINK); buttonWrapper.addComponent(updateBtn); Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { ViewState viewState = HistoryViewManager.back(); if (viewState instanceof NullViewState) { EventBusFactory.getInstance().post(new ContactEvent.GotoList(this, null)); } } }); cancelBtn.setIcon(FontAwesome.TIMES); cancelBtn.setStyleName(UIConstants.THEME_GRAY_LINK); buttonWrapper.addComponent(cancelBtn); layout.addComponent(buttonWrapper); layout.setComponentAlignment(buttonWrapper, Alignment.MIDDLE_CENTER); return layout; }