code: public void replaceElement(final CmsContainerPageElementPanel elementWidget, final String elementId) {
  
          final CmsRpcAction<CmsContainerElementData> action = new CmsRpcAction<CmsContainerElementData>() {
  
              @Override
              public void execute() {
  
                  start(500, true);
                  getContainerpageService().replaceElement(
                      getData().getRpcContext(),
                      getData().getDetailId(),
                      getRequestParams(),
                      elementWidget.getId(),
                      elementId,
                      getPageState(),
                      getLocale(),
                      this);
              }
  
              @Override
              protected void onResponse(CmsContainerElementData result) {
  
                  stop(false);
  
                  if (result != null) {
                      // cache the loaded element
                      m_elements.put(result.getClientId(), result);
                      try {
                          replaceContainerElement(elementWidget, result);
                          resetEditButtons();
                          addToRecentList(result.getClientId(), null);
                          setPageChanged(new Runnable() {
  
                              public void run() {
  
                                  // nothing to do
  
                              }
                          });
                      } catch (Exception e) {
                          // should never happen
                          CmsDebugLog.getInstance().printLine(e.getLocalizedMessage());
                      }
                  }
              }
          };
  
          if (!isGroupcontainerEditing()) {
  
              lockContainerpage(new I_CmsSimpleCallback<Boolean>() {
  
                  public void execute(Boolean arg) {
  
                      if (arg.booleanValue()) {
                          action.execute();
                      }
                  }
              });
  
          } else {
              action.execute();
          }
      }
docs: Replaces the given element with another content while keeping it's settings.<p>
  
  @param elementWidget the element to replace
  @param elementId the id of the replacing content