|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectworkspace.typeblocking.FocusTraversalManager
public class FocusTraversalManager
The FocusTraversalManager has two function. First, it maintains a pointer to the block, if any, that has focus and the corresponding focus point on that block. If the focus is not on the block, then it must be set to some point of the block canvas. The second primary function of the FocusTraversalManager is to redirect the focus to the next appropriate block in a particular stack. One could "traverse" the stack by moving the focus to one of the following: 1. the block after 2. the block before 3. the next block 4. the previous block The exact definition of what "next", "previous", "after", and "before" is described in details in their corresponding method summary. As a focus manager of the entire system, the class must maintain particular invariants at all time. Clients of this module may obtain the focus through three observer (getter) methods. Clients may also manualy mutate the focus through three modifier (setter) methods. However, BOTH the value returned in the observer methods and the value passed in the modifier methods MUST maintain particular invariants described below. These invariants must hold at all time and check reps should be imposed to ensure that any changes to the system still holds these crucial invariants. Clients of this module may assume that the invariants mentioned below will always hold. INVARIANT I. If the canvas has focus, then the block does not. Thus 1. focusBlock == Block.null 2. canvasFocusPoint != null 3. blockFocusPoint == null INVARIANT II. If the block has focus, then the canvas does not. Thus 1. focusBlock != Block.null 2. canvasFocusPoint == null 3. blockFocusPoint != null
Constructor Summary | |
---|---|
FocusTraversalManager()
|
Method Summary | |
---|---|
boolean |
focusAfterBlock()
Gives focus to the first after block down the tree, that is, the next control block in the stack. |
boolean |
focusBeforeBlock()
Gives focus to the first beforeblock up the tree, that is, the previous control block in the stack. |
boolean |
focusNextBlock()
Reassigns the focus to the "next block" of the current focusBlock. |
boolean |
focusPrevBlock()
Reassigns the focus to the "previous block" of the current focusBlock. |
java.awt.Point |
getBlockPoint()
|
java.awt.Point |
getCanvasPoint()
|
java.lang.Long |
getFocusBlockID()
|
(package private) java.lang.Long |
getTopOfStack(java.lang.Long blockID)
For a given block, returns the outermost (top-leftmost) block in the stack. |
void |
keyPressed(java.awt.event.KeyEvent e)
|
void |
keyReleased(java.awt.event.KeyEvent e)
|
void |
keyTyped(java.awt.event.KeyEvent e)
|
void |
mouseClicked(java.awt.event.MouseEvent e)
|
void |
mouseEntered(java.awt.event.MouseEvent e)
|
void |
mouseExited(java.awt.event.MouseEvent e)
|
void |
mousePressed(java.awt.event.MouseEvent e)
|
void |
mouseReleased(java.awt.event.MouseEvent e)
|
void |
setFocus(Block block)
Sets focus to block |
void |
setFocus(java.lang.Long blockID)
|
(package private) void |
setFocus(java.awt.Point location)
|
void |
setFocus(java.awt.Point canvasPoint,
java.lang.Long blockID)
Set Focus to canvas at canvasPoint. |
java.lang.String |
toString()
|
void |
workspaceEventOccurred(WorkspaceEvent event)
Subscription: BLOCK_ADDED events. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public FocusTraversalManager()
Method Detail |
---|
public java.lang.Long getFocusBlockID()
public java.awt.Point getCanvasPoint()
public java.awt.Point getBlockPoint()
public void setFocus(Block block)
public void setFocus(java.lang.Long blockID)
public void setFocus(java.awt.Point canvasPoint, java.lang.Long blockID)
canvasPoint
- blockID
- TODO: finish method documentationvoid setFocus(java.awt.Point location)
public boolean focusNextBlock()
public boolean focusPrevBlock()
public boolean focusAfterBlock()
public boolean focusBeforeBlock()
java.lang.Long getTopOfStack(java.lang.Long blockID)
blockID
- any block in a stack.
public void mousePressed(java.awt.event.MouseEvent e)
mousePressed
in interface java.awt.event.MouseListener
public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased
in interface java.awt.event.MouseListener
public void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered
in interface java.awt.event.MouseListener
public void mouseExited(java.awt.event.MouseEvent e)
mouseExited
in interface java.awt.event.MouseListener
public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked
in interface java.awt.event.MouseListener
public void keyPressed(java.awt.event.KeyEvent e)
keyPressed
in interface java.awt.event.KeyListener
public void keyReleased(java.awt.event.KeyEvent e)
keyReleased
in interface java.awt.event.KeyListener
public void keyTyped(java.awt.event.KeyEvent e)
keyTyped
in interface java.awt.event.KeyListener
public void workspaceEventOccurred(WorkspaceEvent event)
workspaceEventOccurred
in interface WorkspaceListener
event
- WorkspaceEvent object holding information regarding the triggered
event.public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |