skip to main content
Diagrammer > Programmer's documentation > Building Web applications > Developing JViews Diagrammer JavaScript Web applications > Deleting selected nodes and links
 
Deleting selected nodes and links
Shows how to delete selected nodes and links.
*Overview
*Provides an overview of the class used to delete selected nodes and links.
*Client-side configuration
*Shows how to configure deletion of selected nodes and links on the client side of the JavaScript Web application.
*Server-side configuration
*Shows how to configure deletion of selected nodes and links on the server side of the JavaScript Web application
Overview
The ability to delete selected nodes and links in a JavaScript Web application is handled through the IlvSelectionManager class.
Once set on the view and configured (see Managing selection) you can call the deleteSelection() method on the IlvSelectionManager class to delete objects that have been selected using the IlvSelectInteractor.
NOTE Nodes and Links deletion makes sense in multisession mode only.
Client-side configuration
To be able to delete the selected nodes and links on the client side, import the following scripts:
 
<script TYPE="text/javascript" src="script/IlvAbstractSelectionManager.js">
</script>
<script TYPE="text/javascript" src="script/framework/IlvSelectionManager.js">
</script>
Once selected by the user, the objects can be deleted using the following line of code:
 
view.getSelectionManager().deleteSelection();
Server-side configuration
To be able to deal with the actions submitted by the deleteSelection() call from the client side, the image servlet support must be configured by adding the action listener that can handle them.
Example:
 
public class DiagrammerServlet extends IlvDiagrammerServlet {
  protected IlvSDMServletSupport createServletSupport(ServletContext context) {
    return new DiagrammerServletSupport(context);
  }
}
 
public class DiagrammerServletSupport extends IlvDiagrammerServletSupport {
  public DiagrammerServletSupport(ServletContext context) {
    super(context);
    addServerActionListener(new IlvDiagrammerDeleteActionListener());;
  }
}

Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.