diff --git a/src/main/java/org/olat/core/gui/components/AbstractComponent.java b/src/main/java/org/olat/core/gui/components/AbstractComponent.java index c574fef0658e80822d97d2b2e8cfcea9ffa1816c..45d432acfeac144a9453164b26d99a63115b2b21 100644 --- a/src/main/java/org/olat/core/gui/components/AbstractComponent.java +++ b/src/main/java/org/olat/core/gui/components/AbstractComponent.java @@ -256,6 +256,7 @@ public abstract class AbstractComponent implements Component { * * @return a list of the controllers listening (normally only one) */ + @Override public List<ComponentEventListener> debuginfoGetListeners() { return listeners; } @@ -263,6 +264,7 @@ public abstract class AbstractComponent implements Component { /** * @param controller */ + @Override public void addListener(ComponentEventListener controller) { // tests if the same controller was already registered to avoid // double-firing. @@ -272,7 +274,8 @@ public abstract class AbstractComponent implements Component { + "', controller was: " + controller.toString()); listeners.add(controller); } - + + @Override public void removeListener(ComponentEventListener controller) { listeners.remove(controller); } diff --git a/src/main/java/org/olat/core/gui/components/Component.java b/src/main/java/org/olat/core/gui/components/Component.java index a60e5eee07c5509c96f501db2b8d3d249cda12b2..3518cbed0b241f51f1ee13bdfa12fca0836abfad 100644 --- a/src/main/java/org/olat/core/gui/components/Component.java +++ b/src/main/java/org/olat/core/gui/components/Component.java @@ -78,6 +78,8 @@ public interface Component { public void addListener(ComponentEventListener controller); + public void removeListener(ComponentEventListener controller); + public List<ComponentEventListener> debuginfoGetListeners(); public void dispatchRequest(UserRequest ureq); diff --git a/src/main/java/org/olat/modules/qpool/ui/QuestionItemDetailsController.java b/src/main/java/org/olat/modules/qpool/ui/QuestionItemDetailsController.java index 44d5c3be45fb1c7f73c42a51855f375d7854a7a6..dbfabfbeec8d2d1b1c003699db4002e64ac89d29 100644 --- a/src/main/java/org/olat/modules/qpool/ui/QuestionItemDetailsController.java +++ b/src/main/java/org/olat/modules/qpool/ui/QuestionItemDetailsController.java @@ -32,6 +32,7 @@ import org.olat.core.gui.components.link.Link; import org.olat.core.gui.components.link.LinkFactory; import org.olat.core.gui.components.stack.BreadcrumbPanel; import org.olat.core.gui.components.stack.BreadcrumbPanelAware; +import org.olat.core.gui.components.stack.PopEvent; import org.olat.core.gui.components.velocity.VelocityContainer; import org.olat.core.gui.control.Controller; import org.olat.core.gui.control.Event; @@ -71,6 +72,7 @@ public class QuestionItemDetailsController extends BasicController implements Br private CloseableModalController cmc; private final VelocityContainer mainVC; private DialogBoxController confirmDeleteBox; + private LayoutMain3ColsController editMainCtrl; private SelectBusinessGroupController selectGroupCtrl; private final MetadatasController metadatasCtrl; private final UserCommentsAndRatingsController commentsAndRatingCtr; @@ -141,11 +143,16 @@ public class QuestionItemDetailsController extends BasicController implements Br @Override protected void doDispose() { - // + if(stackPanel != null) { + stackPanel.removeListener(this); + } } @Override public void setBreadcrumbPanel(BreadcrumbPanel stackPanel) { + if(stackPanel != null) { + stackPanel.addListener(this); + } this.stackPanel = stackPanel; } @@ -167,6 +174,13 @@ public class QuestionItemDetailsController extends BasicController implements Br fireEvent(ureq, new QItemEvent("next", metadatasCtrl.getItem())); } else if(source == previousItem) { fireEvent(ureq, new QItemEvent("previous", metadatasCtrl.getItem())); + } else if(source == stackPanel) { + if(event instanceof PopEvent) { + PopEvent pop = (PopEvent)event; + if(pop.getController() == editMainCtrl) { + doContentChanged(ureq); + } + } } } @@ -222,8 +236,8 @@ public class QuestionItemDetailsController extends BasicController implements Br editCtrl = spi.getEditableController(ureq, getWindowControl(), item); listenTo(editCtrl); - LayoutMain3ColsController mainCtrl = new LayoutMain3ColsController(ureq, getWindowControl(), editCtrl); - stackPanel.pushController("Edition", mainCtrl); + editMainCtrl = new LayoutMain3ColsController(ureq, getWindowControl(), editCtrl); + stackPanel.pushController("Edition", editMainCtrl); } private void doContentChanged(UserRequest ureq) {