Package com.vaadin.server

Examples of com.vaadin.server.ClassResource


import com.vaadin.ui.Embedded;

public class TestMimeTypes extends TestCase {

    public void testEmbeddedPDF() {
        Embedded e = new Embedded("A pdf", new ClassResource("file.pddf"));
        assertEquals("Invalid mimetype", "application/octet-stream",
                e.getMimeType());
        e = new Embedded("A pdf", new ClassResource("file.pdf"));
        assertEquals("Invalid mimetype", "application/pdf", e.getMimeType());
    }
View Full Code Here


            addComponent(gl);

        }

        private void addImage() {
            ClassResource res = new ClassResource("img1.png") {

                private static final long serialVersionUID = 1L;

                @Override
                public DownloadStream getStream() {
                    try {
                        Thread.sleep((long) (Math.random() * 5000));
                    } catch (InterruptedException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
                    return super.getStream();
                }

            };
            res.setCacheTime(0);
            Embedded emb = new Embedded("" + n, res);
            emb.setWidth("30px");
            emb.setHeight("5px");
            gl.addComponent(emb);
            l.setValue("" + n++);
View Full Code Here

    @Override
    protected void setup() {

        // Public domain sounds from pdsounds.org 27.2.2013

        final Resource[] s1 = { new ClassResource(getClass(), "bip.mp3"),
                new ClassResource(getClass(), "bip.ogg") };
        final Resource[] s2 = {
                new ClassResource(getClass(), "toyphone_dialling.mp3"),
                new ClassResource(getClass(), "toyphone_dialling.ogg") };

        final Audio audio = new Audio();

        audio.setSources(s1);
        audio.setShowControls(true);
View Full Code Here

        df4.setLocale(new Locale("fi", "FI"));
    }

    @Override
    public void attach() {
        final ClassResource res = new ClassResource("m.gif");
        df.setIcon(res);
        super.attach();
    }
View Full Code Here

                                        .getText());
            }
        });
        addComponent(dropTarget);

        Embedded iframe = new Embedded("", new ClassResource("html5drop.htm"));
        iframe.setType(Embedded.TYPE_BROWSER);
        iframe.setWidth(400, Sizeable.UNITS_PIXELS);
        iframe.setHeight(400, Sizeable.UNITS_PIXELS);
        addComponent(iframe);
View Full Code Here

        final VerticalLayout tab1 = new VerticalLayout();
        tab1.addComponent(new Label("try tab2"));
        final VerticalLayout tab2 = new VerticalLayout();
        test(tab2);
        populateLayout(tab2);
        tabsheet.addTab(tab1, "TabSheet tab1", new ClassResource("m.gif"));
        tabsheet.addTab(tab2, "TabSheet tab2", new ClassResource("m.gif"));

        final VerticalLayout expandLayout = new VerticalLayout();
        test(expandLayout);
        populateLayout(expandLayout);
View Full Code Here

     * Stresses component by configuring it
     *
     * @param c
     */
    void test(AbstractComponent c) {
        final ClassResource res = new ClassResource("m.gif");
        final ErrorMessage errorMsg = new UserError("User error " + c);

        if ((c.getCaption() == null) || (c.getCaption().length() <= 0)) {
            c.setCaption("Caption " + c);
        }
View Full Code Here

        }
        // resource = new DynamicConnectorResource(this, "requestImage.png");
        // addComponents(resource, components);
        // resource = new ThemeResource("favicon.ico");
        // addComponents(resource, components);
        resource = new ClassResource(new EmbeddedPdf().getClass(), "test.pdf");
        addComponents("Class resource pdf", resource, components);

        addComponent(new Button("Remove first download button",
                new ClickListener() {
View Full Code Here

    }

    private Component getExamplePicture(String caption) {
        // loads image from package com.vaadin.demo
        final ClassResource cr = new ClassResource("m-bullet-blue.gif");
        final Embedded em = new Embedded("Embedded " + caption, cr);
        em.setWidth("170px");
        return em;
    }
View Full Code Here

        Embedded player = new Embedded();
        player.setType(Embedded.TYPE_OBJECT);
        player.setMimeType("application/x-shockwave-flash");
        player.setWidth("400px");
        player.setHeight("300px");
        player.setSource(new ClassResource(
                com.vaadin.tests.components.flash.FlashIsVisible.class,
                "simple.swf"));
        addComponent(player);
    }
View Full Code Here

TOP

Related Classes of com.vaadin.server.ClassResource

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.