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

COVERAGE SUMMARY FOR SOURCE FILE [CompositeComponentEditPart.java]

nameclass, %method, %block, %line, %
CompositeComponentEditPart.java0%   (0/3)0%   (0/32)0%   (0/478)0%   (0/162)

COVERAGE BREAKDOWN BY CLASS AND METHOD

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

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