Skip to content

Package: NewInternetAction

NewInternetAction

nameinstructionbranchcomplexitylinemethod
NewInternetAction(ConfigurationGraph)
M: 0 C: 4
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
createNode(Point)
M: 32 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 6 C: 0
0%
M: 1 C: 0
0%

Coverage

1: package networkconfigurator.actions;
2:
3: import java.awt.Point;
4:
5: import javax.swing.JOptionPane;
6:
7: import model.assignment.VariableAssignment;
8: import networkconfigurator.ConfigurationGraph;
9: import networkconfigurator.item.ConnectingType;
10: import networkconfigurator.item.Internet;
11: import networkconfigurator.item.NcNodeConstants;
12: import networkconfigurator.item.Node;
13:
14: /**
15: * Action for adding a new internet.
16: *
17: * @author Erik Arand
18: *
19: */
20: public class NewInternetAction extends AbstractNewAction {
21:         /**
22:          * action for a new Internet-Object.
23:          *
24:          * @param graph
25:          * the graph.
26:          */
27:         public NewInternetAction(final ConfigurationGraph graph) {
28:                 super(graph);
29:         }
30:
31:         @Override
32:         protected Node createNode(final Point p) throws CreateNodeException {
33:                 final ConnectingType type = (ConnectingType) JOptionPane.showInputDialog(null,
34:                                 NcNodeConstants.CONNECTION_TYPE, NcNodeConstants.CHOOSE_A_CONNECTION_TYPE,
35:                                 JOptionPane.INFORMATION_MESSAGE, null, ConnectingType.values(),
36:                                 ConnectingType.values()[0]);
37:•                if (type == null) {
38:                         throw new CreateNodeException("No ConnectingType was choosen.");
39:                 }
40:                 return new Internet(p, type, new VariableAssignment(null, null, "Internet", null));
41:         }
42:
43: }