思维导图:多少个节点级别? “ ApplicationScoped的@Initialized和@Destroyed事件可能会触发两次”

时间:2018-08-20 18:52:45

标签: java primefaces

所以,我试图在素面MindMap中创建2个节点,如下所示: - 根 -节点链接 -链接到上一个节点的节点

但是我有这个错误:

WELD-000718: No EEModuleDescriptor defined for bean archive with ID: StoryGenerator.war. @Initialized and @Destroyed events for ApplicationScoped may be fired twice.

是否可以将多个节点链接到根?你有例子吗? 这是我的代码:

<h:form>
  <p:mindmap value="#{mapController.root}" class="mindmap">
    <p:ajax event="select" listener="#{mapController.onNodeSelect}" />
   </p:mindmap>
</h:form>


@PostConstruct
    public void init() {
        universes = this.universeFacade.findAll();
        universes.forEach(universe->{
            root.addNode(new DefaultMindmapNode(universe.getName(), universe, nodeColor, true));
        });
    }

public void onNodeSelect(SelectEvent event) {
        System.out.println("PROBLEM ICI");
        MindmapNode node = (MindmapNode) event.getObject();
        Object data = node.getData();
        DefaultMindmapNode newNode;

        if (node.getChildren().isEmpty()) {
            String className = data.getClass().getSimpleName();
            if (className.equals("Universe")) {
                initialSituations = ((Universe)data).getInitialSituations();
                for (int i = 0; i < initialSituations.size(); i++) {
                    System.out.println("/**** INITIAL SITUATIONS *****/");
                    System.out.println(initialSituations.get(i).getName());
                    newNode = new DefaultMindmapNode(initialSituations.get(i).getName(), initialSituations.get(i), nodeColor, true);
                    node.addNode(newNode);
                }
            }
            if (className.equals("InitialSituation")) {
                System.out.println("Initial SItuation");
                disruptives = ((InitialSituation)data).getDisruptives();
                for (int i = 0; i < disruptives.size(); i++) {
                    newNode = new DefaultMindmapNode(disruptives.get(i).getName(), disruptives.get(i), nodeColor, true);
                    node.addNode(newNode);
                }
            }
        }
    }

当我单击第二级节点时出现错误。谢谢您的帮助

0 个答案:

没有答案