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

COVERAGE SUMMARY FOR SOURCE FILE [ProcessingResourceSpecificationEditPart.java]

nameclass, %method, %block, %line, %
ProcessingResourceSpecificationEditPart.java0%   (0/3)0%   (0/34)0%   (0/437)0%   (0/142)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ProcessingResourceSpecificationEditPart0%   (0/1)0%   (0/20)0%   (0/264)0%   (0/94)
ProcessingResourceSpecificationEditPart (View): void 0%   (0/1)0%   (0/4)0%   (0/2)
access$0 (ProcessingResourceSpecificationEditPart): 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/68)0%   (0/27)
createDefaultEditPolicies (): void 0%   (0/1)0%   (0/20)0%   (0/7)
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 (): ProcessingResourceSpecificationEditPart$ProcessingResourc... 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/32)0%   (0/13)
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 ProcessingResourceSpecificationEditPart$10%   (0/1)0%   (0/4)0%   (0/22)0%   (0/9)
ProcessingResourceSpecificationEditPart$1 (ProcessingResourceSpecificationEdi... 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 ProcessingResourceSpecificationEditPart$ProcessingResourceSpecificationFigure0%   (0/1)0%   (0/10)0%   (0/151)0%   (0/41)
ProcessingResourceSpecificationEditPart$ProcessingResourceSpecificationFigure... 0%   (0/1)0%   (0/43)0%   (0/10)
createContents (): void 0%   (0/1)0%   (0/83)0%   (0/22)
getFigureActiveResourceTypeFigure (): WrappingLabel 0%   (0/1)0%   (0/3)0%   (0/1)
getFigureMTTFFigure (): WrappingLabel 0%   (0/1)0%   (0/3)0%   (0/1)
getFigureMTTRFigure (): WrappingLabel 0%   (0/1)0%   (0/3)0%   (0/1)
getFigureNoOfReplicasFigure (): WrappingLabel 0%   (0/1)0%   (0/3)0%   (0/1)
getFigureProcessingRateFigure (): WrappingLabel 0%   (0/1)0%   (0/3)0%   (0/1)
getFigureSchedulingPolicyFigure (): 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 2009, SDQ, IPD, Uni Karlsruhe (TH)
3 */
4package de.uka.ipd.sdq.pcm.gmf.resource.edit.parts;
5 
6import org.eclipse.draw2d.ColorConstants;
7import org.eclipse.draw2d.IFigure;
8import org.eclipse.draw2d.LineBorder;
9import org.eclipse.draw2d.RectangleFigure;
10import org.eclipse.draw2d.Shape;
11import org.eclipse.draw2d.StackLayout;
12import org.eclipse.draw2d.geometry.Dimension;
13import org.eclipse.gef.EditPart;
14import org.eclipse.gef.EditPolicy;
15import org.eclipse.gef.Request;
16import org.eclipse.gef.commands.Command;
17import org.eclipse.gef.editpolicies.LayoutEditPolicy;
18import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
19import org.eclipse.gef.requests.CreateRequest;
20import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
21import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
22import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
23import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
24import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
25import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
26import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
27import org.eclipse.gmf.runtime.notation.View;
28import org.eclipse.swt.graphics.Color;
29 
30import de.uka.ipd.sdq.pcm.dialogs.resource.OpenProcessingRateDialog;
31import de.uka.ipd.sdq.pcm.gmf.resource.edit.policies.ProcessingResourceSpecificationItemSemanticEditPolicy;
32import de.uka.ipd.sdq.pcm.gmf.resource.part.PalladioComponentModelVisualIDRegistry;
33 
34/**
35 * @generated
36 */
37public class ProcessingResourceSpecificationEditPart extends ShapeNodeEditPart {
38 
39        /**
40         * @generated
41         */
42        public static final int VISUAL_ID = 3001;
43 
44        /**
45         * @generated
46         */
47        protected IFigure contentPane;
48 
49        /**
50         * @generated
51         */
52        protected IFigure primaryShape;
53 
54        /**
55         * @generated
56         */
57        public ProcessingResourceSpecificationEditPart(View view) {
58                super(view);
59        }
60 
61        /**
62         * @generated
63         */
64        protected void createDefaultEditPolicies() {
65                super.createDefaultEditPolicies();
66                installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE,
67                                new ProcessingResourceSpecificationItemSemanticEditPolicy());
68                installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
69                installEditPolicy(EditPolicyRoles.OPEN_ROLE,
70                                new OpenProcessingRateDialog());
71                // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies
72                // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
73        }
74 
75        /**
76         * @generated
77         */
78        protected LayoutEditPolicy createLayoutEditPolicy() {
79                LayoutEditPolicy lep = new LayoutEditPolicy() {
80 
81                        protected EditPolicy createChildEditPolicy(EditPart child) {
82                                EditPolicy result = child
83                                                .getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
84                                if (result == null) {
85                                        result = new NonResizableEditPolicy();
86                                }
87                                return result;
88                        }
89 
90                        protected Command getMoveChildrenCommand(Request request) {
91                                return null;
92                        }
93 
94                        protected Command getCreateCommand(CreateRequest request) {
95                                return null;
96                        }
97                };
98                return lep;
99        }
100 
101        /**
102         * @generated
103         */
104        protected IFigure createNodeShape() {
105                ProcessingResourceSpecificationFigure figure = new ProcessingResourceSpecificationFigure();
106                return primaryShape = figure;
107        }
108 
109        /**
110         * @generated
111         */
112        public ProcessingResourceSpecificationFigure getPrimaryShape() {
113                return (ProcessingResourceSpecificationFigure) primaryShape;
114        }
115 
116        /**
117         * @generated
118         */
119        protected boolean addFixedChild(EditPart childEditPart) {
120                if (childEditPart instanceof ProcessingResourceSpecificationMTTREditPart) {
121                        ((ProcessingResourceSpecificationMTTREditPart) childEditPart)
122                                        .setLabel(getPrimaryShape().getFigureMTTRFigure());
123                        return true;
124                }
125                if (childEditPart instanceof ProcessingResourceSpecificationSchedulingPolicyEditPart) {
126                        ((ProcessingResourceSpecificationSchedulingPolicyEditPart) childEditPart)
127                                        .setLabel(getPrimaryShape()
128                                                        .getFigureSchedulingPolicyFigure());
129                        return true;
130                }
131                if (childEditPart instanceof ProcessingResourceSpecificationNumberOfReplicasEditPart) {
132                        ((ProcessingResourceSpecificationNumberOfReplicasEditPart) childEditPart)
133                                        .setLabel(getPrimaryShape().getFigureNoOfReplicasFigure());
134                        return true;
135                }
136                if (childEditPart instanceof ProcessingResourceSpecificationActiveResourceTypeLabelEditPart) {
137                        ((ProcessingResourceSpecificationActiveResourceTypeLabelEditPart) childEditPart)
138                                        .setLabel(getPrimaryShape()
139                                                        .getFigureActiveResourceTypeFigure());
140                        return true;
141                }
142                if (childEditPart instanceof WrappingLabelEditPart) {
143                        ((WrappingLabelEditPart) childEditPart).setLabel(getPrimaryShape()
144                                        .getFigureProcessingRateFigure());
145                        return true;
146                }
147                if (childEditPart instanceof ProcessingResourceSpecificationMTTFEditPart) {
148                        ((ProcessingResourceSpecificationMTTFEditPart) childEditPart)
149                                        .setLabel(getPrimaryShape().getFigureMTTFFigure());
150                        return true;
151                }
152                return false;
153        }
154 
155        /**
156         * @generated
157         */
158        protected boolean removeFixedChild(EditPart childEditPart) {
159                if (childEditPart instanceof ProcessingResourceSpecificationMTTREditPart) {
160                        return true;
161                }
162                if (childEditPart instanceof ProcessingResourceSpecificationSchedulingPolicyEditPart) {
163                        return true;
164                }
165                if (childEditPart instanceof ProcessingResourceSpecificationNumberOfReplicasEditPart) {
166                        return true;
167                }
168                if (childEditPart instanceof ProcessingResourceSpecificationActiveResourceTypeLabelEditPart) {
169                        return true;
170                }
171                if (childEditPart instanceof WrappingLabelEditPart) {
172                        return true;
173                }
174                if (childEditPart instanceof ProcessingResourceSpecificationMTTFEditPart) {
175                        return true;
176                }
177                return false;
178        }
179 
180        /**
181         * @generated
182         */
183        protected void addChildVisual(EditPart childEditPart, int index) {
184                if (addFixedChild(childEditPart)) {
185                        return;
186                }
187                super.addChildVisual(childEditPart, -1);
188        }
189 
190        /**
191         * @generated
192         */
193        protected void removeChildVisual(EditPart childEditPart) {
194                if (removeFixedChild(childEditPart)) {
195                        return;
196                }
197                super.removeChildVisual(childEditPart);
198        }
199 
200        /**
201         * @generated
202         */
203        protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
204                return getContentPane();
205        }
206 
207        /**
208         * @generated
209         */
210        protected NodeFigure createNodePlate() {
211                DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(40, 40);
212                return result;
213        }
214 
215        /**
216         * Creates figure for this edit part.
217         * 
218         * Body of this method does not depend on settings in generation model
219         * so you may safely remove <i>generated</i> tag and modify it.
220         * 
221         * @generated
222         */
223        protected NodeFigure createNodeFigure() {
224                NodeFigure figure = createNodePlate();
225                figure.setLayoutManager(new StackLayout());
226                IFigure shape = createNodeShape();
227                figure.add(shape);
228                contentPane = setupContentPane(shape);
229                return figure;
230        }
231 
232        /**
233         * Default implementation treats passed figure as content pane.
234         * Respects layout one may have set for generated figure.
235         * @param nodeShape instance of generated figure class
236         * @generated
237         */
238        protected IFigure setupContentPane(IFigure nodeShape) {
239                if (nodeShape.getLayoutManager() == null) {
240                        ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
241                        layout.setSpacing(5);
242                        nodeShape.setLayoutManager(layout);
243                }
244                return nodeShape; // use nodeShape itself as contentPane
245        }
246 
247        /**
248         * @generated
249         */
250        public IFigure getContentPane() {
251                if (contentPane != null) {
252                        return contentPane;
253                }
254                return super.getContentPane();
255        }
256 
257        /**
258         * @generated
259         */
260        protected void setForegroundColor(Color color) {
261                if (primaryShape != null) {
262                        primaryShape.setForegroundColor(color);
263                }
264        }
265 
266        /**
267         * @generated
268         */
269        protected void setBackgroundColor(Color color) {
270                if (primaryShape != null) {
271                        primaryShape.setBackgroundColor(color);
272                }
273        }
274 
275        /**
276         * @generated
277         */
278        protected void setLineWidth(int width) {
279                if (primaryShape instanceof Shape) {
280                        ((Shape) primaryShape).setLineWidth(width);
281                }
282        }
283 
284        /**
285         * @generated
286         */
287        protected void setLineType(int style) {
288                if (primaryShape instanceof Shape) {
289                        ((Shape) primaryShape).setLineStyle(style);
290                }
291        }
292 
293        /**
294         * @generated
295         */
296        public EditPart getPrimaryChildEditPart() {
297                return getChildBySemanticHint(PalladioComponentModelVisualIDRegistry
298                                .getType(ProcessingResourceSpecificationMTTFEditPart.VISUAL_ID));
299        }
300 
301        /**
302         * @generated
303         */
304        public class ProcessingResourceSpecificationFigure extends RectangleFigure {
305 
306                /**
307                 * @generated
308                 */
309                private WrappingLabel fFigureProcessingRateFigure;
310                /**
311                 * @generated
312                 */
313                private WrappingLabel fFigureSchedulingPolicyFigure;
314                /**
315                 * @generated
316                 */
317                private WrappingLabel fFigureMTTFFigure;
318                /**
319                 * @generated
320                 */
321                private WrappingLabel fFigureMTTRFigure;
322                /**
323                 * @generated
324                 */
325                private WrappingLabel fFigureActiveResourceTypeFigure;
326                /**
327                 * @generated
328                 */
329                private WrappingLabel fFigureNoOfReplicasFigure;
330 
331                /**
332                 * @generated
333                 */
334                public ProcessingResourceSpecificationFigure() {
335                        this.setFill(false);
336                        this.setOutline(false);
337                        this.setLineWidth(1);
338                        this.setMinimumSize(new Dimension(getMapMode().DPtoLP(0),
339                                        getMapMode().DPtoLP(0)));
340                        this.setBorder(new LineBorder(null, getMapMode().DPtoLP(1)));
341                        createContents();
342                }
343 
344                /**
345                 * @generated
346                 */
347                private void createContents() {
348 
349                        fFigureActiveResourceTypeFigure = new WrappingLabel();
350                        fFigureActiveResourceTypeFigure
351                                        .setText("ProcessingResourceSpecification");
352                        fFigureActiveResourceTypeFigure
353                                        .setForegroundColor(ColorConstants.lightGray);
354 
355                        this.add(fFigureActiveResourceTypeFigure);
356 
357                        fFigureSchedulingPolicyFigure = new WrappingLabel();
358                        fFigureSchedulingPolicyFigure.setText("");
359 
360                        this.add(fFigureSchedulingPolicyFigure);
361 
362                        fFigureNoOfReplicasFigure = new WrappingLabel();
363                        fFigureNoOfReplicasFigure.setText("");
364 
365                        this.add(fFigureNoOfReplicasFigure);
366 
367                        fFigureProcessingRateFigure = new WrappingLabel();
368                        fFigureProcessingRateFigure.setText("");
369 
370                        this.add(fFigureProcessingRateFigure);
371 
372                        fFigureMTTFFigure = new WrappingLabel();
373                        fFigureMTTFFigure.setText("");
374 
375                        this.add(fFigureMTTFFigure);
376 
377                        fFigureMTTRFigure = new WrappingLabel();
378                        fFigureMTTRFigure.setText("");
379 
380                        this.add(fFigureMTTRFigure);
381 
382                }
383 
384                /**
385                 * @generated
386                 */
387                private boolean myUseLocalCoordinates = false;
388 
389                /**
390                 * @generated
391                 */
392                protected boolean useLocalCoordinates() {
393                        return myUseLocalCoordinates;
394                }
395 
396                /**
397                 * @generated
398                 */
399                protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
400                        myUseLocalCoordinates = useLocalCoordinates;
401                }
402 
403                /**
404                 * @generated
405                 */
406                public WrappingLabel getFigureProcessingRateFigure() {
407                        return fFigureProcessingRateFigure;
408                }
409 
410                /**
411                 * @generated
412                 */
413                public WrappingLabel getFigureSchedulingPolicyFigure() {
414                        return fFigureSchedulingPolicyFigure;
415                }
416 
417                /**
418                 * @generated
419                 */
420                public WrappingLabel getFigureMTTFFigure() {
421                        return fFigureMTTFFigure;
422                }
423 
424                /**
425                 * @generated
426                 */
427                public WrappingLabel getFigureMTTRFigure() {
428                        return fFigureMTTRFigure;
429                }
430 
431                /**
432                 * @generated
433                 */
434                public WrappingLabel getFigureActiveResourceTypeFigure() {
435                        return fFigureActiveResourceTypeFigure;
436                }
437 
438                /**
439                 * @generated
440                 */
441                public WrappingLabel getFigureNoOfReplicasFigure() {
442                        return fFigureNoOfReplicasFigure;
443                }
444 
445        }
446 
447}

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