Skip to content

Package: MainView

MainView

nameinstructionbranchcomplexitylinemethod
MainView()
M: 80 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 21 C: 0
0%
M: 1 C: 0
0%
configJFrame()
M: 29 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 7 C: 0
0%
M: 1 C: 0
0%
configLeftPanel()
M: 52 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 7 C: 0
0%
M: 1 C: 0
0%
configMainPanel()
M: 20 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
configPanes()
M: 9 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
configRightPanel()
M: 52 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 7 C: 0
0%
M: 1 C: 0
0%
configTopPanel()
M: 56 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 8 C: 0
0%
M: 1 C: 0
0%
getContentPane()
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%
getLeftTreePanel()
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%
getMainViewMenueArea()
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%
getRightTablePanel()
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%
getSlContentPane()
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%
getSlLeftTreePanel()
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%
getSlRightTablePanel()
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%
getSlTopMenuePanel()
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%
getTableArea()
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%
getTopMenuePanel()
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%
getTreeArea()
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%
getjFrame()
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%
unavailableLookAndFeelReact()
M: 24 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 6 C: 0
0%
M: 1 C: 0
0%

Coverage

1: package gui.view;
2:
3: import java.awt.SystemColor;
4: import java.awt.Toolkit;
5:
6: import javax.swing.JDialog;
7: import javax.swing.JFrame;
8: import javax.swing.JPanel;
9: import javax.swing.JTextArea;
10: import javax.swing.SpringLayout;
11: import javax.swing.UIManager;
12: import javax.swing.border.EmptyBorder;
13:
14: /**
15: * The Main-View.
16: *
17: * @author Lukas/Mark
18: *
19: */
20: public class MainView {
21:         /**
22:          * The main JFrame.
23:          *
24:          */
25:         private final JFrame jFrame;
26:
27:         /**
28:          * This is the contentPane.
29:          */
30:         private final JPanel contentPane;
31:         /**
32:          * This is the top menu pane.
33:          */
34:         private final JPanel topMenuePanel;
35:         /**
36:          * This panels separate the areas.
37:          */
38:         private final JPanel leftTreePanel, rightTablePanel;
39:
40:         /**
41:          * The tree area.
42:          */
43:         private final MainViewTreeArea treeArea;
44:         /**
45:          * The table area.
46:          */
47:         private final MainViewTableArea tableArea;
48:         /**
49:          * The menue area.
50:          */
51:         private final MainViewMenueArea mainViewMenueArea;
52:         /**
53:          * The layout managers for all panes.
54:          */
55:         private final SpringLayout slContentPane, slRightTablePanel, slLeftTreePanel, slTopMenuePanel;
56:
57:         /**
58:          * Create the frame.
59:          */
60:         public MainView() {
61:                 super();
62:                 this.jFrame = new JFrame();
63:                 this.jFrame.setResizable(true);
64:                 try {
65:                         UIManager.setLookAndFeel(basic.GuiConstants.LOOKANDFEEL);
66:                 } catch (final Exception e) {
67:                         unavailableLookAndFeelReact();
68:                 }
69:                 // Initiate the spring layouts.
70:                 this.slContentPane = new SpringLayout();
71:                 this.slLeftTreePanel = new SpringLayout();
72:                 this.slRightTablePanel = new SpringLayout();
73:                 this.slTopMenuePanel = new SpringLayout();
74:                 // Initiate the main contentPane
75:                 this.contentPane = new JPanel();
76:                 // initiate the area content panes.
77:                 this.topMenuePanel = new JPanel();
78:                 this.leftTreePanel = new JPanel();
79:                 this.rightTablePanel = new JPanel();
80:                 // Following methods are for setting the Layout and to config the components.
81:                 this.configPanes();
82:                 this.configJFrame();
83:                 // Initiate the table area on the right side.
84:                 this.tableArea = new MainViewTableArea(this);
85:                 // Initiate the tree area on the left side.
86:                 this.treeArea = new MainViewTreeArea(this);
87:                 // Initiate the top menue area.
88:                 this.mainViewMenueArea = new MainViewMenueArea(this);
89:
90:         }
91:
92:         /**
93:          * If the look and feel is unavailable.
94:          */
95:         private void unavailableLookAndFeelReact() {
96:                 final JDialog exWinWithoutLAF = new JDialog();
97:                 exWinWithoutLAF.add(new JTextArea(
98:                                 basic.GuiConstants.LOOKANDFEELEXCP + basic.GuiConstants.LOOKANDFEEL));
99:                 exWinWithoutLAF.setBounds(basic.GuiConstants.FRAMEBOUNDX, basic.GuiConstants.FRAMEBOUNDY,
100:                                 basic.GuiConstants.FRAMEBOUNDWIDTH, basic.GuiConstants.FRAMEBOUNDHEIGHT);
101:                 exWinWithoutLAF.setAlwaysOnTop(true);
102:                 exWinWithoutLAF.setVisible(true);
103:         }
104:
105:         /**
106:          * method for setting the Mainframe width and height will be set in this method as well.
107:          */
108:         private void configJFrame() {
109:                 this.jFrame.setIconImage(Toolkit.getDefaultToolkit().getImage(MainView.class
110:                                 .getResource("/com/sun/java/swing/plaf/windows/icons/HardDrive.gif")));
111:                 this.jFrame.setTitle(basic.GuiConstants.JFRAMETITLE);
112:                 this.jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
113:                 this.jFrame.setBounds(basic.GuiConstants.FRAMEBOUNDX, basic.GuiConstants.FRAMEBOUNDY,
114:                                 basic.GuiConstants.FRAMEBOUNDWIDTH, basic.GuiConstants.FRAMEBOUNDHEIGHT);
115:                 this.jFrame.setContentPane(this.contentPane);
116:         }
117:
118:         /**
119:          *
120:          */
121:         private void configPanes() {
122:                 this.configMainPanel();
123:                 this.configTopPanel();
124:                 this.configLeftPanel();
125:                 this.configRightPanel();
126:
127:         }
128:
129:         /**
130:          * method for set padding, width and height of main JPanel.
131:          */
132:         private void configMainPanel() {
133:                 this.contentPane.setBackground(SystemColor.control);
134:                 this.contentPane.setBorder(new EmptyBorder(basic.GuiConstants.BORDER,
135:                                 basic.GuiConstants.BORDER, basic.GuiConstants.BORDER, basic.GuiConstants.BORDER));
136:                 this.contentPane.setLayout(this.slContentPane);
137:         }
138:
139:         /**
140:          *
141:          */
142:         private void configTopPanel() {
143:                 this.topMenuePanel.setBackground(SystemColor.control);
144:                 this.slContentPane.putConstraint(SpringLayout.NORTH, this.topMenuePanel, 0,
145:                                 SpringLayout.NORTH, this.contentPane);
146:                 this.slContentPane.putConstraint(SpringLayout.EAST, this.topMenuePanel, 0,
147:                                 SpringLayout.EAST, this.contentPane);
148:                 this.slContentPane.putConstraint(SpringLayout.SOUTH, this.topMenuePanel,
149:                                 basic.GuiConstants.DEFAULTPADDING, SpringLayout.NORTH, this.leftTreePanel);
150:                 this.slContentPane.putConstraint(SpringLayout.WEST, this.topMenuePanel, 0,
151:                                 SpringLayout.WEST, this.contentPane);
152:
153:                 this.topMenuePanel.setLayout(this.slTopMenuePanel);
154:                 this.contentPane.add(this.topMenuePanel);
155:         }
156:
157:         /**
158:          *
159:          */
160:         private void configRightPanel() {
161:                 this.slContentPane.putConstraint(SpringLayout.NORTH, this.rightTablePanel,
162:                                 basic.GuiConstants.DEFAULTNORTHPAD, SpringLayout.NORTH, this.contentPane);
163:                 this.slContentPane.putConstraint(SpringLayout.EAST, this.rightTablePanel, 0,
164:                                 SpringLayout.EAST, this.contentPane);
165:                 this.slContentPane.putConstraint(SpringLayout.SOUTH, this.rightTablePanel, 0,
166:                                 SpringLayout.SOUTH, this.contentPane);
167:                 this.slContentPane.putConstraint(SpringLayout.WEST, this.rightTablePanel,
168:                                 basic.GuiConstants.RIGHTPANWESTPAD, SpringLayout.WEST, this.contentPane);
169:
170:                 this.rightTablePanel.setLayout(this.slRightTablePanel);
171:                 this.contentPane.add(this.rightTablePanel);
172:
173:         }
174:
175:         /**
176:          *
177:          */
178:         private void configLeftPanel() {
179:                 this.slContentPane.putConstraint(SpringLayout.NORTH, this.leftTreePanel,
180:                                 basic.GuiConstants.DEFAULTNORTHPAD, SpringLayout.NORTH, this.contentPane);
181:                 this.slContentPane.putConstraint(SpringLayout.EAST, this.leftTreePanel,
182:                                 basic.GuiConstants.DEFAULTPADDING, SpringLayout.WEST, this.rightTablePanel);
183:                 this.slContentPane.putConstraint(SpringLayout.SOUTH, this.leftTreePanel, 0,
184:                                 SpringLayout.SOUTH, this.contentPane);
185:                 this.slContentPane.putConstraint(SpringLayout.WEST, this.leftTreePanel, 0,
186:                                 SpringLayout.WEST, this.contentPane);
187:
188:                 this.leftTreePanel.setLayout(this.slLeftTreePanel);
189:                 this.contentPane.add(this.leftTreePanel);
190:         }
191:
192:         /**
193:          * @return the jFrame
194:          */
195:         public JFrame getjFrame() {
196:                 return this.jFrame;
197:         }
198:
199:         /**
200:          * @return the slContentPane
201:          */
202:         public SpringLayout getSlContentPane() {
203:                 return this.slContentPane;
204:         }
205:
206:         /**
207:          * @return the contentPane
208:          */
209:         public JPanel getContentPane() {
210:                 return this.contentPane;
211:         }
212:
213:         /**
214:          * @return the treeArea
215:          */
216:         public MainViewTreeArea getTreeArea() {
217:                 return this.treeArea;
218:         }
219:
220:         /**
221:          * @return the tableArea
222:          */
223:         public MainViewTableArea getTableArea() {
224:                 return this.tableArea;
225:         }
226:
227:         /**
228:          * @return the topMenuePanel
229:          */
230:         public JPanel getTopMenuePanel() {
231:                 return this.topMenuePanel;
232:         }
233:
234:         /**
235:          * @return the leftTreePanel
236:          */
237:         public JPanel getLeftTreePanel() {
238:                 return this.leftTreePanel;
239:         }
240:
241:         /**
242:          * @return the rightTablePanel
243:          */
244:         public JPanel getRightTablePanel() {
245:                 return this.rightTablePanel;
246:         }
247:
248:         /**
249:          * @return the mainViewMenueArea
250:          */
251:         public MainViewMenueArea getMainViewMenueArea() {
252:                 return this.mainViewMenueArea;
253:         }
254:
255:         /**
256:          * @return the slRightTablePanel
257:          */
258:         public SpringLayout getSlRightTablePanel() {
259:                 return this.slRightTablePanel;
260:         }
261:
262:         /**
263:          * @return the slLeftTreePanel
264:          */
265:         public SpringLayout getSlLeftTreePanel() {
266:                 return this.slLeftTreePanel;
267:         }
268:
269:         /**
270:          * @return the slTopMenuePanel
271:          */
272:         public SpringLayout getSlTopMenuePanel() {
273:                 return this.slTopMenuePanel;
274:         }
275:
276: }