]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.g2d/src/org/simantics/g2d/elementclass/LabelClass.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.g2d / src / org / simantics / g2d / elementclass / LabelClass.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management
3  * in Industry THTH ry.
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
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.g2d.elementclass;
13
14 import java.awt.geom.Rectangle2D;
15
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;
24
25 /**
26  * TODO Add horiz, vert alignment
27  * 
28  * @author Toni Kalajainen
29  */
30 public class LabelClass {
31
32     public static final ElementClass CLASS =
33         ElementClass.compile(
34                 TextColorImpl.BLACK,
35                 DefaultTransform.INSTANCE,
36                 FixedSize.of(100, 20),
37                 Text.INSTANCE,
38                 new TextPainter()
39                 //new RotatorHandler()
40         );
41
42
43
44     static class TextSize implements InternalSize {
45         private static final long serialVersionUID = 7358363139299763075L;
46
47         @Override
48         public Rectangle2D getBounds(IElement e, Rectangle2D size) {
49             // FontRenderContext is required !!?!
50             return null;
51         }
52     }
53
54 }