EMMA Coverage Report (generated Sun Feb 05 10:43:15 CET 2012)
[all classes][de.uka.ipd.sdq.pcmbench.tabs.operations]

COVERAGE SUMMARY FOR SOURCE FILE [DialogCellLayout.java]

nameclass, %method, %block, %line, %
DialogCellLayout.java0%   (0/1)0%   (0/3)0%   (0/117)0%   (0/22)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class DialogCellLayout0%   (0/1)0%   (0/3)0%   (0/117)0%   (0/22)
DialogCellLayout (Control, Button, Button): void 0%   (0/1)0%   (0/12)0%   (0/5)
computeSize (Composite, int, int, boolean): Point 0%   (0/1)0%   (0/39)0%   (0/9)
layout (Composite, boolean): void 0%   (0/1)0%   (0/66)0%   (0/8)

1/**
2 * 
3 */
4package de.uka.ipd.sdq.pcmbench.tabs.operations;
5 
6import org.eclipse.swt.SWT;
7import org.eclipse.swt.graphics.Point;
8import org.eclipse.swt.graphics.Rectangle;
9import org.eclipse.swt.widgets.Button;
10import org.eclipse.swt.widgets.Composite;
11import org.eclipse.swt.widgets.Control;
12import org.eclipse.swt.widgets.Layout;
13 
14/**
15 * Internal class for laying out the dialog.
16 */
17public class DialogCellLayout extends Layout {
18 
19        /**
20     * The current contents.
21     */
22    private Control contents;
23    /**
24     * The button.
25     */
26        private Button selButton;
27        private Button delButton;
28        
29        
30        public DialogCellLayout(Control contents, Button selectionButton, Button deleteButton) {
31                this.selButton = selectionButton;
32                this.delButton = deleteButton;
33                this.contents = contents;
34        }
35 
36        /* (non-Javadoc)
37         * @see org.eclipse.swt.widgets.Layout#computeSize(org.eclipse.swt.widgets.Composite, int, int, boolean)
38         */
39        @Override
40        protected Point computeSize(Composite composite, int wHint, int hHint,
41                        boolean force) {
42                 if (wHint != SWT.DEFAULT && hHint != SWT.DEFAULT) {
43                                return new Point(wHint, hHint);
44                        }
45         Point contentsSize = contents.computeSize(SWT.DEFAULT, SWT.DEFAULT,
46                 force);
47         Point buttonSize = selButton.computeSize(SWT.DEFAULT, SWT.DEFAULT,
48                 force);
49         // Just return the button width to ensure the button is not clipped
50         // if the label is long.
51         // The label will just use whatever extra width there is
52         Point result = new Point(buttonSize.x, Math.max(contentsSize.y,
53                 buttonSize.y));
54         return result;
55        }
56 
57        /* (non-Javadoc)
58         * @see org.eclipse.swt.widgets.Layout#layout(org.eclipse.swt.widgets.Composite, boolean)
59         */
60        @Override
61        protected void layout(Composite editor, boolean force) {
62                   Rectangle bounds = editor.getClientArea();
63           Point selSize = selButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, force);
64           Point delSize = delButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, force);
65           if (contents != null) {
66                                contents.setBounds(bounds.x, 0, bounds.width - selSize.x - delSize.x, bounds.height);
67                        }
68           selButton.setBounds(bounds.width - selSize.x, 0, selSize.x, bounds.height);
69           delButton.setBounds(bounds.width - selSize.x - delSize.x, 0, delSize.x, bounds.height);
70        }
71 
72}

[all classes][de.uka.ipd.sdq.pcmbench.tabs.operations]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov