EMMA Coverage Report (generated Sun Feb 05 10:43:15 CET 2012)
[all classes][de.uka.ipd.sdq.pcm.gmf.allocation.edit.policies]

COVERAGE SUMMARY FOR SOURCE FILE [PalladioComponentModelTextNonResizableEditPolicy.java]

nameclass, %method, %block, %line, %
PalladioComponentModelTextNonResizableEditPolicy.java0%   (0/2)0%   (0/16)0%   (0/280)0%   (0/79)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class PalladioComponentModelTextNonResizableEditPolicy0%   (0/1)0%   (0/14)0%   (0/266)0%   (0/76)
PalladioComponentModelTextNonResizableEditPolicy (): void 0%   (0/1)0%   (0/3)0%   (0/1)
createFocusFeedbackFigure (): IFigure 0%   (0/1)0%   (0/5)0%   (0/1)
createSelectionFeedbackFigure (): IFigure 0%   (0/1)0%   (0/28)0%   (0/11)
createSelectionHandles (): List 0%   (0/1)0%   (0/20)0%   (0/4)
getFeedbackBounds (): Rectangle 0%   (0/1)0%   (0/32)0%   (0/7)
hideFocus (): void 0%   (0/1)0%   (0/21)0%   (0/6)
hideSelection (): void 0%   (0/1)0%   (0/28)0%   (0/8)
refreshFeedback (): void 0%   (0/1)0%   (0/5)0%   (0/3)
refreshFocusFeedback (): void 0%   (0/1)0%   (0/9)0%   (0/3)
refreshSelectionFeedback (): void 0%   (0/1)0%   (0/27)0%   (0/7)
showFocus (): void 0%   (0/1)0%   (0/22)0%   (0/6)
showPrimarySelection (): void 0%   (0/1)0%   (0/20)0%   (0/6)
showSelection (): void 0%   (0/1)0%   (0/29)0%   (0/8)
updateLabel (Label): void 0%   (0/1)0%   (0/17)0%   (0/5)
     
class PalladioComponentModelTextNonResizableEditPolicy$10%   (0/1)0%   (0/2)0%   (0/14)0%   (0/4)
PalladioComponentModelTextNonResizableEditPolicy$1 (PalladioComponentModelTex... 0%   (0/1)0%   (0/6)0%   (0/2)
paintFigure (Graphics): void 0%   (0/1)0%   (0/8)0%   (0/2)

1/*
2 * Copyright 2007, SDQ, IPD, U KA
3 */
4package de.uka.ipd.sdq.pcm.gmf.allocation.edit.policies;
5 
6import java.util.Collections;
7import java.util.List;
8 
9import org.eclipse.draw2d.ColorConstants;
10import org.eclipse.draw2d.Figure;
11import org.eclipse.draw2d.Graphics;
12import org.eclipse.draw2d.IFigure;
13import org.eclipse.draw2d.Label;
14import org.eclipse.draw2d.RectangleFigure;
15import org.eclipse.draw2d.geometry.Rectangle;
16import org.eclipse.gef.GraphicalEditPart;
17import org.eclipse.gef.handles.MoveHandle;
18import org.eclipse.gmf.runtime.diagram.ui.editpolicies.NonResizableEditPolicyEx;
19import org.eclipse.gmf.runtime.diagram.ui.tools.DragEditPartsTrackerEx;
20import org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel;
21 
22/**
23 * @generated
24 */
25public class PalladioComponentModelTextNonResizableEditPolicy extends
26                NonResizableEditPolicyEx {
27 
28        /**
29         * @generated
30         */
31        private IFigure selectionFeedbackFigure;
32 
33        /**
34         * @generated
35         */
36        private IFigure focusFeedbackFigure;
37 
38        /**
39         * @generated
40         */
41        protected void showPrimarySelection() {
42                if (getHostFigure() instanceof WrapLabel) {
43                        ((WrapLabel) getHostFigure()).setSelected(true);
44                        ((WrapLabel) getHostFigure()).setFocus(true);
45                } else {
46                        showSelection();
47                        showFocus();
48                }
49        }
50 
51        /**
52         * @generated
53         */
54        protected void showSelection() {
55                if (getHostFigure() instanceof WrapLabel) {
56                        ((WrapLabel) getHostFigure()).setSelected(true);
57                        ((WrapLabel) getHostFigure()).setFocus(false);
58                } else {
59                        hideSelection();
60                        addFeedback(selectionFeedbackFigure = createSelectionFeedbackFigure());
61                        refreshSelectionFeedback();
62                        hideFocus();
63                }
64        }
65 
66        /**
67         * @generated
68         */
69        protected void hideSelection() {
70                if (getHostFigure() instanceof WrapLabel) {
71                        ((WrapLabel) getHostFigure()).setSelected(false);
72                        ((WrapLabel) getHostFigure()).setFocus(false);
73                } else {
74                        if (selectionFeedbackFigure != null) {
75                                removeFeedback(selectionFeedbackFigure);
76                                selectionFeedbackFigure = null;
77                        }
78                        hideFocus();
79                }
80        }
81 
82        /**
83         * @generated
84         */
85        protected void showFocus() {
86                if (getHostFigure() instanceof WrapLabel) {
87                        ((WrapLabel) getHostFigure()).setFocus(true);
88                } else {
89                        hideFocus();
90                        addFeedback(focusFeedbackFigure = createFocusFeedbackFigure());
91                        refreshFocusFeedback();
92                }
93        }
94 
95        /**
96         * @generated
97         */
98        protected void hideFocus() {
99                if (getHostFigure() instanceof WrapLabel) {
100                        ((WrapLabel) getHostFigure()).setFocus(false);
101                } else {
102                        if (focusFeedbackFigure != null) {
103                                removeFeedback(focusFeedbackFigure);
104                                focusFeedbackFigure = null;
105                        }
106                }
107        }
108 
109        /**
110         * @generated
111         */
112        protected Rectangle getFeedbackBounds() {
113                Rectangle bounds;
114                if (getHostFigure() instanceof Label) {
115                        bounds = ((Label) getHostFigure()).getTextBounds();
116                        bounds.intersect(getHostFigure().getBounds());
117                } else {
118                        bounds = getHostFigure().getBounds().getCopy();
119                }
120                getHostFigure().getParent().translateToAbsolute(bounds);
121                getFeedbackLayer().translateToRelative(bounds);
122                return bounds;
123        }
124 
125        /**
126         * @generated
127         */
128        protected IFigure createSelectionFeedbackFigure() {
129                if (getHostFigure() instanceof Label) {
130                        Label feedbackFigure = new Label();
131                        feedbackFigure.setOpaque(true);
132                        feedbackFigure
133                                        .setBackgroundColor(ColorConstants.menuBackgroundSelected);
134                        feedbackFigure
135                                        .setForegroundColor(ColorConstants.menuForegroundSelected);
136                        return feedbackFigure;
137                } else {
138                        RectangleFigure feedbackFigure = new RectangleFigure();
139                        feedbackFigure.setFill(false);
140                        return feedbackFigure;
141                }
142        }
143 
144        /**
145         * @generated
146         */
147        protected IFigure createFocusFeedbackFigure() {
148                return new Figure() {
149 
150                        protected void paintFigure(Graphics graphics) {
151                                graphics.drawFocus(getBounds().getResized(-1, -1));
152                        }
153                };
154        }
155 
156        /**
157         * @generated
158         */
159        protected void updateLabel(Label target) {
160                Label source = (Label) getHostFigure();
161                target.setText(source.getText());
162                target.setTextAlignment(source.getTextAlignment());
163                target.setFont(source.getFont());
164        }
165 
166        /**
167         * @generated
168         */
169        protected void refreshSelectionFeedback() {
170                if (selectionFeedbackFigure != null) {
171                        if (selectionFeedbackFigure instanceof Label) {
172                                updateLabel((Label) selectionFeedbackFigure);
173                                selectionFeedbackFigure.setBounds(getFeedbackBounds());
174                        } else {
175                                selectionFeedbackFigure.setBounds(getFeedbackBounds().expand(5,
176                                                5));
177                        }
178                }
179        }
180 
181        /**
182         * @generated
183         */
184        protected void refreshFocusFeedback() {
185                if (focusFeedbackFigure != null) {
186                        focusFeedbackFigure.setBounds(getFeedbackBounds());
187                }
188        }
189 
190        /**
191         * @generated
192         */
193        public void refreshFeedback() {
194                refreshSelectionFeedback();
195                refreshFocusFeedback();
196        }
197 
198        /**
199         * @generated
200         */
201        protected List createSelectionHandles() {
202                MoveHandle moveHandle = new MoveHandle((GraphicalEditPart) getHost());
203                moveHandle.setBorder(null);
204                moveHandle.setDragTracker(new DragEditPartsTrackerEx(getHost()));
205                return Collections.singletonList(moveHandle);
206        }
207}

[all classes][de.uka.ipd.sdq.pcm.gmf.allocation.edit.policies]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov