如何将鱼尾纹添加到 UMLet?

发布于 2024-12-16 18:13:41 字数 172 浏览 1 评论 0原文

我使用 UMLet 创建类图。

UMLet 允许您通过编写自己的 Java 代码来添加自定义元素以进行显示。然后将它们作为 .java 文件存储在程序目录中。

如何将鱼尾纹关系添加为自定义元素?

I'm using UMLet for creating class diagrams.

UMLet lets you add custom elements by writing your own Java code for their display. These are then stored as .java files in the programs directory.

How can I add crow's foot relations as custom elements?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

七禾 2024-12-23 18:13:41

几年前我也想要同样的东西。我最终只是下载了源代码并进行了更改。我相信我使用的是 Umlet 10.0.3 或 10.3。我更改的文件是com.umlet.element.base.Relation.java。基本上它是修改属性解析器代码。我添加了两个新端点:“m>”和 ”

在方法 setState 中,我添加了:

else if (s.indexOf(">>") >= 0) {
    endArrow = "<<";

// Glenn Crow Foot Mod Begin
} else if (s.indexOf("m>") >= 0) {
    // Mulitplicity set -> crow's foot for ERD
    endArrow = "crowsFoot";
// Glenn Crow Foot Mod End

}
else if (s.indexOf(">") >= 0) {
    if (endArrow.equals("")) endArrow = "<";
}

在同一方法中进一步向下添加:

else if (s.indexOf("<<") >= 0) {
    beginArrow = "<<";

// Glenn Crow Foot Mod Begin
} else if (s.indexOf("<m") >= 0) {
    // Mulitplicity set -> crow's foot for ERD
    beginArrow = "crowsFoot";
// Glenn Crow Foot Mod End

}
else if (s.indexOf("<") >= 0) {

paintEntity 方法中,我添加以下内容:

else if (r instanceof Arrow) {
    Arrow arrow = (Arrow) r;

    // Glenn Crow Foot Mod Begin
    if (arrow.getString().equals("crowsFoot")) {
        g2.drawLine( (int) arrow.getX(), (int) arrow.getY() + arrow.getArrowEndA().y,
                     (int) arrow.getX() + arrow.getArrowEndA().x, (int) arrow.getY()    );
        g2.drawLine( (int) arrow.getX(), (int) arrow.getY() + arrow.getArrowEndB().y,
                     (int) arrow.getX() + arrow.getArrowEndB().x, (int) arrow.getY()    );
    // Glenn Crow Foot Mod End

    // A.Mueller Start
    } else if (!arrow.getString().equals("n")

我对结果感到满意。但我不想把它放在每个版本中,而且它从未添加到代码库中(我怀疑是因为它不够 uml 风格),所以它现在可能已经过时了。

I wanted the same thing a few years back. I ended up just downloading the source and changing it. I believe I was using Umlet 10.0.3 or 10.3. The file I changed was com.umlet.element.base.Relation.java. Basically it is modifying the property parser code. I added two new endpoints: "m>" and "

In method setState I added:

else if (s.indexOf(">>") >= 0) {
    endArrow = "<<";

// Glenn Crow Foot Mod Begin
} else if (s.indexOf("m>") >= 0) {
    // Mulitplicity set -> crow's foot for ERD
    endArrow = "crowsFoot";
// Glenn Crow Foot Mod End

}
else if (s.indexOf(">") >= 0) {
    if (endArrow.equals("")) endArrow = "<";
}

and a bit further down in the same method:

else if (s.indexOf("<<") >= 0) {
    beginArrow = "<<";

// Glenn Crow Foot Mod Begin
} else if (s.indexOf("<m") >= 0) {
    // Mulitplicity set -> crow's foot for ERD
    beginArrow = "crowsFoot";
// Glenn Crow Foot Mod End

}
else if (s.indexOf("<") >= 0) {

In the paintEntity method, I added the following:

else if (r instanceof Arrow) {
    Arrow arrow = (Arrow) r;

    // Glenn Crow Foot Mod Begin
    if (arrow.getString().equals("crowsFoot")) {
        g2.drawLine( (int) arrow.getX(), (int) arrow.getY() + arrow.getArrowEndA().y,
                     (int) arrow.getX() + arrow.getArrowEndA().x, (int) arrow.getY()    );
        g2.drawLine( (int) arrow.getX(), (int) arrow.getY() + arrow.getArrowEndB().y,
                     (int) arrow.getX() + arrow.getArrowEndB().x, (int) arrow.getY()    );
    // Glenn Crow Foot Mod End

    // A.Mueller Start
    } else if (!arrow.getString().equals("n")

I was happy with the result. But I didn't want to put it in each release, and it was never added to the code base (I suspect because it isn't uml-ish enough), so it may be out of date now.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文