

def componentAttachedToContainer(self, event):
    self._test._attachCounter += 1
    self._test._attachedComponent = event.getAttachedComponent()
    self._test._attachTarget = event.getContainer()
    it = self._test._attachTarget.getComponentIterator()
    while True:
        try:
            if (it.next() == self._test._attachedComponent):
                self._test._foundInContainer = True
                break
        except StopIteration:
            break
    if isinstance(self._test._attachTarget, AbstractOrderedLayout):
        self._test._indexOfComponent = self._test._attachTarget.getComponentIndex(self._test._attachedComponent)
    elif isinstance(self._test._attachTarget, GridLayout):
        self._test._componentArea = self._test._attachTarget.getComponentArea(self._test._attachedComponent)
    elif isinstance(self._test._attachTarget, AbsoluteLayout):
        self._test._componentPosition = self._test._attachTarget.getPosition(self._test._attachedComponent)

dataset/ETHPy150Open rwl/muntjac/muntjac/test/server/components/component_attach_detach_listener_test.py MyAttachListener.componentAttachedToContainer/original