001 /** 002 * planningtool - A Planning Tool with Critiquing Support. 003 * 004 * Copyright (C) 2006 olale 005 006 * This program is free software; you can redistribute it and/or 007 * modify it under the terms of the GNU General Public License 008 * as published by the Free Software Foundation; either version 2 009 * of the License, or (at your option) any later version. 010 011 * This program is distributed in the hope that it will be useful, 012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 014 * GNU General Public License for more details. 015 016 * You should have received a copy of the GNU General Public License 017 * along with this program; if not, write to the Free Software 018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 019 020 * Contact information: 021 * E-mail: olale@ida.liu.se 022 * olale@lysator.liu.se 023 */ 024 package se.liu.ida.critiquer.constraints; 025 026 import java.awt.Color; 027 import java.awt.Graphics2D; 028 import java.awt.Shape; 029 import java.util.List; 030 031 import se.liu.ida.critiquer.activities.Activity; 032 import se.liu.ida.critiquer.activities.parameters.Parameter; 033 import se.liu.ida.critiquer.gui.TimeView; 034 import se.liu.ida.critiquer.gui.View; 035 036 /** 037 * @author olale 038 * 039 */ 040 public class TestActivityArea extends StandardConstraint { 041 042 /** 043 * 044 */ 045 private static final long serialVersionUID = 1L; 046 047 /** 048 * 049 */ 050 public TestActivityArea() { 051 super(); 052 // TODO Auto-generated constructor stub 053 } 054 055 /* (non-Javadoc) 056 * @see se.liu.ida.critiquer.activities.AbstractParamChangedListener#paramChanged(se.liu.ida.critiquer.activities.Activity, se.liu.ida.critiquer.activities.parameters.Parameter) 057 */ 058 @Override 059 public <T> void paramChanged(Activity activity, Parameter<T> p) { 060 // TODO Auto-generated method stub 061 062 } 063 064 /* (non-Javadoc) 065 * @see se.liu.ida.critiquer.constraints.SingletonConstraint#getDescription() 066 */ 067 public String getDescription() { 068 // TODO Auto-generated method stub 069 return null; 070 } 071 072 073 074 /* (non-Javadoc) 075 * @see se.liu.ida.critiquer.constraints.StandardConstraint#initApplicableViews() 076 */ 077 @Override 078 protected void initApplicableViews() { 079 applicableViews.add(TimeView.class); 080 } 081 082 /* (non-Javadoc) 083 * @see se.liu.ida.critiquer.gui.ViewRenderingListener#viewUpdated(se.liu.ida.critiquer.gui.View, java.awt.Graphics2D) 084 */ 085 public void viewUpdated(View v, Graphics2D g2) { 086 List<Activity> activities = v.getEvaluationActivities(); 087 for (Activity activity : activities) { 088 Color oldColor = g2.getColor(); 089 g2.setColor(Color.GRAY); 090 g2.draw(((TimeView)v).getTimeChartArea()); 091 Shape activityArea = v.getActivityArea(activity); 092 if (activityArea!=null) { 093 g2.draw(activityArea); 094 } else { 095 System.err.println("No activity area for "+activity); 096 } 097 g2.setColor(oldColor); 098 099 } 100 } 101 102 }