/* * Copyright (c) 2007 Borland Software Corporation * * 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 * * Contributors: * Dmitry Stadnik (Borland) - initial API and implementation */ package org.eclipse.gmf.examples.taipan.figures; import org.eclipse.draw2d.GridData; import org.eclipse.draw2d.GridLayout; import org.eclipse.draw2d.IFigure; import org.eclipse.draw2d.Label; import org.eclipse.draw2d.RectangleFigure; /** * @author dstadnik */ public class PileShape extends RectangleFigure { public PileShape() { GridLayout layout = new GridLayout(); layout.marginWidth = 0; layout.marginHeight = 0; setLayoutManager(layout); } public void add(IFigure figure, Object constraint, int index) { if (constraint == null) { if (figure instanceof Label) { constraint = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_CENTER | GridData.GRAB_HORIZONTAL); } else { constraint = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_VERTICAL | GridData.GRAB_HORIZONTAL); } } super.add(figure, constraint, index); } }