EMMA Coverage Report (generated Tue Feb 12 22:23:49 ICT 2008)
[all classes][net.sourceforge.hivegui.dialog]

COVERAGE SUMMARY FOR SOURCE FILE [GridBagCommandPanelAdder.java]

nameclass, %method, %block, %line, %
GridBagCommandPanelAdder.java0%   (0/1)0%   (0/2)0%   (0/84)0%   (0/21)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class GridBagCommandPanelAdder0%   (0/1)0%   (0/2)0%   (0/84)0%   (0/21)
GridBagCommandPanelAdder (): void 0%   (0/1)0%   (0/4)0%   (0/2)
addCommandPanel (JComponent, JPanel): void 0%   (0/1)0%   (0/80)0%   (0/19)

1//  Copyright 2004-2007 Jean-Francois Poilpret
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14 
15package net.sourceforge.hivegui.dialog;
16 
17import java.awt.Component;
18import java.awt.GridBagConstraints;
19import java.awt.GridBagLayout;
20 
21import javax.swing.JComponent;
22import javax.swing.JPanel;
23 
24public class GridBagCommandPanelAdder extends AbstractCommandPanelAdder
25{
26        public GridBagCommandPanelAdder()
27        {
28                super(GridBagLayout.class);
29        }
30 
31        @Override protected void addCommandPanel(        JComponent container,
32                                                                                                JPanel commands)
33        {
34                // Calculate the number of rows and columns
35                GridBagLayout layout = (GridBagLayout) container.getLayout();
36                Component[] comps = container.getComponents();
37                int cols = 0;
38                int rows = 0;
39                for (Component comp: comps)
40                {
41                        GridBagConstraints constraints = layout.getConstraints(comp);
42                        cols = Math.max(constraints.gridx + constraints.gridwidth, cols);
43                        rows = Math.max(constraints.gridy + constraints.gridheight, rows);
44                }
45 
46                // Add one row
47                GridBagConstraints constraints = new GridBagConstraints();
48                constraints.gridx = 0;
49                constraints.gridy = rows;
50                constraints.gridwidth = cols;
51                constraints.gridheight = 1;
52                constraints.anchor = GridBagConstraints.EAST;
53                constraints.fill = GridBagConstraints.NONE;
54                constraints.weightx = 0.0;
55                constraints.weighty = 0.0;
56                container.add(commands, constraints);
57        }
58}

[all classes][net.sourceforge.hivegui.dialog]
EMMA 2.0.5312 (C) Vladimir Roubtsov