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

COVERAGE SUMMARY FOR SOURCE FILE [OpenWorkloadEditPart.java]

nameclass, %method, %block, %line, %
OpenWorkloadEditPart.java0%   (0/3)0%   (0/29)0%   (0/366)0%   (0/116)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class OpenWorkloadEditPart0%   (0/1)0%   (0/20)0%   (0/178)0%   (0/61)
OpenWorkloadEditPart (View): void 0%   (0/1)0%   (0/4)0%   (0/2)
access$0 (OpenWorkloadEditPart): IMapMode 0%   (0/1)0%   (0/3)0%   (0/1)
addChildVisual (EditPart, int): void 0%   (0/1)0%   (0/10)0%   (0/4)
addFixedChild (EditPart): boolean 0%   (0/1)0%   (0/13)0%   (0/6)
createDefaultEditPolicies (): void 0%   (0/1)0%   (0/14)0%   (0/5)
createLayoutEditPolicy (): LayoutEditPolicy 0%   (0/1)0%   (0/7)0%   (0/2)
createNodeFigure (): NodeFigure 0%   (0/1)0%   (0/21)0%   (0/6)
createNodePlate (): NodeFigure 0%   (0/1)0%   (0/8)0%   (0/2)
createNodeShape (): IFigure 0%   (0/1)0%   (0/10)0%   (0/2)
getContentPane (): IFigure 0%   (0/1)0%   (0/9)0%   (0/3)
getContentPaneFor (IGraphicalEditPart): IFigure 0%   (0/1)0%   (0/3)0%   (0/1)
getPrimaryChildEditPart (): EditPart 0%   (0/1)0%   (0/5)0%   (0/2)
getPrimaryShape (): OpenWorkloadEditPart$OpenWorkloadFigure 0%   (0/1)0%   (0/4)0%   (0/1)
removeChildVisual (EditPart): void 0%   (0/1)0%   (0/9)0%   (0/4)
removeFixedChild (EditPart): boolean 0%   (0/1)0%   (0/7)0%   (0/3)
setBackgroundColor (Color): void 0%   (0/1)0%   (0/8)0%   (0/3)
setForegroundColor (Color): void 0%   (0/1)0%   (0/8)0%   (0/3)
setLineType (int): void 0%   (0/1)0%   (0/10)0%   (0/3)
setLineWidth (int): void 0%   (0/1)0%   (0/10)0%   (0/3)
setupContentPane (IFigure): IFigure 0%   (0/1)0%   (0/15)0%   (0/5)
     
class OpenWorkloadEditPart$10%   (0/1)0%   (0/4)0%   (0/22)0%   (0/9)
OpenWorkloadEditPart$1 (OpenWorkloadEditPart): void 0%   (0/1)0%   (0/6)0%   (0/2)
createChildEditPolicy (EditPart): EditPolicy 0%   (0/1)0%   (0/12)0%   (0/5)
getCreateCommand (CreateRequest): Command 0%   (0/1)0%   (0/2)0%   (0/1)
getMoveChildrenCommand (Request): Command 0%   (0/1)0%   (0/2)0%   (0/1)
     
class OpenWorkloadEditPart$OpenWorkloadFigure0%   (0/1)0%   (0/5)0%   (0/166)0%   (0/48)
OpenWorkloadEditPart$OpenWorkloadFigure (OpenWorkloadEditPart): void 0%   (0/1)0%   (0/55)0%   (0/16)
createContents (): void 0%   (0/1)0%   (0/101)0%   (0/28)
getFigureOpenWorkloadSpecLabelFigure (): WrappingLabel 0%   (0/1)0%   (0/3)0%   (0/1)
setUseLocalCoordinates (boolean): void 0%   (0/1)0%   (0/4)0%   (0/2)
useLocalCoordinates (): boolean 0%   (0/1)0%   (0/3)0%   (0/1)

1/*
2 * Copyright 2007, SDQ, IPD, University of Karlsruhe
3 */
4package de.uka.ipd.sdq.pcm.gmf.usage.edit.parts;
5 
6import org.eclipse.draw2d.ColorConstants;
7import org.eclipse.draw2d.GridData;
8import org.eclipse.draw2d.GridLayout;
9import org.eclipse.draw2d.IFigure;
10import org.eclipse.draw2d.MarginBorder;
11import org.eclipse.draw2d.RectangleFigure;
12import org.eclipse.draw2d.Shape;
13import org.eclipse.draw2d.StackLayout;
14import org.eclipse.draw2d.geometry.Dimension;
15import org.eclipse.gef.EditPart;
16import org.eclipse.gef.EditPolicy;
17import org.eclipse.gef.Request;
18import org.eclipse.gef.commands.Command;
19import org.eclipse.gef.editpolicies.LayoutEditPolicy;
20import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
21import org.eclipse.gef.requests.CreateRequest;
22import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
23import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
24import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
25import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
26import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
27import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
28import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
29import org.eclipse.gmf.runtime.notation.View;
30import org.eclipse.swt.graphics.Color;
31 
32import de.uka.ipd.sdq.pcm.gmf.usage.edit.policies.OpenWorkloadItemSemanticEditPolicy;
33import de.uka.ipd.sdq.pcm.gmf.usage.part.PalladioComponentModelVisualIDRegistry;
34 
35/**
36 * @generated
37 */
38public class OpenWorkloadEditPart extends ShapeNodeEditPart {
39 
40        /**
41         * @generated
42         */
43        public static final int VISUAL_ID = 3016;
44 
45        /**
46         * @generated
47         */
48        protected IFigure contentPane;
49 
50        /**
51         * @generated
52         */
53        protected IFigure primaryShape;
54 
55        /**
56         * @generated
57         */
58        public OpenWorkloadEditPart(View view) {
59                super(view);
60        }
61 
62        /**
63         * @generated
64         */
65        protected void createDefaultEditPolicies() {
66                super.createDefaultEditPolicies();
67                installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE,
68                                new OpenWorkloadItemSemanticEditPolicy());
69                installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
70                // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies
71                // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
72        }
73 
74        /**
75         * @generated
76         */
77        protected LayoutEditPolicy createLayoutEditPolicy() {
78                LayoutEditPolicy lep = new LayoutEditPolicy() {
79 
80                        protected EditPolicy createChildEditPolicy(EditPart child) {
81                                EditPolicy result = child
82                                                .getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
83                                if (result == null) {
84                                        result = new NonResizableEditPolicy();
85                                }
86                                return result;
87                        }
88 
89                        protected Command getMoveChildrenCommand(Request request) {
90                                return null;
91                        }
92 
93                        protected Command getCreateCommand(CreateRequest request) {
94                                return null;
95                        }
96                };
97                return lep;
98        }
99 
100        /**
101         * @generated
102         */
103        protected IFigure createNodeShape() {
104                OpenWorkloadFigure figure = new OpenWorkloadFigure();
105                return primaryShape = figure;
106        }
107 
108        /**
109         * @generated
110         */
111        public OpenWorkloadFigure getPrimaryShape() {
112                return (OpenWorkloadFigure) primaryShape;
113        }
114 
115        /**
116         * @generated
117         */
118        protected boolean addFixedChild(EditPart childEditPart) {
119                if (childEditPart instanceof OpenWorkloadSpecLabelEditPart) {
120                        ((OpenWorkloadSpecLabelEditPart) childEditPart)
121                                        .setLabel(getPrimaryShape()
122                                                        .getFigureOpenWorkloadSpecLabelFigure());
123                        return true;
124                }
125                return false;
126        }
127 
128        /**
129         * @generated
130         */
131        protected boolean removeFixedChild(EditPart childEditPart) {
132                if (childEditPart instanceof OpenWorkloadSpecLabelEditPart) {
133                        return true;
134                }
135                return false;
136        }
137 
138        /**
139         * @generated
140         */
141        protected void addChildVisual(EditPart childEditPart, int index) {
142                if (addFixedChild(childEditPart)) {
143                        return;
144                }
145                super.addChildVisual(childEditPart, -1);
146        }
147 
148        /**
149         * @generated
150         */
151        protected void removeChildVisual(EditPart childEditPart) {
152                if (removeFixedChild(childEditPart)) {
153                        return;
154                }
155                super.removeChildVisual(childEditPart);
156        }
157 
158        /**
159         * @generated
160         */
161        protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
162                return getContentPane();
163        }
164 
165        /**
166         * @generated
167         */
168        protected NodeFigure createNodePlate() {
169                DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(40, 40);
170                return result;
171        }
172 
173        /**
174         * Creates figure for this edit part.
175         * 
176         * Body of this method does not depend on settings in generation model
177         * so you may safely remove <i>generated</i> tag and modify it.
178         * 
179         * @generated
180         */
181        protected NodeFigure createNodeFigure() {
182                NodeFigure figure = createNodePlate();
183                figure.setLayoutManager(new StackLayout());
184                IFigure shape = createNodeShape();
185                figure.add(shape);
186                contentPane = setupContentPane(shape);
187                return figure;
188        }
189 
190        /**
191         * Default implementation treats passed figure as content pane.
192         * Respects layout one may have set for generated figure.
193         * @param nodeShape instance of generated figure class
194         * @generated
195         */
196        protected IFigure setupContentPane(IFigure nodeShape) {
197                if (nodeShape.getLayoutManager() == null) {
198                        ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
199                        layout.setSpacing(5);
200                        nodeShape.setLayoutManager(layout);
201                }
202                return nodeShape; // use nodeShape itself as contentPane
203        }
204 
205        /**
206         * @generated
207         */
208        public IFigure getContentPane() {
209                if (contentPane != null) {
210                        return contentPane;
211                }
212                return super.getContentPane();
213        }
214 
215        /**
216         * @generated
217         */
218        protected void setForegroundColor(Color color) {
219                if (primaryShape != null) {
220                        primaryShape.setForegroundColor(color);
221                }
222        }
223 
224        /**
225         * @generated
226         */
227        protected void setBackgroundColor(Color color) {
228                if (primaryShape != null) {
229                        primaryShape.setBackgroundColor(color);
230                }
231        }
232 
233        /**
234         * @generated
235         */
236        protected void setLineWidth(int width) {
237                if (primaryShape instanceof Shape) {
238                        ((Shape) primaryShape).setLineWidth(width);
239                }
240        }
241 
242        /**
243         * @generated
244         */
245        protected void setLineType(int style) {
246                if (primaryShape instanceof Shape) {
247                        ((Shape) primaryShape).setLineStyle(style);
248                }
249        }
250 
251        /**
252         * @generated
253         */
254        public EditPart getPrimaryChildEditPart() {
255                return getChildBySemanticHint(PalladioComponentModelVisualIDRegistry
256                                .getType(OpenWorkloadSpecLabelEditPart.VISUAL_ID));
257        }
258 
259        /**
260         * @generated
261         */
262        public class OpenWorkloadFigure extends RectangleFigure {
263                /**
264                 * @generated
265                 */
266                private WrappingLabel fFigureOpenWorkloadSpecLabelFigure;
267 
268                /**
269                 * @generated
270                 */
271                public OpenWorkloadFigure() {
272 
273                        GridLayout layoutThis = new GridLayout();
274                        layoutThis.numColumns = 1;
275                        layoutThis.makeColumnsEqualWidth = true;
276                        layoutThis.horizontalSpacing = 0;
277                        layoutThis.verticalSpacing = 0;
278                        layoutThis.marginWidth = 0;
279                        layoutThis.marginHeight = 0;
280                        this.setLayoutManager(layoutThis);
281 
282                        this.setLineWidth(1);
283                        this.setBackgroundColor(ColorConstants.yellow);
284                        this.setMinimumSize(new Dimension(getMapMode().DPtoLP(0),
285                                        getMapMode().DPtoLP(0)));
286                        createContents();
287                }
288 
289                /**
290                 * @generated
291                 */
292                private void createContents() {
293 
294                        WrappingLabel openWorkloadStereotypeLabelFigure0 = new WrappingLabel();
295                        openWorkloadStereotypeLabelFigure0.setText("<<Open Workload>>");
296                        openWorkloadStereotypeLabelFigure0.setBorder(new MarginBorder(
297                                        getMapMode().DPtoLP(2), getMapMode().DPtoLP(0),
298                                        getMapMode().DPtoLP(2), getMapMode().DPtoLP(0)));
299 
300                        GridData constraintOpenWorkloadStereotypeLabelFigure0 = new GridData();
301                        constraintOpenWorkloadStereotypeLabelFigure0.verticalAlignment = GridData.BEGINNING;
302                        constraintOpenWorkloadStereotypeLabelFigure0.horizontalAlignment = GridData.CENTER;
303                        constraintOpenWorkloadStereotypeLabelFigure0.horizontalIndent = 0;
304                        constraintOpenWorkloadStereotypeLabelFigure0.horizontalSpan = 1;
305                        constraintOpenWorkloadStereotypeLabelFigure0.verticalSpan = 1;
306                        constraintOpenWorkloadStereotypeLabelFigure0.grabExcessHorizontalSpace = true;
307                        constraintOpenWorkloadStereotypeLabelFigure0.grabExcessVerticalSpace = false;
308                        this.add(openWorkloadStereotypeLabelFigure0,
309                                        constraintOpenWorkloadStereotypeLabelFigure0);
310 
311                        fFigureOpenWorkloadSpecLabelFigure = new WrappingLabel();
312                        fFigureOpenWorkloadSpecLabelFigure.setText("<spec>");
313 
314                        GridData constraintFFigureOpenWorkloadSpecLabelFigure = new GridData();
315                        constraintFFigureOpenWorkloadSpecLabelFigure.verticalAlignment = GridData.END;
316                        constraintFFigureOpenWorkloadSpecLabelFigure.horizontalAlignment = GridData.CENTER;
317                        constraintFFigureOpenWorkloadSpecLabelFigure.horizontalIndent = 0;
318                        constraintFFigureOpenWorkloadSpecLabelFigure.horizontalSpan = 1;
319                        constraintFFigureOpenWorkloadSpecLabelFigure.verticalSpan = 1;
320                        constraintFFigureOpenWorkloadSpecLabelFigure.grabExcessHorizontalSpace = true;
321                        constraintFFigureOpenWorkloadSpecLabelFigure.grabExcessVerticalSpace = false;
322                        this.add(fFigureOpenWorkloadSpecLabelFigure,
323                                        constraintFFigureOpenWorkloadSpecLabelFigure);
324 
325                }
326 
327                /**
328                 * @generated
329                 */
330                public WrappingLabel getFigureOpenWorkloadSpecLabelFigure() {
331                        return fFigureOpenWorkloadSpecLabelFigure;
332                }
333 
334                /**
335                 * @generated
336                 */
337                private boolean myUseLocalCoordinates = false;
338 
339                /**
340                 * @generated
341                 */
342                protected boolean useLocalCoordinates() {
343                        return myUseLocalCoordinates;
344                }
345 
346                /**
347                 * @generated
348                 */
349                protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
350                        myUseLocalCoordinates = useLocalCoordinates;
351                }
352 
353        }
354 
355}

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