List of usage examples for com.vaadin.ui CssLayout setWidthUndefined
@Override public void setWidthUndefined()
From source file:com.esofthead.mycollab.vaadin.ui.MultiSelectComp.java
License:Open Source License
@Override protected Component initContent() { final HorizontalLayout content = new HorizontalLayout(); content.setSpacing(false);/* w w w . j ava 2 s. co m*/ content.addComponent(this.componentsDisplay); content.setComponentAlignment(this.componentsDisplay, Alignment.MIDDLE_LEFT); this.componentPopupSelection.addStyleName(UIConstants.SELECT_BG); this.componentPopupSelection.setWidth("25px"); this.componentPopupSelection.setPopupPositionComponent(content); CssLayout btnWrapper = new CssLayout(); btnWrapper.setWidthUndefined(); btnWrapper.addStyleName(UIConstants.SELECT_BG); btnWrapper.addComponent(componentPopupSelection); content.addComponent(btnWrapper); content.setComponentAlignment(btnWrapper, Alignment.MIDDLE_LEFT); content.setWidth(widthVal); content.setExpandRatio(this.componentsDisplay, 1.0f); return content; }
From source file:de.symeda.sormas.ui.dashboard.statistics.DashboardStatisticsSubComponent.java
License:Open Source License
public CssLayout createCountLayout(boolean addMarginBottom) { CssLayout countLayout = new CssLayout(); countLayout.setWidthUndefined(); if (addMarginBottom) { CssStyles.style(countLayout, CssStyles.VSPACE_3); }//from w w w . j a va 2s. c o m return countLayout; }
From source file:org.lucidj.vaadinui.BaseVaadinUI.java
License:Apache License
private void initSystemToolbar() { desktop_canvas.setSizeFull();//from www. j a v a2 s . co m desktop_canvas.setWidth("100%"); ui_header = new HorizontalLayout(); { ui_header.setStyleName("ui-header-area"); ui_header.setWidth(100, Sizeable.Unit.PERCENTAGE); ui_header.setHeightUndefined(); ui_header.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); Label logo = new Label(" ", ContentMode.HTML); { logo.addStyleName("ui-header-logo"); logo.setWidth(default_sidebar_width_pixels, Sizeable.Unit.PIXELS); } ui_header.addComponent(logo); HorizontalLayout header_components = new HorizontalLayout(); { header_components.setWidth(100, com.vaadin.server.Sizeable.Unit.PERCENTAGE); header_components.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); header_components.setSpacing(true); // Search component CssLayout search_component = new CssLayout(); { search_component.setWidth(100, com.vaadin.server.Sizeable.Unit.PERCENTAGE); search_component.setWidthUndefined(); search_component.addStyleName("v-component-group"); search_component.addStyleName("ui-header-search"); final ComboBox search_text = new ComboBox(); { search_text.setInputPrompt("Search or paste URL..."); //combo.setContainerDataSource(StringGenerator.generateContainer(200, false)); search_text.setNullSelectionAllowed(true); search_text.setTextInputAllowed(true); search_text.setNewItemsAllowed(true); //combo.select(combo.getItemIds().iterator().next()); //combo.setItemCaptionPropertyId(StringGenerator.CAPTION_PROPERTY); //combo.setItemIconPropertyId(StringGenerator.ICON_PROPERTY); // TODO: SOMEDAY DISCOVER HOW TO EXPAND THIS GROUPED COMPONENT, AND THE CURE FOR CANCER search_text.setWidth("480px"); search_text.addStyleName("invisible-focus"); search_text.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent valueChangeEvent) { String search_args = (String) search_text.getValue(); if (search_args != null) { fireEvent("search", search_text.getValue()); value_change_button_quirk = true; } } }); // Handles the Enter key by activating on focus and deactivating on blur final ShortcutListener handle_enter = new ShortcutListener("Enter", ShortcutAction.KeyCode.ENTER, null) { @Override public void handleAction(Object o, Object o1) { value_change_button_quirk = false; fireEvent("search", search_text.getValue()); } }; search_text.addFocusListener(new FieldEvents.FocusListener() { @Override public void focus(FieldEvents.FocusEvent focusEvent) { if (nested_focus_blur_bug_count++ == 0) { search_text.addShortcutListener(handle_enter); } } }); search_text.addBlurListener(new FieldEvents.BlurListener() { @Override public void blur(FieldEvents.BlurEvent blurEvent) { if (--nested_focus_blur_bug_count == 0) { search_text.removeShortcutListener(handle_enter); } } }); } search_component.addComponent(search_text); Button search_button = new Button(); { search_button.setIcon(FontAwesome.SEARCH); search_button.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { if (!value_change_button_quirk) { fireEvent("search", search_text.getValue()); } value_change_button_quirk = false; } }); search_button.addStyleName("invisible-focus"); } search_component.addComponent(search_button); } header_components.addComponent(search_component); // User component user_component = new HorizontalLayout(); { user_component.setStyleName("ui-header-user"); user_component.setWidthUndefined(); } header_components.addComponent(user_component); // I swear someday I'll learn CSS, AFTER implementing my own distributed // operating system with augmented reality interface and a machine learning kernel, // all written in Z80 assembly, as a preparation for the task. Label spacer = new Label(); spacer.setWidthUndefined(); header_components.addComponent(spacer); // Search expands header_components.setExpandRatio(search_component, 1.0f); } ui_header.addComponent(header_components); ui_header.setExpandRatio(header_components, 1.0f); } desktop_canvas.addComponent(ui_header); desktop_canvas.addComponent(empty_desktop); desktop_canvas.setExpandRatio(empty_desktop, 1.0f); setContent(desktop_canvas); }