void setParent(ControllerGroup<?> theParent) { if (_myParent != null && _myParent != this) { _myParent.remove(this); } _myParent = theParent; if (_myParent != this) { _myParent.add(this); } absolutePosition = new PVector(position.x, position.y); absolutePosition.add(_myParent.absolutePosition); positionBuffer = new PVector(position.x, position.y); _myControlWindow = _myParent.getWindow(); for (int i = 0; i < controllers.size(); i++) { if (controllers.get(i) instanceof Controller<?>) { ((Controller<?>) controllers.get(i))._myControlWindow = _myControlWindow; } else { ((ControllerGroup<?>) controllers.get(i))._myControlWindow = _myControlWindow; } } if (_myControlWindow != null) { setMouseOver(false); } }
/** {@inheritDoc} */ public T updateAbsolutePosition() { absolutePosition.set(position); absolutePosition.add(_myParent.getAbsolutePosition()); for (int i = 0; i < controllers.size(); i++) { controllers.get(i).updateAbsolutePosition(); } return me; }
/** @return Tab */ public Tab getTab() { if (this instanceof Tab) { return (Tab) this; } if (_myParent instanceof Tab) { return (Tab) _myParent; } return _myParent.getTab(); }
@Override public T bringToFront(ControllerInterface<?> theController) { if (_myParent instanceof Tab) { moveTo((Tab) _myParent); } else { _myParent.bringToFront(theController); } if (theController != this) { if (controllers.get().contains(theController)) { controllers.remove(theController); controllers.add(theController); } } return me; }
/** removes the group from controlP5. */ public void remove() { _myControlWindow.removeMouseOverFor(this); if (_myParent != null) { _myParent.remove(this); } if (cp5 != null) { cp5.remove(this); } for (int i = controllers.size() - 1; i >= 0; i--) { controllers.get(i).remove(); } controllers.clear(); controllers.clearDrawable(); controllers = new ControllerList(); if (this instanceof Tab) { _myControlWindow.removeTab((Tab) this); } }