Examples of CssLayout


Examples of com.vaadin.ui.CssLayout

        dragAndDropWrapper.setDragStartMode(DragStartMode.WRAPPER);
        dragAndDropWrapper.setWidth("100px");
        dragAndDropWrapper.setHeight("100px");
        getLayout().addComponent(dragAndDropWrapper);

        final CssLayout cssLayout = new CssLayout();
        cssLayout.setHeight("300px");

        dragAndDropWrapper2 = new DragAndDropWrapper(cssLayout);
        dragAndDropWrapper2
                .setCaption("Drop here or sort with dd (wrapper(csslayout(n*wrapper(label))))");

        dh = new DropHandler() {

            @Override
            public AcceptCriterion getAcceptCriterion() {
                return AcceptAll.get();
            }

            @Override
            public void drop(DragAndDropEvent dropEvent) {

                /*
                 * TODO wrap componentns in wrappers (so we can build reordering
                 * here)
                 */

                if (dropEvent.getTransferable() instanceof WrapperTransferable) {
                    WrapperTransferable transferable = (WrapperTransferable) dropEvent
                            .getTransferable();
                    Component sourceComponent = transferable
                            .getSourceComponent();

                    Component draggedComponent = transferable
                            .getDraggedComponent();

                    DropTarget target = dropEvent.getTargetDetails()
                            .getTarget();

                    WrappedLabel wrappedLabel = new WrappedLabel(
                            draggedComponent.toString());
                    if (target instanceof WrappedLabel) {
                        int i = 1; // add next to reference by default
                        Iterator<Component> componentIterator = cssLayout
                                .getComponentIterator();
                        Component next = componentIterator.next();
                        while (next != target && componentIterator.hasNext()) {
                            if (next != sourceComponent) {
                                // don't count on index if component is being
                                // moved
                                i++;
                            }
                            next = componentIterator.next();
                        }

                        if (sourceComponent instanceof WrappedLabel) {
                            cssLayout.removeComponent(sourceComponent);
                            wrappedLabel = (WrappedLabel) sourceComponent;
                        }
                        if (dropEvent.getTargetDetails()
                                .getData("verticalLocation").equals("TOP")) {
                            // before reference if dropped on topmost part
                            i--;
                            if (i < 0) {
                                i = 0;
                            }
                        }
                        cssLayout.addComponent(wrappedLabel, i);

                    } else {
                        cssLayout.addComponent(wrappedLabel);
                    }

                } else {
                    // no component, add label with "Text"

                    String data = (String) dropEvent.getTransferable().getData(
                            "text/plain");
                    if (data == null || "".equals(data)) {
                        data = "-- no Text --";
                    }
                    cssLayout.addComponent(new WrappedLabel(data));

                }

            }
        };
View Full Code Here

Examples of com.vaadin.ui.CssLayout

            getUI().getNavigator().navigateTo(NAME);
        }
    });

    public SimpleLoginMainView() {
        setCompositionRoot(new CssLayout(text, logout));
    }
View Full Code Here

Examples of com.vaadin.ui.CssLayout

        Label l = new Label(
                "This green label should consume all available space, pushing ok button to bottom of the view");
        l.setSizeFull();

        CssLayout lo = new CssLayout() {
            @Override
            protected String getCss(Component c) {
                return "background: green;color:red;";
            }
        };
        lo.setSizeFull();

        f.setLayout(lo);
        lo.addComponent(l);

        f.getFooter().addComponent(new Button("OK button"));

        getLayout().setSizeFull();
        getLayout().addComponent(f);
View Full Code Here

Examples of com.vaadin.ui.CssLayout

        return al;

    }

    private Component createClickableCSSLayout() {
        final CssLayout cl = new CssLayout();
        cl.setCaption("CSSLayout");
        cl.setStyleName("borders");
        cl.setWidth("300px");
        cl.setHeight("500px");
        cl.addComponent(new TextField("This is its caption",
                "This is a textfield"));
        cl.addComponent(new TextField("Another textfield caption",
                "This is another textfield"));

        cl.addComponent(new Button("A button with its own click listener",
                new Button.ClickListener() {

                    @Override
                    public void buttonClick(
                            com.vaadin.ui.Button.ClickEvent event) {
                        log("Button " + event.getButton().getCaption()
                                + " was clicked");

                    }
                }));
        cl.addLayoutClickListener(new LayoutClickListener() {

            @Override
            public void layoutClick(LayoutClickEvent event) {
                logLayoutClick("CSSLayout", event);
            }
View Full Code Here

Examples of com.vaadin.ui.CssLayout

        // get()
        // not converted to thread local

        sp = new HorizontalSplitPanel();
        sp.setSplitPosition(20);
        CssLayout l = new CssLayout();
        sp.setFirstComponent(l);

        tree1 = new Tree("Volume 1");
        tree1.setImmediate(true);

        fs1 = new BeanItemContainer<File>(File.class);
        tree1.setContainerDataSource(fs1);
        for (int i = 0; i < files.length; i++) {
            fs1.addBean(files[i]);
            if (files[i] instanceof Folder) {
                tree1.setChildrenAllowed(files[i], true);
            } else {
                tree1.setChildrenAllowed(files[i], false);
            }
            if (i >= files.length / 2) {
                tree1.setParent(files[i], files[i - files.length / 2]);
            }
        }
        tree1.setItemCaptionPropertyId("name");
        tree1.setItemIconPropertyId("icon");

        tree1.setDragMode(TreeDragMode.NODE);

        DropHandler dropHandler = new DropHandler() {
            @Override
            public AcceptCriterion getAcceptCriterion() {
                return AcceptAll.get();
            }

            @Override
            public void drop(DragAndDropEvent dropEvent) {
                File file = null;
                Folder folder = null;
                TreeTargetDetails dropTargetData = (TreeTargetDetails) dropEvent
                        .getTargetDetails();
                folder = (Folder) dropTargetData.getItemIdInto();
                if (dropEvent.getTransferable() instanceof DataBoundTransferable) {
                    DataBoundTransferable transferable = (DataBoundTransferable) dropEvent
                            .getTransferable();
                    file = (File) transferable.getItemId();
                } else if (dropEvent.getTransferable().getSourceComponent() instanceof FileIcon) {
                    FileIcon draggedIcon = (FileIcon) dropEvent
                            .getTransferable().getSourceComponent();
                    file = draggedIcon.file;

                }
                setParent(file, folder);
            }
        };

        tree1.setDropHandler(dropHandler);

        Handler actionHandler = new Handler() {

            private Action[] actions = new Action[] { new Action("Remove") };

            @Override
            public void handleAction(Action action, Object sender, Object target) {
                ContainerHierarchicalWrapper containerDataSource = (ContainerHierarchicalWrapper) tree1
                        .getContainerDataSource();
                containerDataSource.removeItemRecursively(target);
            }

            @Override
            public Action[] getActions(Object target, Object sender) {
                return actions;
            }
        };
        tree1.addActionHandler(actionHandler);

        tree1.addListener(new Property.ValueChangeListener() {
            @Override
            public void valueChange(ValueChangeEvent event) {
                Object value = event.getProperty().getValue();
                if (value != null && !(value instanceof Folder)) {
                    value = tree1.getParent(value);
                }
                FolderView folderView = FolderView.get((Folder) value);
                sp.setSecondComponent(folderView);
                folderView.reload();
            }
        });

        l.addComponent(tree1);

        sp.setSecondComponent(FolderView.get(null));

        getLayout().setSizeFull();
        getLayout().addComponent(sp);
View Full Code Here

Examples of com.vaadin.ui.CssLayout

        getLayout().setSizeFull();
        final VerticalLayout sp = new VerticalLayout();

        sp.setHeight("100%");

        final CssLayout cssLayout = new CssLayout() {
            @Override
            protected String getCss(Component c) {
                return "background-color: yellow;";
            }
        };
        cssLayout.setSizeFull();
        Label l = new Label("bö");
        l.setSizeFull();
        cssLayout.addComponent(l);

        sp.addComponent(cssLayout);

        Button button = new Button("b");
        button.addListener(new ClickListener() {
View Full Code Here

Examples of com.vaadin.ui.CssLayout

        vl.setComponentError(new UserError("A error message..."));
        vl.addComponent(new Label("Some content"));
        vl.setId("layout" + debugIdCounter++);
        addComponent(vl);

        CssLayout css = new CssLayout();
        css.setCaption("CssLayout");
        css.addComponent(new Label("Some content"));
        css.setId("layout" + debugIdCounter++);
        addComponent(css);

        AbsoluteLayout abs = new AbsoluteLayout();
        abs.setCaption("Abs layout");
        abs.addComponent(new Label("Some content"));
View Full Code Here

Examples of com.vaadin.ui.CssLayout

    static class FileIcon extends DragAndDropWrapper {
        private final File file;
        private CssLayout l;

        public FileIcon(final File file) {
            super(new CssLayout());
            l = (CssLayout) getCompositionRoot();
            setWidth(null);
            l.setWidth(null);
            setDragStartMode(DragStartMode.WRAPPER); // drag all contained
            // components, not just the
View Full Code Here

Examples of com.vaadin.ui.CssLayout

    private Button addMore;

    @Override
    protected void setup() {
        final CssLayout pl = new CssLayout();
        final Panel p = new Panel(pl);
        p.setSizeFull();
        p.setHeight("600px");
        pl.addComponent(foo());
        addMore = new Button("Add");
        addMore.addListener(new ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                pl.removeComponent(addMore);
                pl.addComponent(foo());
                pl.addComponent(addMore);
            }
        });
        pl.addComponent(addMore);
        addComponent(p);
        ((VerticalLayout) getMainWindow().getContent()).setSizeFull();
    }
View Full Code Here

Examples of com.vaadin.ui.CssLayout

        getLayout().getParent().setHeight("4000px");
        getLayout().getParent().setWidth("4000px");
        getLayout().setHeight("4000px");
        getLayout().setWidth("4000px");

        CssLayout layout = new CssLayout();
        layout.setHeight("4000px");
        layout.setWidth("4000px");
        addComponent(layout);

        Label hoverableLabel = new Label("Hover me");
        hoverableLabel.setId("hoverable-label");
        hoverableLabel.setStyleName("hoverable-label");
        hoverableLabel.setWidth("-1px");
        hoverableLabel.setDescription("Tooltip");
        layout.addComponent(hoverableLabel);

        Label hiddenLabel = new Label("Hidden");
        hiddenLabel.setStyleName("hidden-label");
        hiddenLabel.setWidth("-1px");
        layout.addComponent(hiddenLabel);

        getMainWindow().scrollIntoView(hiddenLabel);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.