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

ingenias.editor.cellfactories.MedicationTimeDiagramCellViewFactory 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 MedicationTimeDiagramCellViewFactory implements CellViewFactory {

public MedicationTimeDiagramCellViewFactory() {}
 

 	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(Medication.class)){
           return new ingenias.editor.cell.MedicationView(v);
   }

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

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

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

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

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


   // Diagram Relationships start here

   if (v.getClass().equals(MedicinesIntakesEdge.class)){
           return new ingenias.editor.cell.MedicinesIntakesView(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(TIStartTimeEdge.class)){
           return new ingenias.editor.cell.TIStartTimeView(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(socialRelationsEdge.class)){
           return new ingenias.editor.cell.socialRelationsView(v);
   }

   if (v.getClass().equals(WorkAsEdge.class)){
           return new ingenias.editor.cell.WorkAsView(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(ConnectsEdge.class)){
           return new ingenias.editor.cell.ConnectsView(v);
   }

   if (v.getClass().equals(SBhasFloorEdge.class)){
           return new ingenias.editor.cell.SBhasFloorView(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(FPreconditionEdge.class)){
           return new ingenias.editor.cell.FPreconditionView(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(aeinv_opEdge.class)){
           return new ingenias.editor.cell.aeinv_opView(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(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(InitialDateEdge.class)){
           return new ingenias.editor.cell.InitialDateView(v);
   }

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

   if (v.getClass().equals(RelatedHumanEdge.class)){
           return new ingenias.editor.cell.RelatedHumanView(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(ActionResponsibleEdge.class)){
           return new ingenias.editor.cell.ActionResponsibleView(v);
   }

   if (v.getClass().equals(ActionHappeningAfterwardsEdge.class)){
           return new ingenias.editor.cell.ActionHappeningAfterwardsView(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(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