Example usage for com.vaadin.ui AbstractLayout addComponent

List of usage examples for com.vaadin.ui AbstractLayout addComponent

Introduction

In this page you can find the example usage for com.vaadin.ui AbstractLayout addComponent.

Prototype

@Override
public void addComponent(Component c) 

Source Link

Document

This only implements the events and component parent calls.

Usage

From source file:com.haulmont.cuba.web.app.folders.CubaFoldersPane.java

License:Apache License

protected Component addFoldersLabel(AbstractLayout layout, Label label) {
    HorizontalLayout l = new HorizontalLayout();
    l.setMargin(new MarginInfo(false, true, false, true));
    l.addComponent(label);/*  w ww.  j a  v  a2s . co m*/
    l.setWidth("100%");
    layout.addComponent(l);
    return l;
}

From source file:com.mcparland.john.DragAndDropPanel.java

License:Apache License

/**
 * Create a drag-and-droppable layout.//  w w w .  j  a v a  2 s. com
 * 
 * @param layout
 *            the layout.
 * @return a drag-and-droppable layout.
 */
private Component createLayout(final AbstractLayout layout) {
    layout.addComponent(createButton("One"));
    layout.addComponent(createButton("Two"));
    layout.addComponent(createButton("Three"));
    layout.addComponent(createButton("Four"));

    final DragAndDropWrapper dndWrapper = new DragAndDropWrapper(layout);
    dndWrapper.setSizeFull();
    dndWrapper.setDropHandler(new DropHandler() {

        /*
         * (non-Javadoc)
         * 
         * @see com.vaadin.event.dd.DropHandler#getAcceptCriterion()
         */
        public AcceptCriterion getAcceptCriterion() {
            return AcceptAll.get();
        }

        /*
         * (non-Javadoc)
         * 
         * @see com.vaadin.event.dd.DropHandler#drop(com.vaadin.event.dd.
         * DragAndDropEvent)
         */
        public void drop(DragAndDropEvent event) {
            WrapperTransferable t = (WrapperTransferable) event.getTransferable();
            layout.addComponent(t.getSourceComponent());
        }
    });

    return dndWrapper;
}

From source file:de.symeda.sormas.ui.caze.CaseInfoLayout.java

License:Open Source License

private static Label addDescLabel(AbstractLayout layout, Object content, String caption) {
    String contentString = content != null ? content.toString() : "";
    Label label = new Label(contentString);
    label.setCaption(caption);//  w  w w.  j  av a 2s.c o  m
    layout.addComponent(label);
    return label;
}

From source file:dk.apaq.vaadin.addon.printservice.RemotePrintServiceManager.java

License:Open Source License

private static RemotePrintServiceManager createManager(AbstractLayout app) {
    //Window mainWindow = app.getMainWindow();
    //if(mainWindow == null) {
    //    throw new NullPointerException("Application must have a main window set before adding a Print Manager can be created.");
    //}//from   ww  w .j  av  a2  s  .c om

    //look for already added browsercookies

    Iterator<Component> it = app.getComponentIterator();
    while (it.hasNext()) {
        Component c = it.next();
        if (c instanceof RemotePrintServiceManager) {
            return (RemotePrintServiceManager) c;
        }
    }

    //...else create and add a new one.
    PrintServiceApplet applet = new PrintServiceApplet();
    RemotePrintServiceManager manager = new RemotePrintServiceManager(applet);
    applet.setManager(manager);

    app.addComponent(manager);
    return manager;
}

From source file:edu.nps.moves.mmowgli.modules.actionplans.ActionDashboardTabActionPlans.java

License:Open Source License

public void initGuiTL() {
    AbstractLayout leftLay = getLeftLayout();

    flowLay = new VerticalLayout();
    flowLay.setWidth("100%");
    leftLay.addComponent(flowLay); //, "top:0px;left:0px");
    flowLay.addStyleName("m-padding15");
    flowLay.setSpacing(true);//from  w  w  w  . ja v  a2s. c o  m

    Label titleLab = new Label("All Plans");
    flowLay.addComponent(titleLab);
    flowLay.setComponentAlignment(titleLab, Alignment.TOP_LEFT);
    titleLab.addStyleName("m-actionplan-mission-title-text");

    Label contentLab = new Label("The Action Plans tab displays a list of all action plans in the game.");
    flowLay.addComponent(contentLab);
    flowLay.setComponentAlignment(contentLab, Alignment.TOP_LEFT);
    flowLay.addStyleName("m-actionplan-mission-content-text");

    Button requestActionPlanButt = new IDButton("Action Plan Request", ACTIONPLANREQUESTCLICK);
    requestActionPlanButt.setStyleName(BaseTheme.BUTTON_LINK);
    requestActionPlanButt.setDescription("Open a page where you can submit a request to create an action plan");
    flowLay.addComponent(requestActionPlanButt);

    AbsoluteLayout rightLay = getRightLayout();
    flowLay = new VerticalLayout();
    rightLay.addComponent(flowLay, "top:0px;left:0px");
    flowLay.setSpacing(true);
    flowLay.setStyleName("m-actionplan-plan-rightside"); // set the style name so the css's below can use it (e.g.: .m-actionplan-plan-rightside
                                                         // .m-actionplan-plan-headling { blah:blah;} )

    loadTableTL();
}

From source file:edu.nps.moves.mmowgli.modules.actionplans.ActionDashboardTabMyPlans.java

License:Open Source License

public void initGuiTL() {
    AbstractLayout leftLay = getLeftLayout();

    flowLay = new VerticalLayout();
    flowLay.setWidth("100%");
    flowLay.addStyleName("m-padding15");
    leftLay.addComponent(flowLay); //, "top:0px;left:0px");
    flowLay.setSpacing(true);/*  w  ww.  jav  a2 s . c  o  m*/

    Label titleLab = new Label("My Plans");
    flowLay.addComponent(titleLab);
    flowLay.setComponentAlignment(titleLab, Alignment.TOP_LEFT);
    titleLab.addStyleName("m-actionplan-mission-title-text");

    Label contentLab = new Label("Choose a link below to display the filtered list of your choice.");
    flowLay.addComponent(contentLab);
    flowLay.setComponentAlignment(contentLab, Alignment.TOP_LEFT);
    flowLay.addStyleName("m-actionplan-mission-content-text");

    Label lab;
    flowLay.addComponent(lab = new Label());
    lab.setHeight("25px");

    Button myPlansButt = new Button("My Plans");
    //myPlansButt.setStyleName(BaseTheme.BUTTON_LINK);
    //flowLay.addComponent(myPlansButt);

    Button requestActionPlanButt = new IDButton("Request Action Plan Authorship", ACTIONPLANREQUESTCLICK);
    requestActionPlanButt.setStyleName(BaseTheme.BUTTON_LINK);
    requestActionPlanButt
            .setDescription("Open a page where you can submit a request to be an action plan author");
    flowLay.addComponent(requestActionPlanButt);

    // Note for the above button request
    flowLay.addComponent(new Label("(appears in another browser tab)"));

    ClickListener firstLis;
    myPlansButt.addClickListener(firstLis = new ButtListener2(buildMyPlansFilter(), null)); // @HibernateUserRead

    AbsoluteLayout rightLay = getRightLayout();

    flowLay = new VerticalLayout();
    rightLay.addComponent(flowLay, "top:0px;left:0px");
    flowLay.setSpacing(true);
    flowLay.setStyleName("m-actionplan-plan-rightside"); // set the style name so the css's below can use it (e.g.: .m-actionplan-plan-rightside
                                                         // .m-actionplan-plan-heading { blah:blah;} )

    firstLis.buttonClick(null); // loads the table
}

From source file:edu.nps.moves.mmowgli.modules.actionplans.ActionDashboardTabNeedAuthors.java

License:Open Source License

public void initGuiTL() {
    AbstractLayout leftLay = getLeftLayout();

    flowLay = new VerticalLayout();
    flowLay.setWidth("100%");
    flowLay.addStyleName("m-padding15");
    leftLay.addComponent(flowLay); //, "top:0px;left:0px");
    flowLay.setSpacing(true);//  ww w.j  a v a  2 s.  co  m

    Label titleLab = new Label("Action Plans needing Authors");
    flowLay.addComponent(titleLab);
    flowLay.setComponentAlignment(titleLab, Alignment.TOP_LEFT);
    titleLab.addStyleName("m-actionplan-mission-title-text");

    Label contentLab = new Label("You may sign up for authorship in any of these plans.");
    flowLay.addComponent(contentLab);
    flowLay.setComponentAlignment(contentLab, Alignment.TOP_LEFT);
    flowLay.addStyleName("m-actionplan-mission-content-text");

    Button requestActionPlanButt = new IDButton("Action Plan Request", ACTIONPLANREQUESTCLICK);
    requestActionPlanButt.setStyleName(BaseTheme.BUTTON_LINK);
    requestActionPlanButt
            .setDescription("Open a page where you can submit a request to be an action plan author");
    flowLay.addComponent(requestActionPlanButt);

    AbsoluteLayout rightLay = getRightLayout();

    flowLay = new VerticalLayout();
    rightLay.addComponent(flowLay, "top:0px;left:0px");
    flowLay.setSpacing(true);
    flowLay.setStyleName("m-actionplan-plan-rightside"); // set the style name so the css's below can use it (e.g.: .m-actionplan-plan-rightside
                                                         // .m-actionplan-plan-headling { blah:blah;} )

    loadTableTL();
}

From source file:fi.semantum.strategia.Utils.java

License:Open Source License

public static void fillTagEditor(final Database database, final AbstractLayout layout, final List<String> tags,
        final boolean allowRemove) {

    layout.removeAllComponents();/*w  ww . j  a va 2s  . c o  m*/

    for (int i = 0; i < tags.size(); i++) {

        String tag = tags.get(i);

        HorizontalLayout hl = new HorizontalLayout();

        if (allowRemove) {
            final int index = i;
            Button b = new Button();
            b.addStyleName(ValoTheme.BUTTON_BORDERLESS);
            b.setIcon(FontAwesome.TIMES_CIRCLE);
            b.addClickListener(new ClickListener() {

                private static final long serialVersionUID = -4473258383318654850L;

                @Override
                public void buttonClick(ClickEvent event) {
                    tags.remove(index);
                    fillTagEditor(database, layout, tags, allowRemove);
                }
            });
            hl.addComponent(b);
        }

        Button tagButton = tagButton(database, "dialog", tag, i);
        hl.addComponent(tagButton);
        hl.setComponentAlignment(tagButton, Alignment.MIDDLE_LEFT);

        layout.addComponent(hl);

    }

}

From source file:org.semanticsoft.vaaclipse.presentation.renderers.ToolBarRenderer.java

License:Open Source License

@Override
public void createWidget(MUIElement element, MElementContainer<MUIElement> parent) {
    if (!(element instanceof MToolBar)) {
        return;// w ww .ja va2  s  . c om
    }

    MToolBar toolbarModel = (MToolBar) element;
    processContribution(toolbarModel);

    AbstractLayout toolBarWidget;

    if ((MElementContainer<?>) toolbarModel.getParent() instanceof MTrimBar) {
        MTrimBar parentTrimBar = (MTrimBar) (MElementContainer<?>) toolbarModel.getParent();
        int orientation = parentTrimBar.getSide().getValue();

        if (orientation == SideValue.TOP_VALUE || orientation == SideValue.BOTTOM_VALUE) {
            toolBarWidget = new HorizontalLayout() {
                @Override
                public void addComponent(Component c) {
                    if (!c.getStyleName().contains("horizontalseparator"))
                        c.addStyleName("horizontaltoolbarlement");
                    super.addComponent(c);
                }

                @Override
                public void addComponent(Component c, int index) {
                    if (!c.getStyleName().contains("horizontalseparator"))
                        c.addStyleName("horizontaltoolbarlement");
                    super.addComponent(c, index);
                }
            };
            toolBarWidget.addStyleName("horizontaltoolbar");
        } else {
            toolBarWidget = new VerticalLayout() {
                @Override
                public void addComponent(Component c) {
                    if (!c.getStyleName().contains("verticalseparator"))
                        c.addStyleName("verticaltoolbarlement");
                    super.addComponent(c);
                }

                @Override
                public void addComponent(Component c, int index) {
                    if (!c.getStyleName().contains("verticalseparator"))
                        c.addStyleName("verticaltoolbarlement");
                    super.addComponent(c, index);
                }
            };
            toolBarWidget.addStyleName("verticaltoolbar");
        }

        Component separator = GuiUtils.createSeparator(toolbarModel);
        if (separator != null)
            toolBarWidget.addComponent(separator);
    } else
        toolBarWidget = new HorizontalLayout();

    toolBarWidget.setSizeUndefined();
    toolBarWidget.addStyleName("toolbar");

    for (String css : toolbarModel.getTags()) {
        toolBarWidget.addStyleName(css);
    }

    element.setWidget(toolBarWidget);
}

From source file:org.semanticsoft.vaaclipse.presentation.renderers.ToolBarRenderer.java

License:Open Source License

@Override
public void processContents(final MElementContainer<MUIElement> container) {
    MToolBar toolBar = (MToolBar) (MElementContainer<?>) container;
    AbstractLayout toolBarWidget = (AbstractLayout) container.getWidget();
    if (toolBarWidget != null) {
        for (MUIElement element : container.getChildren()) {
            if (element instanceof MHandledToolItem || element instanceof MDirectToolItem) {
                toolBarWidget.addComponent((Component) element.getWidget());
            } else if (element instanceof MToolBarSeparator) {
                toolBarWidget.addComponent(GuiUtils.createSeparator(toolBar));
            }//from   www .  ja  v  a 2 s  .co  m
        }
    }
}