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