在JAVA中将自定义节点添加到Alloyui DiagramBuilder [英] Add custom node to Alloyui DiagramBuilder in JAVA

查看:122
本文介绍了在JAVA中将自定义节点添加到Alloyui DiagramBuilder的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用此示例用Alloyui绘制图表,但我找不到在 JAVA 中创建自定义节点的方法。

I have been using this example to make a diagram with Alloyui, but I don't find the way to make a custom node in JAVA.

我试图将其简单地添加到AvaliableFields中,但似乎不起作用:

I've tried to simply add it in AvaliableFields, but doesn't seem to work:

diagramBuilder.setAvailableFields(
    new NodeType(
         "diagram-node-custom-icon",
         "Custom",
         "custom"
     ));

我已经在另一个示例中直接在javascript中完成了此工作,并且可以:

I have already done this in another example, directly in the javascript and works:

 Y.DiagramNodeCustom = Y.Component.create({
        NAME: 'diagram-node',

        ATTRS: {
            type: {
                value: 'custom'
            },
            myAtt: {
                validator: Y.Lang.isString,
                value: ''
            },
            myAtt2: {
                validator: Y.Lang.isString,
                value: ''
            }
        },

        EXTENDS: Y.DiagramNodeTask,

        prototype: {
            getPropertyModel: function () {
                var instance = this;

                var model = Y.DiagramNodeTask.superclass.getPropertyModel.apply(instance, arguments);

                model.push({
                    attributeName: 'myAtt',
                    name: '123'
                });

                model.push({
                    attributeName: 'myAtt2',
                    name: '456'
                });

                return model;
            }
        }
    });

但是我只尝试触摸Java部分。有任何想法吗?

But I'm trying only to touch the java part. Any ideas?

推荐答案

此附加组件似乎不接受自定义节点,因此我正在使用Javascript。

Seems like this add-on doesn't accept custom nodes, so I am working with Javascript.

这篇关于在JAVA中将自定义节点添加到Alloyui DiagramBuilder的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆