Skip to contentMethod: acceptConnectVisitor(ConnectVisitor)
      1: package networkconfigurator.item;
2: 
3: import java.awt.Point;
4: import java.awt.image.BufferedImage;
5: import java.io.File;
6: import java.io.IOException;
7: 
8: import javax.imageio.ImageIO;
9: 
10: import model.assignment.VariableAssignment;
11: import networkconfigurator.DetailBarLabel;
12: import networkconfigurator.DetailBarPropertyEntry;
13: import networkconfigurator.DetailDrawPropertyEntry;
14: 
15: /**
16:  * Host node.
17:  * 
18:  * @author Erik Arand
19:  *
20:  */
21: public class Host extends Routable {
22: 
23:         /**
24:          * Constructor.
25:          * 
26:          * @param p
27:          *            the point.
28:          */
29:         public Host(final Point p) {
30:                 super();
31:                 this.setPoint(p);
32:                 setBoundary();
33:                 this.setName(NcNodeConstants.HOST);
34:         }
35: 
36:         /**
37:          * Constructor with name.
38:          * 
39:          * @param p
40:          *            the point.
41:          * @param name
42:          *            the name of the host.
43:          */
44:         public Host(final Point p, final VariableAssignment name) {
45:                 this(p);
46:                 this.setName(name.getValue());
47:                 this.getPropertyBar().add(new DetailBarPropertyEntry(new DetailBarLabel("Name")));
48:                 this.getPropertyBar().add(new DetailBarPropertyEntry(name));
49:                 this.getPropertyDraw().add(new DetailDrawPropertyEntry(name));
50:         }
51: 
52:         @Override
53:         public void accept(final ItemVisitor visitor) {
54:                 visitor.host(this);
55:         }
56: 
57:         @Override
58:         public BufferedImage giveImage() {
59:                 try {
60:                         return ImageIO.read(new File(NcNodeConstants.PACKAGE_ICONS + "host.png"));
61:                 } catch (final IOException e) {
62:                         e.printStackTrace();
63:                 }
64:                 return null;
65:         }
66: 
67:         @Override
68:         public void acceptConnectingTypeVisitor(final ConnectingTypeVisitor visitor) {
69:                 visitor.others(this);
70: 
71:         }
72: 
73:         @Override
74:         public void acceptConnectVisitor(final ConnectVisitor visitor) {
75:         }
76: 
77: }