com.alveole.interfaces
Interface LinkManager

All Known Implementing Classes:
BasicLinkManager, JspToUrlLinkManager, LinksManager, PackageToAnyLinksManager, Struts2LinkManager

public interface LinkManager

This interface must be implemented by plugins that wish to add new links types between any NodeContainer. When user drags a new link between two nodes, all LinkManager plugins are called (method canLink) until one can perform linking. Then, createLink method is called. Then link must be created, and its mgrId attribute must be correctly set to current LinkManager plugin ID. When user wants to delete a selected link, deleteLink is called. Serialization and unserialization of link is performed by associated LinkManager. Its goal is to save / restore all specific properties or objects stored in that link.

Author:
sylvain
See Also:
com.alveole.studio.linkmanager.

Method Summary
 boolean canLink(ProjectContext context, NodeContainer node1, NodeContainer node2)
          Check wether this plugin is responsible for creating a link of this type.
 NodeLink copyLink(ProjectContext context, NodeLink original, NodeContainer node1, NodeContainer node2)
          Copies a link (when user selects some nodes and links and click copy popup menu, and paste).
 void createLink(ProjectContext context, NodeContainer node1, NodeContainer node2)
          Create a link.
 void deleteLink(ProjectContext context, NodeLink link)
          Delete a link.
 void editLink(ProjectContext context, NodeLink link, boolean shortView)
          Edit and modify a link.
 void serialize(NodeLink link, org.w3c.dom.Element element)
          Serialize this link specific part.
 void unserialize(NodeLink link, org.w3c.dom.Element element)
          Unserialize (if it is possible for this plugin) this serialized link specific part.
 

Method Detail

canLink

boolean canLink(ProjectContext context,
                NodeContainer node1,
                NodeContainer node2)
Check wether this plugin is responsible for creating a link of this type.

Parameters:
context - The project context.
node1 - The first node.
node2 - The target node.
Returns:
true if this manager can perform linking of these two nodes.

createLink

void createLink(ProjectContext context,
                NodeContainer node1,
                NodeContainer node2)
Create a link. This method is called to create and initialize a link. It is responsible for opening all necessary dialogs to ask user to fill any needed data.

Parameters:
context - The project context.
node1 - The original node.
node2 - The target node.

copyLink

NodeLink copyLink(ProjectContext context,
                  NodeLink original,
                  NodeContainer node1,
                  NodeContainer node2)
Copies a link (when user selects some nodes and links and click copy popup menu, and paste). Note: copy is performed only when user clicks "paste" in popup menu.

Parameters:
context - The project context.
original - The origin node for this link.
node1 - The copy of the origin node.
node2 - The copy of the target node.
Returns:
The copy or null if link cannot be copied.

editLink

void editLink(ProjectContext context,
              NodeLink link,
              boolean shortView)
Edit and modify a link. Opens a specific link edition panel.

Parameters:
context - The current project context.
link - The node link to be edited.
shortView - true if link is simply selected, false if link has been dbl-clicked.

deleteLink

void deleteLink(ProjectContext context,
                NodeLink link)
Delete a link. Performs all cleanup for this link, using project API.

Parameters:
context - The current project context.
link - The link to be deleted.
See Also:
Project

unserialize

void unserialize(NodeLink link,
                 org.w3c.dom.Element element)
Unserialize (if it is possible for this plugin) this serialized link specific part. This includes all specific attributes.

Parameters:
link - The node link.
element - The DOM element in which specific properties from link should be stored.

serialize

void serialize(NodeLink link,
               org.w3c.dom.Element element)
Serialize this link specific part. This includes all specific attributes.

Parameters:
link - The link to customize given the serialized data.
element - The specific DOM element that stores properties.