public static String addStencilShape(EditorPalette palette,String nodeXml,String path){
  int lessthanIndex=nodeXml.indexOf("<");
  nodeXml=nodeXml.substring(lessthanIndex);
  mxStencilShape newShape=new mxStencilShape(nodeXml);
  String name=newShape.getName();
  ImageIcon icon=null;
  if (path != null) {
    String iconPath=path + newShape.getIconPath();
    icon=new ImageIcon(iconPath);
  }
  mxGraphics2DCanvas.putShape(name,newShape);
  if (palette != null && icon != null) {
    palette.addTemplate(name,icon,"shape=" + name,80,80,"");
  }
  return name;
}

public static String addStencilShape ( EditorPalette palette , String nodeXml , String path ) { int lessthanIndex = nodeXml . indexOf ( "<" ) ; nodeXml = nodeXml . substring ( lessthanIndex ) ; mxStencilShape newShape = new mxStencilShape ( nodeXml ) ; String name = newShape . getName ( ) ; ImageIcon icon = null ; if ( path != null ) { String iconPath = path + newShape . getIconPath ( ) ; icon = new ImageIcon ( iconPath ) ; } mxGraphics2DCanvas . putShape ( name , newShape ) ; if ( palette != null && icon != null ) { palette . addTemplate ( name , icon , "shape=" + name , 80 , 80 , "" ) ; } return name ; }
loads and registers the shape as a new shape in mxgraphics2dcanvas and adds a new entry to use that shape in the specified palette
