@Override
  public IHierarchicalNodeLayout getNodeLayoutByModelName(IHierarchicalNodeModel model) {
    if (modelNameToLayoutName != null) {
      String name = modelNameToLayoutName.get(model.getLabel());
      if (name != null) {
        IHierarchicalNodeLayout layout = getNodeLayoutByName(name);
        layout.setModel(model);

        String initInfo = info(model, layout);
        Logger.getLogger(HierarchicalLayoutFactory.class).info(initInfo);
        return layout;
      } else
        throw new RuntimeException(
            "layout factory does not have a defined layout for model " + model.getLabel());
    } else
      throw new RuntimeException("layout factory does not have a model<->layout mapping by name");
  }
 @Override
 public IHierarchicalNodeLayout getHierarchicalNodeLayout(IHierarchicalNodeModel model) {
   IHierarchicalNodeLayout layout = null;
   if (hasLayoutForModel(model.getLabel())) layout = getNodeLayoutByModelName(model);
   else layout = getNodeLayoutByModelType(model);
   attachChildren(layout, model);
   return layout;
 }
 /** recursively handle children models. */
 protected void attachChildren(IHierarchicalNodeLayout layout, IHierarchicalNodeModel model) {
   for (IBoundedItem child : model.getChildren()) {
     if (child instanceof IHierarchicalNodeModel) {
       IHierarchicalNodeModel submodel = (IHierarchicalNodeModel) child;
       IHierarchicalNodeLayout sublayout = getHierarchicalNodeLayout(submodel);
       if (sublayout != null) layout.addChild(sublayout);
     }
   }
 }
 @Override
 public IHierarchicalNodeLayout getLayout(IHierarchicalNodeModel model) {
   IHierarchicalNodeLayout layout = getRootLayout(model, model.getEdgeModel());
   return layout;
 }
 protected String info(IHierarchicalNodeModel model, IHierarchicalNodeLayout layout) {
   return model.getClass().getSimpleName() + model.getLabel() + layout.getClass().getSimpleName();
 }