]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.g2d/src/org/simantics/g2d/notification/PositionedMessage.java
G2DParentNode handles "undefined" child bounds separately
[simantics/platform.git] / bundles / org.simantics.g2d / src / org / simantics / g2d / notification / PositionedMessage.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.notification;
13
14 import java.awt.Font;
15 import java.awt.geom.Point2D;
16 import java.awt.geom.Rectangle2D;
17
18 import org.simantics.scenegraph.g2d.G2DParentNode;
19
20 public class PositionedMessage extends AbstractNotification implements INotification {
21
22     private static final double MARGIN = 10;
23
24     String                      message;
25     Point2D                     position;
26     Font                        font   = new Font("Arial", Font.PLAIN, 14);
27
28     public PositionedMessage(String message, Point2D canvasPosition) {
29         this.message = message;
30         this.position = canvasPosition;
31         this.bounds.setFrame(position.getX(), position.getY(), 0, 0);
32     }
33
34     @Override
35     public void setBounds(Rectangle2D r) {
36         // Intentional NOP
37     }
38
39     @Override
40     public void update(G2DParentNode parent) {
41     }
42
43 }