import javax.swing.JOptionPane;
import org.freeplane.plugin.script.proxy.NodeProxy;
import org.freeplane.plugin.script.proxy.Proxy;
import org.freeplane.plugin.script.proxy.Proxy.NodeRO;
import org.freeplane.plugin.script.proxy.Proxy.Node;


final String ERROR_INFO = "You must invoke this script on root node of freshly created mind-map...";
final String PERSON_NODE = "Person";
final String PERSON_NODE_NOTE = "This template is auto-generated by the script." + 
								" Root children nodes represent specific information about person" + 
								" like e-mail, username, company and website. In each of those children" +
								" you can create a child node in which you put specific information and" +
								" after that you can invoke script specific for that information to search" +
								" for related info.";
final String E_MAIL_NODE = "E-mail";
final String USERNAME_NODE = "Username";
final String WEBSITE_NODE = "Website";
final String COMPANY_NODE = "Company";

if(!node.isRoot()) {
	JOptionPane.showMessageDialog(null, ERROR_INFO);
	return;
}

node.setText(PERSON_NODE);
node.setNoteText(PERSON_NODE_NOTE);

createBranch(E_MAIL_NODE, E_MAIL_NODE.toLowerCase(), node);
createBranch(USERNAME_NODE, USERNAME_NODE.toLowerCase(), node);
createBranch(WEBSITE_NODE, WEBSITE_NODE.toLowerCase(), node);
createBranch(COMPANY_NODE, COMPANY_NODE.toLowerCase(), node);

def createBranch(text, tagValue, Node root) {
	Node child = root.createChild(text);
	child.setVerticalShift(30);
	child.setHorizontalShift(50);
}