Example usage for com.vaadin.ui ComponentContainer addComponent

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

Introduction

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

Prototype

public void addComponent(Component c);

Source Link

Document

Adds the component into this container.

Usage

From source file:br.gov.frameworkdemoiselle.vaadin.util.ViewNavigator.java

License:Open Source License

@SuppressWarnings("serial")
private void navigateTo(final ComponentContainer layout, BaseVaadinView component) {
    if (layout == null) {
        throw new RuntimeException(
                "No 'Navigable' was defined. Use @Navigable or navigator.setNavigable() first.");
    }//from  w  w w .  j  a  v  a  2  s .c om
    layout.removeAllComponents();
    layout.addComponent(component);
    beanManager.fireEvent(component, new AnnotationLiteral<BeforeNavigateToView>() {
    });
    stack.push(component);
}

From source file:com.digitallabs.demos.Vaadin6BootstrapThemeDemo.java

License:Apache License

private void typography(ComponentContainer container) {
    for (int i = 1; i <= 6; i++) {
        Label header = new Label("Bootstrap heading <h" + i + ">");
        header.addStyleName(Bootstrap.Typography.valueOf("H" + i).styleName());
        container.addComponent(header);
    }//  w w w.ja v  a 2  s .c  o m

    Label text = new Label(
            "Nullam quis risus eget urna mollis ornare vel eu leo. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nullam id dolor id nibh ultricies vehicula.");
    text.addStyleName(Bootstrap.Typography.BODYCOPY.styleName());
    container.addComponent(text);

    text = new Label(
            "Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec ullamcorper nulla non metus auctor fringilla. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Donec ullamcorper nulla non metus auctor fringilla.");
    text.addStyleName(Bootstrap.Typography.BODYCOPY.styleName());
    container.addComponent(text);

    text = new Label(
            "Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit.");
    text.addStyleName(Bootstrap.Typography.BODYCOPY.styleName());
    container.addComponent(text);

    text = new Label(
            "Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Duis mollis, est non commodo luctus.");
    text.addStyleName(Bootstrap.Typography.LEAD.styleName());
    container.addComponent(text);

    text = new Label(
            "Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit.");
    text.addStyleName(Bootstrap.Typography.SMALL.styleName());
    container.addComponent(text);

    text = new Label("Left aligned text");
    text.addStyleName(Bootstrap.Typography.TEXT_LEFT.styleName());
    container.addComponent(text);

    text = new Label("Center aligned text");
    text.addStyleName(Bootstrap.Typography.TEXT_CENTER.styleName());
    container.addComponent(text);

    text = new Label("Right aligned text");
    text.addStyleName(Bootstrap.Typography.TEXT_RIGHT.styleName());
    container.addComponent(text);

    // Colors

    text = new Label("Muted. Fusce dapibus, tellus ac cursus commodo, tortor mauris nibh.");
    text.addStyleName(Bootstrap.Typography.TEXT_MUTED.styleName());
    container.addComponent(text);

    text = new Label("Primary. Nullam id dolor id nibh ultricies vehicula ut id elit.");
    text.addStyleName(Bootstrap.Typography.TEXT_PRIMARY.styleName());
    container.addComponent(text);

    text = new Label("Warning. Nullam id dolor id nibh ultricies vehicula ut id elit.");
    text.addStyleName(Bootstrap.Typography.TEXT_WARNING.styleName());
    container.addComponent(text);

    text = new Label("Danger. Nullam id dolor id nibh ultricies vehicula ut id elit.");
    text.addStyleName(Bootstrap.Typography.TEXT_DANGER.styleName());
    container.addComponent(text);

    text = new Label("Success. Nullam id dolor id nibh ultricies vehicula ut id elit.");
    text.addStyleName(Bootstrap.Typography.TEXT_SUCCESS.styleName());
    container.addComponent(text);

    text = new Label("Info. Nullam id dolor id nibh ultricies vehicula ut id elit.");
    text.addStyleName(Bootstrap.Typography.TEXT_INFO.styleName());
    container.addComponent(text);
}

From source file:com.digitallabs.demos.Vaadin6BootstrapThemeDemo.java

License:Apache License

private void tables(ComponentContainer container) {
    Table table = getSampleTable("");
    container.addComponent(table);

    table = getSampleTable("Striped");
    table.addStyleName(Bootstrap.Tables.STRIPED.styleName());
    container.addComponent(table);//  w  w w  .  j  a  v a2 s  .c  o  m

    table = getSampleTable("Bordered");
    table.addStyleName(Bootstrap.Tables.BORDERED.styleName());
    container.addComponent(table);

    table = getSampleTable("Hover rows");
    table.addStyleName(Bootstrap.Tables.HOVER.styleName());
    container.addComponent(table);

    table = getSampleTable("Condensed");
    table.addStyleName(Bootstrap.Tables.CONDENSED.styleName());
    container.addComponent(table);
}

From source file:com.digitallabs.demos.Vaadin6BootstrapThemeDemo.java

License:Apache License

private void forms(ComponentContainer container) {
    VerticalLayout form = new VerticalLayout();
    form.addStyleName(Bootstrap.Forms.FORM.styleName());
    form.setSpacing(true);/*from   www .ja  va2  s.  co  m*/
    form.setCaption("Legend");

    TextField email = new TextField("Email address");
    email.setInputPrompt("Enter email");
    form.addComponent(email);

    PasswordField password = new PasswordField("Password");
    password.setInputPrompt("Password");
    form.addComponent(password);

    Upload upload = new Upload("File input", null);
    form.addComponent(upload);

    Label help = new Label("Example block-level help text here.");
    help.addStyleName("help-block");
    form.addComponent(help);

    CheckBox check = new CheckBox("Check me out");
    form.addComponent(check);

    Button submit = new Button("Submit");
    submit.addStyleName(Bootstrap.Buttons.DEFAULT.styleName());
    form.addComponent(submit);

    container.addComponent(form);
}

From source file:com.esofthead.mycollab.mobile.ui.AbstractMobilePresenter.java

License:Open Source License

@Override
protected void onGo(ComponentContainer navigator, ScreenData<?> data) {
    if (navigator instanceof NavigationManager)
        ((NavigationManager) navigator).navigateTo(view.getWidget());
    else {/*from   ww  w  .j av  a 2 s . co m*/
        navigator.removeAllComponents();
        navigator.addComponent(view.getWidget());
    }
}

From source file:com.esofthead.mycollab.module.project.view.bug.ComponentAddPresenter.java

License:Open Source License

@Override
protected void onGo(ComponentContainer container, ScreenData<?> data) {
    if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.COMPONENTS)) {
        com.esofthead.mycollab.module.project.view.bug.ComponentContainer componentContainer = (com.esofthead.mycollab.module.project.view.bug.ComponentContainer) container;
        componentContainer.removeAllComponents();
        componentContainer.addComponent(view.getWidget());

        Component component = (Component) data.getParams();
        view.editItem(component);/*from   w w w .  jav a 2s .c  o m*/

        ProjectBreadcrumb breadcrumb = ViewManager.getCacheComponent(ProjectBreadcrumb.class);

        if (component.getId() == null) {
            breadcrumb.gotoComponentAdd();
        } else {
            breadcrumb.gotoComponentEdit(component);
        }
    } else {
        NotificationUtil.showMessagePermissionAlert();
    }
}

From source file:com.esofthead.mycollab.module.project.view.bug.ComponentListPresenter.java

License:Open Source License

@Override
protected void onGo(com.vaadin.ui.ComponentContainer container, ScreenData<?> data) {
    if (CurrentProjectVariables.canRead(ProjectRolePermissionCollections.COMPONENTS)) {
        ComponentContainer trackerContainer = (ComponentContainer) container;
        trackerContainer.removeAllComponents();
        trackerContainer.addComponent(view.getWidget());

        searchCriteria = (ComponentSearchCriteria) data.getParams();

        int totalCount = componentService.getTotalCount(searchCriteria);

        if (totalCount > 0) {
            displayListView(container, data);
            doSearch(searchCriteria);/*  ww w . jav  a 2 s.co  m*/
        } else {
            displayNoExistItems(container, data);
        }

        ProjectBreadcrumb breadcrumb = ViewManager.getCacheComponent(ProjectBreadcrumb.class);
        breadcrumb.gotoComponentList();
    } else {
        NotificationUtil.showMessagePermissionAlert();
    }
}

From source file:com.esofthead.mycollab.module.project.view.bug.ComponentReadPresenter.java

License:Open Source License

@Override
protected void onGo(ComponentContainer container, ScreenData<?> data) {
    if (CurrentProjectVariables.canRead(ProjectRolePermissionCollections.COMPONENTS)) {
        if (data.getParams() instanceof Integer) {
            ComponentService componentService = ApplicationContextUtil.getSpringBean(ComponentService.class);
            SimpleComponent component = componentService.findById((Integer) data.getParams(),
                    AppContext.getAccountId());
            if (component != null) {
                ComponentContainer componentContainer = container;
                componentContainer.removeAllComponents();
                componentContainer.addComponent(view.getWidget());
                view.previewItem(component);

                ProjectBreadcrumb breadcrumb = ViewManager.getCacheComponent(ProjectBreadcrumb.class);
                breadcrumb.gotoComponentRead(component);
            } else {
                NotificationUtil.showRecordNotExistNotification();
                return;
            }//from  ww  w  .j a va 2 s.c o m
        } else {
            throw new MyCollabException("Unhanddle this case yet");
        }
    } else {
        NotificationUtil.showMessagePermissionAlert();
    }
}

From source file:com.esofthead.mycollab.module.project.view.ProjectGenericListPresenter.java

License:Open Source License

private void displayView(ComponentContainer container, ScreenData<?> data) {
    container.removeAllComponents();//from   www  .j  av  a 2  s.  c  o  m
    if (candidateView instanceof LazyPageView) {
        candidateView.removeAllComponents();
    }
    container.addComponent(candidateView);
}

From source file:com.esofthead.mycollab.module.project.view.ProjectListPresenter.java

License:Open Source License

@Override
protected void onGo(ComponentContainer container, ScreenData<?> data) {
    container.addComponent(view);
    ProjectSearchCriteria searchCriteria = new ProjectSearchCriteria();
    doSearch(searchCriteria);// w w  w.j a  v a2  s  .  co  m
}