如何创建图表节点列表的层次结构?

时间:2016-01-11 11:33:10

标签: javafx treeview hierarchyid

我想创建一个TreeView,其中我存储了我的图形的所有节点。当我修改节点的名称时,我希望在我的树视图上更新此名称...但我不知道如何处理你能帮助我吗?

我在添加新节点时尝试添加节点的名称:

这是我的方法addNode:

@Override
public void addNode(final double currentZoomFactor) {
    String s;

    final double windowXOffset = graphEditorContainer.windowXProperty().get() / currentZoomFactor;
    final double windowYOffset = graphEditorContainer.windowYProperty().get() / currentZoomFactor;

    final GNode node = GraphFactory.eINSTANCE.createGNode();
    node.setY(NODE_INITIAL_Y + windowYOffset);

    node.setType(GreySkinConstants.GREY_NODE);
    node.setX(NODE_INITIAL_X + windowXOffset);
    node.setId(allocateNewId());
   //node.setNomClasse("nom_classe");

    final GConnector input = GraphFactory.eINSTANCE.createGConnector();
    node.getConnectors().add(input);
    input.setType(GreySkinConstants.GREY_OUTPUT_CONNECTOR);

    final GConnector output = GraphFactory.eINSTANCE.createGConnector();
    node.getConnectors().add(output);
    output.setType(GreySkinConstants.GREY_OUTPUT_CONNECTOR);

    Commands.addNode(graphEditor.getModel(), node);

    GraphEditorDemoController.getInstance().getClasse_Listview().getItems().add(node.getNomClasse());
}

0 个答案:

没有答案