public class IlvDocumentViewSupport extends Object implements IlvDocumentView
IlvDocumentView
interface.
An instance of this class can be used as a member field of the
document view class and can delegate implementation of methods to it.ACTIVE_PROPERTY, ACTIVE_VIEW_NAME, APPLICATION_PROPERTY, CLOSABLE_PROPERTY, CLOSING_VIEW_MSG, DOCUMENT_PROPERTY, SETTINGS_ELEMENT_PROPERTY, STATIC_VIEW_PROPERTY, VIEW_CONTAINER_PROPERTY
Constructor and Description |
---|
IlvDocumentViewSupport(Object view)
Constructs a new
IlvDocumentViewSupport . |
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(ActionEvent event)
Invoked when an action event occurs.
|
void |
addActionHandler(ActionHandler actionHandler)
Adds the specified
actionHandler to the list of action
handlers of the support object. |
void |
addPropertyChangeListener(PropertyChangeListener listener)
Adds a listener that listens for changes in the properties of this object.
|
IlvApplication |
getApplication()
Returns the application of the view.
|
IlvDocument |
getDocument()
Returns the document associated with the view.
|
Object |
getProperty(String key)
Returns the property of this view with the specified key.
|
IlvViewContainer |
getViewContainer()
Returns the view container that owns the view.
|
void |
initializeView(IlvDocument document)
Initializes the document view with the specified document.
|
boolean |
isProcessingAction(String command)
Determines whether the action with the specified command key can be
processed by the support object.
|
void |
receiveMessage(MessageEvent event)
Processes the specified message
event . |
void |
registerActionMethod(String command,
String methodName)
Maps the method with the specified
methodName to the specified
action command . |
void |
registerActionStateMethod(String command,
String methodName)
Registers a method to be called when updating the specified action.
|
protected void |
registerMappings(IlvMessageMapper mapper)
This method is automatically called to register the mappings between
action events and updates with the view methods.
|
boolean |
removeActionHandler(ActionHandler actionHandler)
Removes the specified
actionHandler from the list of action
handlers managed by this support object. |
void |
removePropertyChangeListener(PropertyChangeListener listener)
Removes the specified
listener from the list of PropertyChange
listeners managed by this object. |
void |
setApplication(IlvApplication application)
Sets the application of the view.
|
void |
setDocument(IlvDocument document)
Sets the document associated with the view.
|
Object |
setProperty(String key,
Object value)
Changes the value of one of the properties of the view.
|
void |
setViewContainer(IlvViewContainer container)
Sets the view container that owns the view.
|
boolean |
updateAction(Action action)
Updates the state of the specified action.
|
void |
viewClosed()
Invoked after the view has been closed.
|
void |
viewClosing()
Invoked before the view closes.
|
public IlvDocumentViewSupport(Object view)
IlvDocumentViewSupport
.view
- The view that uses this support object.public void initializeView(IlvDocument document)
initializeView
in interface IlvDocumentView
document
- The document to initialize the content of the view with.public void viewClosing()
viewClosing
in interface IlvDocumentView
viewClosed()
public void viewClosed()
viewClosed
in interface IlvDocumentView
viewClosing()
public IlvDocument getDocument()
getDocument
in interface IlvDocumentView
IlvDocumentView.DOCUMENT_PROPERTY
.public void setDocument(IlvDocument document)
IlvDocumentView.DOCUMENT_PROPERTY
is set to the new
specified document.document
- The document of the view.IlvDocumentView.DOCUMENT_PROPERTY
public IlvViewContainer getViewContainer()
getViewContainer
in interface IlvDocumentView
IlvDocumentView.VIEW_CONTAINER_PROPERTY
.setViewContainer(ilog.views.appframe.docview.IlvViewContainer)
public void setViewContainer(IlvViewContainer container)
IlvDocumentView.VIEW_CONTAINER_PROPERTY
is set to the new
specified container.container
- The new view container of the view.getViewContainer()
public IlvApplication getApplication()
getApplication
in interface IlvDocumentView
IlvDocumentView.APPLICATION_PROPERTY
.setApplication(ilog.views.appframe.IlvApplication)
public void setApplication(IlvApplication application)
IlvDocumentView.APPLICATION_PROPERTY
is set to the new
specified application.application
- The application of the view.getApplication()
public void receiveMessage(MessageEvent event)
event
.
This method retrieves the method associated with the name of the
specified message and invokes it with the message event
parameters as the parameter.receiveMessage
in interface MessageListener
event
- The message event.registerMappings(ilog.views.appframe.event.IlvMessageMapper)
public void registerActionMethod(String command, String methodName)
methodName
to the specified
action command
.
The method methodName
of the view object specified to this support object
is invoked when an action event with the specified command
key occurs.
The specified method must have been defined with the following signatures:
public void methodName(ActionEvent e) { ... }or
public void methodName() { ... }
command
- The command key of the action.methodName
- The name of the method to map to the specified action.IlvMessageMapper.registerActionMethod(java.lang.String, java.lang.String)
,
actionPerformed(java.awt.event.ActionEvent)
public void registerActionStateMethod(String command, String methodName)
public boolean methodName(Action action) { ... }
command
- The command key of the action to be updated.methodName
- The name of the method of the view to associate with the
update events of the specified action.updateAction(javax.swing.Action)
protected void registerMappings(IlvMessageMapper mapper)
mapper
- The message mapper to register mappings to.registerActionMethod(java.lang.String, java.lang.String)
,
registerActionStateMethod(java.lang.String, java.lang.String)
public boolean isProcessingAction(String command)
isProcessingAction
in interface ActionHandler
command
- The command key of the action.true
if the action has been associated with a method
or an action handler added with addActionHandler(ilog.views.appframe.event.ActionHandler)
;
false
otherwise.registerActionMethod(java.lang.String, java.lang.String)
public boolean updateAction(Action action)
registerActionStateMethod(java.lang.String, java.lang.String)
, it will be called. If an
action handler added with the addActionHandler(ilog.views.appframe.event.ActionHandler)
method is associated
with the action, it will be invoked. Otherwise, this method
does nothing and returns false
.updateAction
in interface ActionHandler
action
- The action to update the state of.true
if a method or an action handler could process
the state of the specified action; false
otherwise.ActionHandler.updateAction(javax.swing.Action)
,
registerActionStateMethod(java.lang.String, java.lang.String)
public void actionPerformed(ActionEvent event)
registerActionMethod(java.lang.String, java.lang.String)
for the action corresponding to the
action event, it will be called. If an action handler added with
the addActionHandler(ilog.views.appframe.event.ActionHandler)
has been added for processing this action,
it will be invoked. Otherwise, nothing is done.actionPerformed
in interface ActionListener
event
- The action event to handle.ActionListener.actionPerformed(java.awt.event.ActionEvent)
,
registerActionMethod(java.lang.String, java.lang.String)
,
addActionHandler(ilog.views.appframe.event.ActionHandler)
public void addActionHandler(ActionHandler actionHandler)
actionHandler
to the list of action
handlers of the support object.actionHandler
- The new action handler.removeActionHandler(ilog.views.appframe.event.ActionHandler)
public boolean removeActionHandler(ActionHandler actionHandler)
actionHandler
from the list of action
handlers managed by this support object.true
if the action handler was added previously;
false
otherwise.addActionHandler(ilog.views.appframe.event.ActionHandler)
public Object setProperty(String key, Object value)
PropertyChangeEvent
is sent to
property change listeners.setProperty
in interface IlvPropertyManager
key
- The non-null
property key.value
- An Object
value. If it is equal to
null
, the property with the specified key will be removed.getProperty(java.lang.String)
public Object getProperty(String key)
getProperty
in interface IlvPropertyManager
key
- The non-null
property key.null
if the specified property was not found.setProperty(java.lang.String, java.lang.Object)
public void addPropertyChangeListener(PropertyChangeListener listener)
addPropertyChangeListener
in interface IlvPropertyManager
listener
- The listener to add.removePropertyChangeListener(java.beans.PropertyChangeListener)
public void removePropertyChangeListener(PropertyChangeListener listener)
listener
from the list of PropertyChange
listeners managed by this object.removePropertyChangeListener
in interface IlvPropertyManager
listener
- The listener to removeaddPropertyChangeListener(java.beans.PropertyChangeListener)
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.