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.g2d.notification;
\r
14 import java.awt.geom.Rectangle2D;
\r
17 * @author Tuukka Lehtonen
\r
19 public abstract class AbstractNotification implements INotification {
\r
21 protected Rectangle2D bounds = new Rectangle2D.Double();
\r
22 protected long creationTime;
\r
23 protected double progress;
\r
25 public AbstractNotification() {
\r
26 this.creationTime = System.currentTimeMillis();
\r
30 public long getCreationTime() {
\r
31 return creationTime;
\r
35 // public Rectangle2D getBounds(Graphics2D g) {
\r
40 public void setBounds(Rectangle2D r) {
\r
41 this.bounds.setFrame(r);
\r
45 public void setProgress(double p) {
\r
50 public int compareTo(INotification o) {
\r
51 long delta = getCreationTime() - o.getCreationTime();
\r
52 return delta < 0 ? -1 : delta > 0 ? 1 : 0;
\r
56 public String toString() {
\r
57 return getClass().getSimpleName() + "[" + creationTime + ", progress=" + progress + "]";
\r