Skip to content

Package: AddRouterView

AddRouterView

nameinstructionbranchcomplexitylinemethod
AddRouterView()
M: 134 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 27 C: 0
0%
M: 1 C: 0
0%
configPanel()
M: 94 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 12 C: 0
0%
M: 1 C: 0
0%
getBtnSearchPath()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getButtonPane()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getCancelButton()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getContentPanel()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getFileChooser()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getLblSourcepath()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getOkButton()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getSerialversionuid()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getSlContentPanel()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getTfSourcePath()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%

Coverage

1: package gui.view;
2:
3: import java.awt.BorderLayout;
4: import java.awt.FlowLayout;
5:
6: import javax.swing.JButton;
7: import javax.swing.JDialog;
8: import javax.swing.JFileChooser;
9: import javax.swing.JFrame;
10: import javax.swing.JLabel;
11: import javax.swing.JPanel;
12: import javax.swing.JTextField;
13: import javax.swing.SpringLayout;
14: import javax.swing.border.EmptyBorder;
15:
16: /**
17: * The dialog box for adding a router.
18: *
19: * @author Mark Wittig / Lukas Aliger
20: *
21: */
22: public class AddRouterView extends JDialog {
23:
24:         /**
25:          * default serialVersionUID.
26:          */
27:         private static final long serialVersionUID = -5924070168033850535L;
28:
29:         /**
30:          * The main JPanel of AddRouterView.
31:          */
32:         private final JPanel contentPanel = new JPanel();
33:
34:         /**
35:          * textField to entry the source path of the routers config.
36:          */
37:         private final JTextField tfSourcePath;
38:
39:         /**
40:          * label of the textField tfSourcePath.
41:          */
42:         private final JLabel lblSourcepath;
43:
44:         /**
45:          * The button for searching the router config.
46:          */
47:         private final JButton btnSearchPath;
48:
49:         /**
50:          * The layout for AddRouterView.
51:          */
52:         private final SpringLayout slContentPanel;
53:
54:         /**
55:          * the panel for the okButton and cancelButton.
56:          */
57:         private final JPanel buttonPane;
58:
59:         /**
60:          * The button for confirming the addRouter dialogue.
61:          */
62:         private final JButton okButton;
63:
64:         /**
65:          * The button for aborting the addRouter dialogue.
66:          */
67:         private final JButton cancelButton;
68:
69:         /**
70:          * FileChooser for searching the router config easily.
71:          */
72:         private final JFileChooser fileChooser;
73:
74:         /**
75:          * Create the dialog.
76:          */
77:         public AddRouterView() {
78:                 super();
79:                 this.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
80:                 this.setResizable(false);
81:                 this.setBounds(basic.GuiConstants.FRAMEBOUNDX, basic.GuiConstants.FRAMEBOUNDY,
82:                                 basic.GuiConstants.DIALOGBOXWIDTH, basic.GuiConstants.DIALOGBOXHEIGHT);
83:
84:                 getContentPane().setLayout(new BorderLayout());
85:
86:                 this.contentPanel.setBorder(new EmptyBorder(basic.GuiConstants.BORDER,
87:                                 basic.GuiConstants.BORDER, basic.GuiConstants.BORDER, basic.GuiConstants.BORDER));
88:
89:                 getContentPane().add(this.contentPanel, BorderLayout.CENTER);
90:
91:                 this.tfSourcePath = new JTextField();
92:                 this.tfSourcePath.setColumns(basic.GuiConstants.TEXTFIELDCOLS);
93:
94:                 this.lblSourcepath = new JLabel("Sourcepath");
95:
96:                 this.btnSearchPath = new JButton("Search Path");
97:
98:                 this.slContentPanel = new SpringLayout();
99:
100:                 configPanel();
101:
102:                 this.buttonPane = new JPanel();
103:                 this.buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
104:                 getContentPane().add(this.buttonPane, BorderLayout.SOUTH);
105:
106:                 this.okButton = new JButton(basic.GuiConstants.OKAYTEXT);
107:                 this.okButton.setActionCommand(basic.GuiConstants.OKAYTEXT);
108:                 this.buttonPane.add(this.okButton);
109:                 getRootPane().setDefaultButton(this.okButton);
110:
111:                 this.cancelButton = new JButton(basic.GuiConstants.CANCELTEXT);
112:                 this.cancelButton.setActionCommand("Cancel");
113:                 this.buttonPane.add(this.cancelButton);
114:
115:                 this.fileChooser = new JFileChooser();
116:                 this.fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
117:
118:         }
119:
120:         /**
121:          * Method for set the layout of the items of ContentPanel.
122:          */
123:         private void configPanel() {
124:                 this.slContentPanel.putConstraint(SpringLayout.NORTH, this.btnSearchPath,
125:                                 basic.GuiConstants.BTNSPNORTH, SpringLayout.NORTH, this.contentPanel);
126:                 this.slContentPanel.putConstraint(SpringLayout.WEST, this.btnSearchPath,
127:                                 basic.GuiConstants.BTNSPWEST, SpringLayout.WEST, this.contentPanel);
128:                 this.slContentPanel.putConstraint(SpringLayout.NORTH, this.tfSourcePath,
129:                                 basic.GuiConstants.TFSPNORTH, SpringLayout.NORTH, this.contentPanel);
130:                 this.slContentPanel.putConstraint(SpringLayout.WEST, this.tfSourcePath,
131:                                 basic.GuiConstants.TFSPWEST, SpringLayout.WEST, this.contentPanel);
132:                 this.slContentPanel.putConstraint(SpringLayout.EAST, this.tfSourcePath,
133:                                 basic.GuiConstants.TFSPEAST, SpringLayout.WEST, this.contentPanel);
134:                 this.slContentPanel.putConstraint(SpringLayout.NORTH, this.lblSourcepath,
135:                                 basic.GuiConstants.LBLSPNORTH, SpringLayout.NORTH, this.contentPanel);
136:                 this.slContentPanel.putConstraint(SpringLayout.WEST, this.lblSourcepath,
137:                                 basic.GuiConstants.LBLSPWEST, SpringLayout.WEST, this.contentPanel);
138:                 this.contentPanel.setLayout(this.slContentPanel);
139:                 this.contentPanel.add(this.lblSourcepath);
140:                 this.contentPanel.add(this.tfSourcePath);
141:                 this.contentPanel.add(this.btnSearchPath);
142:         }
143:
144:         /**
145:          * @return the serialversionuid
146:          */
147:         protected static long getSerialversionuid() {
148:                 return serialVersionUID;
149:         }
150:
151:         /**
152:          * @return the contentPanel
153:          */
154:         public JPanel getContentPanel() {
155:                 return this.contentPanel;
156:         }
157:
158:         /**
159:          * @return the tfSourcePath
160:          */
161:         public JTextField getTfSourcePath() {
162:                 return this.tfSourcePath;
163:         }
164:
165:         /**
166:          * @return the lblSourcepath
167:          */
168:         public JLabel getLblSourcepath() {
169:                 return this.lblSourcepath;
170:         }
171:
172:         /**
173:          * @return the btnSearchPath
174:          */
175:         public JButton getBtnSearchPath() {
176:                 return this.btnSearchPath;
177:         }
178:
179:         /**
180:          * @return the slContentPanel
181:          */
182:         public SpringLayout getSlContentPanel() {
183:                 return this.slContentPanel;
184:         }
185:
186:         /**
187:          * @return the buttonPane
188:          */
189:         public JPanel getButtonPane() {
190:                 return this.buttonPane;
191:         }
192:
193:         /**
194:          * @return the okButton
195:          */
196:         public JButton getOkButton() {
197:                 return this.okButton;
198:         }
199:
200:         /**
201:          * @return the cancelButton
202:          */
203:         public JButton getCancelButton() {
204:                 return this.cancelButton;
205:         }
206:
207:         /**
208:          * @return the fileChooser
209:          */
210:         public JFileChooser getFileChooser() {
211:                 return this.fileChooser;
212:         }
213:
214: }