org.kalmeo.util.frame
Class FrameHandler

java.lang.Object
  extended by org.kalmeo.util.frame.FrameHandler

public class FrameHandler
extends java.lang.Object

The FrameHandler id the base of the 'Frame' mecanism. It permits to process messages through separate object instance called Frame and organized into a stack.
The last pushed frame of this FrameHandler will be invoke to process a new message first. If it doesn't use it, the message is pass to the next frame untile a frame returns false on its onMessage(...) call.

Author:
bbeaulant

Constructor Summary
FrameHandler()
           
 
Method Summary
 Frame getTopFrame()
          Returns th Frame on top of the frames stack, or null if the FrameHandler is empty.
 boolean processMessage(java.lang.Object identifier, java.lang.Object[] arguments)
          Process a message into the frame stack.
 boolean pushFrame(Frame frame)
          Push a frame on top of the frames stack
 void removeAllFrameOnTopOf(Frame frame)
          Remove all frames on top of the given frame.
 void removeAllFrames()
          Remove all frames.
 boolean removeFrame(Frame frame)
          Remove a frame ont top of the frames stack
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FrameHandler

public FrameHandler()
Method Detail

getTopFrame

public Frame getTopFrame()
Returns th Frame on top of the frames stack, or null if the FrameHandler is empty.

Returns:
the Frame on top of the stack

pushFrame

public boolean pushFrame(Frame frame)
Push a frame on top of the frames stack

Parameters:
frame - the Frame to push
Returns:
true if frame is pushed or false if the frame was already present in to the stack

removeFrame

public boolean removeFrame(Frame frame)
Remove a frame ont top of the frames stack

Parameters:
frame - the Frame to remove
Returns:
true if frame is removed or false if the frame wasn't present in to the stack

removeAllFrames

public void removeAllFrames()
Remove all frames.


removeAllFrameOnTopOf

public void removeAllFrameOnTopOf(Frame frame)
Remove all frames on top of the given frame. The frame is not removed and become the new top frame.

Parameters:
frame - the reference Frame

processMessage

public boolean processMessage(java.lang.Object identifier,
                              java.lang.Object[] arguments)
Process a message into the frame stack.

Parameters:
identifier - the message identifier
arguments - the message arguments
Returns:
true if the message has been processed by a frame.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2007-2008 Kalmeo. All Rights Reserved.