public void undo() { children = removedChildren; int size = children_size(); for (int i = 0; i < size; i++) { // Get next child final Component child = children_get(i); child.setParent(MarkupContainer.this); } } });
@Override public void undo() { children = removedChildren; int size = children_size(); for (int i = 0; i < size; i++) { // Get next child final Component child = children_get(i); child.setParent(MarkupContainer.this); } } });
/** * @param component * Component being removed */ private final void removedComponent(final Component component) { // Notify Page that component is being removed final Page page = component.findPage(); if (page != null) { page.componentRemoved(component); } component.detach(); // Component is removed component.setParent(null); }
/** * Reconstructs the component * * @param parent * parent of the component * @param index * position in parent's children * @return reconstructed component */ Component reconstruct(MarkupContainer parent, int index) { Component component = componentSource.restoreComponent(id); if (parent != null) { component.setParent(parent); } component.beforeRender(); parseComponentInfo(parent, componentInfo, component); return component; };
/** * Reconstructs the component * * @param parent * parent of the component * @param index * position in parent's children * @return */ Component reconstruct(MarkupContainer parent, int index) { Component component = componentSource.restoreComponent(id); if (parent != null) { component.setParent(parent); } component.beforeRender(); parseComponentInfo(parent, componentInfo, component); return component; };
/** * @param component * Component being removed */ private void removedComponent(final Component component) { // Notify Page that component is being removed final Page page = component.findPage(); if (page != null) { page.componentRemoved(component); } component.detach(); component.internalOnRemove(); // Component is removed component.setParent(null); }
/** * @param component * Component being removed */ private void removedComponent(final Component component) { // Notify Page that component is being removed final Page page = component.findPage(); if (page != null) { page.componentRemoved(component); } component.detach(); component.internalOnRemove(); // Component is removed component.setParent(null); }
/** * @param component * Component being removed */ private final void removedComponent(final Component component) { // Notify Page that component is being removed final Page page = component.findPage(); if (page != null) { page.componentRemoved(component); } component.detach(); component.internalOnRemove(); // Component is removed component.setParent(null); }
/** * Removes all children from this container. * <p> * Note: implementation does not call {@link MarkupContainer#remove(Component) } for each * component. * * @return {@code this} for method chaining */ public MarkupContainer removeAll() { if (children != null) { addStateChange(); for (Component child : this) { // Do not call remove() because the state change would then be // recorded twice. child.internalOnRemove(); child.detach(); child.setParent(null); } children = null; removals_add(null, null); } return this; }
/** * Removes all children from this container. * <p> * Note: implementation does not call {@link MarkupContainer#remove(Component) } for each * component. * * @return {@code this} for method chaining */ public MarkupContainer removeAll() { if (children != null) { addStateChange(); for (Component child : this) { // Do not call remove() because the state change would then be // recorded twice. child.internalOnRemove(); child.detach(); child.setParent(null); } children = null; removals_add(null, null); } return this; }
component.setParent(this);
child.setParent(this);
child.setParent(this);
@Before public void setUp() throws Exception { target = new EntityModel(); mockParent = context.mock(MarkupContainer.class, "parent"); mockComponent1 = context.mock(Component.class, "component1"); mockComponent2 = context.mock(Component.class, "component2"); context.checking(new Expectations() {{ allowing(mockParent).getId(); will(returnValue("parent")); allowing(mockComponent1).getId(); will(returnValue("id1")); allowing(mockComponent2).getId(); will(returnValue("id2")); ignoring(mockComponent1); ignoring(mockComponent2); }}); mockComponent1.setParent(mockParent); mockComponent2.setParent(mockParent); }
@Before public void setUp() throws Exception { target = new EntityModel(EntityModel.Mode.VIEW, EntityModel.RenderingHint.REGULAR); mockParent = context.mock(MarkupContainer.class, "parent"); mockComponent1 = context.mock(Component.class, "component1"); mockComponent2 = context.mock(Component.class, "component2"); context.checking(new Expectations() {{ allowing(mockParent).getId(); will(returnValue("parent")); allowing(mockComponent1).getId(); will(returnValue("id1")); allowing(mockComponent2).getId(); will(returnValue("id2")); ignoring(mockComponent1); ignoring(mockComponent2); }}); mockComponent1.setParent(mockParent); mockComponent2.setParent(mockParent); }