ConfigureTree.java 文件源码

java
阅读 31 收藏 0 点赞 0 评论 0

项目:VASSAL-src 作者:
protected Action buildCloneAction(final Configurable target) {
  final DefaultMutableTreeNode targetNode = getTreeNode(target);
  if (targetNode.getParent() != null) {
    return new AbstractAction("Clone") {
      private static final long serialVersionUID = 1L;

      public void actionPerformed(ActionEvent evt) {
        Configurable clone = null;
        try {
          clone = target.getClass().getConstructor().newInstance();
        }
        catch (Throwable t) {
          ReflectionUtils.handleNewInstanceFailure(t, target.getClass());
        }

        if (clone != null) {
          clone.build(target.getBuildElement(Builder.createNewDocument()));
          insert(getParent(targetNode), clone,
                 targetNode.getParent().getIndex(targetNode) + 1);
        }
      }
    };
  }
  else {
    return null;
  }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号