Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 1d365eb2a640b2eda6526b8bf7f2c186aaff8710 (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
/*****************************************************************************
 * Copyright (c) 2012 CEA LIST.
 *
 *    
 * All rights reserved. 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
 *
 *****************************************************************************/
package org.eclipse.papyrus.uml.diagram.timing.custom.layouts;

import java.util.List;

import org.eclipse.draw2d.AbstractLayout;
import org.eclipse.draw2d.FreeformLayer;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.draw2d.geometry.Rectangle;

public class FillLayout extends AbstractLayout {

	public void layout(final IFigure container) {
		final Rectangle clientArea = container.getClientArea();
		final List<?> children = container.getChildren();
		for(int i = 0; i < children.size(); i++) {
			final IFigure child = (IFigure)children.get(i);
			child.setBounds(clientArea);
			if(child instanceof FreeformLayer) {
				final FreeformLayer freeformLayer = (FreeformLayer)child;
				freeformLayer.setFreeformBounds(clientArea);
			}
		}
	}

	@Override
	protected Dimension calculatePreferredSize(final IFigure container, final int wHint, final int hHint) {
		return new Dimension(-1, -1);
	}
}

Back to the top