Search in sources :

Example 61 with CssLayout

use of com.vaadin.ui.CssLayout in project opencms-core by alkacon.

the class CmsSitemapTreeController method createNode.

/**
 * Creates a sitemap tree node widget from a tree node bean.<p>
 *
 * @param entry the tree node bean
 * @return the tree node widget
 */
public CmsSitemapTreeNode createNode(final CmsSitemapTreeNodeData entry) {
    final CmsSitemapTreeNode node = new CmsSitemapTreeNode();
    node.addLayoutClickListener(new LayoutClickListener() {

        private static final long serialVersionUID = 1L;

        @SuppressWarnings("synthetic-access")
        public void layoutClick(LayoutClickEvent event) {
            Component currentComponent = event.getClickedComponent();
            if (currentComponent != null) {
                boolean linked = false;
                do {
                    currentComponent = currentComponent.getParent();
                    if ((currentComponent != null) && "linked".equals(((AbstractComponent) currentComponent).getData())) {
                        linked = true;
                    }
                    if (event.getClickedComponent() instanceof CmsResourceIcon) {
                        if (currentComponent == node) {
                            openTargetPage((CmsSitemapTreeNodeData) (node.getData()), linked);
                        } else if (currentComponent instanceof CmsSitemapTreeNode) {
                            break;
                        }
                    }
                } while (currentComponent != null);
            }
        }
    });
    Resource icon = CmsResourceIcon.getSitemapResourceIcon(A_CmsUI.getCmsObject(), entry.getResource(), IconMode.localeCompare);
    CmsResourceInfo info = new CmsResourceInfo(entry.getClientEntry().getTitle(), entry.getClientEntry().getSitePath(), icon);
    info = CmsResourceInfo.createSitemapResourceInfo(entry.getResource(), OpenCms.getSiteManager().getSiteForRootPath(m_localeContext.getRoot().getRootPath()));
    info.getResourceIcon().addStyleName(OpenCmsTheme.POINTER);
    info.getResourceIcon().setDescription(CmsVaadinUtils.getMessageText(Messages.GUI_LOCALECOMPARE_OPEN_PAGE_0));
    if (entry.getClientEntry().isHiddenNavigationEntry()) {
        info.addStyleName(OpenCmsTheme.RESOURCE_INFO_WEAK);
    }
    final MenuBar menu = new MenuBar();
    boolean noTranslation = false;
    noTranslation = entry.isMarkedNoTranslation(m_localeContext.getComparisonLocale());
    final MenuItem main = menu.addItem("", null);
    main.setIcon(FontOpenCms.CONTEXT_MENU);
    CssLayout rightSide = new CssLayout();
    info.setButtonWidget(rightSide);
    rightSide.addComponent(menu);
    main.setCommand(new Command() {

        /**
         * Serial version id.
         */
        private static final long serialVersionUID = 1L;

        public void menuSelected(MenuItem selectedItem) {
            List<I_CmsSimpleContextMenuEntry<MenuContext>> entries = Arrays.asList(new EntryOpen(), new EntryExplorer(), new EntryProperties(), new EntryLink(), new EntryUnlink(), new EntryMark(), new EntryRemoveMark(), new EntryCopy(), new EntryInfo());
            MenuContext context = new MenuContext(entry, node);
            m_menu.setEntries(entries, context);
            m_menu.open(menu);
        }
    });
    menu.addStyleName("borderless o-toolbar-button o-resourceinfo-toolbar");
    if (entry.isLinked()) {
        CmsSite site = OpenCms.getSiteManager().getSiteForRootPath(m_localeContext.getRoot().getRootPath());
        CmsResourceInfo linkedInfo = CmsResourceInfo.createSitemapResourceInfo(readSitemapEntryFolderIfPossible(entry.getLinkedResource()), site);
        linkedInfo.addStyleName(OpenCmsTheme.RESOURCE_INFO_DIRECTLINK);
        rightSide.addComponent(linkedInfo, 0);
        linkedInfo.setWidth(RHS_WIDTH + "px");
        node.setContent(info);
        // Data used by click handler to distinguish clicked resource icons
        linkedInfo.setData("linked");
        linkedInfo.getResourceIcon().setDescription(CmsVaadinUtils.getMessageText(Messages.GUI_LOCALECOMPARE_OPEN_PAGE_0));
        linkedInfo.getResourceIcon().addStyleName(OpenCmsTheme.POINTER);
    } else {
        if (noTranslation) {
            CmsResourceInfo noTranslationInfo = new CmsResourceInfo();
            String topMessage = CmsVaadinUtils.getMessageText(Messages.GUI_LOCALECOMPARE_NO_TRANSLATION_TOP_0);
            String bottomMessage = CmsVaadinUtils.getMessageText(Messages.GUI_LOCALECOMPARE_NO_TRANSLATION_BOTTOM_0);
            noTranslationInfo.getTopLine().setValue(topMessage);
            noTranslationInfo.getBottomLine().setValue(bottomMessage);
            noTranslationInfo.getResourceIcon().setValue("<span class=\"" + OpenCmsTheme.RESOURCE_ICON + " " + OpenCmsTheme.NO_TRANSLATION_ICON + "\">" + FontAwesome.BAN.getHtml() + "</span>");
            noTranslationInfo.addStyleName(OpenCmsTheme.RESOURCE_INFO_DIRECTLINK);
            noTranslationInfo.setWidth(RHS_WIDTH + "px");
            rightSide.addComponent(noTranslationInfo, 0);
        }
        node.setContent(info);
    }
    if (entry.hasNoChildren()) {
        node.setOpen(true);
        node.setOpenerVisible(false);
    }
    node.setData(entry);
    return node;
}
Also used : MenuBar(com.vaadin.ui.MenuBar) CssLayout(com.vaadin.ui.CssLayout) List(java.util.List) AbstractComponent(com.vaadin.ui.AbstractComponent) Component(com.vaadin.ui.Component) LayoutClickEvent(com.vaadin.event.LayoutEvents.LayoutClickEvent) CmsResourceIcon(org.opencms.ui.components.CmsResourceIcon) Resource(com.vaadin.server.Resource) CmsResource(org.opencms.file.CmsResource) MenuItem(com.vaadin.ui.MenuBar.MenuItem) CmsSite(org.opencms.site.CmsSite) CmsResourceInfo(org.opencms.ui.components.CmsResourceInfo) Command(com.vaadin.ui.MenuBar.Command) LayoutClickListener(com.vaadin.event.LayoutEvents.LayoutClickListener)

Example 62 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 63 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)

Example 64 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 65 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)

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