]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.g2d/src/org/simantics/g2d/elementclass/LabelClass.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.g2d / src / org / simantics / g2d / elementclass / LabelClass.java
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
8  *\r
9  * Contributors:\r
10  *     VTT Technical Research Centre of Finland - initial API and implementation\r
11  *******************************************************************************/\r
12 package org.simantics.g2d.elementclass;\r
13 \r
14 import java.awt.geom.Rectangle2D;\r
15 \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
24 \r
25 /**\r
26  * TODO Add horiz, vert alignment\r
27  * \r
28  * @author Toni Kalajainen\r
29  */\r
30 public class LabelClass {\r
31 \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
37                 Text.INSTANCE,\r
38                 new TextPainter()\r
39                 //new RotatorHandler()\r
40         );\r
41 \r
42 \r
43 \r
44     static class TextSize implements InternalSize {\r
45         private static final long serialVersionUID = 7358363139299763075L;\r
46 \r
47         @Override\r
48         public Rectangle2D getBounds(IElement e, Rectangle2D size) {\r
49             // FontRenderContext is required !!?!\r
50             return null;\r
51         }\r
52     }\r
53 \r
54 }\r