Install listeners to send notifications for
actions executed on, the server side, such as when a graphic
object is clicked, selected, or deleted.
To implement and configure a server
action listener:
-
Create a servlet that extends a subclass of IlvManagerServlet or IlvSDMServlet, or that uses these classes themselves. The actionName attribute is the action type (such as clicked or delete), and the actionListener attribute is the class of the server action listener.For more details, see the IlvServerActionParser and the js-diagrammer-editing sample located in <installdir> /jviews-diagrammer810/samples/diagrammer/js-diagrammer-editing/index.html.
-
Configure the server-side action listeners either by editing the
web.xml
file or by using annotations.Customized servlet example in a web.xml file:<servlet> <servlet-name>DiagrammerEditingServlet</servlet-name> <servlet-class>demo.editing.DiagrammerEditingServlet</servlet-class> <!-- content between init-param tags equivalent to annotations shown in next substep. --> <init-param> <param-name>serverActions</param-name> <param-value> [createObject] [deleteObject, ilog.views.diagrammer.servlet.IlvDiagrammerDeleteActionListener] </param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>DiagrammerEditingServlet</servlet-name> <url-pattern>/DiagrammerEditingServlet</url-pattern> </servlet-mapping>
To use the customized servlet in a JViews Diagrammer view, use the following assignment statement:<jvdf:diagrammerView id="diagrammer" servlet="DiagrammerEditingServlet " ... />
Java annotation example configuring server action listeners:@IlvServerActions(parameters={ @IlvServerActionParam(actionName="deleteObject", actionListener=DiagrammerDeleteActionListener.class), @IlvServerActionParam(actionName="createObject"), @IlvServerActionParam(actionName="myServerAction", actionListener=MyServerAction.class), }) public class DiagrammerEditingServlet extends IlvDiagrammerServlet { ......}