@@ -0,0 +1,3332 @@
+package org.vaadin.johannesd.vquery.demo;%0A%0Aimport static org.vaadin.johannesd.vquery.VQuery.$;%0A%0Aimport javax.servlet.annotation.WebServlet;%0A%0Aimport com.vaadin.annotations.VaadinServletConfiguration;%0Aimport com.vaadin.server.VaadinRequest;%0Aimport com.vaadin.server.VaadinServlet;%0Aimport com.vaadin.ui.Button;%0Aimport com.vaadin.ui.Button.ClickEvent;%0Aimport com.vaadin.ui.Component;%0Aimport com.vaadin.ui.GridLayout;%0Aimport com.vaadin.ui.Label;%0Aimport com.vaadin.ui.Panel;%0Aimport com.vaadin.ui.Slider;%0Aimport com.vaadin.ui.TextField;%0Aimport com.vaadin.ui.UI;%0Aimport com.vaadin.ui.VerticalLayout;%0A%0A/**%0A * Main UI class%0A */%0A@SuppressWarnings(%22serial%22)%0Apublic class VQueryDemoUI extends UI %7B%0A%09%0A%09@WebServlet(%22/*%22)%0A%09@VaadinServletConfiguration(productionMode=false, ui = VQueryDemoUI.class)%0A%09public static class DemoServlet extends VaadinServlet %7B%0A%09%7D%0A%0A    @Override%0A    protected void init(VaadinRequest request) %7B%0A        getPage().getStyles().add(%0A                %22.my-style %7B background-color: #FBA !important; %7D%22);%0A        getPage().getStyles().add(%0A                %22.my-style-2 %7B outline: 2px dotted #235 !important; %7D%22);%0A%0A        GridLayout layout = new GridLayout(3, 1);%0A        layout.setSizeFull();%0A        layout.setSpacing(true);%0A        layout.setMargin(true);%0A        setContent(layout);%0A%0A        layout.addComponent(new Button(%22Add my-style-2 to leaf components%22,%0A                new Button.ClickListener() %7B%0A                    @Override%0A                    public void buttonClick(ClickEvent event) %7B%0A                        $().isLeaf(true).addStyleName(%22my-style-2%22);%0A%0A                    %7D%0A                %7D));%0A        layout.addComponent(new Button(%22Disable buttons 4..7%22,%0A                new Button.ClickListener() %7B%0A                    @Override%0A                    public void buttonClick(ClickEvent event) %7B%0A                        $().is(Button.class).slice(4, 8).setEnabled(false);%0A                    %7D%0A                %7D));%0A        layout.addComponent(new Button(%0A                %22Add my-style to components that have labels and whose index is 2 or 3%22,%0A                new Button.ClickListener() %7B%0A                    @Override%0A                    public void buttonClick(ClickEvent event) %7B%0A                        $().is(Label.class).parent().slice(2, 4)%0A                                .addStyleName(%22my-style%22);%0A                    %7D%0A                %7D));%0A%0A        for (int i = 0; i %3C 9; ++i) %7B%0A            layout.addComponent(test());%0A        %7D%0A    %7D%0A%0A    private Component test() %7B%0A        VerticalLayout l = new VerticalLayout();%0A        l.setSpacing(true);%0A        l.setMargin(true);%0A        Panel p = new Panel(l);%0A        p.setSizeFull();%0A%0A        for (int i = 0; i %3C 5; ++i) %7B%0A            Component c = null;%0A            int n = (int) (Math.random() * 4);%0A            switch (n) %7B%0A            case 0:%0A                c = new Button(%22bar%22);%0A                break;%0A            case 1:%0A                c = new TextField();%0A                break;%0A            case 2:%0A                c = new Slider();%0A                c.setWidth(%22100px%22);%0A                break;%0A            case 3:%0A                c = new Label(%22foo%22);%0A                break;%0A            case 4:%0A                break;%0A            case 5:%0A                break;%0A            %7D%0A            l.addComponent(c);%0A        %7D%0A        return p;%0A    %7D%0A%7D

Add a simple demo application