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.gui.graph; 025 026 import org.tigris.gef.graph.GraphModel; 027 import org.tigris.gef.graph.presentation.NetPort; 028 029 public class ChildPort extends AbstractActivityPort { 030 031 /** 032 * 033 */ 034 private static final long serialVersionUID = 1L; 035 036 public ChildPort(ActivityNode activityNode) { 037 super(activityNode); 038 // TODO Auto-generated constructor stub 039 } 040 041 /* 042 * (non-Javadoc) 043 * 044 * @see org.tigris.gef.graph.presentation.NetPort#canConnectTo(org.tigris.gef.graph.GraphModel, 045 * java.lang.Object) 046 */ 047 @Override 048 public boolean canConnectTo(GraphModel gm, Object anotherPort) { 049 boolean canConnect = super.canConnectTo(gm, anotherPort); 050 /* 051 * Additional constraints regarding which tasks may be subtasks of other 052 * tasks? 053 */ 054 if (anotherPort instanceof ParentPort) { 055 ParentPort parentPort = (ParentPort) anotherPort; 056 canConnect &= getActivityNode().getActivity().canBeChildOf(parentPort.getActivityNode().getActivity()); 057 } else { 058 canConnect = false; 059 } 060 return canConnect; 061 062 } 063 064 @Override 065 protected Class defaultEdgeClass(NetPort otherPort) { 066 try { 067 return Class.forName("se.liu.ida.critiquer.gui.graph.InheritanceEdge"); 068 } catch (java.lang.ClassNotFoundException ignore) { 069 return null; 070 } 071 } 072 073 }