Package com.vaadin.ui

Examples of com.vaadin.ui.AbstractLayout


    }

    protected AbstractLayout createLabelsFields(
            Class<? extends AbstractComponent> compType, boolean useIcon,
            String ErrorMessage) {
        AbstractLayout mainLayout = new VerticalLayout();
        AbstractLayout curLayout = null;
        try {
            curLayout = layoutClass.newInstance();
        } catch (InstantiationException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        } catch (IllegalAccessException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        }
        final Component[] components = new Component[CAPTIONS.length];

        for (int i = 0; i < components.length; i++) {
            AbstractComponent comp = null;
            try {
                comp = compType.newInstance();
            } catch (InstantiationException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (IllegalAccessException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            components[i] = comp;
            comp.setCaption(CAPTIONS[i]);
            if (useIcon) {
                comp.setIcon(ICONS[i]);
            }
            if (ErrorMessage != null) {
                if (ErrorMessage.length() == 0) {
                    comp.setComponentError(new UserError(null));
                } else {
                    comp.setComponentError(new UserError(ErrorMessage));
                }
            }
            // if component is a tab sheet add two tabs for it
            if (comp instanceof TabSheet) {
                comp.setSizeUndefined();
                TabSheet tab = (TabSheet) comp;
                tab.addTab(new UndefWideLabel("TAB1"), "TAB1",
                        new ThemeResource(GLOBE_16_PNG));
                tab.addTab(new UndefWideLabel("TAB2"), "TAB2", null);
            }
            curLayout.addComponent(comp);
            mainLayout.addComponent(curLayout);
        }
        return mainLayout;
    }
View Full Code Here


public class MarginsInLabels extends AbstractTestUI {

    @Override
    protected void setup(VaadinRequest request) {
        AbstractLayout layout = new VerticalLayout();
        layout.addComponent(new Label("<h1>Vertical layout</h1>",
                ContentMode.HTML));
        layout.addComponent(new Label("Next row"));
        addComponent(layout);

        layout = new GridLayout(1, 2);
        layout.setWidth("100%");
        layout.addComponent(new Label("<h1>Grid layout</h1>", ContentMode.HTML));
        layout.addComponent(new Label("Next row"));
        addComponent(layout);

        TabSheet tabSheet = new TabSheet();
        tabSheet.addTab(new Label("<h1>Tabsheet</h1>", ContentMode.HTML),
                "Label");
View Full Code Here

TOP

Related Classes of com.vaadin.ui.AbstractLayout

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.