Example usage for com.vaadin.ui ComponentContainer replaceComponent

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

Introduction

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

Prototype

public void replaceComponent(Component oldComponent, Component newComponent);

Source Link

Document

Replaces the component in the container with another one without changing position.

Usage

From source file:org.opencms.ui.sitemap.CmsSitemapTreeController.java

License:Open Source License

/**
 * Updates a sitemap node widget after the resource it corresponds to has changed.<p>
 *
 * @param node the sitemap node/* w w  w  .  j  a v  a2 s  . c  o  m*/
 */
public void updateNode(CmsSitemapTreeNode node) {

    CmsSitemapTreeNodeData data = (CmsSitemapTreeNodeData) node.getData();
    try {
        CmsSitemapTreeNodeData changedData = m_treeDataProvider.getData(A_CmsUI.getCmsObject()
                .readResource(data.getClientEntry().getId(), CmsResourceFilter.IGNORE_EXPIRATION));
        CmsSitemapTreeNode changedNode = createNode(changedData);
        initEventHandlers(changedNode);
        ComponentContainer parent = (ComponentContainer) (node.getParent());
        parent.replaceComponent(node, changedNode);
    } catch (CmsException e) {
        LOG.error(e.getLocalizedMessage(), e);
    }
}