Example usage for com.vaadin.ui ComponentContainer removeComponent

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

Introduction

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

Prototype

public void removeComponent(Component c);

Source Link

Document

Removes the component from this container.

Usage

From source file:org.lunifera.web.ecp.uimodel.presentation.vaadin.internal.VerticalLayoutPresentation.java

License:Open Source License

@Override
public void unrender() {
    if (componentBase != null) {
        ComponentContainer parent = ((ComponentContainer) componentBase.getParent());
        if (parent != null) {
            parent.removeComponent(componentBase);
        }//from   w  w  w. jav a2 s.  c  o  m
        componentBase = null;
        verticalLayout = null;

        // unrender the childs
        for (IWidgetPresentation<?> child : getChildren()) {
            child.unrender();
        }
    }
}

From source file:org.lunifera.web.ecp.uimodel.presentation.vaadin.internal.ViewPresentation.java

License:Open Source License

/**
 * {@inheritDoc}//from  ww w.j  ava2  s . c o  m
 */
@Override
public void unrender() {
    if (componentBase != null) {
        ComponentContainer parent = ((ComponentContainer) componentBase.getParent());
        if (parent != null) {
            parent.removeComponent(componentBase);
        }
        componentBase = null;

        IWidgetPresentation<?> childPresentation = getContent();
        if (childPresentation != null) {
            childPresentation.unrender();
        }
    }
}

From source file:org.panifex.web.vaadin.runtime.html.VaadinHtmlComponentUtil.java

License:Open Source License

/**
 * Removes the component from the container.
 *
 * @param htmlComp the component to be removed from the container
 * @param container the container from the component to be removed
 *//*w  ww. j av  a2s  .co m*/
public static void removeComponentFromContainer(HtmlComponent htmlComp, ComponentContainer container) {
    Component comp = castHtmlComponent(htmlComp, Component.class);
    container.removeComponent(comp);
}

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

License:Open Source License

private void disconnectReferencedElementsFromPerspectiveWidgets(
        MElementContainer<? extends MUIElement> container) {
    for (MUIElement e : container.getChildren()) {
        if (e instanceof MPlaceholder) {
            MPlaceholder ph = (MPlaceholder) e;
            if (ph.isToBeRendered()) {
                ComponentContainer phComponent = (ComponentContainer) ph.getWidget();
                Component refComponent = (Component) ph.getRef().getWidget();
                phComponent.removeComponent(refComponent);
            }/*  ww  w.  jav  a  2  s.  c  o  m*/
        }
    }
}

From source file:ru.codeinside.gses.webui.declarant.DeclarantFactory.java

License:Mozilla Public License

static Component createStartEventForm(final long procedureId, final ProcedureSelectListener listener,
        VerticalLayout layout) {//from   w w  w .jav a 2 s  .  com
    final ProcedureProcessDefinition def = Flash.flash().getDeclarantService().selectActive(procedureId);
    if (def == null) {
        layout.getWindow().showNotification("  ");
        return null;
    }
    final String processDefinitionId = def.getProcessDefinitionId();
    String login = Flash.flash().getLogin();
    List<IdentityLink> identityLinksForProcessDefinition = Flash.flash().getProcessEngine()
            .getRepositoryService().getIdentityLinksForProcessDefinition(processDefinitionId);
    boolean ok = identityLinksForProcessDefinition.isEmpty();
    for (IdentityLink identityLink : identityLinksForProcessDefinition) {
        if (identityLink.getGroupId() != null) {
            if (Flash.flash().getAdminService().getUserItem(login).getGroups()
                    .contains(identityLink.getGroupId())) {
                ok = true;
                break;
            }
        }
        if (identityLink.getUserId() != null && identityLink.getUserId().equals(login)) {
            ok = true;
            break;
        }
    }
    if (!ok) {
        layout.getWindow().showNotification(" ? ? ");
        return null;
    }

    DataAccumulator accumulator = new DataAccumulator();
    ExecutorService executorService = Flash.flash().getExecutorService();
    final FormDescription formDescription = Functions.withEngine(new FormDescriptionBuilder(
            FormID.byProcessDefinitionId(processDefinitionId), executorService, accumulator));
    if (formDescription == null) {
        layout.getWindow().showNotification("  ");
        return null;
    }
    return new TaskForm(formDescription, new TaskForm.CloseListener() {
        @Override
        public void onFormClose(final TaskForm form) {
            final ComponentContainer container = (ComponentContainer) form.getParent();
            container.removeComponent(form);
            final HorizontalLayout layout = new HorizontalLayout();
            layout.setSizeFull();
            final Button next = new Button("C? ?...", new Button.ClickListener() {
                @Override
                public void buttonClick(Button.ClickEvent event) {
                    listener.selectProcedure(procedureId);
                }
            });
            layout.addComponent(next);
            layout.setComponentAlignment(next, Alignment.BOTTOM_RIGHT);
            container.addComponent(layout);
        }
    }, accumulator);
}