Search in sources :

Example 21 with CssLayout

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

the class CubaTokenList method initField.

protected void initField() {
    if (editor == null) {
        editor = new CssLayout();
        editor.setWidthUndefined();
        editor.setStyleName(TOKENLIST_EDITOR_STYLENAME);
    }
    editor.removeAllComponents();
    if (!owner.isSimple()) {
        owner.lookupPickerField.setWidthAuto();
        editor.addComponent(WebComponentsHelper.getComposition(owner.lookupPickerField));
    }
    owner.lookupPickerField.setVisible(!owner.isSimple());
    owner.addButton.setVisible(owner.isSimple());
    owner.addButton.setStyleName(ADD_BTN_STYLENAME);
    if (addButtonSub != null) {
        addButtonSub.remove();
    }
    if (!owner.isSimple()) {
        addButtonSub = owner.addButton.addClickListener(e -> {
            if (owner.isEditableWithParent()) {
                owner.addValueFromLookupPickerField();
            }
            owner.addButton.focus();
        });
    } else {
        addButtonSub = owner.addButton.addClickListener(e -> owner.openLookup(() -> owner.addButton.focus()));
    }
    Button vAddButton = owner.addButton.unwrapOrNull(Button.class);
    if (vAddButton != null) {
        editor.addComponent(vAddButton);
    }
    owner.clearButton.setVisible(owner.clearEnabled);
    owner.clearButton.setStyleName(CLEAR_BTN_STYLENAME);
    if (clearBtnClickSubscription != null) {
        clearBtnClickSubscription.remove();
    }
    clearBtnClickSubscription = owner.clearButton.addClickListener(e -> {
        clearValue();
        owner.clearButton.focus();
    });
    com.vaadin.ui.Button vClearButton = owner.clearButton.unwrapOrNull(com.vaadin.ui.Button.class);
    editor.addComponent(vClearButton);
}
Also used : CustomField(com.vaadin.ui.CustomField) CubaTokenListLabel(com.haulmont.cuba.web.widgets.CubaTokenListLabel) java.util(java.util) TokenList(com.haulmont.cuba.gui.components.TokenList) ValueSource(com.haulmont.cuba.gui.components.data.ValueSource) CssLayout(com.vaadin.ui.CssLayout) MarginInfo(com.vaadin.shared.ui.MarginInfo) CollectionUtils(org.apache.commons.collections4.CollectionUtils) Button(com.vaadin.ui.Button) Subscription(com.haulmont.bali.events.Subscription) Instance(com.haulmont.chile.core.model.Instance) CubaScrollBoxLayout(com.haulmont.cuba.web.widgets.CubaScrollBoxLayout) Entity(com.haulmont.cuba.core.entity.Entity) Component(com.vaadin.ui.Component) CssLayout(com.vaadin.ui.CssLayout) Button(com.vaadin.ui.Button) Button(com.vaadin.ui.Button)

Example 22 with CssLayout

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

the class CubaFileUploadWrapper method initLayout.

protected void initLayout(UploadComponent uploadComponent) {
    this.uploadButton = uploadComponent;
    container = new CssLayout();
    container.addStyleName("c-fileupload-container");
    fileNameButton = new CubaButton();
    fileNameButton.setWidth(100, Unit.PERCENTAGE);
    fileNameButton.addStyleName(ValoTheme.BUTTON_LINK);
    fileNameButton.addStyleName("c-fileupload-filename");
    setFileNameButtonCaption(null);
    container.addComponent(fileNameButton);
    container.addComponent(uploadComponent);
    clearButton = new CubaButton("");
    clearButton.setStyleName("c-fileupload-clear");
    container.addComponent(clearButton);
    setShowClearButton(showClearButton);
    setShowFileName(false);
    setWidthUndefined();
}
Also used : CssLayout(com.vaadin.ui.CssLayout) CubaButton(com.haulmont.cuba.web.widgets.CubaButton)

Example 23 with CssLayout

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

the class WindowBreadCrumbs method createLinksLayout.

protected Layout createLinksLayout() {
    CssLayout linksLayout = new CssLayout();
    linksLayout.setPrimaryStyleName("c-breadcrumbs");
    return linksLayout;
}
Also used : CssLayout(com.vaadin.ui.CssLayout)

Example 24 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 25 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)

Aggregations

CssLayout (com.vaadin.ui.CssLayout)28 Label (com.vaadin.ui.Label)10 Button (com.vaadin.ui.Button)8 ClickEvent (com.vaadin.ui.Button.ClickEvent)4 ClickListener (com.vaadin.ui.Button.ClickListener)4 Component (com.vaadin.ui.Component)4 VerticalLayout (com.vaadin.ui.VerticalLayout)4 HorizontalLayout (com.vaadin.ui.HorizontalLayout)3 TextField (com.vaadin.ui.TextField)3 LayoutClickEvent (com.vaadin.event.LayoutEvents.LayoutClickEvent)2 LayoutClickListener (com.vaadin.event.LayoutEvents.LayoutClickListener)2 ValoTheme (com.vaadin.ui.themes.ValoTheme)2 PrettyTimeLabel (org.activiti.explorer.ui.custom.PrettyTimeLabel)2 ClaimTaskClickListener (org.activiti.explorer.ui.task.listener.ClaimTaskClickListener)2 Subscription (com.haulmont.bali.events.Subscription)1 Instance (com.haulmont.chile.core.model.Instance)1 Entity (com.haulmont.cuba.core.entity.Entity)1 TokenList (com.haulmont.cuba.gui.components.TokenList)1 ValueSource (com.haulmont.cuba.gui.components.data.ValueSource)1 WebAbstractComponent (com.haulmont.cuba.web.gui.components.WebAbstractComponent)1