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

nameclass, %method, %block, %line, %
BranchTransitionEditPart.java0%   (0/3)0%   (0/32)0%   (0/519)0%   (0/154)

COVERAGE BREAKDOWN BY CLASS AND METHOD

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

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