Package com.vaadin.ui

Examples of com.vaadin.ui.CustomLayout


    @Override
    public void init() {
        LegacyWindow w = new LegacyWindow("main window");

        String customlayout = "<div location=\"test\"></div>";
        CustomLayout cl = null;
        try {
            cl = new CustomLayout(new ByteArrayInputStream(
                    customlayout.getBytes()));
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        cl.setWidth("100%");
        w.setContent(cl);

        // VerticalLayout ol = new VerticalLayout();
        // w.setContent(ol);
        VerticalLayout hugeLayout = new VerticalLayout();
        hugeLayout.setMargin(true);
        hugeLayout.setSpacing(true);
        for (int i = 0; i < 30; i++) {
            hugeLayout.addComponent(new Label("huge " + i));
        }
        cl.addComponent(hugeLayout, "test");
        // ol.addComponent(hugeLayout);
        setMainWindow(w);
    }
View Full Code Here


        URL url = getURL();
        main.addComponent(new Label(
                "Icon is built by servlet with a slow method, so it will show the bug (components not firing requestLayout)."));

        try {
            CustomLayout cl = new CustomLayout(
                    new ByteArrayInputStream(
                            ("This is an empty CustomLayout with as slow image. <img src=\""
                                    + url.toString() + "/icon.png\" />")
                                    .getBytes()));
            main.addComponent(cl);

            cl = new CustomLayout(
                    new ByteArrayInputStream(
                            ("This is an empty CustomLayout with as slow image. <img src=\""
                                    + url.toString() + "/icon.png\" />")
                                    .getBytes()));
            main.addComponent(cl);
View Full Code Here

    @Override
    public void init() {
        LegacyWindow w = new LegacyWindow(getClass().getSimpleName());
        setMainWindow(w);
        setTheme("tests-tickets");
        CustomLayout l;

        // WebApplicationContext wac = ((WebApplicationContext) getContext());
        // File f = new File(wac.getBaseDirectory().getAbsoluteFile()
        // + "/VAADIN/themes/" + getTheme() + "/layouts/Ticket2022.html");

        l = new CustomLayout("Ticket2022");
        // try {
        // l = new CustomLayout(new FileInputStream(f));
        w.setContent(l);
        // } catch (FileNotFoundException e) {
        // // TODO Auto-generated catch block
View Full Code Here

    @Override
    public void init() {
        LegacyWindow w = new LegacyWindow(getClass().getSimpleName());
        setMainWindow(w);
        setTheme("tests-tickets");
        CustomLayout cl = new CustomLayout("Ticket2296");
        cl.setSizeFull();
        Button b = new Button("100%x100% button");
        b.setSizeFull();
        cl.addComponent(b, "button1");

        b = new Button("100%x100% button");
        b.setSizeFull();
        cl.addComponent(b, "button2");

        b = new Button("50%x50% button");
        b.setWidth("50%");
        b.setHeight("50%");
        cl.addComponent(b, "button3");

        w.setContent(cl);
    }
View Full Code Here

        final LegacyWindow main = new LegacyWindow("#1775");
        setMainWindow(main);
        setTheme("tests-tickets");
        String layoutName = "Ticket1775";
        final CustomLayout layout = new CustomLayout(layoutName);

        main.addComponent(layout);

        Button button2 = new Button("Populate content");
        main.addComponent(button2);

        final Button button = new Button("Change content");
        main.addComponent(button);

        button2.addListener(new Button.ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                Label mainComponent = new Label("Main");
                Label header = new Label("Header");
                final Label anotherComponent = new Label("another");
                layout.addComponent(mainComponent, "body");
                layout.addComponent(header, "loginUser");
                button.addListener(new Button.ClickListener() {
                    @Override
                    public void buttonClick(Button.ClickEvent event) {
                        layout.addComponent(anotherComponent, "body");
                        layout.removeComponent("loginUser");
                    }
                });

            }
        });
View Full Code Here

    }

    private void createUI(GridLayout layout) {
        String s = "<b>Blah</b><input type=\"text\" value='Lorem\" ipsum'/>";
        try {
            cl1 = new CustomLayout(new ByteArrayInputStream(s.getBytes()));
            layout.addComponent(cl1);

            layout.addComponent(new Button("Disable/Enable",
                    new ClickListener() {

                        @Override
                        public void buttonClick(ClickEvent event) {
                            boolean e = cl1.isEnabled();

                            cl1.setEnabled(!e);
                            cl2.setEnabled(!e);
                        }

                    }));
            File baseDir = VaadinService.getCurrent().getBaseDirectory()
                    .getAbsoluteFile();
            File f = new File(baseDir + "/VAADIN/themes/" + getTheme()
                    + "/layouts/Ticket1975.html");

            cl2 = new CustomLayout(new FileInputStream(f));
            layout.addComponent(cl2);

        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
View Full Code Here

        // set the application to use example -theme
        setTheme("tests-components");

        // Create custom layout, themes/example/layout/mainLayout.html
        mainLayout = new CustomLayout("mainLayout");
        // wrap custom layout inside a panel
        VerticalLayout customLayoutPanelLayout = new VerticalLayout();
        customLayoutPanelLayout.setMargin(true);
        final Panel customLayoutPanel = new Panel(
                "Panel containing custom layout (mainLayout.html)",
View Full Code Here

     *
     */
    public void setBody(String customLayout) {
        VerticalLayout bodyLayout = new VerticalLayout();
        bodyLayout.setMargin(true);
        bodyLayout.addComponent(new CustomLayout(customLayout));
        bodyPanel.setContent(bodyLayout);
        bodyPanel.setCaption(customLayout + ".html");
    }
View Full Code Here

        // Create custom layout
        VerticalLayout panelCLayout = new VerticalLayout();
        panelCLayout.setMargin(true);
        final Panel panelC = new Panel("Custom layout with style exampleStyle",
                panelCLayout);
        final CustomLayout layoutC = new CustomLayout("exampleStyle");
        // Add 4 random components
        fillLayout(layoutC, componentCountD);
        // Add layout to panel
        panelCLayout.addComponent(layoutC);
View Full Code Here

            builder.append('a');
        }
        byte[] bytes = builder.toString().getBytes(Charset.forName("UTF-8"));
        ByteArrayInputStream inputStream = new ByteArrayInputStream(bytes);
        InputStreamImpl stream = new InputStreamImpl(inputStream, buffer / 2);
        new CustomLayout(stream);

        Assert.assertTrue("Stream is not closed in CustomLayout CTOR ",
                stream.isClosed());
        Assert.assertEquals("Number of read bytes is incorrect", bytes.length,
                stream.getCount());
View Full Code Here

TOP

Related Classes of com.vaadin.ui.CustomLayout

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.