Package com.vaadin.server

Examples of com.vaadin.server.Resource


    @Override
    protected void paintRowIcon(PaintTarget target, Object[][] cells,
            int indexInRowbuffer) throws PaintException {
        // always paint if present (in parent only if row headers visible)
        if (getRowHeaderMode() == ROW_HEADER_MODE_HIDDEN) {
            Resource itemIcon = getItemIcon(cells[CELL_ITEMID][indexInRowbuffer]);
            if (itemIcon != null) {
                target.addAttribute("icon", itemIcon);
            }
        } else if (cells[CELL_ICON][indexInRowbuffer] != null) {
            target.addAttribute("icon",
View Full Code Here


    public static Resource getIcon(String fileName) {
        return getIconByMimeType(getMIMEType(fileName));
    }

    private static Resource getIconByMimeType(String mimeType) {
        final Resource icon = MIMEToIconMap.get(mimeType);
        if (icon != null) {
            return icon;
        }

        // If nothing is known about the file-type, general file
View Full Code Here

        p.setHeight(h);

        newLayout.setSizeFull();

        String captions[] = new String[] { "TextField with caption", null };
        Resource icons[] = new Resource[] {
                new ThemeResource("icons/16/document-delete.png"), null };
        boolean required[] = new boolean[] { true, false };
        TextField fields[][] = new TextField[captions.length][icons.length];
        for (int caption = 0; caption < captions.length; caption++) {
            for (int icon = 0; icon < icons.length; icon++) {
View Full Code Here

        }
    };

    @Override
    public void setup(VaadinRequest request) {
        Resource resource = new ExternalResource(IMAGE_URL + "?text=Hello!");

        getSession().addRequestHandler(requestHandler);

        // Add an image using the resource
        Image image = new Image("A dynamically generated image", resource);
View Full Code Here

            l.setWidth(null);
            setDragStartMode(DragStartMode.WRAPPER); // drag all contained
            // components, not just the
            // one on it started
            this.file = file;
            Resource icon2 = file.getIcon();
            String name = file.getName();
            l.addComponent(new Embedded(null, icon2));
            l.addComponent(new Label(name));

            l.addListener(new LayoutClickListener() {
View Full Code Here

            getState()
                    .setMessages(
                            Arrays.asList("First state message",
                                    "Second state message"));
            // Dummy resource used to test URL translation
            Resource resource = new ConnectorResource() {
                @Override
                public String getMIMEType() {
                    return null;
                }
View Full Code Here

                createClickAction(option, tabCaptionCategory, setTabCaption,
                        Integer.valueOf(i), option);
            }

            for (String option : iconOptions.keySet()) {
                Resource icon = iconOptions.get(option);
                createClickAction(option, tabIconCategory, setTabIcon,
                        Integer.valueOf(i), icon);
            }

        }
View Full Code Here

public class LinkToPercentage extends TestBase {

    @Override
    protected void setup() {
        String filename = "110% Vaadin";
        Resource resource = new StreamResource(new StreamSource() {
            @Override
            public InputStream getStream() {
                return new InputStream() {
                    boolean first = true;
View Full Code Here

                }

                // Adds the attributes
                target.addAttribute(TreeConstants.ATTRIBUTE_NODE_CAPTION,
                        getItemCaption(itemId));
                final Resource icon = getItemIcon(itemId);
                if (icon != null) {
                    target.addAttribute(TreeConstants.ATTRIBUTE_NODE_ICON,
                            getItemIcon(itemId));
                    target.addAttribute(TreeConstants.ATTRIBUTE_NODE_ICON_ALT,
                            getItemIconAlternateText(itemId));
View Full Code Here

            Command command = item.getCommand();
            if (command != null) {
                target.addAttribute("command", true);
            }

            Resource icon = item.getIcon();
            if (icon != null) {
                target.addAttribute(MenuBarConstants.ATTRIBUTE_ITEM_ICON, icon);
            }

            if (!item.isEnabled()) {
View Full Code Here

TOP

Related Classes of com.vaadin.server.Resource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.