Example usage for com.vaadin.ui ComponentContainer removeAllComponents

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

Introduction

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

Prototype

public void removeAllComponents();

Source Link

Document

Removes all components from 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 ww. ja  v  a2s . co m*/
    layout.removeAllComponents();
    layout.addComponent(component);
    beanManager.fireEvent(component, new AnnotationLiteral<BeforeNavigateToView>() {
    });
    stack.push(component);
}

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 {//www.  java 2s  . c  o 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 ww  .  j a v  a  2 s .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);//from   www. j a  v a  2s  .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   w  ww .j av a 2  s . co  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();
    if (candidateView instanceof LazyPageView) {
        candidateView.removeAllComponents();
    }//from   w w w  . j ava2 s  .c o m
    container.addComponent(candidateView);
}

From source file:com.esofthead.mycollab.module.project.view.settings.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 = AppContextUtil.getSpringBean(ComponentService.class);
            SimpleComponent component = componentService.findById((Integer) data.getParams(),
                    AppContext.getAccountId());
            if (component != null) {
                ComponentContainer componentContainer = container;
                componentContainer.removeAllComponents();
                componentContainer.addComponent(view);
                view.previewItem(component);

                ProjectBreadcrumb breadcrumb = ViewManager.getCacheComponent(ProjectBreadcrumb.class);
                breadcrumb.gotoComponentRead(component);
            } else {
                NotificationUtil.showRecordNotExistNotification();
            }//  www. j av  a2s . co  m
        } else {
            throw new MyCollabException("Unhandle this case yet");
        }
    } else {
        NotificationUtil.showMessagePermissionAlert();
    }
}

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

License:Open Source License

@Override
protected void onGo(ComponentContainer container, ScreenData<?> data) {
    if (CurrentProjectVariables.canRead(ProjectRolePermissionCollections.TASKS)) {
        container.removeAllComponents();
        container.addComponent(view);/*from  ww  w  .j a  v a  2 s .c  o  m*/
        String query = (data != null && data.getParams() instanceof String) ? (String) data.getParams() : "";
        view.displayView(query);

        ProjectBreadcrumb breadCrumb = ViewManager.getCacheComponent(ProjectBreadcrumb.class);
        breadCrumb.gotoTaskDashboard(query);
    } else {
        throw new SecureAccessException();
    }
}

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

License:Open Source License

@Override
protected void onGo(ComponentContainer container, ScreenData<?> data) {
    ComponentContainer projectContainer = container;
    projectContainer.removeAllComponents();
    projectContainer.addComponent(view.getWidget());
    Project project = (Project) data.getParams();
    view.editItem(project);//from   w  w w .  jav  a 2  s .  c o m

    if (project.getId() == null) {
        AppContext.addFragment("project/add", "New Project");
    }
}

From source file:com.esofthead.mycollab.module.user.view.LoginPresenter.java

License:Open Source License

@Override
protected void onGo(ComponentContainer container, ScreenData<?> data) {
    container.removeAllComponents();
    container.addComponent(view.getWidget());

    AppContext.addFragment("user/login", "Login Page");
}