1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
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
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.g2d.notification;
14 import java.awt.geom.Rectangle2D;
17 * @author Tuukka Lehtonen
19 public abstract class AbstractNotification implements INotification {
21 protected Rectangle2D bounds = new Rectangle2D.Double();
22 protected long creationTime;
23 protected double progress;
25 public AbstractNotification() {
26 this.creationTime = System.currentTimeMillis();
30 public long getCreationTime() {
35 // public Rectangle2D getBounds(Graphics2D g) {
40 public void setBounds(Rectangle2D r) {
41 this.bounds.setFrame(r);
45 public void setProgress(double p) {
50 public int compareTo(INotification o) {
51 long delta = getCreationTime() - o.getCreationTime();
52 return delta < 0 ? -1 : delta > 0 ? 1 : 0;
56 public String toString() {
57 return getClass().getSimpleName() + "[" + creationTime + ", progress=" + progress + "]";