1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.g2d.elementclass;
14 import java.awt.geom.Rectangle2D;
16 import org.simantics.g2d.element.ElementClass;
17 import org.simantics.g2d.element.IElement;
18 import org.simantics.g2d.element.handler.InternalSize;
19 import org.simantics.g2d.element.handler.Text;
20 import org.simantics.g2d.element.handler.impl.DefaultTransform;
21 import org.simantics.g2d.element.handler.impl.FixedSize;
22 import org.simantics.g2d.element.handler.impl.TextColorImpl;
23 import org.simantics.g2d.element.handler.impl.TextPainter;
26 * TODO Add horiz, vert alignment
28 * @author Toni Kalajainen
30 public class LabelClass {
32 public static final ElementClass CLASS =
35 DefaultTransform.INSTANCE,
36 FixedSize.of(100, 20),
39 //new RotatorHandler()
44 static class TextSize implements InternalSize {
45 private static final long serialVersionUID = 7358363139299763075L;
48 public Rectangle2D getBounds(IElement e, Rectangle2D size) {
49 // FontRenderContext is required !!?!