Main Page | Packages | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

ProjectComponent.java

Go to the documentation of this file.
00001 /*
00002  * ProjectComponent.java
00003  *
00004  * Copyright (C) 2005 Project SQUID, http://www.cs.helsinki.fi/group/squid/
00005  *
00006  * This file is part of Ikayaki.
00007  *
00008  * Ikayaki is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * Ikayaki is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with Ikayaki; if not, write to the Free Software
00020  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
00021  */
00022 
00023 package ikayaki.gui;
00024 
00025 import ikayaki.*;
00026 
00027 import javax.swing.*;
00028 import java.awt.*;
00029 
00035 public class ProjectComponent extends JPanel implements ProjectListener, MeasurementListener {
00036 
00040     private Project project;
00041 
00045     public ProjectComponent() {
00046         super();
00047         project = null;
00048     }
00049 
00053     public Project getProject() {
00054         return project;
00055     }
00056 
00063     public void setProject(Project project) {
00064         if (this.project != null) {
00065             this.project.removeProjectListener(this);
00066             this.project.removeMeasurementListener(this);
00067         }
00068         if (project != null) {
00069             project.addProjectListener(this);
00070             project.addMeasurementListener(this);
00071         }
00072         this.project = project;
00073     }
00074 
00080     public Frame getParentFrame() {
00081         Container c = getParent();
00082         do {
00083             if (c == null) {
00084                 return null;
00085             } else {
00086                 c = c.getParent();
00087             }
00088         } while (!(c instanceof Frame));
00089         return (Frame) c;
00090     }
00091 
00097     public void projectUpdated(ProjectEvent event) {
00098         // DOES NOTHING
00099     }
00100 
00106     public void measurementUpdated(MeasurementEvent event) {
00107         // DOES NOTHING
00108     }
00109 }

Generated on Fri May 6 16:00:32 2005 for Squid by  doxygen 1.4.1