Search in sources :

Example 36 with CssLayout

use of com.vaadin.ui.CssLayout in project VaadinUtils by rlsutton1.

the class BaseCrudView method buildSearchBar.

private void buildSearchBar() {
    AbstractLayout group = new HorizontalLayout();
    if (UI.getCurrent().getTheme().equals(ValoTheme.class.getSimpleName())) {
        group = new CssLayout();
        group.addStyleName("v-component-group");
    }
    group.setSizeFull();
    searchLayout.addComponent(group);
    AbstractLayout advancedSearch = buildAdvancedSearch();
    if (advancedSearch != null) {
        group.addComponent(advancedSearchButton);
    }
    Button clear = createClearButton();
    group.addComponent(clear);
    group.addComponent(createRefreshButton());
    // searchField.setWidth("80%");
    searchField.setId("CrudSearchField");
    group.addComponent(searchField);
    if (group instanceof HorizontalLayout) {
        ((HorizontalLayout) group).setExpandRatio(searchField, 1);
    }
    group.addComponent(searchButton);
    searchButton.addClickListener(new ClickListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            triggerFilter();
        }
    });
    searchButton.setVisible(!dynamicSearch);
    final OnEnterKeyHandler onEnterKeyHandler = new OnEnterKeyHandler() {

        @Override
        public void enterKeyPressed() {
            if (!dynamicSearch) {
                searchButton.click();
            }
        }
    };
    onEnterKeyHandler.attachTo(searchField);
}
Also used : ValoTheme(com.vaadin.ui.themes.ValoTheme) CssLayout(com.vaadin.ui.CssLayout) Button(com.vaadin.ui.Button) ClickEvent(com.vaadin.ui.Button.ClickEvent) AbstractLayout(com.vaadin.ui.AbstractLayout) ClickListener(com.vaadin.ui.Button.ClickListener) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Example 37 with CssLayout

use of com.vaadin.ui.CssLayout in project charts by vaadin.

the class ChartsDemoUI method init.

@Override
protected void init(VaadinRequest request) {
    initGATracker();
    tabSheet = new TabSheet();
    tabSheet.addSelectedTabChangeListener(new TabSheet.SelectedTabChangeListener() {

        @Override
        public void selectedTabChange(TabSheet.SelectedTabChangeEvent event) {
            com.vaadin.ui.JavaScript.eval("setTimeout(function(){prettyPrint();},300);");
        }
    });
    tabSheet.setSizeFull();
    tabSheet.addStyleName(ValoTheme.TABSHEET_PADDED_TABBAR);
    Link homepage = new Link("Home Page", new ExternalResource("https://vaadin.com/components/vaadin-charts"));
    Link javadoc = new Link("JavaDoc", new ExternalResource("https://vaadin.com/api/com.vaadin/vaadin-charts/" + getVersion() + "/"));
    Link manual = new Link("Manual", new ExternalResource("https://vaadin.com/docs/v8/charts/charts-overview.html"));
    Link pricing = new Link("Pricing", new ExternalResource("https://vaadin.com/pricing"));
    Label version = new Label("Version " + getVersion());
    version.addStyleName("version");
    HorizontalLayout links = new HorizontalLayout(homepage, pricing, javadoc, manual);
    links.setSpacing(true);
    links.addStyleName("links");
    final HorizontalSplitPanel horizontalSplitPanel = new HorizontalSplitPanel();
    horizontalSplitPanel.setSecondComponent(tabSheet);
    horizontalSplitPanel.setSplitPosition(300, Unit.PIXELS);
    horizontalSplitPanel.addStyleName("main-layout");
    ChartOptions.get().setTheme(new ValoLightTheme());
    themeSelector = new ComboBox("Charts Theme:");
    themeSelector.addStyleName("theme-selector");
    themeSelector.addStyleName(ValoTheme.COMBOBOX_SMALL);
    themeSelector.setTextInputAllowed(false);
    com.vaadin.addon.charts.model.style.Theme defaultTheme = new ValoLightTheme();
    Map<com.vaadin.addon.charts.model.style.Theme, String> mapThemes = new HashMap<>();
    com.vaadin.addon.charts.model.style.Theme[] themes = new com.vaadin.addon.charts.model.style.Theme[] { defaultTheme, new ValoDarkTheme(), new VaadinTheme(), new HighChartsDefaultTheme(), new GridTheme(), new GrayTheme(), new SkiesTheme() };
    mapThemes.put(themes[0], "Valo Light");
    mapThemes.put(themes[1], "Valo Dark");
    mapThemes.put(themes[2], "Vaadin");
    mapThemes.put(themes[3], "HighCharts");
    mapThemes.put(themes[4], "Grid");
    mapThemes.put(themes[5], "Gray");
    mapThemes.put(themes[6], "Skies");
    themeSelector.setEmptySelectionAllowed(false);
    themeSelector.setItems(themes);
    themeSelector.setSelectedItem(defaultTheme);
    themeSelector.setItemCaptionGenerator(mapThemes::get);
    themeSelector.addSelectionListener(e -> {
        ChartOptions.get().setTheme(e.getValue());
    });
    final HierarchicalContainer container = getContainer();
    VerticalLayout content = new VerticalLayout();
    content.setSpacing(true);
    content.setMargin(false);
    Label logo = new Label("Vaadin Charts for Vaadin 8");
    logo.setWidth("100%");
    logo.addStyleName("h3");
    logo.addStyleName("logo");
    TextField filterField = new TextField();
    filterField.setPlaceholder("Filter examples");
    filterField.setIcon(FontAwesome.SEARCH);
    filterField.addStyleName("filter");
    filterField.setWidth("100%");
    filterField.addValueChangeListener(e -> {
        container.removeAllContainerFilters();
        String text = e.getValue();
        if (text != null && !text.isEmpty()) {
            expandForFiltering();
            container.addContainerFilter("searchName", text, true, false);
        } else {
            restoreExpandedStates();
        }
    });
    tree = new Tree();
    tree.setImmediate(true);
    tree.setContainerDataSource(container);
    tree.setItemCaptionPropertyId("displayName");
    tree.setNullSelectionAllowed(false);
    tree.setWidth("100%");
    tree.addValueChangeListener(new Property.ValueChangeListener() {

        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            Object value = event.getProperty().getValue();
            if (value instanceof Class) {
                updateTabSheet((Class) value);
            } else {
                tree.expandItemsRecursively(value);
            }
        }
    });
    Button trial = new Button("Start Free Trial");
    trial.addStyleName(ValoTheme.BUTTON_PRIMARY);
    trial.addStyleName(ValoTheme.BUTTON_TINY);
    trial.addClickListener(e -> {
        getUI().getPage().open("https://vaadin.com/trial", "_blank");
    });
    content.addComponents(logo, links, trial, filterField, tree, version);
    content.setComponentAlignment(trial, Alignment.MIDDLE_CENTER);
    horizontalSplitPanel.setFirstComponent(content);
    selectItem();
    Page.getCurrent().addUriFragmentChangedListener(new Page.UriFragmentChangedListener() {

        @Override
        public void uriFragmentChanged(Page.UriFragmentChangedEvent event) {
            selectItem();
        }
    });
    setContent(new CssLayout() {

        {
            setSizeFull();
            addComponent(horizontalSplitPanel);
            addComponent(themeSelector);
        }
    });
    if (tracker != null) {
        tracker.trackPageview("/charts");
    }
}
Also used : SkiesTheme(com.vaadin.addon.charts.themes.SkiesTheme) HighChartsDefaultTheme(com.vaadin.addon.charts.themes.HighChartsDefaultTheme) ValoLightTheme(com.vaadin.addon.charts.themes.ValoLightTheme) HashMap(java.util.HashMap) Label(com.vaadin.ui.Label) VaadinTheme(com.vaadin.addon.charts.themes.VaadinTheme) Page(com.vaadin.server.Page) GrayTheme(com.vaadin.addon.charts.themes.GrayTheme) HorizontalLayout(com.vaadin.ui.HorizontalLayout) ValoDarkTheme(com.vaadin.addon.charts.themes.ValoDarkTheme) CssLayout(com.vaadin.ui.CssLayout) Button(com.vaadin.ui.Button) VerticalLayout(com.vaadin.ui.VerticalLayout) TextField(com.vaadin.ui.TextField) Tree(com.vaadin.v7.ui.Tree) Property(com.vaadin.v7.data.Property) ComboBox(com.vaadin.ui.ComboBox) GridTheme(com.vaadin.addon.charts.themes.GridTheme) ExternalResource(com.vaadin.server.ExternalResource) TabSheet(com.vaadin.ui.TabSheet) HorizontalSplitPanel(com.vaadin.ui.HorizontalSplitPanel) ValoLightTheme(com.vaadin.addon.charts.themes.ValoLightTheme) ValoDarkTheme(com.vaadin.addon.charts.themes.ValoDarkTheme) ValoTheme(com.vaadin.ui.themes.ValoTheme) Theme(com.vaadin.annotations.Theme) GrayTheme(com.vaadin.addon.charts.themes.GrayTheme) VaadinTheme(com.vaadin.addon.charts.themes.VaadinTheme) GridTheme(com.vaadin.addon.charts.themes.GridTheme) HighChartsDefaultTheme(com.vaadin.addon.charts.themes.HighChartsDefaultTheme) SkiesTheme(com.vaadin.addon.charts.themes.SkiesTheme) HierarchicalContainer(com.vaadin.v7.data.util.HierarchicalContainer) Link(com.vaadin.ui.Link)

Example 38 with CssLayout

use of com.vaadin.ui.CssLayout in project Activiti by Activiti.

the class MainLayout method initFooter.

protected void initFooter() {
    footer = new CssLayout();
    footer.setWidth(100, UNITS_PERCENTAGE);
    footer.addStyleName(ExplorerLayout.STYLE_MAIN_FOOTER);
    addComponent(footer);
    Label footerLabel = new Label();
    footerLabel.setContentMode(Label.CONTENT_XHTML);
    footerLabel.setValue(i18nManager.getMessage(Messages.FOOTER_MESSAGE));
    footerLabel.setWidth(100, UNITS_PERCENTAGE);
    footer.addComponent(footerLabel);
}
Also used : CssLayout(com.vaadin.ui.CssLayout) Label(com.vaadin.ui.Label)

Example 39 with CssLayout

use of com.vaadin.ui.CssLayout in project Activiti by Activiti.

the class TaskListHeader method initInputField.

protected void initInputField() {
    // Csslayout is used to style inputtext as rounded
    CssLayout csslayout = new CssLayout();
    csslayout.setHeight(24, UNITS_PIXELS);
    csslayout.setWidth(100, UNITS_PERCENTAGE);
    layout.addComponent(csslayout);
    inputField = new TextField();
    inputField.setWidth(100, UNITS_PERCENTAGE);
    inputField.addStyleName(ExplorerLayout.STYLE_SEARCHBOX);
    inputField.setInputPrompt(i18nManager.getMessage(Messages.TASK_CREATE_NEW));
    inputField.focus();
    csslayout.addComponent(inputField);
    layout.setComponentAlignment(csslayout, Alignment.MIDDLE_LEFT);
    layout.setExpandRatio(csslayout, 1.0f);
}
Also used : CssLayout(com.vaadin.ui.CssLayout) TextField(com.vaadin.ui.TextField)

Example 40 with CssLayout

use of com.vaadin.ui.CssLayout in project cuba by cuba-platform.

the class CubaCurrencyField method initLayout.

protected void initLayout() {
    container = new CssLayout();
    container.setSizeFull();
    container.setPrimaryStyleName(CURRENCYFIELD_LAYOUT_STYLENAME);
    container.addComponent(currencyLabel);
    if (useWrapper()) {
        ie9InputWrapper = new CssLayout(textField);
        ie9InputWrapper.setSizeFull();
        ie9InputWrapper.setPrimaryStyleName(IE9_INPUT_WRAP_STYLENAME);
        container.addComponent(ie9InputWrapper);
    } else {
        container.addComponent(textField);
    }
    setFocusDelegate(textField);
}
Also used : CssLayout(com.vaadin.ui.CssLayout)

Aggregations

CssLayout (com.vaadin.ui.CssLayout)69 Label (com.vaadin.ui.Label)25 Button (com.vaadin.ui.Button)12 VerticalLayout (com.vaadin.ui.VerticalLayout)12 HorizontalLayout (com.vaadin.ui.HorizontalLayout)11 Component (com.vaadin.ui.Component)7 ClickEvent (com.vaadin.ui.Button.ClickEvent)6 ClickListener (com.vaadin.ui.Button.ClickListener)6 List (java.util.List)6 CounterStatisticModel (com.github.markash.ui.component.card.CounterStatisticModel)5 CounterStatisticsCard (com.github.markash.ui.component.card.CounterStatisticsCard)5 Page (com.vaadin.server.Page)3 Layout (com.vaadin.ui.Layout)3 HorizontalFlexLayout (de.catma.ui.layout.HorizontalFlexLayout)3 Path (java.nio.file.Path)3 EventBus (com.google.common.eventbus.EventBus)2 ViewRiksdagenGovermentRoleMember (com.hack23.cia.model.internal.application.data.ministry.impl.ViewRiksdagenGovermentRoleMember)2 ViewRiksdagenMinistry (com.hack23.cia.model.internal.application.data.ministry.impl.ViewRiksdagenMinistry)2 ViewRiksdagenPartyRoleMember (com.hack23.cia.model.internal.application.data.party.impl.ViewRiksdagenPartyRoleMember)2 ViewRiksdagenPartySummary (com.hack23.cia.model.internal.application.data.party.impl.ViewRiksdagenPartySummary)2