public abstract class IlpAbstractGraphicController extends Object implements IlpGraphicController, MouseInputListener, KeyListener, FocusListener
Modifier and Type | Field and Description |
---|---|
protected WeakReference |
lastInteractedObject
The object interaction state used for the last interacted object.
|
protected WeakHashMap |
lastInteractionStates |
Constructor and Description |
---|
IlpAbstractGraphicController(IlpContext context)
Creates a controller.
|
Modifier and Type | Method and Description |
---|---|
void |
attach(IlpGraphicView v)
Attaches a controller to a given view.
|
protected void |
attachView(IlpGraphicView view) |
protected IlpGraphicViewStyleManager |
createGraphicViewStyleManager(IlpContext context,
IlpGraphicView view)
Creates the graphic view style manager, either by retrieving it
from an XML file or any other storage, or simply by creating an empty instance.
|
protected IlpViewInteractionContext |
createViewInteractionContext(IlpGraphicView view)
Returns a new view interaction context for the given view.
|
void |
detach()
Detaches a controller from its view.
|
void |
focusGained(FocusEvent e)
Invoked when a component gains the keyboard focus.
|
void |
focusLost(FocusEvent e)
Invoked when a component loses the keyboard focus.
|
IlpObjectInteractor |
getCompleteObjectInteractor(IlpRepresentationObject object)
Returns the interactor responsible for handling events on the given object
in the graphic view controlled by this instance.
|
IlpContext |
getContext()
Returns the context used by the interaction with
the graphic view.
|
IlpInteractorManager |
getDefaultInteractorManager()
Gets the default interactor manager.
|
IlpViewInteractor |
getDefaultViewInteractor()
Returns the default view interactor.
|
Component |
getFocusEventComponent()
Returns the component, closely related to the view, whose focus events
shall be forwarded to the interactor.
|
Component |
getKeyEventComponent()
Returns the component, closely related to the view, whose key events
shall be forwarded to the interactor.
|
Component |
getMouseEventComponent()
Returns the component, closely related to the view, whose mouse events
shall be forwarded to the interactor.
|
IlpInteractionState |
getObjectInteractionState(IlpObjectInteractor ointeractor,
IlpObjectInteractionContext ctxt)
Looks up the interaction state corresponding to the given context
used by object interaction.
|
IlpObjectInteractor |
getObjectInteractor(IlpObject object)
Returns the interactor associated with the given business object
in the graphic view controlled by this instance.
|
IlpObjectInteractor |
getObjectInteractor(IlpObject object,
IlpAttribute attribute)
Returns the interactor associated with the given business object and
the given attribute in the graphic view controlled by this instance.
|
IlpObjectInteractor |
getObjectInteractor(IlpRepresentationObject object)
Returns the interactor associated with the given object
in the graphic view controlled by this instance.
|
IlpObjectInteractor |
getObjectInteractor(IlpRepresentationObject object,
IlpAttribute attribute)
Returns the interactor associated with the given object and
the given attribute in the graphic view controlled by this instance.
|
IlpObjectInteractor |
getObjectInteractor(Object key)
Returns the interactor associated with the given key in
the graphic view controlled by this instance.
|
IlpGraphicView |
getView()
Returns the view that is being controlled.
|
IlpViewInteractionContext |
getViewInteractionContext()
Returns the view interaction context.
|
IlpViewInteractor |
getViewInteractor()
Returns the interactor associated with the view.
|
protected void |
initGraphicViewStyleManager(IlpContext context,
IlpGraphicView view)
Creates the graphic view style manager, either retrieving the configuration
from an XML file or any other storage, or simply creating an empty instance;
and initializes the view with it.
|
protected void |
initInteractorManager(IlpContext context)
Returns the default interactor manager from the context.
|
void |
keyPressed(KeyEvent e)
Invoked when a key has been pressed.
|
void |
keyReleased(KeyEvent e)
Invoked when a key has been released.
|
void |
keyTyped(KeyEvent e)
Invoked when a key has been typed.
|
void |
mouseClicked(MouseEvent e)
Invoked when the mouse button has been clicked (pressed
and released) on a component.
|
void |
mouseDragged(MouseEvent e)
Invoked when a mouse button is pressed on a component and then
dragged.
|
void |
mouseEntered(MouseEvent e)
Invoked when the mouse enters a component.
|
void |
mouseExited(MouseEvent e)
Invoked when the mouse exits a component.
|
void |
mouseMoved(MouseEvent e)
Invoked when the mouse cursor has been moved onto a component
but no buttons have been pushed.
|
void |
mousePressed(MouseEvent e)
Invoked when a mouse button has been pressed on a component.
|
void |
mouseReleased(MouseEvent e)
Invoked when a mouse button has been released on a component.
|
void |
removeObjectInteractors()
Remove all the interactors associated with representation objects.
|
void |
removeObjectInteractors(IlpObject object)
Removes all the interactors associated with the given business object.
|
void |
removeObjectInteractors(IlpRepresentationObject object)
Removes all the interactors associated with the given object.
|
void |
setDefaultInteractorManager(IlpInteractorManager defaultManager)
Sets the default interactor manager.
|
void |
setDefaultViewInteractor(IlpViewInteractor interactor)
Sets the default view interactor.
|
void |
setObjectInteractor(IlpObject object,
IlpAttribute attribute,
IlpObjectInteractor interactor)
Sets the interactor associated with the given business object and attribute.
|
void |
setObjectInteractor(IlpObject object,
IlpObjectInteractor interactor)
Sets the interactor associated with the given business object.
|
void |
setObjectInteractor(IlpRepresentationObject object,
IlpAttribute attribute,
IlpObjectInteractor interactor)
Sets the interactor associated with the given object and attribute.
|
void |
setObjectInteractor(IlpRepresentationObject object,
IlpObjectInteractor interactor)
Sets the interactor associated with the given object.
|
void |
setObjectInteractor(Object key,
IlpObjectInteractor interactor)
Sets the interactor associated with the given key.
|
void |
setViewInteractor(IlpViewInteractor interactor)
Sets the interactor associated with the view.
|
protected WeakReference lastInteractedObject
protected WeakHashMap lastInteractionStates
public IlpAbstractGraphicController(IlpContext context)
setController
on the view.IllegalArgumentException
- if the given context is equal to
null
.public Component getMouseEventComponent()
public Component getKeyEventComponent()
public Component getFocusEventComponent()
public IlpContext getContext()
getContext
in interface IlpGraphicController
public IlpGraphicView getView()
getView
in interface IlpGraphicController
public IlpViewInteractor getViewInteractor()
getViewInteractor
in interface IlpGraphicController
public void setViewInteractor(IlpViewInteractor interactor)
setViewInteractor
in interface IlpGraphicController
public IlpViewInteractor getDefaultViewInteractor()
getDefaultViewInteractor
in interface IlpGraphicController
public void setDefaultViewInteractor(IlpViewInteractor interactor)
Note: Setting the default view interactor does not change the currently active view interactor immediately. It has an effect on the view interactor only the next time an interactor detaches itself.
public void setDefaultInteractorManager(IlpInteractorManager defaultManager)
The default interactor manager is used to retrieve interactor information, when it cannot be found in this graphic controller.
public IlpInteractorManager getDefaultInteractorManager()
The default manager is used to retrieve interactor information, when it cannot be found in this controller.
By default, the default interactor manager is defined in the application context used to create the graphic controller instance.
public void attach(IlpGraphicView v)
attach
in interface IlpGraphicController
IllegalStateException
- if the controller is already attached to a
graphic view.protected void attachView(IlpGraphicView view)
public void detach()
detach
in interface IlpGraphicController
public final IlpViewInteractionContext getViewInteractionContext()
public IlpInteractionState getObjectInteractionState(IlpObjectInteractor ointeractor, IlpObjectInteractionContext ctxt)
ointeractor
- The object interactor.ctxt
- The context where the event occurred.protected void initGraphicViewStyleManager(IlpContext context, IlpGraphicView view)
protected IlpGraphicViewStyleManager createGraphicViewStyleManager(IlpContext context, IlpGraphicView view)
IlpDefaultGraphicViewStyleManager
protected IlpViewInteractionContext createViewInteractionContext(IlpGraphicView view)
view
- The view for which to create a view interaction context.protected void initInteractorManager(IlpContext context)
public IlpObjectInteractor getObjectInteractor(Object key)
getObjectInteractor
in interface IlpInteractorManager
public IlpObjectInteractor getObjectInteractor(IlpRepresentationObject object)
getObjectInteractor
in interface IlpInteractorManager
public IlpObjectInteractor getObjectInteractor(IlpRepresentationObject object, IlpAttribute attribute)
getObjectInteractor
in interface IlpInteractorManager
public IlpObjectInteractor getObjectInteractor(IlpObject object)
getObjectInteractor
in interface IlpInteractorManager
public IlpObjectInteractor getObjectInteractor(IlpObject object, IlpAttribute attribute)
getObjectInteractor
in interface IlpInteractorManager
public void setObjectInteractor(Object key, IlpObjectInteractor interactor)
setObjectInteractor
in interface IlpMutableInteractorManager
public void setObjectInteractor(IlpRepresentationObject object, IlpObjectInteractor interactor)
setObjectInteractor
in interface IlpMutableInteractorManager
public void setObjectInteractor(IlpRepresentationObject object, IlpAttribute attribute, IlpObjectInteractor interactor)
setObjectInteractor
in interface IlpMutableInteractorManager
public void setObjectInteractor(IlpObject object, IlpObjectInteractor interactor)
setObjectInteractor
in interface IlpMutableInteractorManager
public void setObjectInteractor(IlpObject object, IlpAttribute attribute, IlpObjectInteractor interactor)
setObjectInteractor
in interface IlpMutableInteractorManager
public void removeObjectInteractors(IlpRepresentationObject object)
removeObjectInteractors
in interface IlpMutableInteractorManager
public void removeObjectInteractors(IlpObject object)
removeObjectInteractors
in interface IlpMutableInteractorManager
public void removeObjectInteractors()
removeObjectInteractors
in interface IlpMutableInteractorManager
public void mouseClicked(MouseEvent e)
mouseClicked
in interface MouseListener
public void mousePressed(MouseEvent e)
mousePressed
in interface MouseListener
public void mouseReleased(MouseEvent e)
mouseReleased
in interface MouseListener
public void mouseEntered(MouseEvent e)
mouseEntered
in interface MouseListener
public void mouseExited(MouseEvent e)
mouseExited
in interface MouseListener
public void mouseDragged(MouseEvent e)
mouseDragged
in interface MouseMotionListener
public void mouseMoved(MouseEvent e)
mouseMoved
in interface MouseMotionListener
public void keyTyped(KeyEvent e)
keyTyped
in interface KeyListener
public void keyPressed(KeyEvent e)
keyPressed
in interface KeyListener
public void keyReleased(KeyEvent e)
keyReleased
in interface KeyListener
public void focusGained(FocusEvent e)
focusGained
in interface FocusListener
public void focusLost(FocusEvent e)
focusLost
in interface FocusListener
public IlpObjectInteractor getCompleteObjectInteractor(IlpRepresentationObject object)
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.