Design a help manager of a Java application. A help manager allows the show of a help message depending on the objects on which a client has clicked. For example, the "?", sometimes located near the contextual menu of a Windows dialog box, allows the show of the help of the button or the area where we click. If the button on which one clicks does not contain help, it is the area containing which displays its help, and so on. If no object contains help, with final, the manager displays "Not help available for this area". Instantiate your class diagram in a sequence diagram of on the example of a printing window. This window (JDialog) consists in an explanatory text (JLabel), and in a container (JPanel). This last contains a Print button (JButton) and a Cancel button (JButton). The Print button contains help "Launches the impression of the document". The Cancel button, the text as well as the window do not contain help. Lastly, the container contains help "Click on one of the buttons". In the sequence diagram, reveal the scénarios: "The user asks for the help of the Print button", "the user asks for the help of the Cancel button", and "the user asks for the help of the text".
A classical instantiation of the pattern.
There is a separation between containers and contents. Two issues arise. The first concerns the validity of the solution and the second concerns the interaction with another misaligned pattern presents in the design. We have considered this solution valid even if delegation between content objects is not possible. The problem can be solved by adding a reflexive association on the class Content.