Search in sources :

Example 11 with Resource

use of com.vaadin.server.Resource in project cuba by cuba-platform.

the class CubaSideMenu method markMenuStructureAsDirty.

protected void markMenuStructureAsDirty() {
    markAsDirty();
    this.structureChanged = true;
    for (String menuIconsKey : menuIconResourceKeys) {
        Resource resource = getResource(menuIconsKey);
        menuIconsKeyMapper.remove(resource);
        setResource(menuIconsKey, null);
    }
    menuItemIdMapper.removeAll();
    menuIconsKeyMapper.removeAll();
    // all badges will be sent to client with items
    badgeUpdates.clear();
}
Also used : Resource(com.vaadin.server.Resource)

Example 12 with Resource

use of com.vaadin.server.Resource in project cuba by cuba-platform.

the class CubaPickerField method updateIcon.

protected void updateIcon(T value) {
    Resource iconResource = iconGenerator != null ? iconGenerator.apply(value) : null;
    getField().setIcon(iconResource);
}
Also used : Resource(com.vaadin.server.Resource)

Example 13 with Resource

use of com.vaadin.server.Resource in project cuba by cuba-platform.

the class WebAbstractActionsHolderComponent method setContextMenuButtonIcon.

protected void setContextMenuButtonIcon(CubaButton button, String icon) {
    if (!StringUtils.isEmpty(icon)) {
        Resource iconResource = getIconResource(icon);
        button.setIcon(iconResource);
    } else {
        button.setIcon(null);
    }
}
Also used : Resource(com.vaadin.server.Resource)

Example 14 with Resource

use of com.vaadin.server.Resource in project cuba by cuba-platform.

the class DDUtil method onBeforeClientResponse.

public static void onBeforeClientResponse(HasComponents layout, DragAndDropAwareState state) {
    DDLayoutState dragAndDropState = state.getDragAndDropState();
    Iterator<Component> componentIterator = layout.iterator();
    dragAndDropState.draggable = new ArrayList<>();
    dragAndDropState.referenceImageComponents = new HashMap<>();
    dragAndDropState.nonGrabbable = new ArrayList<>();
    dragAndDropState.dragCaptions = new HashMap<>();
    if (layout instanceof AbstractClientConnector) {
        for (DragCaptionInfo dci : dragAndDropState.dragCaptions.values()) {
            if (dci.iconKey != null) {
                ((AbstractClientConnector) layout).setConnectorResource(dci.iconKey, null);
            }
        }
    }
    KeyMapper<Resource> keyMapper = new KeyMapper<>();
    while (componentIterator.hasNext()) {
        Component c = componentIterator.next();
        if (layout instanceof DragFilterSupport && ((DragFilterSupport) layout).getDragFilter().isDraggable(c)) {
            dragAndDropState.draggable.add(c);
        }
        if (layout instanceof DragGrabFilterSupport) {
            DragGrabFilter dragGrabFilter = ((DragGrabFilterSupport) layout).getDragGrabFilter();
            if (dragGrabFilter != null) {
                addNonGrabbedComponents(dragAndDropState.nonGrabbable, c, dragGrabFilter);
            }
        }
        if (layout instanceof HasDragCaptionProvider) {
            DragCaptionProvider dragCaptionProvider = ((HasDragCaptionProvider) layout).getDragCaptionProvider();
            if (dragCaptionProvider != null) {
                DragCaption dragCaption = dragCaptionProvider.getDragCaption(c);
                if (dragCaption != null) {
                    String dragIconKey = null;
                    if (dragCaption.getIcon() != null && layout instanceof AbstractClientConnector) {
                        dragIconKey = keyMapper.key(dragCaption.getIcon());
                        ((AbstractClientConnector) layout).setConnectorResource(dragIconKey, dragCaption.getIcon());
                    }
                    DragCaptionInfo dci = new DragCaptionInfo();
                    dci.caption = dragCaption.getCaption();
                    dci.contentMode = dragCaption.getContentMode();
                    dci.iconKey = dragIconKey;
                    dragAndDropState.dragCaptions.put(c, dci);
                }
            }
        }
        if (layout instanceof DragImageReferenceSupport) {
            DragImageProvider provider = ((DragImageReferenceSupport) layout).getDragImageProvider();
            if (provider != null) {
                Component dragImage = provider.getDragImage(c);
                if (dragImage != null) {
                    dragAndDropState.referenceImageComponents.put(c, dragImage);
                }
            }
        }
    }
}
Also used : DDLayoutState(com.haulmont.cuba.web.widgets.client.addons.dragdroplayouts.ui.interfaces.DDLayoutState) KeyMapper(com.vaadin.server.KeyMapper) Resource(com.vaadin.server.Resource) AbstractClientConnector(com.vaadin.server.AbstractClientConnector) DragCaptionInfo(com.haulmont.cuba.web.widgets.client.addons.dragdroplayouts.ui.DragCaptionInfo) Component(com.vaadin.ui.Component)

Example 15 with Resource

use of com.vaadin.server.Resource in project cuba by cuba-platform.

the class WebFileUploadField method setClearButtonIcon.

@Override
public void setClearButtonIcon(String icon) {
    if (icon != null) {
        IconResolver iconResolver = beanLocator.get(IconResolver.NAME);
        Resource iconResource = iconResolver.getIconResource(icon);
        component.setClearButtonIcon(iconResource);
    } else {
        component.setClearButtonIcon(null);
    }
}
Also used : IconResolver(com.haulmont.cuba.web.gui.icons.IconResolver) Resource(com.vaadin.server.Resource)

Aggregations

Resource (com.vaadin.server.Resource)19 ExternalResource (com.vaadin.server.ExternalResource)5 StreamResource (com.vaadin.server.StreamResource)4 Button (com.vaadin.ui.Button)4 ClickEvent (com.vaadin.ui.Button.ClickEvent)3 ReportSave (au.com.vaadinutils.jasper.scheduler.entities.ReportSave)2 ReportSaveParameter (au.com.vaadinutils.jasper.scheduler.entities.ReportSaveParameter)2 ClickEventLogged (au.com.vaadinutils.listener.ClickEventLogged)2 Configuration (com.haulmont.cuba.core.global.Configuration)2 ThemeConstants (com.haulmont.cuba.gui.theme.ThemeConstants)2 WebConfig (com.haulmont.cuba.web.WebConfig)2 VersionedThemeResource (com.haulmont.cuba.web.toolkit.VersionedThemeResource)2 FileResource (com.vaadin.server.FileResource)2 BrowserFrame (com.vaadin.ui.BrowserFrame)2 InputDialog (au.com.vaadinutils.editors.InputDialog)1 Recipient (au.com.vaadinutils.editors.Recipient)1 ExpanderComponent (au.com.vaadinutils.jasper.filter.ExpanderComponent)1 ReportParameter (au.com.vaadinutils.jasper.parameter.ReportParameter)1 JasperReportEmailWindow (au.com.vaadinutils.jasper.scheduler.JasperReportEmailWindow)1 JasperReportSchedulerWindow (au.com.vaadinutils.jasper.scheduler.JasperReportSchedulerWindow)1