com.vaadin.server.Sizeable.Unit Java Examples
The following examples show how to use
com.vaadin.server.Sizeable.Unit.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WebSplitPanel.java From cuba with Apache License 2.0 | 6 votes |
protected void createComponentImpl() { if (orientation == SplitPanel.ORIENTATION_HORIZONTAL) { component = new CubaHorizontalSplitPanel() { @Override public void setSplitPosition(float pos, Unit unit, boolean reverse) { currentPosition = this.getSplitPosition(); inverse = this.isSplitPositionReversed(); super.setSplitPosition(pos, unit, reverse); } }; } else { component = new CubaVerticalSplitPanel() { @Override public void setSplitPosition(float pos, Unit unit, boolean reverse) { currentPosition = this.getSplitPosition(); inverse = this.isSplitPositionReversed(); super.setSplitPosition(pos, unit, reverse); } }; } component.addSplitPositionChangeListener(this::fireSplitPositionChangeListener); }
Example #2
Source File: FormUtils.java From jdal with Apache License 2.0 | 6 votes |
/** * Create a titled separator * @param title title * @return a {@link HorizontalLayout} with title and rule. */ public static Component createTitledSeparator(String title) { Label titleLabel = new Label(title); titleLabel.setStyleName(Reindeer.LABEL_H2); Label rule = new Label("<hr />", ContentMode.HTML); titleLabel.setSizeUndefined(); HorizontalLayout hl = new HorizontalLayout(); hl.addComponent(titleLabel); Box.addHorizontalStruct(hl, 20); hl.addComponent(rule); hl.setComponentAlignment(rule, Alignment.BOTTOM_CENTER); hl.setExpandRatio(rule, 1); hl.setWidth(100, Unit.PERCENTAGE); return hl; }
Example #3
Source File: RowUtil.java From cia with Apache License 2.0 | 6 votes |
/** * Creates the row item. * * @param row the row * @param button the button * @param description the description */ public static void createRowItem(final ResponsiveRow row, final Button button, final String description) { final CssLayout layout = new CssLayout(); layout.addStyleName("v-layout-content-overview-panel-level2"); Responsive.makeResponsive(layout); layout.setSizeUndefined(); button.addStyleName(ITEMBOX); button.addStyleName(TITLE); Responsive.makeResponsive(button); button.setWidth(100, Unit.PERCENTAGE); layout.addComponent(button); final Label descriptionLabel = new Label(description); descriptionLabel.addStyleName(ITEMBOX); Responsive.makeResponsive(descriptionLabel); descriptionLabel.setWidth(100, Unit.PERCENTAGE); layout.addComponent(descriptionLabel); row.addColumn().withDisplayRules(DISPLAY_SIZE_XS_DEVICE, DISPLAYS_SIZE_XM_DEVICE, DISPLAY_SIZE_MD_DEVICE, DISPLAY_SIZE_LG_DEVICE).withComponent(layout); }
Example #4
Source File: RowUtil.java From cia with Apache License 2.0 | 6 votes |
/** * Creates the row component. * * @param row the row * @param component the component * @param description the description */ public static void createRowComponent(final ResponsiveRow row, final Component component, final String description) { final CssLayout layout = new CssLayout(); layout.addStyleName(".v-layout-content-pagemode-panel-level2"); Responsive.makeResponsive(layout); layout.setSizeUndefined(); final Label descriptionLabel = new Label(description); descriptionLabel.addStyleName(ITEMBOX); Responsive.makeResponsive(descriptionLabel); descriptionLabel.setWidth(100, Unit.PERCENTAGE); layout.addComponent(descriptionLabel); component.addStyleName(ITEMBOX); component.addStyleName(TITLE); Responsive.makeResponsive(component); component.setWidth(100, Unit.PERCENTAGE); layout.addComponent(component); row.addColumn().withDisplayRules(DISPLAY_SIZE_XS_DEVICE, DISPLAYS_SIZE_XM_DEVICE, DISPLAY_SIZE_MD_DEVICE, DISPLAY_SIZE_LG_DEVICE).withComponent(layout); }
Example #5
Source File: WebSplitPanel.java From cuba with Apache License 2.0 | 6 votes |
@Override public void applySettings(Element element) { if (!isSettingsEnabled()) { return; } Element e = element.element("position"); if (e != null) { String value = e.attributeValue("value"); String unit = e.attributeValue("unit"); if (!StringUtils.isBlank(value) && !StringUtils.isBlank(unit)) { Unit convertedUnit; if (NumberUtils.isNumber(unit)) { convertedUnit = convertLegacyUnit(Integer.parseInt(unit)); } else { convertedUnit = Unit.getUnitFromSymbol(unit); } component.setSplitPosition(Float.parseFloat(value), convertedUnit, component.isSplitPositionReversed()); } } }
Example #6
Source File: AppMainWindow.java From cuba with Apache License 2.0 | 5 votes |
@Override public void init(Map<String, Object> params) { super.init(params); mainMenu.focus(); initLogoImage(logoImage); initLayoutAnalyzerContextMenu(logoImage); initFtsField(ftsField); if (webConfig.getUseInverseHeader()) { titleBar.setStyleName("c-app-menubar c-inverse-header"); } if (webConfig.getFoldersPaneEnabled()) { if (webConfig.getFoldersPaneVisibleByDefault()) { foldersSplit.setSplitPosition(webConfig.getFoldersPaneDefaultWidth(), SizeUnit.PIXELS); } else { foldersSplit.setSplitPosition(0); } CubaHorizontalSplitPanel vSplitPanel = (CubaHorizontalSplitPanel) WebComponentsHelper.unwrap(foldersSplit); vSplitPanel.setDefaultPosition(webConfig.getFoldersPaneDefaultWidth() + "px"); vSplitPanel.setMaxSplitPosition(50, Unit.PERCENTAGE); vSplitPanel.setDockable(true); } else { foldersPane.setEnabled(false); foldersPane.setVisible(false); foldersSplit.remove(workArea); int foldersSplitIndex = indexOf(foldersSplit); remove(foldersSplit); add(workArea, foldersSplitIndex); expand(workArea); } }
Example #7
Source File: TextFieldBuilder.java From hawkbit with Eclipse Public License 1.0 | 5 votes |
/** * Create a search text field. * * @param textChangeListener * listener when text is changed. * @return the textfield */ public TextField createSearchField(final TextChangeListener textChangeListener) { final TextField textField = style("filter-box").styleName("text-style filter-box-hide").buildTextComponent(); textField.setWidth(100.0F, Unit.PERCENTAGE); textField.addTextChangeListener(textChangeListener); textField.setTextChangeEventMode(TextChangeEventMode.LAZY); // 1 seconds timeout. textField.setTextChangeTimeout(1000); return textField; }
Example #8
Source File: Box.java From jdal with Apache License 2.0 | 5 votes |
/** * @return new VerticalLayout */ public static VerticalLayout createVerticalBox() { VerticalLayout vl = new VerticalLayout(); vl.setHeight(100, Unit.PERCENTAGE); return vl; }
Example #9
Source File: SimpleBoxFormBuilder.java From jdal with Apache License 2.0 | 5 votes |
public void add(Component c, String label, int width, Alignment alignment) { if (rows == 0 && rowsHeight.isEmpty()) { log.warn("You must call row() before adding components. I will add a row with default height for you"); row(); } if (label != null) c.setCaption(label); VerticalLayout column = getColumn(); column.addComponent(c); index++; setWidth(width); if (alignment != null) { column.setComponentAlignment(c, alignment); } if (rowCellSpand) { c.setWidth(100, Unit.PERCENTAGE); } if (useTabIndex && c instanceof Field) { ((Field<?>) c).setTabIndex(tabIndex++); } }
Example #10
Source File: Util.java From gantt with Apache License 2.0 | 5 votes |
public static NativeSelect createWidthUnitEditor(final Component component) { return createNativeSelectEditor("Width Unit", component.getWidthUnits(), Arrays.asList(Unit.PERCENTAGE, Unit.PIXELS), new SelectValueChange() { @Override public void onValueChange(Object unit) { component.setWidth(component.getWidth(), (Unit) unit); } }); }
Example #11
Source File: Util.java From gantt with Apache License 2.0 | 5 votes |
public static NativeSelect createHeightUnitEditor(final Component component) { return createNativeSelectEditor("Height Unit", component.getHeightUnits(), Arrays.asList(Unit.PERCENTAGE, Unit.PIXELS), new SelectValueChange() { @Override public void onValueChange(Object unit) { component.setHeight(component.getHeight(), (Unit) unit); } }); }
Example #12
Source File: GridCellFilter.java From vaadin-grid-util with MIT License | 5 votes |
/** * link component to headerRow and take care for styling * * @param columnId id of property * @param cellFilter component will get added to filterRow */ protected void handleFilterRow(String columnId, CellFilterComponent<?> cellFilter) { cellFilters.put(columnId, cellFilter); cellFilter.getComponent() .setWidth(100, Unit.PERCENTAGE); if (null != filterHeaderRow.getCell(columnId)) { filterHeaderRow.getCell(columnId) .setComponent(cellFilter.getComponent()); filterHeaderRow.getCell(columnId) .setStyleName("filter-header"); } }
Example #13
Source File: WebSplitPanel.java From cuba with Apache License 2.0 | 5 votes |
protected Unit convertLegacyUnit(int unit) { switch (unit) { case 0: return Unit.PIXELS; case 8: return Unit.PERCENTAGE; default: return Unit.PIXELS; } }
Example #14
Source File: RowUtil.java From cia with Apache License 2.0 | 5 votes |
/** * Creates the grid layout. * * @param panelContent the panel content * @return the responsive row */ public static ResponsiveRow createGridLayout(final AbstractOrderedLayout panelContent) { final ResponsiveLayout layout = new ResponsiveLayout(); Responsive.makeResponsive(layout); layout.addStyleName("v-layout-content-overview-panel-level1"); layout.setWidth(100, Unit.PERCENTAGE); layout.setHeight(100, Unit.PERCENTAGE); panelContent.addComponent(layout); panelContent.setExpandRatio(layout, ContentRatio.LARGE); return layout.addRow(); }
Example #15
Source File: AbstractGhantChartManagerImpl.java From cia with Apache License 2.0 | 5 votes |
/** * Creates the gantt. * * @return the gantt */ private static final Gantt createGantt() { final Gantt gantt = new Gantt(); gantt.setSizeFull(); gantt.setWidth(100, Unit.PERCENTAGE); gantt.setHeight(100, Unit.PERCENTAGE); gantt.setResizableSteps(false); gantt.setMovableSteps(false); gantt.setResolution(Resolution.Week); return gantt; }
Example #16
Source File: AbstractChartDataManagerImpl.java From cia with Apache License 2.0 | 5 votes |
/** * Adds the chart. * * @param content * the content * @param caption * the caption * @param chart * the chart * @param fullPage * the full page */ protected final void addChart(final AbstractOrderedLayout content,final String caption, final DCharts chart, final boolean fullPage) { final HorizontalLayout horizontalLayout = new HorizontalLayout(); final int browserWindowWidth = getChartWindowWidth(); final int browserWindowHeight = getChartWindowHeight(fullPage); horizontalLayout.setWidth(browserWindowWidth, Unit.PIXELS); horizontalLayout.setHeight(browserWindowHeight, Unit.PIXELS); horizontalLayout.setMargin(true); horizontalLayout.setSpacing(false); horizontalLayout.addStyleName("v-layout-content-overview-panel-level1"); final Panel formPanel = new Panel(); formPanel.setSizeFull(); formPanel.setContent(horizontalLayout); formPanel.setCaption(caption); content.addComponent(formPanel); content.setExpandRatio(formPanel, ContentRatio.LARGE); chart.setWidth(100, Unit.PERCENTAGE); chart.setHeight(100, Unit.PERCENTAGE); chart.setMarginRight(CHART_RIGHT_MARGIN); chart.setMarginLeft(CHART_LEFT_MARGIN); chart.setMarginBottom(CHART_BOTTOM_MARGIN_SIZE); chart.setMarginTop(CHART_TOP_MARGIN_SIZE); horizontalLayout.addComponent(chart); chart.setCaption(caption); }
Example #17
Source File: AbstractMenuItemFactoryImpl.java From cia with Apache License 2.0 | 5 votes |
/** * Creates the button link. * * @param row * the panel content * @param linkText * the link text * @param icon * the icon * @param command * the command * @param description * the description */ protected final void createButtonLink(final ResponsiveRow row,final String linkText,final Resource icon, final ClickListener command, final String description) { final CssLayout layout = new CssLayout(); layout.addStyleName("v-layout-content-overview-panel-level2"); Responsive.makeResponsive(layout); layout.setSizeUndefined(); final Button button = new Button(linkText); Responsive.makeResponsive(button); button.setStyleName(LINK_STYLE_NAME); button.addStyleName("title"); button.addClickListener(command); button.setIcon(icon); button.setWidth(100, Unit.PERCENTAGE); layout.addComponent(button); final Label descriptionLabel = new Label(description); descriptionLabel.addStyleName("itembox"); Responsive.makeResponsive(descriptionLabel); descriptionLabel.setWidth(100, Unit.PERCENTAGE); layout.addComponent(descriptionLabel); row.addColumn().withDisplayRules(DISPLAY_SIZE_XS_DEVICE,DISPLAYS_SIZE_XM_DEVICE,DISPLAY_SIZE_MD_DEVICE,DISPLAY_SIZE_LG_DEVICE).withComponent(layout); }
Example #18
Source File: AbstractPageModContentFactoryImpl.java From cia with Apache License 2.0 | 5 votes |
/** * Creates the panel content. * * @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; }
Example #19
Source File: AbstractPageModContentFactoryImpl.java From cia with Apache License 2.0 | 5 votes |
/** * Creates the page visit history. * * @param pageName * the page name * @param pageId * the page id * @param panelContent * the panel content */ protected final void createPageVisitHistory(final String pageName, final String pageId, final VerticalLayout panelContent) { final TabSheet tabsheet = new TabSheet(); tabsheet.setWidth(100, Unit.PERCENTAGE); tabsheet.setHeight(100, Unit.PERCENTAGE); panelContent.addComponent(tabsheet); panelContent.setExpandRatio(tabsheet, ContentRatio.LARGE); final HorizontalLayout tabContentPageItemRankHistory = new HorizontalLayout(); tabContentPageItemRankHistory.setWidth(100, Unit.PERCENTAGE); tabContentPageItemRankHistory.setHeight(100, Unit.PERCENTAGE); final Tab tabPageItemRankHistory = tabsheet.addTab(tabContentPageItemRankHistory); tabPageItemRankHistory.setCaption(CURRENT_PAGE_VISIT_HISTORY); adminChartDataManager.createApplicationActionEventPageElementDailySummaryChart(tabContentPageItemRankHistory, pageName, pageId); final HorizontalLayout tabContentPageModeSummary = new HorizontalLayout(); tabContentPageModeSummary.setWidth(100, Unit.PERCENTAGE); tabContentPageModeSummary.setHeight(100, Unit.PERCENTAGE); final Tab tabPageModeSummary = tabsheet.addTab(tabContentPageModeSummary); tabPageModeSummary.setCaption(GENERAL_PAGE_MODE_PAGE_VISIT); adminChartDataManager.createApplicationActionEventPageModeDailySummaryChart(tabContentPageModeSummary, pageName); }
Example #20
Source File: SimpleBoxFormBuilder.java From jdal with Apache License 2.0 | 4 votes |
/** * Builds the panel form. * @return the form component */ public Component getForm() { for (int i = 0; i < columns.size(); i++) { VerticalLayout box = columns.get(i); int width = columnsWidth.get(i); if (width > SIZE_UNDEFINED && width < SIZE_FULL) { box.setWidth(width, Unit.PIXELS); // shrink container container.setExpandRatio(box, 0); } else if (width == SIZE_FULL) { box.setWidth("100%"); container.setExpandRatio(box, 1); } else { container.setExpandRatio(box, 0); box.setWidth(Sizeable.SIZE_UNDEFINED, Unit.PIXELS); } for (int j = 0; j < rowsHeight.size(); j++) { Component c = box.getComponent(j); int height = rowsHeight.get(j); if (height > SIZE_UNDEFINED && height < SIZE_FULL) { c.setHeight(height, Unit.PIXELS); box.setExpandRatio(c, 0); } else if (height == SIZE_FULL) { c.setHeight("100%"); box.setExpandRatio(c, 1); } else { box.setExpandRatio(c, 0); } } } if (fixedHeight) { container.setHeight(getFormHeight(), Unit.PIXELS); } else { container.setHeight(100, Unit.PERCENTAGE); } if (fixedWidth) { container.setWidth(Sizeable.SIZE_UNDEFINED, Unit.PIXELS); } else { container.setWidth(100, Unit.PERCENTAGE); } container.addStyleName("jd-box"); if (debug) container.addStyleName("jd-box-debug"); return container; }
Example #21
Source File: Box.java From jdal with Apache License 2.0 | 4 votes |
/** * @param defaultSpace * @return new struct */ public static Component createHorizontalStrut(int defaultSpace) { Label label = new Label(" "); label.setWidth(defaultSpace, Unit.PIXELS); return label; }