3
* Copyright 2008,2009 Newcastle University
5
* This file is part of Workcraft.
7
* Workcraft is free software: you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation, either version 3 of the License, or
10
* (at your option) any later version.
12
* Workcraft is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
17
* You should have received a copy of the GNU General Public License
18
* along with Workcraft. If not, see <http://www.gnu.org/licenses/>.
22
package org.workcraft.plugins.xmas.components;
24
import java.awt.Shape;
25
import java.awt.event.KeyEvent;
26
import java.awt.geom.Path2D;
28
import org.workcraft.annotations.DisplayName;
29
import org.workcraft.annotations.Hotkey;
30
import org.workcraft.annotations.SVGIcon;
31
import org.workcraft.dom.visual.Positioning;
34
@Hotkey(KeyEvent.VK_K)
35
@SVGIcon("images/icons/svg/xmas-fork.svg")
36
public class VisualForkComponent extends VisualXmasComponent {
38
public VisualForkComponent(ForkComponent component) {
40
if (component.getChildren().isEmpty()) {
41
this.addInput("", Positioning.TOP);
42
this.addOutput("", Positioning.BOTTOM_RIGHT);
43
this.addOutput("", Positioning.BOTTOM_LEFT);
48
public Shape getShape() {
49
Path2D shape = new Path2D.Double();
51
shape.moveTo(0, -0.5 * size);
52
shape.lineTo(0, -0.1 * size);
54
shape.moveTo(-0.5 * size, -0.1 * size);
55
shape.lineTo(+0.5 * size, -0.1 * size);
57
shape.moveTo(-0.5 * size, +0.1 * size);
58
shape.lineTo(+0.5 * size, +0.1 * size);
60
shape.moveTo(-0.5 * size, +0.1 * size);
61
shape.lineTo(-0.5 * size, +0.5 * size);
63
shape.moveTo(+0.5 * size, +0.1 * size);
64
shape.lineTo(+0.5 * size, +0.5 * size);