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 [CommunicationLinkResourceSpecificationEditPart.java]

nameclass, %method, %block, %line, %
CommunicationLinkResourceSpecificationEditPart.java0%   (0/3)0%   (0/32)0%   (0/395)0%   (0/128)

COVERAGE BREAKDOWN BY CLASS AND METHOD

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

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