List of usage examples for com.vaadin.ui VerticalLayout setMargin
@Override public void setMargin(boolean enabled)
From source file:com.hack23.cia.web.impl.ui.application.views.common.pagemode.AbstractPageModContentFactoryImpl.java
License:Apache License
/** * Creates the panel content./* w w w. j av a 2 s .c om*/ * * @return the vertical layout */ protected final VerticalLayout createPanelContent() { final VerticalLayout panelContent = new VerticalLayout(); panelContent.setMargin(true); panelContent.setWidth(100, Unit.PERCENTAGE); panelContent.setHeight(100, Unit.PERCENTAGE); panelContent.setStyleName("Header"); return panelContent; }
From source file:com.haulmont.cuba.web.gui.components.table.AbbreviatedCellClickListener.java
License:Apache License
@SuppressWarnings("unchecked") @Override//from w w w. j a va 2 s . c o m public void onClick(Entity item, String columnId) { Table.Column column = table.getColumn(columnId); MetaProperty metaProperty; String value; if (DynamicAttributesUtils.isDynamicAttribute(columnId)) { metaProperty = dynamicAttributesTools.getMetaPropertyPath(item.getMetaClass(), columnId) .getMetaProperty(); value = dynamicAttributesTools.getDynamicAttributeValueAsString(metaProperty, item.getValueEx(columnId)); } else { value = item.getValueEx(columnId); } if (column.getMaxTextLength() != null) { boolean isMultiLineCell = StringUtils.contains(value, "\n"); if (value == null || (value.length() <= column.getMaxTextLength() + MAX_TEXT_LENGTH_GAP && !isMultiLineCell)) { // todo artamonov if we click with CTRL and Table is multiselect then we lose previous selected items //noinspection SuspiciousMethodCalls if (!table.getSelected().contains(item)) { table.setSelected(item); } // do not show popup view return; } } VerticalLayout layout = new VerticalLayout(); layout.setMargin(false); layout.setSpacing(false); layout.setWidthUndefined(); layout.setStyleName("c-table-view-textcut"); CubaTextArea textArea = new CubaTextArea(); textArea.setValue(Strings.nullToEmpty(value)); textArea.setReadOnly(true); CubaResizableTextAreaWrapper content = new CubaResizableTextAreaWrapper(textArea); content.setResizableDirection(ResizeDirection.BOTH); // todo implement injection for ThemeConstains in components ThemeConstants theme = App.getInstance().getThemeConstants(); if (theme != null) { content.setWidth(theme.get("cuba.web.Table.abbreviatedPopupWidth")); content.setHeight(theme.get("cuba.web.Table.abbreviatedPopupHeight")); } else { content.setWidth("320px"); content.setHeight("200px"); } layout.addComponent(content); CubaEnhancedTable enhancedTable = table.unwrap(CubaEnhancedTable.class); enhancedTable.showCustomPopup(layout); enhancedTable.setCustomPopupAutoClose(false); }
From source file:com.haulmont.cuba.web.gui.components.table.WebTableFieldFactory.java
License:Apache License
protected Component getComponentImplementation(com.haulmont.cuba.gui.components.Component columnComponent) { com.vaadin.ui.Component composition = columnComponent.unwrapComposition(com.vaadin.ui.Component.class); Component componentImpl = composition; if (composition instanceof com.vaadin.v7.ui.Field && ((com.vaadin.v7.ui.Field) composition).isRequired()) { VerticalLayout layout = new VerticalLayout(); // vaadin8 replace with CssLayout layout.setMargin(false); layout.setSpacing(false);/*from w ww .ja v a 2s . com*/ layout.addComponent(composition); if (composition.getWidth() < 0) { layout.setWidthUndefined(); } componentImpl = layout; } return componentImpl; }
From source file:com.haulmont.cuba.web.toolkit.ui.CubaColorPickerPopup.java
License:Apache License
@Override protected Component createSelectTab() { VerticalLayout selLayout = new VerticalLayout(); selLayout.setMargin(new MarginInfo(false, false, true, false)); selLayout.addComponent(selPreview);/*from w w w . j a v a2s . c om*/ selLayout.addStyleName("seltab"); colorSelect = new CubaColorPickerSelect(); colorSelect.addColorChangeListener(this); selLayout.addComponent(colorSelect); return selLayout; }
From source file:com.haulmont.cuba.web.widgets.CubaColorPickerPopup.java
License:Apache License
@Override protected VerticalLayout createHistoryOuterContainer(VerticalLayout innerContainer) { innerContainer.setMargin(false); VerticalLayout historyOuterContainer = super.createHistoryOuterContainer(innerContainer); historyOuterContainer.setMargin(new MarginInfo(false, true, false, true)); return historyOuterContainer; }
From source file:com.haulmont.cuba.web.widgets.CubaColorPickerPopup.java
License:Apache License
@Override protected Component createSelectTab() { VerticalLayout selLayout = new VerticalLayout(); selLayout.setSpacing(false);/* w w w . jav a 2s .c o m*/ selLayout.setMargin(new MarginInfo(false, false, true, false)); selLayout.addComponent(selPreview); selLayout.addStyleName("seltab"); colorSelect = new CubaColorPickerSelect(); colorSelect.addValueChangeListener(this::colorChanged); selLayout.addComponent(colorSelect); return selLayout; }
From source file:com.hivesys.dashboard.view.repository.DragAndDropBox.java
private void showComponent(final Component c, final String name) { final VerticalLayout layout = new VerticalLayout(); layout.setSizeUndefined();//from w ww. j av a 2 s . co m layout.setMargin(true); final Window w = new Window(name, layout); w.addStyleName("dropdisplaywindow"); w.setSizeUndefined(); w.setResizable(false); c.setSizeUndefined(); layout.addComponent(c); UI.getCurrent().addWindow(w); }
From source file:com.hivesys.dashboard.view.search.TextualView.java
public void UpdateSearchPane(String searchString) { css.removeAllComponents();//w w w . ja va 2 s . co m SearchResponse response = ElasticSearchContext.getInstance().searchSimpleQuery(searchString); logResponse(response); SearchHits results = response.getHits(); Label labelResultSummary = new Label("About " + results.getHits().length + " results found <br><br>", ContentMode.HTML); css.addComponent(labelResultSummary); for (SearchHit hit : results) { CssLayout cssResult = new CssLayout(); cssResult.setStyleName("search-result"); try { String filename = DocumentDB.getInstance().getDocumentNameFromHash(hit.getId()); String boxviewID = DocumentDB.getInstance().getBoxViewIDFromHash(hit.getId()); String highlight = ""; HighlightField objhighlight = hit.highlightFields().get("file"); if (objhighlight != null) { for (Text fgmt : objhighlight.getFragments()) { highlight += fgmt.string() + "<br>"; } } Button lblfileName = new Button(filename); lblfileName.addClickListener((Button.ClickEvent event) -> { if (boxviewID != null) { String url = BoxViewDocuments.getInstance().getViewURL(boxviewID); if (url != null || !url.equals("")) { url = BoxViewDocuments.getInstance().getViewURL(boxviewID); BrowserFrame bframe = new BrowserFrame(filename, new ExternalResource(url)); VerticalLayout vlayout = new VerticalLayout(bframe); final Window w = new Window(); w.setSizeFull(); w.setModal(true); w.setWindowMode(WindowMode.MAXIMIZED); w.setContent(vlayout); vlayout.setSizeFull(); vlayout.setMargin(true); w.setResizable(false); w.setDraggable(false); UI.getCurrent().addWindow(w); bframe.setSizeFull(); return; } Notification.show("Preview not available for this document!"); } }); lblfileName.setPrimaryStyleName("filename"); Label lblHighlight = new Label(highlight, ContentMode.HTML); lblHighlight.setStyleName("highlight"); cssResult.addComponent(lblfileName); cssResult.addComponent(lblHighlight); css.addComponent(cssResult); css.addComponent(new Label("<br>", ContentMode.HTML)); } catch (SQLException ex) { } } }
From source file:com.hris.connection.ErrorLoggedNotification.java
public static void showErrorLoggedOnWindow(String error, String className) { VerticalLayout v = new VerticalLayout(); v.setSizeFull();//from w ww . ja v a 2 s . co m v.setMargin(true); Window sub = new Window("ERROR MESSAGE!", v); sub.setWidth("500px"); if (sub.getParent() == null) { UI.getCurrent().addWindow(sub); } sub.setModal(true); Panel panel = new Panel(); panel.setSizeFull(); panel.setContent(new Label(error + " on \n" + className, ContentMode.HTML)); panel.getContent().setHeightUndefined(); sub.setContent(panel); sub.getContent().setHeightUndefined(); }
From source file:com.hris.payroll.reports.ReportViewer.java
public ReportViewer(String reportType, int branchId, Date payrollDate) { this.reportType = reportType; this.branchId = branchId; this.payrollDate = payrollDate; setWidth("900px"); setHeight("600px"); center();/* ww w.j ava 2 s . co m*/ StreamResource resource = null; switch (reportType) { case "Payslip": { String filename = "Payslip-" + new Date().getTime() + ".pdf"; resource = new StreamResource(new PayslipReportPDF(getBranchId(), getPayrollDate()), filename); break; } case "Advances Summary": { String filename = "Advances-" + new Date().getTime() + ".pdf"; resource = new StreamResource(new AdvancesSummaryReportPdf(getBranchId(), getPayrollDate()), filename); break; } default: { String filename = "Advances-" + new Date().getTime() + ".pdf"; resource = new StreamResource(new AdvancesReportPdf(getBranchId(), getPayrollDate(), reportType), filename); break; } } resource.setMIMEType("application/pdf"); VerticalLayout v = new VerticalLayout(); v.setSizeFull(); v.setSpacing(true); v.setMargin(new MarginInfo(false, false, true, false)); Embedded em = new Embedded(); em.setSource(resource); em.setSizeFull(); em.setType(Embedded.TYPE_BROWSER); v.addComponent(em); v.setExpandRatio(em, 1); setContent(v); }