All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ingenias.editor.cellfactories.ActivityDiagramCellViewFactory Maven / Gradle / Ivy

There is a newer version: 1.0.11
Show newest version


/** 
 * Copyright (C) 2010  Jorge J. Gomez-Sanz over original code from Ruben Fuentes
 * 
 *   Modifications over original code from jgraph.sourceforge.net
 * 
 * This file is part of the INGENME tool. INGENME is an open source meta-editor
 * which produces customized editors for user-defined modeling languages
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation version 3 of the License
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see 
 **/
 
package ingenias.editor.cellfactories;

import java.awt.*;
import javax.swing.*;
import javax.swing.event.*;
import java.awt.event.*;
import java.util.Map;
import java.util.Hashtable;

import java.awt.*;
import java.awt.image.*;
import javax.swing.*;
import java.awt.event.*;
import java.net.URL;
import java.util.Map;
import java.util.Hashtable;
import java.util.ArrayList;
import javax.swing.event.UndoableEditEvent;
import org.jgraph.JGraph;
import org.jgraph.graph.*;
import org.jgraph.event.*;
import java.util.Vector;
import org.jgraph.JGraph;
import org.jgraph.graph.*;
import org.jgraph.event.*;
import org.jgraph.plaf.basic.*;
import ingenias.editor.entities.*;
import ingenias.editor.cell.*;
import ingenias.editor.events.*;

public class ActivityDiagramCellViewFactory implements CellViewFactory {

public ActivityDiagramCellViewFactory() {}
 

 	public org.jgraph.graph.CellView createView(GraphModel model, Object cell) {
		
			org.jgraph.graph.CellView view = null;
			if (model.isPort(cell))
				view = new PortView(cell);
			else if (model.isEdge(cell))
				view = createEdgeView(cell);
			else
				view = createVertexView(cell);
			return view;
		}

  // Modificar agregando nuevas clases VIEW segun se vayan a?endo

  protected org.jgraph.graph.VertexView createVertexView(Object v) {
    Object userObject = ( (DefaultGraphCell) v).getUserObject();

   // Diagram Objects start here


   if (userObject.getClass().equals(CDayOfTheWeek.class)){
           return new ingenias.editor.cell.CDayOfTheWeekView(v);
   }

   if (userObject.getClass().equals(CInside.class)){
           return new ingenias.editor.cell.CInsideView(v);
   }

   if (userObject.getClass().equals(CSymptom.class)){
           return new ingenias.editor.cell.CSymptomView(v);
   }

   if (userObject.getClass().equals(CTimer.class)){
           return new ingenias.editor.cell.CTimerView(v);
   }

   if (userObject.getClass().equals(IFFlowControl.class)){
           return new ingenias.editor.cell.IFFlowControlView(v);
   }

   if (userObject.getClass().equals(CEvent.class)){
           return new ingenias.editor.cell.CEventView(v);
   }

   if (userObject.getClass().equals(CProb.class)){
           return new ingenias.editor.cell.CProbView(v);
   }

   if (userObject.getClass().equals(COutside.class)){
           return new ingenias.editor.cell.COutsideView(v);
   }

   if (userObject.getClass().equals(CAlways.class)){
           return new ingenias.editor.cell.CAlwaysView(v);
   }

   if (userObject.getClass().equals(BActivity.class)){
           return new ingenias.editor.cell.BActivityView(v);
   }

   if (userObject.getClass().equals(CTime.class)){
           return new ingenias.editor.cell.CTimeView(v);
   }

   if (userObject.getClass().equals(StartBehaviourEvent.class)){
           return new ingenias.editor.cell.StartBehaviourEventView(v);
   }

   if (userObject.getClass().equals(EPublicEvent.class)){
           return new ingenias.editor.cell.EPublicEventView(v);
   }

   if (userObject.getClass().equals(StopBehaviourEvent.class)){
           return new ingenias.editor.cell.StopBehaviourEventView(v);
   }

   if (userObject.getClass().equals(Human.class)){
           return new ingenias.editor.cell.HumanView(v);
   }

   if (userObject.getClass().equals(SymptomChangedEvent.class)){
           return new ingenias.editor.cell.SymptomChangedEventView(v);
   }

   if (userObject.getClass().equals(FallingEvent.class)){
           return new ingenias.editor.cell.FallingEventView(v);
   }

   if (userObject.getClass().equals(MedsTakenEvent.class)){
           return new ingenias.editor.cell.MedsTakenEventView(v);
   }

   if (userObject.getClass().equals(ObjDroppedEvent.class)){
           return new ingenias.editor.cell.ObjDroppedEventView(v);
   }

   if (userObject.getClass().equals(BEvent.class)){
           return new ingenias.editor.cell.BEventView(v);
   }

   if (userObject.getClass().equals(EPrivateEvent.class)){
           return new ingenias.editor.cell.EPrivateEventView(v);
   }


   // Diagram Relationships start here

   if (v.getClass().equals(FalseFlowEdge.class)){
           return new ingenias.editor.cell.FalseFlowView(v);
   }

   if (v.getClass().equals(TrueFlowEdge.class)){
           return new ingenias.editor.cell.TrueFlowView(v);
   }

   if (v.getClass().equals(NextActivityEdge.class)){
           return new ingenias.editor.cell.NextActivityView(v);
   }

   if (v.getClass().equals(ProducesEventEdge.class)){
           return new ingenias.editor.cell.ProducesEventView(v);
   }

   if (v.getClass().equals(condEdge.class)){
           return new ingenias.editor.cell.condView(v);
   }

   if (v.getClass().equals(ProfileOfEdge.class)){
           return new ingenias.editor.cell.ProfileOfView(v);
   }

   if (v.getClass().equals(IntervalClockTimeEdge.class)){
           return new ingenias.editor.cell.IntervalClockTimeView(v);
   }

   if (v.getClass().equals(medEdge.class)){
           return new ingenias.editor.cell.medView(v);
   }

   if (v.getClass().equals(LiveInEdge.class)){
           return new ingenias.editor.cell.LiveInView(v);
   }

   if (v.getClass().equals(WorkAsEdge.class)){
           return new ingenias.editor.cell.WorkAsView(v);
   }

   if (v.getClass().equals(socialRelationsEdge.class)){
           return new ingenias.editor.cell.socialRelationsView(v);
   }

   if (v.getClass().equals(RelatedEventEdge.class)){
           return new ingenias.editor.cell.RelatedEventView(v);
   }

   if (v.getClass().equals(ConditionNeededEdge.class)){
           return new ingenias.editor.cell.ConditionNeededView(v);
   }

   if (v.getClass().equals(ActivityAttachedEdge.class)){
           return new ingenias.editor.cell.ActivityAttachedView(v);
   }

   if (v.getClass().equals(SBhasFloorEdge.class)){
           return new ingenias.editor.cell.SBhasFloorView(v);
   }

   if (v.getClass().equals(ConnectsEdge.class)){
           return new ingenias.editor.cell.ConnectsView(v);
   }

   if (v.getClass().equals(FPreconditionEdge.class)){
           return new ingenias.editor.cell.FPreconditionView(v);
   }

   if (v.getClass().equals(toolEdge.class)){
           return new ingenias.editor.cell.toolView(v);
   }

   if (v.getClass().equals(AllowedTaskEdge.class)){
           return new ingenias.editor.cell.AllowedTaskView(v);
   }

   if (v.getClass().equals(aeas_op1Edge.class)){
           return new ingenias.editor.cell.aeas_op1View(v);
   }

   if (v.getClass().equals(aeas_op2Edge.class)){
           return new ingenias.editor.cell.aeas_op2View(v);
   }

   if (v.getClass().equals(aeinv_opEdge.class)){
           return new ingenias.editor.cell.aeinv_opView(v);
   }

   if (v.getClass().equals(aemd_op1Edge.class)){
           return new ingenias.editor.cell.aemd_op1View(v);
   }

   if (v.getClass().equals(aemd_op2Edge.class)){
           return new ingenias.editor.cell.aemd_op2View(v);
   }

   if (v.getClass().equals(RelatedHumanEdge.class)){
           return new ingenias.editor.cell.RelatedHumanView(v);
   }

   if (v.getClass().equals(InitialDateEdge.class)){
           return new ingenias.editor.cell.InitialDateView(v);
   }

   if (v.getClass().equals(InitialLocationEdge.class)){
           return new ingenias.editor.cell.InitialLocationView(v);
   }

   if (v.getClass().equals(InitialActivityEdge.class)){
           return new ingenias.editor.cell.InitialActivityView(v);
   }

   if (v.getClass().equals(CameraFaceToHumanEdge.class)){
           return new ingenias.editor.cell.CameraFaceToHumanView(v);
   }

   if (v.getClass().equals(InitializesSymptomEdge.class)){
           return new ingenias.editor.cell.InitializesSymptomView(v);
   }

   if (v.getClass().equals(InitializedSymptomEdge.class)){
           return new ingenias.editor.cell.InitializedSymptomView(v);
   }

   if (v.getClass().equals(AffectedActionEdge.class)){
           return new ingenias.editor.cell.AffectedActionView(v);
   }

   if (v.getClass().equals(DeonticAssignementEdge.class)){
           return new ingenias.editor.cell.DeonticAssignementView(v);
   }

   if (v.getClass().equals(ActionHappeningAfterwardsEdge.class)){
           return new ingenias.editor.cell.ActionHappeningAfterwardsView(v);
   }

   if (v.getClass().equals(ActionResponsibleEdge.class)){
           return new ingenias.editor.cell.ActionResponsibleView(v);
   }

   if (v.getClass().equals(RoleEdge.class)){
           return new ingenias.editor.cell.RoleView(v);
   }


    return null;
  }

  protected org.jgraph.graph.EdgeView createEdgeView(Object v) {
  return new org.jgraph.graph.EdgeView(v);

//         if (v instanceof ExecuteEdge){
//           return new ExecuteView(v,this,cm);
//         }

  }

 


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy