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

COVERAGE SUMMARY FOR SOURCE FILE [SinkRoleEditPart.java]

nameclass, %method, %block, %line, %
SinkRoleEditPart.java0%   (0/4)0%   (0/27)0%   (0/292)0%   (0/82)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class SinkRoleEditPart0%   (0/1)0%   (0/18)0%   (0/181)0%   (0/55)
SinkRoleEditPart (View): void 0%   (0/1)0%   (0/4)0%   (0/2)
access$0 (SinkRoleEditPart): IMapMode 0%   (0/1)0%   (0/3)0%   (0/1)
addBorderItem (IFigure, IBorderItemEditPart): void 0%   (0/1)0%   (0/28)0%   (0/7)
createDefaultEditPolicies (): void 0%   (0/1)0%   (0/19)0%   (0/7)
createLayoutEditPolicy (): LayoutEditPolicy 0%   (0/1)0%   (0/7)0%   (0/2)
createMainFigure (): NodeFigure 0%   (0/1)0%   (0/17)0%   (0/4)
createNodePlate (): NodeFigure 0%   (0/1)0%   (0/14)0%   (0/3)
createNodeShape (): IFigure 0%   (0/1)0%   (0/10)0%   (0/2)
getContentPane (): IFigure 0%   (0/1)0%   (0/9)0%   (0/3)
getMARelTypesOnTarget (): List 0%   (0/1)0%   (0/10)0%   (0/4)
getMATypesForSource (IElementType): List 0%   (0/1)0%   (0/13)0%   (0/4)
getPrimaryChildEditPart (): EditPart 0%   (0/1)0%   (0/5)0%   (0/2)
getPrimaryShape (): SinkRoleEditPart$SinkRoleFigure 0%   (0/1)0%   (0/4)0%   (0/1)
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/2)0%   (0/1)
     
class SinkRoleEditPart$10%   (0/1)0%   (0/4)0%   (0/34)0%   (0/12)
SinkRoleEditPart$1 (SinkRoleEditPart): void 0%   (0/1)0%   (0/6)0%   (0/2)
createChildEditPolicy (EditPart): EditPolicy 0%   (0/1)0%   (0/24)0%   (0/8)
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 SinkRoleEditPart$1$10%   (0/1)0%   (0/2)0%   (0/19)0%   (0/6)
SinkRoleEditPart$1$1 (SinkRoleEditPart$1): void 0%   (0/1)0%   (0/6)0%   (0/2)
createSelectionHandles (): List 0%   (0/1)0%   (0/13)0%   (0/4)
     
class SinkRoleEditPart$SinkRoleFigure0%   (0/1)0%   (0/3)0%   (0/58)0%   (0/13)
SinkRoleEditPart$SinkRoleFigure (SinkRoleEditPart): void 0%   (0/1)0%   (0/51)0%   (0/10)
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, Uni Karlsruhe (TH)
3 */
4package de.uka.ipd.sdq.pcm.gmf.composite.edit.parts;
5 
6import java.util.ArrayList;
7import java.util.Collections;
8import java.util.List;
9 
10import org.eclipse.draw2d.IFigure;
11import org.eclipse.draw2d.PositionConstants;
12import org.eclipse.draw2d.RectangleFigure;
13import org.eclipse.draw2d.Shape;
14import org.eclipse.draw2d.StackLayout;
15import org.eclipse.draw2d.geometry.Dimension;
16import org.eclipse.draw2d.geometry.Point;
17import org.eclipse.gef.EditPart;
18import org.eclipse.gef.EditPolicy;
19import org.eclipse.gef.GraphicalEditPart;
20import org.eclipse.gef.Request;
21import org.eclipse.gef.commands.Command;
22import org.eclipse.gef.editpolicies.LayoutEditPolicy;
23import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
24import org.eclipse.gef.handles.MoveHandle;
25import org.eclipse.gef.requests.CreateRequest;
26import org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderedShapeEditPart;
27import org.eclipse.gmf.runtime.diagram.ui.editparts.BorderedBorderItemEditPart;
28import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
29import org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy;
30import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
31import org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator;
32import org.eclipse.gmf.runtime.emf.type.core.IElementType;
33import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
34import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
35import org.eclipse.gmf.runtime.notation.View;
36import org.eclipse.swt.graphics.Color;
37 
38import de.uka.ipd.sdq.pcm.gmf.composite.SinkFigure;
39import de.uka.ipd.sdq.pcm.gmf.composite.SourceFigure;
40import de.uka.ipd.sdq.pcm.gmf.composite.AbstractBorderFigure.POSITION_TYPE;
41import de.uka.ipd.sdq.pcm.gmf.composite.edit.policies.SinkRoleItemSemanticEditPolicy;
42import de.uka.ipd.sdq.pcm.gmf.composite.part.PalladioComponentModelVisualIDRegistry;
43import de.uka.ipd.sdq.pcm.gmf.composite.providers.PalladioComponentModelElementTypes;
44 
45/**
46 * The edit part to draw an internal sink role for an assembly context.
47 * 
48 * @generated
49 */
50public class SinkRoleEditPart extends BorderedBorderItemEditPart {
51 
52        /**
53         * size of the figure in LP
54         * 
55         * @generated not
56         */
57        private static final int FIGURE_LOGICAL_SIZE = 30;
58 
59        /**
60         * @generated
61         */
62        public static final int VISUAL_ID = 3014;
63 
64        /**
65         * @generated
66         */
67        protected IFigure contentPane;
68 
69        /**
70         * @generated
71         */
72        protected IFigure primaryShape;
73 
74        /**
75         * @generated
76         */
77        public SinkRoleEditPart(View view) {
78                super(view);
79        }
80 
81        /**
82         * @generated
83         */
84        protected void createDefaultEditPolicies() {
85                super.createDefaultEditPolicies();
86                installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE,
87                                getPrimaryDragEditPolicy());
88                installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE,
89                                new SinkRoleItemSemanticEditPolicy());
90                installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
91                // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies
92                // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
93        }
94 
95        /**
96         * @generated
97         */
98        protected LayoutEditPolicy createLayoutEditPolicy() {
99                LayoutEditPolicy lep = new LayoutEditPolicy() {
100 
101                        protected EditPolicy createChildEditPolicy(EditPart child) {
102                                View childView = (View) child.getModel();
103                                switch (PalladioComponentModelVisualIDRegistry
104                                                .getVisualID(childView)) {
105                                case SinkRoleEntityNameEditPart.VISUAL_ID:
106                                        return new BorderItemSelectionEditPolicy() {
107 
108                                                protected List createSelectionHandles() {
109                                                        MoveHandle mh = new MoveHandle(
110                                                                        (GraphicalEditPart) getHost());
111                                                        mh.setBorder(null);
112                                                        return Collections.singletonList(mh);
113                                                }
114                                        };
115                                }
116                                EditPolicy result = child
117                                                .getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
118                                if (result == null) {
119                                        result = new NonResizableEditPolicy();
120                                }
121                                return result;
122                        }
123 
124                        protected Command getMoveChildrenCommand(Request request) {
125                                return null;
126                        }
127 
128                        protected Command getCreateCommand(CreateRequest request) {
129                                return null;
130                        }
131                };
132                return lep;
133        }
134 
135        /**
136         * @generated
137         */
138        protected IFigure createNodeShape() {
139                SinkRoleFigure figure = new SinkRoleFigure();
140                return primaryShape = figure;
141        }
142 
143        /**
144         * @generated
145         */
146        public SinkRoleFigure getPrimaryShape() {
147                return (SinkRoleFigure) primaryShape;
148        }
149 
150        /**
151         * @generated
152         */
153        protected void addBorderItem(IFigure borderItemContainer,
154                        IBorderItemEditPart borderItemEditPart) {
155                if (borderItemEditPart instanceof SinkRoleEntityNameEditPart) {
156                        BorderItemLocator locator = new BorderItemLocator(getMainFigure(),
157                                        PositionConstants.SOUTH);
158                        locator.setBorderItemOffset(new Dimension(-20, -20));
159                        borderItemContainer.add(borderItemEditPart.getFigure(), locator);
160                } else {
161                        super.addBorderItem(borderItemContainer, borderItemEditPart);
162                }
163        }
164 
165        /**
166         * Create the node shape. 
167         * This is manually adopted to trigger 
168         * @generated
169         */
170        protected NodeFigure createNodePlate() {
171                DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(20, 20);
172 
173                //FIXME: workaround for #154536
174                result.getBounds().setSize(result.getPreferredSize());
175                return result;
176        }
177 
178        /**
179         * Creates figure for this edit part.
180         * 
181         * Body of this method does not depend on settings in generation model
182         * so you may safely remove <i>generated</i> tag and modify it.
183         * 
184         * Manually modified to generate a specific sink figure 
185         * instead of the standard shape configured in the map model.
186         * 
187         * @generated not
188         */
189        protected NodeFigure createMainFigure() {
190                SinkFigure figure = new SinkFigure(getMapMode().DPtoLP(
191                                FIGURE_LOGICAL_SIZE), POSITION_TYPE.POS_INTERNAL);
192                figure.getBounds().setSize(figure.getPreferredSize());
193                return figure;
194        }
195 
196        /**
197         * Default implementation treats passed figure as content pane.
198         * Respects layout one may have set for generated figure.
199         * @param nodeShape instance of generated figure class
200         * @generated
201         */
202        protected IFigure setupContentPane(IFigure nodeShape) {
203                return nodeShape; // use nodeShape itself as contentPane
204        }
205 
206        /**
207         * @generated
208         */
209        public IFigure getContentPane() {
210                if (contentPane != null) {
211                        return contentPane;
212                }
213                return super.getContentPane();
214        }
215 
216        /**
217         * @generated
218         */
219        protected void setForegroundColor(Color color) {
220                if (primaryShape != null) {
221                        primaryShape.setForegroundColor(color);
222                }
223        }
224 
225        /**
226         * @generated
227         */
228        protected void setBackgroundColor(Color color) {
229                if (primaryShape != null) {
230                        primaryShape.setBackgroundColor(color);
231                }
232        }
233 
234        /**
235         * @generated
236         */
237        protected void setLineWidth(int width) {
238                if (primaryShape instanceof Shape) {
239                        ((Shape) primaryShape).setLineWidth(width);
240                }
241        }
242 
243        /**
244         * @generated
245         */
246        protected void setLineType(int style) {
247                if (primaryShape instanceof Shape) {
248                        ((Shape) primaryShape).setLineStyle(style);
249                }
250        }
251 
252        /**
253         * @generated
254         */
255        public EditPart getPrimaryChildEditPart() {
256                return getChildBySemanticHint(PalladioComponentModelVisualIDRegistry
257                                .getType(SinkRoleEntityNameEditPart.VISUAL_ID));
258        }
259 
260        /**
261         * @generated
262         */
263        public List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/getMARelTypesOnTarget() {
264                List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/types = new ArrayList/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/();
265                types
266                                .add(PalladioComponentModelElementTypes.AssemblyEventConnector_4007);
267                return types;
268        }
269 
270        /**
271         * @generated
272         */
273        public List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/getMATypesForSource(
274                        IElementType relationshipType) {
275                List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/types = new ArrayList/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/();
276                if (relationshipType == PalladioComponentModelElementTypes.AssemblyEventConnector_4007) {
277                        types.add(PalladioComponentModelElementTypes.SourceRole_3013);
278                }
279                return types;
280        }
281 
282        /**
283         * @generated
284         */
285        public class SinkRoleFigure extends RectangleFigure {
286 
287                /**
288                 * @generated
289                 */
290                public SinkRoleFigure() {
291                        this.setLineWidth(1);
292                        this.setPreferredSize(new Dimension(getMapMode().DPtoLP(20),
293                                        getMapMode().DPtoLP(20)));
294                        this.setMinimumSize(new Dimension(getMapMode().DPtoLP(0),
295                                        getMapMode().DPtoLP(0)));
296                        this.setLocation(new Point(getMapMode().DPtoLP(40), getMapMode()
297                                        .DPtoLP(40)));
298                }
299 
300                /**
301                 * @generated
302                 */
303                private boolean myUseLocalCoordinates = false;
304 
305                /**
306                 * @generated
307                 */
308                protected boolean useLocalCoordinates() {
309                        return myUseLocalCoordinates;
310                }
311 
312                /**
313                 * @generated
314                 */
315                protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
316                        myUseLocalCoordinates = useLocalCoordinates;
317                }
318 
319        }
320 
321}

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