ingenias.editor.cellfactories.SimulationDiagramCellViewFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sociaalmled Show documentation
Show all versions of sociaalmled Show documentation
A editor for modelling scenarios for PHAT simulator
/**
* 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 SimulationDiagramCellViewFactory implements CellViewFactory {
public SimulationDiagramCellViewFactory() {}
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(FTable.class)){
return new ingenias.editor.cell.FTableView(v);
}
if (userObject.getClass().equals(SBathroom.class)){
return new ingenias.editor.cell.SBathroomView(v);
}
if (userObject.getClass().equals(AndroidApplication.class)){
return new ingenias.editor.cell.AndroidApplicationView(v);
}
if (userObject.getClass().equals(SDate.class)){
return new ingenias.editor.cell.SDateView(v);
}
if (userObject.getClass().equals(Human.class)){
return new ingenias.editor.cell.HumanView(v);
}
if (userObject.getClass().equals(SKitchen.class)){
return new ingenias.editor.cell.SKitchenView(v);
}
if (userObject.getClass().equals(PartOfBody.class)){
return new ingenias.editor.cell.PartOfBodyView(v);
}
if (userObject.getClass().equals(FlyCamInit.class)){
return new ingenias.editor.cell.FlyCamInitView(v);
}
if (userObject.getClass().equals(WorldInitialization.class)){
return new ingenias.editor.cell.WorldInitializationView(v);
}
if (userObject.getClass().equals(AndroidEmulator.class)){
return new ingenias.editor.cell.AndroidEmulatorView(v);
}
if (userObject.getClass().equals(SBedroom.class)){
return new ingenias.editor.cell.SBedroomView(v);
}
if (userObject.getClass().equals(SCorridor.class)){
return new ingenias.editor.cell.SCorridorView(v);
}
if (userObject.getClass().equals(PDSymtom.class)){
return new ingenias.editor.cell.PDSymtomView(v);
}
if (userObject.getClass().equals(SArea.class)){
return new ingenias.editor.cell.SAreaView(v);
}
if (userObject.getClass().equals(ESmartPhone.class)){
return new ingenias.editor.cell.ESmartPhoneView(v);
}
if (userObject.getClass().equals(HumanInitialization.class)){
return new ingenias.editor.cell.HumanInitializationView(v);
}
if (userObject.getClass().equals(BActivity.class)){
return new ingenias.editor.cell.BActivityView(v);
}
if (userObject.getClass().equals(CameraInit.class)){
return new ingenias.editor.cell.CameraInitView(v);
}
if (userObject.getClass().equals(SymptomInitialization.class)){
return new ingenias.editor.cell.SymptomInitializationView(v);
}
if (userObject.getClass().equals(SLivingroom.class)){
return new ingenias.editor.cell.SLivingroomView(v);
}
// Diagram Relationships start here
if (v.getClass().equals(EmulatorPeerEdge.class)){
return new ingenias.editor.cell.EmulatorPeerView(v);
}
if (v.getClass().equals(RunAndroidAppEdge.class)){
return new ingenias.editor.cell.RunAndroidAppView(v);
}
if (v.getClass().equals(InitialDeviceLocationEdge.class)){
return new ingenias.editor.cell.InitialDeviceLocationView(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);
// }
}
}