Package com.vaadin.ui

Examples of com.vaadin.ui.HorizontalLayout


        private static final int LAST = 1;
        private Button up;
        private Button down;

        MyComponent(String name) {
            HorizontalLayout ol = new HorizontalLayout();
            ol.setId(name.replaceAll(" ", ""));
            ol.addComponent(new Label(name));
            up = new Button("up");
            up.addListener(new Button.ClickListener() {
                @Override
                public void buttonClick(ClickEvent event) {
                    int newIndex = order.indexOf(MyComponent.this) - 1;
                    MyComponent old = order.get(newIndex);
                    main.replaceComponent(old, MyComponent.this);
                    order.remove(MyComponent.this);
                    order.add(newIndex, MyComponent.this);
                    if (newIndex == 0) {
                        MyComponent.this.setMode(FIRST);
                    } else {
                        MyComponent.this.setMode(69);
                    }
                }
            });
            ol.addComponent(up);

            down = new Button("down");
            down.addListener(new Button.ClickListener() {
                @Override
                public void buttonClick(ClickEvent event) {
                    int newIndex = order.indexOf(MyComponent.this) + 1;
                    MyComponent old = order.get(newIndex);
                    main.replaceComponent(old, MyComponent.this);
                    order.remove(MyComponent.this);
                    order.add(newIndex, MyComponent.this);
                    if (newIndex == order.size() - 1) {
                        MyComponent.this.setMode(LAST);
                    } else {
                        MyComponent.this.setMode(69);
                    }
                }
            });
            ol.addComponent(down);

            setCompositionRoot(ol);

        }
View Full Code Here


        // Create horizontal ordered layout
        VerticalLayout panelALayout = new VerticalLayout();
        panelALayout.setMargin(true);
        final Panel panelA = new Panel(
                "Panel containing horizontal ordered layout", panelALayout);
        HorizontalLayout layoutA = new HorizontalLayout();
        // Add 4 random components
        fillLayout(layoutA, componentCountA);
        // Add layout to panel
        panelALayout.addComponent(layoutA);

        // Create vertical ordered layout
        VerticalLayout panelBLayout = new VerticalLayout();
        panelBLayout.setMargin(true);
        final Panel panelB = new Panel(
                "Panel containing vertical ordered layout", panelBLayout);
        VerticalLayout layoutB = new VerticalLayout();
        // Add 4 random components
        fillLayout(layoutB, componentCountB);
        // Add layout to panel
        panelBLayout.addComponent(layoutB);

        // Create grid layout
        final int gridSize = (int) java.lang.Math.sqrt(componentCountC);
        VerticalLayout panelGLayout = new VerticalLayout();
        panelGLayout.setMargin(true);
        final Panel panelG = new Panel("Panel containing grid layout ("
                + gridSize + " x " + gridSize + ")", panelGLayout);
        GridLayout layoutG = new GridLayout(gridSize, gridSize);
        // Add 12 random components
        fillLayout(layoutG, componentCountC);
        // Add layout to panel
        panelGLayout.addComponent(layoutG);

        // Create TabSheet
        final TabSheet tabsheet = new TabSheet();
        tabsheet.setCaption("Tabsheet, above layouts are added to this component");
        layoutA = new HorizontalLayout();
        // Add 4 random components
        fillLayout(layoutA, componentCountA);
        tabsheet.addTab(layoutA, "Horizontal ordered layout", null);
        layoutB = new VerticalLayout();
        // Add 4 random components
View Full Code Here

        addComponent(withParametersButton);
    }

    public void addComponents(List<Class<? extends Component>> components,
            String URL) {
        final HorizontalLayout hl = new HorizontalLayout();
        for (Class<? extends Component> cls : components) {
            try {
                AbstractComponent c = (AbstractComponent) cls.newInstance();
                c.setId(cls.getName());
                c.setCaption(cls.getName());
                c.setDescription(URL);
                c.setWidth("100px");
                c.setHeight("100px");
                hl.addComponent(c);

                new BrowserWindowOpener(URL).extend(c);

                if (c instanceof Button) {
                    ((Button) c).addClickListener(new ClickListener() {
View Full Code Here

@Theme("tests-responsive")
public class ResponsiveLayoutUpdate extends AbstractTestUI {

    @Override
    protected void setup(VaadinRequest request) {
        HorizontalLayout layout = new HorizontalLayout();
        layout.addStyleName("layout-update");
        layout.setWidth("100%");
        setContent(layout);
        Responsive.makeResponsive(layout);

        Label label = new Label(
                "This label changes its size between the breakpoints, allowing more space for the adjacent component.");
        label.addStyleName("change-width");
        label.setSizeUndefined();
        layout.addComponent(label);

        Panel panel = new Panel("Panel");
        panel.setContent(new Label(
                "This Panel should be maximized in both breakpoints."));
        panel.setSizeFull();
        layout.addComponent(panel);
        layout.setExpandRatio(panel, 1);
    }
View Full Code Here

        }
        return t;
    }

    public Component createTestBench(Tree t) {
        final HorizontalLayout ol = new HorizontalLayout();

        ol.addComponent(t);

        final VerticalLayout statusLayout = new VerticalLayout();
        statusLayout.setMargin(true);
        final Panel status = new Panel("Events", statusLayout);
        final Button clear = new Button("c");
        clear.addClickListener(new ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                statusLayout.removeAllComponents();
                statusLayout.addComponent(clear);
            }
        });
        statusLayout.addComponent(clear);

        status.setHeight("300px");
        status.setWidth("400px");

        ol.addComponent(status);

        t.addListener(new Listener() {
            @Override
            public void componentEvent(Event event) {
                statusLayout
View Full Code Here

    @Override
    protected void setUp() throws Exception {
        super.setUp();

        olayout = new HorizontalLayout();
        olayout.addComponentAttachListener(new MyAttachListener());
        olayout.addComponentDetachListener(new MyDetachListener());

        gridlayout = new GridLayout();
        gridlayout.addComponentAttachListener(new MyAttachListener());
View Full Code Here

        ttc.setMaxWidth(350);
        ttc.setOpenDelay(200);
        ttc.setCloseTimeout(200);
        ttc.setQuickOpenDelay(1000);
        ttc.setQuickOpenTimeout(1000);
        HorizontalLayout layout = new HorizontalLayout();
        layout.addComponent(makeButton("first"));
        layout.addComponent(makeButton("second"));
        addComponent(layout);

    }
View Full Code Here

            form.setImmediate(true);
            // this is critical for the problem to occur
            form.setBuffered(true);

            HorizontalLayout footer = new HorizontalLayout();
            footer.setSpacing(true);
            form.setFooter(footer);
            Button saveButton = new Button("Save");
            footer.addComponent(saveButton);

            // make saving the form the default action on Enter keypress
            saveButton.setClickShortcut(KeyCode.ENTER);

            table.addListener(new ValueChangeListener() {
View Full Code Here

                changeLayout(switchToFormsButton, formLayout);
            }

        });

        HorizontalLayout buttonLayout = new HorizontalLayout();
        buttonLayout.addComponent(switchToOrderedButton);
        buttonLayout.addComponent(switchToGridButton);
        buttonLayout.addComponent(switchToFormsButton);

        mainLayout.addComponent(buttonLayout);
        mainLayout.addComponent(orderedLayout);
        // w.setContent(orderedLayout);
    }
View Full Code Here

    private HorizontalLayout loginFormLayout;
    protected LoginForm loginForm;

    @Override
    protected void setup() {
        loginFormLayout = new HorizontalLayout();

        loginForm = new LoginForm();
        loginForm.setSizeUndefined();

        updateCaption();
View Full Code Here

TOP

Related Classes of com.vaadin.ui.HorizontalLayout

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.