|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.tmachine.gpg.hue.HUDManager
The main Model and Controller (in MVC terms) for managing the HUDs system.
Keeps track of all HUDS, and contains the preferred methods for changing their state (allowing you to hook into just one place to capture state changes etc, e.g. for propagation to listeners)
| Field Summary | |
protected java.util.LinkedList |
activeHUDGroupsStack
|
protected java.util.HashMap |
allHUDs
|
protected ContextManager |
context
|
protected javax.swing.JComponent |
display
|
protected java.util.ArrayList |
inputListeningHUDs
HUD instances that are currently listening for any input events |
| Constructor Summary | |
HUDManager()
You MUST call setDisplayComponent before using this new instance |
|
| Method Summary | |
void |
activateHUD(HUD h)
Activates the HUD; since a HUD cannot be invisible and active, it is implicitly made visible at the same time; active HUDs receive input events, e.g mouse movement and keyboard presses. |
void |
addHUD(HUD h)
Adds the HUD to the set of current HUDs, and sets the HUD's reference to it's parent manager to point to this instance |
void |
deActivateHUD(HUD h)
De-activates the HUD, so that it gets NO input events, and cannot respond as a tool/control Inactive HUDs can still paint, if they are also visible. |
void |
exitExclusiveActiveHUD()
Restores all the previously active HUDs to their active state |
java.util.ArrayList |
getActiveHUDs()
Only returns HUDs that are both active and visible (assumes that invisible HUDs, which cannot give feedback on what the user is doing, should not be counted active - but leaves them "isActive() == true" so that as soon as they are made visible again they will automatically become active) |
java.util.ArrayList |
getAllHUDs()
Fetches all HUDs, regardless of status |
ContextManager |
getContext()
The context that HUDs can query to find out e.g the most recent cursor co-ordinates |
java.util.ArrayList |
getVisibleHUDs()
Fetches only HUDs that are visible, i.e are being painted to the main renderer |
void |
hideHUD(HUD h)
Renders the supplied HUD invisible, i.e it doesn't participate in repaints |
void |
mouseClicked(java.awt.event.MouseEvent e)
Delegates to all the currently active HUDs that are listening to inputs |
void |
mouseDragged(java.awt.event.MouseEvent e)
Delegates to all the currently active HUDs that are listening to inputs |
void |
mouseEntered(java.awt.event.MouseEvent e)
Delegates to all the currently active HUDs that are listening to inputs |
void |
mouseExited(java.awt.event.MouseEvent e)
Delegates to all the currently active HUDs that are listening to inputs |
void |
mouseMoved(java.awt.event.MouseEvent e)
Delegates to all the currently active HUDs that are listening to inputs |
void |
mousePressed(java.awt.event.MouseEvent e)
Delegates to all the currently active HUDs that are listening to inputs |
void |
mouseReleased(java.awt.event.MouseEvent e)
Delegates to all the currently active HUDs that are listening to inputs |
void |
repaint()
Callback for HUDs to instruct the manager that they have changed their paint state and need a repaint of the main renderer |
void |
setContext(ContextManager cm)
|
void |
setDisplayComponent(javax.swing.JComponent c)
Informs this class which display component is the main renderer |
void |
setExclusiveActiveHUD(HUD h)
Enables a HUD to temporarily mask out all currently active HUD's in favour of one in particular; once that HUD has completed it's action, it should call exitExclusiveHUD to re-enable all previously active HUDs. |
void |
showHUD(HUD h)
Renders the supplied HUD visible, i.e it's paint callback is invoked on all repaints |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected javax.swing.JComponent display
protected ContextManager context
protected java.util.ArrayList inputListeningHUDs
protected java.util.LinkedList activeHUDGroupsStack
protected java.util.HashMap allHUDs
| Constructor Detail |
public HUDManager()
setDisplayComponent(JComponent)| Method Detail |
public void repaint()
public ContextManager getContext()
public void setContext(ContextManager cm)
public void setDisplayComponent(javax.swing.JComponent c)
c - public void addHUD(HUD h)
h - public java.util.ArrayList getAllHUDs()
public java.util.ArrayList getVisibleHUDs()
public void hideHUD(HUD h)
showHUD(HUD)public void showHUD(HUD h)
hideHUD(HUD)public void deActivateHUD(HUD h)
activateHUD(HUD)public void activateHUD(HUD h)
deActivateHUD(HUD),
showHUD(HUD)public java.util.ArrayList getActiveHUDs()
public void setExclusiveActiveHUD(HUD h)
This is a convenient way of making tools that e.g. need to engage in a multiple-stage dialog with the user within the edit window, without risking propagating input events to other HUDS.
This is typically used for complex actions, such as creating a 3D object: the gesture that triggers the create action within the main renderer will mask out everything else because it needs to exclusively capture the next few clicks (e.g. one drag to set size in one plane, followed by a click or release, then a second drag or move followed by a click to set the size in the perpendicular plane, since a 3D object cannot easily be sized using a 2D mouse cursor without this multiple-stage interaction).
h - the HUD to make active whilst all others are masked outexitExclusiveActiveHUD()public void exitExclusiveActiveHUD()
setExclusiveActiveHUD(HUD)public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked in interface java.awt.event.MouseListenerpublic void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged in interface java.awt.event.MouseMotionListenerpublic void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered in interface java.awt.event.MouseListenerpublic void mouseExited(java.awt.event.MouseEvent e)
mouseExited in interface java.awt.event.MouseListenerpublic void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved in interface java.awt.event.MouseMotionListenerpublic void mousePressed(java.awt.event.MouseEvent e)
mousePressed in interface java.awt.event.MouseListenerpublic void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased in interface java.awt.event.MouseListener
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||