Replaces component with new component.<p>

@param component to be replaced
@param replacement new component
498735
public static void replaceComponent(Component component, Component replacement) {

        if (!component.isAttached()) {
            throw new IllegalArgumentException("Component must be attached");
        }
        HasComponents parent = component.getParent();
        if (parent instanceof ComponentContainer) {
            ((ComponentContainer)parent).replaceComponent(component, replacement);
        } else if (parent instanceof SingleComponentContainer) {
            ((SingleComponentContainer)parent).setContent(replacement);
        } else {
            throw new IllegalArgumentException("Illegal class for parent: " + parent.getClass());
        }
    }
223126
public static void replace(final StringBuffer sb, final String find, final String replacement) {
		int pos = 0;
		while(pos<sb.length()) {
			pos = sb.indexOf(find, pos);
			if(pos==-1) break;
			sb.replace(pos, pos+find.length(), replacement);
			pos += replacement.length();
		}
	}
465127
Optional<PackingPlan.InstancePlan> removeAnyInstanceOfComponent(String component) {
    Optional<PackingPlan.InstancePlan> instancePlan = getAnyInstanceOfComponent(component);
    if (instancePlan.isPresent()) {
      PackingPlan.InstancePlan plan = instancePlan.get();
      this.instances.remove(plan);
      return instancePlan;
    }
    return Optional.absent();
  }
604789
public AStarSegmentReplacer<ST> setSegmentReplacer(AStarSegmentReplacer<ST> replacer) {
		final AStarSegmentReplacer<ST> old = this.segmentReplacer;
		this.segmentReplacer = replacer;
		return old;
	}
956212
public void setComponentConstraints(JComponent component)
    {
        GridBagConstraints c = this.getGBConstraints();
        GridBagLayout gridbag = (GridBagLayout)this.getScreenLayout();
        gridbag.setConstraints(component, c);
        
        Application application = BaseApplet.getSharedInstance().getApplication();
        MuffinManager muffinManager = application.getMuffinManager();
        if (component instanceof JTextComponent)
            if (muffinManager != null)
        {
            muffinManager.replaceClipboardAction(component, "cut");
            muffinManager.replaceClipboardAction(component, "copy");
            muffinManager.replaceClipboardAction(component, "paste");
        }        
    }
538180
public void addRow(Component component) {

        Component actualComponent = component == null ? m_newComponentFactory.get() : component;
        I_CmsEditableGroupRow row = m_rowBuilder.buildRow(this, actualComponent);
        m_container.addComponent(row);
        updatePlaceholder();
        updateButtonBars();
        updateGroupValidation();
    }
14786
public void addToGroup(final T component) {
		ComponentGroupModel model = getOrCreateComponentModel();
		model.components.add(component);
		MemoryUtil.checkSize(model.components.size(), this.getClass().getSimpleName());
	}
1214235
@Override
	public <P, E extends Exception> void accept(ComponentVisitor<P, E> visitor, P parameter) throws E
	{
		visitor.visit(this, parameter);
		
		for (Component component : components)
		{
			component.accept(visitor, parameter);
		}
		
		visitor.endVisit(this, parameter);
	}
671505
public static void replaceContent(final JComponent container, final JComponent content,
		boolean scrollable)
	{
		container.removeAll();
		if (scrollable)
		{
			container.add(new JScrollPane(content));
		}
		else
		{
			container.add(content);
		}
		container.revalidate();
		replaceContentInMultiSplitPane(container, content, scrollable);
	}
575230
def replace_component(self, name, callable, provides=None, depends=None):
        """"""
        self.remove_component(name)
        self.add_component(name, callable, provides, depends)
492704
@Override
    public void processComponent(String propertyName, JComponent component) {

        if (component instanceof JComboBox) {
            this.installSearchable((JComboBox) component);
        } else if (component instanceof JList) {
            this.installSearchable((JList) component);
        } else if (component instanceof JTable) {
            this.installSearchable((JTable) component);
        } else if (component instanceof JTextComponent) {
            this.installSearchable((JTextComponent) component);
        }
    }
880410
public void registerSearchReplace(Button search, Button replace) {

        if (getState().m_enableSearchReplace) {
            throw new RuntimeException("Search/replace already registered.");
        }
        search.setId(HTML_ID_PREFIX + m_componentId + "-search");
        replace.setId(HTML_ID_PREFIX + m_componentId + "-replace");
        getState().m_enableSearchReplace = true;
        markAsDirty();
    }
533291
@Override
    public void replaceAtomContainer(int position, IAtomContainer container) {
        IAtomContainer old = atomContainers[position];
        old.removeListener(this);
        atomContainers[position] = container;
        container.addListener(this);
        notifyChanged();
    }
401795
@Override
	public void add(final WComponent component) {
		getCardContainer().add(component);
		CardManagerModel model = getComponentModel();

		if (model.visibleComponent == null) {
			model.visibleComponent = component;
		}
	}
501109
public boolean replaceIn(final StringBuffer source) {
        if (source == null) {
            return false;
        }
        return replaceIn(source, 0, source.length());
    }
188685
public void replace(Fragment fragment) {
        manager.popBackStackImmediate(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);
        manager.beginTransaction()
            .replace(containerId, fragment, indexToTag(0))
            .commit();
        manager.executePendingTransactions();
    }
1218954
@Override
	public void rename(Name oldname, Name newname) throws NamingException
    {
        if (oldname.isEmpty() || newname.isEmpty())
            throw new InvalidNameException("Cannot rename empty name");

        // Extract components that belong to this namespace
        String oldnm = oldname.toString();
        String newnm = newname.toString();

        // Check if new name exists
        if (bindings.get(newnm) != null)
            throw new NameAlreadyBoundException(newname.toString() + " is already bound");

        // Check if old name is bound
        Object oldBinding = bindings.remove(oldnm);
        if (oldBinding == null)
            throw new NameNotFoundException(oldname.toString() + " not bound");

        bindings.put(newnm, oldBinding);
    }