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.scenegraph.g2d.nodes;
\r
14 import java.awt.Color;
\r
15 import java.awt.Graphics2D;
\r
16 import java.awt.Paint;
\r
17 import java.awt.geom.Rectangle2D;
\r
19 import org.simantics.scenegraph.g2d.G2DNode;
\r
21 public class BackgroundNode extends G2DNode {
\r
25 private static final long serialVersionUID = 2805713128639560702L;
\r
27 protected Color color = null;
\r
28 protected Paint paint = null;
\r
29 protected Rectangle2D bounds = null;
\r
32 public void setColor(Color color) {
\r
37 public void setPaint(Paint paint) {
\r
41 @SyncField("bounds")
\r
42 public void setBounds(Rectangle2D bounds) {
\r
43 this.bounds = bounds;
\r
47 public void render(Graphics2D g) {
\r
48 Rectangle2D drawBounds = bounds;
\r
49 if(drawBounds == null) {
\r
50 drawBounds = (Rectangle2D)g.getClipBounds().clone(); // Fill whole clip area if bounds is not defined
\r
64 public String toString() {
\r
65 return super.toString() + " [color=" + color + "]";
\r
69 public Rectangle2D getBoundsInLocal() {
\r