Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: f7755728301dac6798a9147def7076ba00fd53fe (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
/*******************************************************************************
 * Copyright (c) 2012 Jayant Gupta
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * CONTRIBUTORS:
 * 		Jayant Gupta (initial contribution)
 * 
 * 
 *******************************************************************************/

package org.eclipse.etrice.ui.layout;

import java.util.LinkedList;
import java.util.List;
import java.util.Map.Entry;

import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.etrice.ui.behavior.editor.BehaviorEditor;
import org.eclipse.etrice.ui.common.base.editor.DiagramEditorBase;
import org.eclipse.gef.EditPart;
import org.eclipse.graphiti.mm.algorithms.AbstractText;
import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
import org.eclipse.graphiti.mm.pictograms.Anchor;
import org.eclipse.graphiti.mm.pictograms.Connection;
import org.eclipse.graphiti.mm.pictograms.ContainerShape;
import org.eclipse.graphiti.mm.pictograms.Diagram;
import org.eclipse.graphiti.mm.pictograms.FreeFormConnection;
import org.eclipse.graphiti.mm.pictograms.PictogramElement;
import org.eclipse.graphiti.mm.pictograms.Shape;
import org.eclipse.graphiti.ui.editor.DiagramEditor;
import org.eclipse.graphiti.ui.internal.parts.IPictogramElementEditPart;
import org.eclipse.ui.IWorkbenchPart;

import de.cau.cs.kieler.core.kgraph.KGraphElement;
import de.cau.cs.kieler.core.kgraph.KLabeledGraphElement;
import de.cau.cs.kieler.core.kgraph.KNode;
import de.cau.cs.kieler.core.kgraph.KPort;
import de.cau.cs.kieler.kiml.LayoutContext;
import de.cau.cs.kieler.kiml.config.VolatileLayoutConfig;
import de.cau.cs.kieler.kiml.graphiti.GefDiagramLayoutManager;
import de.cau.cs.kieler.kiml.graphiti.GraphitiLayoutCommand;
import de.cau.cs.kieler.kiml.graphiti.GraphitiLayoutConfig;
import de.cau.cs.kieler.kiml.graphiti.KimlGraphitiUtil;
import de.cau.cs.kieler.kiml.klayoutdata.KInsets;
import de.cau.cs.kieler.kiml.klayoutdata.KShapeLayout;
import de.cau.cs.kieler.kiml.klayoutdata.impl.KShapeLayoutImpl;
import de.cau.cs.kieler.kiml.options.LayoutOptions;
import de.cau.cs.kieler.kiml.ui.diagram.LayoutMapping;
import de.cau.cs.kieler.kiml.util.KimlUtil;

/**
 * The abstract class to support the creation of eTrice
 * {@link BehaviorDiagramLayoutManager } and
 * {@link StructureDiagramLayoutManager}
 * 
 * @author jayant
 */
@SuppressWarnings("restriction")
public abstract class ETriceDiagramLayoutManager extends
		GefDiagramLayoutManager<PictogramElement> {

	/**
	 * {@inheritDoc}
	 */
	public abstract boolean supports(Object object);

	/**
	 * {@inheritDoc}
	 */
	@SuppressWarnings({ "rawtypes", "unchecked" })
	public Object getAdapter(final Object object, final Class adapterType) {
		if (adapterType.isAssignableFrom(GraphitiLayoutConfig.class)) {
			return layoutConfig;
		} else if (adapterType
				.isAssignableFrom(IPictogramElementEditPart.class)) {
			if (object instanceof IPictogramElementEditPart) {
				return object;
			} else if (object instanceof DiagramEditor) {
				return ((DiagramEditor) object).getGraphicalViewer()
						.getContents();
			}
		} else if (adapterType.isAssignableFrom(EObject.class)) {
			if (object instanceof IPictogramElementEditPart) {
				PictogramElement pe = ((IPictogramElementEditPart) object)
						.getPictogramElement();
				if (pe.getLink() != null) {
					List<EObject> businessObjects = pe.getLink()
							.getBusinessObjects();
					if (!businessObjects.isEmpty()) {
						return businessObjects.get(0);
					}
				}
			} else if (object instanceof PictogramElement) {
				PictogramElement pe = (PictogramElement) object;
				if (pe.getLink() != null) {
					List<EObject> businessObjects = pe.getLink()
							.getBusinessObjects();
					if (!businessObjects.isEmpty()) {
						return businessObjects.get(0);
					}
				}
			}
		} else if (adapterType.isAssignableFrom(PictogramElement.class)) {
			if (object instanceof PictogramElement) {
				return object;
			} else if (object instanceof IPictogramElementEditPart) {
				return ((IPictogramElementEditPart) object)
						.getPictogramElement();
			} else if (object instanceof DiagramEditor) {
				EditPart contents = ((DiagramEditor) object)
						.getGraphicalViewer().getContents();
				if (contents instanceof IPictogramElementEditPart) {
					return ((IPictogramElementEditPart) contents)
							.getPictogramElement();
				}
			}
		} else if (adapterType
				.isAssignableFrom(TransactionalEditingDomain.class)) {
			if (object instanceof DiagramEditor) {
				return ((DiagramEditor) object).getEditingDomain();
			} else if (object instanceof IPictogramElementEditPart) {
				return ((IPictogramElementEditPart) object)
						.getConfigurationProvider().getDiagramBehavior()
						.getEditingDomain();
			}
		}
		if (object instanceof IAdaptable) {
			return ((IAdaptable) object).getAdapter(adapterType);
		}
		return null;
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public Class<?>[] getAdapterList() {
		return new Class<?>[] { PictogramElement.class };
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @author jayant
	 */

	@Override
	protected void transferLayout(final LayoutMapping<PictogramElement> mapping) {
		DiagramEditor diagramEditor = mapping
				.getProperty(KimlGraphitiUtil.DIAGRAM_EDITOR);

		ETriceLayoutCommand command = null;

		if (diagramEditor instanceof BehaviorEditor) {
			command = new BehaviorLayoutCommand(
					diagramEditor.getEditingDomain(), diagramEditor
							.getDiagramTypeProvider().getFeatureProvider());
		} else {
			command = new StructureLayoutCommand(
					diagramEditor.getEditingDomain(), diagramEditor
							.getDiagramTypeProvider().getFeatureProvider());
		}

		for (Entry<KGraphElement, PictogramElement> entry : mapping
				.getGraphMap().entrySet()) {
			command.add(entry.getKey(), entry.getValue());
		}
		mapping.setProperty(KimlGraphitiUtil.LAYOUT_COMMAND, command);
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	protected void applyLayout(final LayoutMapping<PictogramElement> mapping) {
		TransactionalEditingDomain editingDomain = mapping.getProperty(
				KimlGraphitiUtil.DIAGRAM_EDITOR).getEditingDomain();
		editingDomain.getCommandStack().execute(
				mapping.getProperty(KimlGraphitiUtil.LAYOUT_COMMAND));
	}

	/** the cached layout configuration for Graphiti. */
	private GraphitiLayoutConfig layoutConfig = new GraphitiLayoutConfig();

	/**
	 * {@inheritDoc}
	 * 
	 * @author jayant
	 */
	@Override
	public LayoutMapping<PictogramElement> buildLayoutGraph(
			final IWorkbenchPart workbenchPart, final Object diagramPart) {
		LayoutMapping<PictogramElement> mapping = new LayoutMapping<PictogramElement>(
				this);
		mapping.setProperty(KimlGraphitiUtil.CONNECTIONS,
				new LinkedList<Connection>());
		mapping.setProperty(KimlGraphitiUtil.STATIC_CONFIG,
				new VolatileLayoutConfig());

		if (workbenchPart instanceof DiagramEditorBase) {
			mapping.setProperty(KimlGraphitiUtil.DIAGRAM_EDITOR,
					(DiagramEditorBase) workbenchPart);
		}

		EditPart layoutRootPart = null;
		if (diagramPart instanceof IPictogramElementEditPart) {
			layoutRootPart = (EditPart) diagramPart;
		} else if (mapping.getProperty(KimlGraphitiUtil.DIAGRAM_EDITOR) != null) {
			layoutRootPart = mapping
					.getProperty(KimlGraphitiUtil.DIAGRAM_EDITOR)
					.getGraphicalViewer().getContents();
		}
		if (!(layoutRootPart instanceof IPictogramElementEditPart)) {
			throw new UnsupportedOperationException(
					"Not supported by this layout manager: Workbench part "
							+ workbenchPart + ", Edit part " + diagramPart);
		}
		PictogramElement element = ((IPictogramElementEditPart) layoutRootPart)
				.getPictogramElement();
		mapping.setParentElement(element);

		if (element instanceof Diagram) {

			KNode diagramNode = KimlUtil.createInitializedNode();
			KShapeLayout shapeLayout = diagramNode.getData(KShapeLayout.class);
			GraphicsAlgorithm ga = element.getGraphicsAlgorithm();
			shapeLayout.setPos(ga.getX(), ga.getY());
			shapeLayout.setSize(ga.getWidth(), ga.getHeight());
			mapping.getGraphMap().put(diagramNode, element);

			// Node creation for currently visible top-level Container
			// Shape(Bounding Box) in
			// eTrice Diagrams
			buildLayoutGraphForBoundingBox(mapping, (Diagram) element,
					diagramNode, true);

			mapping.setLayoutGraph(diagramNode);

		} else if (element instanceof Shape) {

			if (isTopLevelBoundingBox((Shape) element)) {
				// The selected Element is the Top Level Top Level Bounding Box
				mapping.setLayoutGraph((KNode) buildAllLevels(mapping,
						(Shape) element, null));
			} else {

				KGraphElement internalKGraphElement = createKGraphElementFromShape(
						mapping, null, (Shape) element);

				if (internalKGraphElement instanceof KNode
						&& !isInternalPort((Shape) element)) {
					// The selected Element is a Node.
					for (Shape childShape : ((ContainerShape) element)
							.getChildren()) {

						createKGraphElementFromShape(mapping,
								internalKGraphElement, childShape);
					}

					mapping.setLayoutGraph((KNode) internalKGraphElement);

				} else {
					// The selected Element is a Port(Boundary or Internal) or
					// an Edge Label.
					// It is an illegal argument for layout
					throw new IllegalArgumentException(
							"The seleted element cannot be lay-outed separately");

				}

			}
		} else if (element instanceof FreeFormConnection) {
			// The selected element is an edge.
			// It is an illegal argument for layout
			throw new IllegalArgumentException(
					"A connection cannot be layouted separately");
		}

		for (Connection entry : mapping
				.getProperty(KimlGraphitiUtil.CONNECTIONS)) {
			KimlGraphitiUtil.createEdge(mapping, entry);
		}

		// create a layout configuration
		mapping.getLayoutConfigs().add(
				mapping.getProperty(KimlGraphitiUtil.STATIC_CONFIG));
		mapping.getLayoutConfigs().add(layoutConfig);

		return mapping;
	}

	/**
	 * Identifies the visible Bounding Box (Top Level Container) and delegates
	 * the control to {@link #buildAllLevels(LayoutMapping, Shape, KNode)}
	 * 
	 * @param mapping
	 *            the mapping of pictogram elements to graph elements
	 * @param diagram
	 *            The Diagram Containing the Bounding Box
	 * @param diagramNode
	 *            The Node for the diagram
	 * @param onlyVisible
	 *            If true, only the visible bounding box will be lay-outed.
	 *            Otherwise, all bounding boxes in current Diagram are
	 *            lay-outed.
	 * 
	 * @author jayant
	 */
	protected abstract void buildLayoutGraphForBoundingBox(
			final LayoutMapping<PictogramElement> mapping,
			final Diagram diagram, final KNode diagramNode,
			final boolean onlyVisible);

	/**
	 * Develops the complete LayoutGraph for the eTrice Diagram starting from
	 * the Bounding Box.
	 * 
	 * @param mapping
	 *            the mapping of pictogram elements to graph elements
	 * @param topLevelBoundingBox
	 *            The Top Level Container Shape containing all other shapes
	 * @param diagramNode
	 *            The KNode corresponding to the Diagram
	 * 
	 * @author jayant
	 */
	/* This is fairly general for both the eTrice editors */
	protected KNode buildAllLevels(LayoutMapping<PictogramElement> mapping,
			Shape topLevelBoundingBox, KNode diagramNode) {
		// Top Level
		KNode topLevelBoundingBoxNode = createNode(mapping, diagramNode,
				topLevelBoundingBox);

		for (Shape secondLevelShape : ((ContainerShape) topLevelBoundingBox)
				.getChildren()) {
			// Second Level
			KGraphElement secondLevelKGraphElement = createKGraphElementFromShape(
					mapping, topLevelBoundingBoxNode, secondLevelShape);

			if (secondLevelKGraphElement instanceof KNode) {
				for (Shape thirdLevelShape : ((ContainerShape) secondLevelShape)
						.getChildren()) {
					// Third Level
					createKGraphElementFromShape(mapping,
							secondLevelKGraphElement, thirdLevelShape);
				}

				if (!isInternalPort(secondLevelShape)) {
					// For KNodes which are not internal ports.
					setNodeLayoutOptions(mapping,
							(KNode) secondLevelKGraphElement, secondLevelShape);
				}

			}
		}

		setNodeLayoutOptions(mapping, topLevelBoundingBoxNode,
				topLevelBoundingBox);

		return topLevelBoundingBoxNode;
	}

	/**
	 * Identifies the type of Shape (Label, Port or Node) and creates the
	 * corresponding KGraphElement Element
	 * 
	 * @param mapping
	 *            the mapping of pictogram elements to graph elements
	 * @param parent
	 *            the parent KNode
	 * @param shape
	 *            the shape for which a KGraphElement is required
	 * 
	 * @return the created KGraphElement for the given Shape
	 * 
	 * @author jayant
	 */
	/* This is fairly general for both the eTrice editors */
	private KGraphElement createKGraphElementFromShape(
			LayoutMapping<PictogramElement> mapping, KGraphElement parent,
			Shape shape) {

		GraphicsAlgorithm ga = shape.getGraphicsAlgorithm();

		// Checking whether this shape is a label
		if (ga instanceof AbstractText) {

			KInsets parentInsets = parent.getData(KShapeLayout.class)
					.getProperty(GraphitiLayoutCommand.INVIS_INSETS);

			assert (parentInsets != null) : "There must be an invisible insets attached to all ports and nodes(except diagramNode)";
			return KimlGraphitiUtil.createLabel((KLabeledGraphElement) parent,
					(AbstractText) ga, -parentInsets.getLeft(),
					-parentInsets.getTop());
		}

		else if (shape instanceof ContainerShape) {

			// Checking whether this shape is a boundary port
			if (isBoundaryPort(shape))
				return createPort(mapping, (KNode) parent, shape);

			else
				// This shape is considered to be a node (includes internal
				// Ports)
				return createNode(mapping, (KNode) parent, shape);

		} else
			return null;
	}

	/**
	 * Create a node for the layout graph.
	 * 
	 * @param mapping
	 *            the mapping of pictogram elements to graph elements
	 * @param parentNode
	 *            the parent node
	 * @param shape
	 *            the shape for a new node
	 * @return a new layout node
	 */
	protected abstract KNode createNode(
			final LayoutMapping<PictogramElement> mapping,
			final KNode parentNode, final Shape shape);

	/**
	 * Create a port for the layout graph.
	 * 
	 * @param mapping
	 *            the mapping of pictogram elements to graph elements
	 * @param parentNode
	 *            the parent node
	 * @param shape
	 *            the shape for a new port
	 * @return a new layout node
	 * 
	 * @author jayant
	 */
	/* This is fairly general for both the eTrice editors */
	protected KPort createPort(final LayoutMapping<PictogramElement> mapping,
			final KNode parentNode, final Shape shape) {
		KPort port = KimlUtil.createInitializedPort();
		port.setNode(parentNode);

		setCurrentPositionAndSize(mapping, parentNode, port, shape);

		mapping.getGraphMap().put(port, shape.getAnchors().get(0));

		// Set Port label
		Shape portLabelShape = ((ContainerShape) shape).getChildren().get(0);
		createKGraphElementFromShape(mapping, port, portLabelShape);

		// gather all connections connected to the parentNode via this port
		for (Anchor anchor : shape.getAnchors()) {
			mapping.getProperty(KimlGraphitiUtil.CONNECTIONS).addAll(
					anchor.getOutgoingConnections());
		}

		return port;
	}

	/**
	 * Sets the insets(border) and calculates the position and size of the
	 * KgraphElement.
	 * 
	 * @param mapping
	 *            the mapping of pictogram elements to graph elements
	 * @param parentNode
	 *            the parent node
	 * @param kelem
	 *            the kGraphElement whose size and position is to be determined
	 * @param shape
	 *            the corresponding shape
	 * 
	 * @author jayant
	 */
	/*
	 * This is fairly general for both the eTrice editors and same for Nodes and
	 * Ports
	 */
	protected void setCurrentPositionAndSize(
			final LayoutMapping<PictogramElement> mapping,
			final KNode parentNode, final KGraphElement kelem, final Shape shape) {

		VolatileLayoutConfig staticConfig = mapping
				.getProperty(KimlGraphitiUtil.STATIC_CONFIG);

		KShapeLayout shapeLayout = kelem.getData(KShapeLayout.class);
		GraphicsAlgorithm ga = shape.getGraphicsAlgorithm();

		// Calculate and set the invisible insets
		KInsets shapeInsets = KimlGraphitiUtil.calcInsets(ga);
		shapeLayout
				.setProperty(GraphitiLayoutCommand.INVIS_INSETS, shapeInsets);
		staticConfig.setValue(GraphitiLayoutCommand.INVIS_INSETS, kelem,
				LayoutContext.GRAPH_ELEM, shapeInsets);

		// Get the parent insets
		KInsets parentInsets = parentNode == null ? null : parentNode.getData(
				KShapeLayout.class).getProperty(
				GraphitiLayoutCommand.INVIS_INSETS);

		// Set Position
		if (parentInsets == null) {
			shapeLayout.setPos(ga.getX() + shapeInsets.getLeft(), ga.getY()
					+ shapeInsets.getTop());
		} else {
			shapeLayout.setPos(
					ga.getX() + shapeInsets.getLeft() - parentInsets.getLeft(),
					ga.getY() + shapeInsets.getTop() - parentInsets.getTop());
		}

		// Set Size
		shapeLayout
				.setSize(
						ga.getWidth() - shapeInsets.getLeft()
								- shapeInsets.getRight(),
						ga.getHeight() - shapeInsets.getTop()
								- shapeInsets.getBottom());

		// the modification flag must initially be false
		((KShapeLayoutImpl) shapeLayout).resetModificationFlag();

	}

	/**
	 * Sets the heuristic layout options for nodes (like minimal width and
	 * minimal height)
	 * 
	 * @param mapping
	 *            the mapping of pictogram elements to graph elements
	 * @param node
	 *            the node for which layout options need to be set
	 * @param shape
	 *            the corresponding shape
	 * @author jayant
	 */
	/* This is fairly general for both the eTrice editors */
	protected void setNodeLayoutOptions(
			final LayoutMapping<PictogramElement> mapping, final KNode node,
			Shape shape) {

		// get label width and height for the node
		// these would be added to the node width and height
		float labelWidth = 0.0f;
		float labelHeight = 0.0f;

		if (!node.getLabels().isEmpty()) {
			KShapeLayout labelLayout = node.getLabels().get(0)
					.getData(KShapeLayout.class);
			// halh of the label width is taken to avoid too much widening of
			// node due to labels
			labelWidth = labelLayout.getWidth() * 0.5f;
		}

		Dimension defaultSize = getDefaultSize(shape);
		float ratio = (float) defaultSize.height() / defaultSize.width();
		// label height is not the original label height but the increase is
		// node height due to label; it is in ratio with the increase in label
		// width.
		labelHeight = ratio * labelWidth;

		VolatileLayoutConfig staticConfig = mapping
				.getProperty(KimlGraphitiUtil.STATIC_CONFIG);
		staticConfig.setValue(LayoutOptions.MIN_WIDTH, node,
				LayoutContext.GRAPH_ELEM, defaultSize.width() + labelWidth);
		staticConfig.setValue(LayoutOptions.MIN_HEIGHT, node,
				LayoutContext.GRAPH_ELEM, defaultSize.height() + labelHeight);
	}

	/**
	 * Determines whether the given shape is a boundary port or not.
	 * 
	 * @param shape
	 *            the shape to be investigated
	 * @return true if the {@code shape} is a port else false
	 * 
	 * @author jayant
	 */
	public abstract boolean isBoundaryPort(Shape shape);

	/**
	 * Determines whether the given shape is an internal port or not.
	 * 
	 * @param shape
	 *            the shape to be investigated
	 * @return true if the {@code shape} is a port else false
	 * 
	 * @author jayant
	 */
	public abstract boolean isInternalPort(Shape shape);

	/**
	 * Determines whether the given shape is a Top Level Bounding Box or not.
	 * 
	 * @param shape
	 *            the shape to be investigated
	 * 
	 * @return true if the {@code shape} is the Top Level Bounding Box
	 * 
	 * @author jayant
	 */
	public abstract boolean isTopLevelBoundingBox(Shape shape);

	/**
	 * Gets the Default Minimal Size for a node
	 * 
	 * @param shape
	 *            The shape attached to the node
	 * 
	 * @return the defaults minimal size for a node
	 * 
	 * @author jayant
	 */
	protected abstract Dimension getDefaultSize(Shape shape);

}

Back to the top