]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.diagram/src/org/simantics/diagram/flag/IFlagType.java
Fixed multiple issues causing dangling references to discarded queries
[simantics/platform.git] / bundles / org.simantics.diagram / src / org / simantics / diagram / flag / IFlagType.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.diagram.flag;
13
14 import java.awt.Font;
15 import java.awt.Shape;
16 import java.awt.geom.Rectangle2D;
17
18 import org.simantics.db.ReadGraph;
19 import org.simantics.db.exception.DatabaseException;
20 import org.simantics.g2d.canvas.ICanvasContext;
21 import org.simantics.g2d.elementclass.FlagClass;
22 import org.simantics.g2d.utils.Alignment;
23
24 /**
25  * @author Tuukka Lehtonen
26  */
27 public interface IFlagType {
28
29     /**
30      * @author Tuukka Lehtonen
31      * @see FlagInfoImpl
32      */
33     public interface FlagInfo {
34         Shape getShape();
35         String[] getText();
36         Rectangle2D getTextArea();
37         FlagClass.Type getType();
38         Alignment getHorizontalAlignment();
39         Alignment getVerticalAlignment();
40         Font getFont();
41     }
42
43     /**
44      * Reads and calculates information about this flags graphical
45      * representation.
46      * 
47      * @param graph database read access
48      * @return all info gathered up about the flag
49      * @throws DatabaseException
50      * @Deprecated implement {@link #getInfo(ReadGraph, ICanvasContext)} instead
51      */
52     default FlagInfo getInfo(ReadGraph graph) throws DatabaseException {
53         throw new UnsupportedOperationException();
54     }
55
56     /**
57      * Reads and calculates information about this flags graphical
58      * representation.
59      * 
60      * @param graph database read access
61      * @param context the canvas context with which the info is loaded 
62      * @return all info gathered up about the flag
63      * @throws DatabaseException
64      */
65     default FlagInfo getInfo(ReadGraph graph, ICanvasContext context) throws DatabaseException {
66         return getInfo(graph);
67     }
68
69 }