7from .handlerchain_class
import HandlerChain
8from .handlerchain_messagewindow_class
import MessageWindow, MessageWindowFactory
9from .handlerchain_message_class
import Message, MessagePosition, MessageType
26 MessageWindowFactory.CreateWindow(
"Window 1", 0, 0, 10, 10, handlerChain)
27 MessageWindowFactory.CreateWindow(
"Window 2", 20, 0, 5, 5, handlerChain)
28 MessageWindowFactory.CreateWindow(
"Window 3", 30, 10, 15, 15, handlerChain)
49 print(
"Handler Chain Exercise")
56 print(
" Handler Chain at start:")
57 print(handlerChain.ToString())
61 print(
" Select Window 2")
64 print(
" Current handler chain:")
65 print(handlerChain.ToString())
67 print(
" Select Window 3")
70 print(
" Current handler chain:")
71 print(handlerChain.ToString())
73 print(
" Select Window 1")
76 print(
" Current handler chain:")
77 print(handlerChain.ToString())
79 print(
" Close Window 2")
82 print(
" Current handler chain:")
83 print(handlerChain.ToString())
Represents a list of handlers that all implement the IMessageHandler interface.
Represents a message sent to the windows.
Position of the message in global coordinates (same scope of coordinates as windows).
None _HandlerChain_ConstructWindowChain(HandlerChain handlerChain)
Helper method to construct a list of windows.
def HandlerChain_Exercise()
Example of using the HandlerChain Pattern or Chain of Responsibility Pattern.